2 use alloc::str::FromStr;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
12 /// An enum which can either contain a u64 or not
13 pub enum COption_DurationZ {
14 /// When we're in this state, this COption_DurationZ contains a u64
16 /// When we're in this state, this COption_DurationZ contains nothing
19 impl COption_DurationZ {
20 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21 if let Self::None = self { false } else { true }
23 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
26 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
27 if let Self::Some(v) = self { v } else { unreachable!() }
31 /// Constructs a new COption_DurationZ containing a u64
32 pub extern "C" fn COption_DurationZ_some(o: u64) -> COption_DurationZ {
33 COption_DurationZ::Some(o)
36 /// Constructs a new COption_DurationZ containing nothing
37 pub extern "C" fn COption_DurationZ_none() -> COption_DurationZ {
38 COption_DurationZ::None
41 /// Frees any resources associated with the u64, if we are in the Some state
42 pub extern "C" fn COption_DurationZ_free(_res: COption_DurationZ) { }
44 /// Creates a new COption_DurationZ which has the same data as `orig`
45 /// but with all dynamically-allocated buffers duplicated in new buffers.
46 pub extern "C" fn COption_DurationZ_clone(orig: &COption_DurationZ) -> COption_DurationZ { Clone::clone(&orig) }
48 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
49 /// This corresponds to std::vector in C++
50 pub struct CVec_BlindedPathZ {
51 /// The elements in the array.
52 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
53 pub data: *mut crate::lightning::blinded_path::BlindedPath,
54 /// The number of elements pointed to by `data`.
57 impl CVec_BlindedPathZ {
58 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedPath> {
59 if self.datalen == 0 { return Vec::new(); }
60 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
61 self.data = core::ptr::null_mut();
65 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedPath] {
66 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
69 impl From<Vec<crate::lightning::blinded_path::BlindedPath>> for CVec_BlindedPathZ {
70 fn from(v: Vec<crate::lightning::blinded_path::BlindedPath>) -> Self {
71 let datalen = v.len();
72 let data = Box::into_raw(v.into_boxed_slice());
73 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
77 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
78 pub extern "C" fn CVec_BlindedPathZ_free(_res: CVec_BlindedPathZ) { }
79 impl Drop for CVec_BlindedPathZ {
81 if self.datalen == 0 { return; }
82 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
85 impl Clone for CVec_BlindedPathZ {
86 fn clone(&self) -> Self {
87 let mut res = Vec::new();
88 if self.datalen == 0 { return Self::from(res); }
89 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
95 /// An enum which can either contain a u64 or not
96 pub enum COption_u64Z {
97 /// When we're in this state, this COption_u64Z contains a u64
99 /// When we're in this state, this COption_u64Z contains nothing
103 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
104 if let Self::None = self { false } else { true }
106 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
109 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
110 if let Self::Some(v) = self { v } else { unreachable!() }
114 /// Constructs a new COption_u64Z containing a u64
115 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
116 COption_u64Z::Some(o)
119 /// Constructs a new COption_u64Z containing nothing
120 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
124 /// Frees any resources associated with the u64, if we are in the Some state
125 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
127 /// Creates a new COption_u64Z which has the same data as `orig`
128 /// but with all dynamically-allocated buffers duplicated in new buffers.
129 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
131 /// The contents of CResult_NoneAPIErrorZ
132 pub union CResult_NoneAPIErrorZPtr {
133 /// Note that this value is always NULL, as there are no contents in the OK variant
134 pub result: *mut core::ffi::c_void,
135 /// A pointer to the contents in the error state.
136 /// Reading from this pointer when `result_ok` is set is undefined.
137 pub err: *mut crate::lightning::util::errors::APIError,
140 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
141 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
143 pub struct CResult_NoneAPIErrorZ {
144 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
145 /// `err` or `result` depending on the state of `result_ok`.
146 pub contents: CResult_NoneAPIErrorZPtr,
147 /// Whether this CResult_NoneAPIErrorZ represents a success state.
151 /// Creates a new CResult_NoneAPIErrorZ in the success state.
152 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
153 CResult_NoneAPIErrorZ {
154 contents: CResult_NoneAPIErrorZPtr {
155 result: core::ptr::null_mut(),
161 /// Creates a new CResult_NoneAPIErrorZ in the error state.
162 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
163 CResult_NoneAPIErrorZ {
164 contents: CResult_NoneAPIErrorZPtr {
165 err: Box::into_raw(Box::new(e)),
170 /// Checks if the given object is currently in the success state
172 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
176 /// Frees any resources used by the CResult_NoneAPIErrorZ.
177 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
178 impl Drop for CResult_NoneAPIErrorZ {
182 if unsafe { !(self.contents.err as *mut ()).is_null() } {
183 let _ = unsafe { Box::from_raw(self.contents.err) };
188 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
189 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
190 let contents = if o.result_ok {
191 let _ = unsafe { Box::from_raw(o.contents.result) };
192 o.contents.result = core::ptr::null_mut();
193 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
195 let err = unsafe { o.contents.err };
196 unsafe { o.contents.err = core::ptr::null_mut(); }
197 CResult_NoneAPIErrorZPtr { err }
201 result_ok: o.result_ok,
205 impl Clone for CResult_NoneAPIErrorZ {
206 fn clone(&self) -> Self {
208 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
209 result: core::ptr::null_mut()
212 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
213 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
219 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
220 /// but with all dynamically-allocated buffers duplicated in new buffers.
221 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
223 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
224 /// This corresponds to std::vector in C++
225 pub struct CVec_CResult_NoneAPIErrorZZ {
226 /// The elements in the array.
227 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
228 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
229 /// The number of elements pointed to by `data`.
232 impl CVec_CResult_NoneAPIErrorZZ {
233 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
234 if self.datalen == 0 { return Vec::new(); }
235 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
236 self.data = core::ptr::null_mut();
240 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
241 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
244 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
245 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
246 let datalen = v.len();
247 let data = Box::into_raw(v.into_boxed_slice());
248 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
252 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
253 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
254 impl Drop for CVec_CResult_NoneAPIErrorZZ {
256 if self.datalen == 0 { return; }
257 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
260 impl Clone for CVec_CResult_NoneAPIErrorZZ {
261 fn clone(&self) -> Self {
262 let mut res = Vec::new();
263 if self.datalen == 0 { return Self::from(res); }
264 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
269 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
270 /// This corresponds to std::vector in C++
271 pub struct CVec_APIErrorZ {
272 /// The elements in the array.
273 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
274 pub data: *mut crate::lightning::util::errors::APIError,
275 /// The number of elements pointed to by `data`.
278 impl CVec_APIErrorZ {
279 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
280 if self.datalen == 0 { return Vec::new(); }
281 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
282 self.data = core::ptr::null_mut();
286 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
287 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
290 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
291 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
292 let datalen = v.len();
293 let data = Box::into_raw(v.into_boxed_slice());
294 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
299 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
300 impl Drop for CVec_APIErrorZ {
302 if self.datalen == 0 { return; }
303 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
306 impl Clone for CVec_APIErrorZ {
307 fn clone(&self) -> Self {
308 let mut res = Vec::new();
309 if self.datalen == 0 { return Self::from(res); }
310 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
315 /// A dynamically-allocated array of u8s of arbitrary size.
316 /// This corresponds to std::vector in C++
317 pub struct CVec_u8Z {
318 /// The elements in the array.
319 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
321 /// The number of elements pointed to by `data`.
325 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
326 if self.datalen == 0 { return Vec::new(); }
327 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
328 self.data = core::ptr::null_mut();
332 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
333 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
336 impl From<Vec<u8>> for CVec_u8Z {
337 fn from(v: Vec<u8>) -> Self {
338 let datalen = v.len();
339 let data = Box::into_raw(v.into_boxed_slice());
340 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
344 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
345 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
346 impl Drop for CVec_u8Z {
348 if self.datalen == 0 { return; }
349 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
352 impl Clone for CVec_u8Z {
353 fn clone(&self) -> Self {
354 let mut res = Vec::new();
355 if self.datalen == 0 { return Self::from(res); }
356 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
362 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
363 pub enum COption_CVec_u8ZZ {
364 /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
365 Some(crate::c_types::derived::CVec_u8Z),
366 /// When we're in this state, this COption_CVec_u8ZZ contains nothing
369 impl COption_CVec_u8ZZ {
370 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
371 if let Self::None = self { false } else { true }
373 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
376 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
377 if let Self::Some(v) = self { v } else { unreachable!() }
381 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
382 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
383 COption_CVec_u8ZZ::Some(o)
386 /// Constructs a new COption_CVec_u8ZZ containing nothing
387 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
388 COption_CVec_u8ZZ::None
391 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
392 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
394 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
395 /// but with all dynamically-allocated buffers duplicated in new buffers.
396 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
398 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
399 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
400 /// A pointer to the contents in the success state.
401 /// Reading from this pointer when `result_ok` is not set is undefined.
402 pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
403 /// A pointer to the contents in the error state.
404 /// Reading from this pointer when `result_ok` is set is undefined.
405 pub err: *mut crate::lightning::ln::msgs::DecodeError,
408 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
409 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
411 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
412 /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
413 /// `err` or `result` depending on the state of `result_ok`.
414 pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
415 /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
419 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
420 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
421 CResult_RecipientOnionFieldsDecodeErrorZ {
422 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
423 result: Box::into_raw(Box::new(o)),
429 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
430 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
431 CResult_RecipientOnionFieldsDecodeErrorZ {
432 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
433 err: Box::into_raw(Box::new(e)),
438 /// Checks if the given object is currently in the success state
440 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
444 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
445 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
446 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
449 if unsafe { !(self.contents.result as *mut ()).is_null() } {
450 let _ = unsafe { Box::from_raw(self.contents.result) };
453 if unsafe { !(self.contents.err as *mut ()).is_null() } {
454 let _ = unsafe { Box::from_raw(self.contents.err) };
459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
460 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
461 let contents = if o.result_ok {
462 let result = unsafe { o.contents.result };
463 unsafe { o.contents.result = core::ptr::null_mut() };
464 CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
466 let err = unsafe { o.contents.err };
467 unsafe { o.contents.err = core::ptr::null_mut(); }
468 CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
472 result_ok: o.result_ok,
476 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
477 fn clone(&self) -> Self {
479 Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
480 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
483 Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
484 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
490 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
491 /// but with all dynamically-allocated buffers duplicated in new buffers.
492 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
494 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
495 pub enum COption_HTLCClaimZ {
496 /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
497 Some(crate::lightning::ln::chan_utils::HTLCClaim),
498 /// When we're in this state, this COption_HTLCClaimZ contains nothing
501 impl COption_HTLCClaimZ {
502 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
503 if let Self::None = self { false } else { true }
505 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
508 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
509 if let Self::Some(v) = self { v } else { unreachable!() }
513 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
514 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
515 COption_HTLCClaimZ::Some(o)
518 /// Constructs a new COption_HTLCClaimZ containing nothing
519 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
520 COption_HTLCClaimZ::None
523 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
524 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
526 /// The contents of CResult_NoneNoneZ
527 pub union CResult_NoneNoneZPtr {
528 /// Note that this value is always NULL, as there are no contents in the OK variant
529 pub result: *mut core::ffi::c_void,
530 /// Note that this value is always NULL, as there are no contents in the Err variant
531 pub err: *mut core::ffi::c_void,
534 /// A CResult_NoneNoneZ represents the result of a fallible operation,
535 /// containing a () on success and a () on failure.
536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
537 pub struct CResult_NoneNoneZ {
538 /// The contents of this CResult_NoneNoneZ, accessible via either
539 /// `err` or `result` depending on the state of `result_ok`.
540 pub contents: CResult_NoneNoneZPtr,
541 /// Whether this CResult_NoneNoneZ represents a success state.
545 /// Creates a new CResult_NoneNoneZ in the success state.
546 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
548 contents: CResult_NoneNoneZPtr {
549 result: core::ptr::null_mut(),
555 /// Creates a new CResult_NoneNoneZ in the error state.
556 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
558 contents: CResult_NoneNoneZPtr {
559 err: core::ptr::null_mut(),
564 /// Checks if the given object is currently in the success state
566 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
570 /// Frees any resources used by the CResult_NoneNoneZ.
571 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
572 impl Drop for CResult_NoneNoneZ {
579 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
580 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
581 let contents = if o.result_ok {
582 let _ = unsafe { Box::from_raw(o.contents.result) };
583 o.contents.result = core::ptr::null_mut();
584 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
586 let _ = unsafe { Box::from_raw(o.contents.err) };
587 o.contents.err = core::ptr::null_mut();
588 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
592 result_ok: o.result_ok,
596 impl Clone for CResult_NoneNoneZ {
597 fn clone(&self) -> Self {
599 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
600 result: core::ptr::null_mut()
603 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
604 err: core::ptr::null_mut()
610 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
611 /// but with all dynamically-allocated buffers duplicated in new buffers.
612 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
614 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
615 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
616 /// A pointer to the contents in the success state.
617 /// Reading from this pointer when `result_ok` is not set is undefined.
618 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
619 /// A pointer to the contents in the error state.
620 /// Reading from this pointer when `result_ok` is set is undefined.
621 pub err: *mut crate::lightning::ln::msgs::DecodeError,
624 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
625 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
627 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
628 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
629 /// `err` or `result` depending on the state of `result_ok`.
630 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
631 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
635 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
636 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
637 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
638 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
639 result: Box::into_raw(Box::new(o)),
645 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
646 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
647 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
648 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
649 err: Box::into_raw(Box::new(e)),
654 /// Checks if the given object is currently in the success state
656 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
660 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
661 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
662 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
665 if unsafe { !(self.contents.result as *mut ()).is_null() } {
666 let _ = unsafe { Box::from_raw(self.contents.result) };
669 if unsafe { !(self.contents.err as *mut ()).is_null() } {
670 let _ = unsafe { Box::from_raw(self.contents.err) };
675 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
676 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
677 let contents = if o.result_ok {
678 let result = unsafe { o.contents.result };
679 unsafe { o.contents.result = core::ptr::null_mut() };
680 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
682 let err = unsafe { o.contents.err };
683 unsafe { o.contents.err = core::ptr::null_mut(); }
684 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
688 result_ok: o.result_ok,
692 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
693 fn clone(&self) -> Self {
695 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
696 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
699 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
700 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
706 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
707 /// but with all dynamically-allocated buffers duplicated in new buffers.
708 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
710 /// The contents of CResult_TxCreationKeysDecodeErrorZ
711 pub union CResult_TxCreationKeysDecodeErrorZPtr {
712 /// A pointer to the contents in the success state.
713 /// Reading from this pointer when `result_ok` is not set is undefined.
714 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
715 /// A pointer to the contents in the error state.
716 /// Reading from this pointer when `result_ok` is set is undefined.
717 pub err: *mut crate::lightning::ln::msgs::DecodeError,
720 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
721 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
723 pub struct CResult_TxCreationKeysDecodeErrorZ {
724 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
725 /// `err` or `result` depending on the state of `result_ok`.
726 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
727 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
731 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
732 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
733 CResult_TxCreationKeysDecodeErrorZ {
734 contents: CResult_TxCreationKeysDecodeErrorZPtr {
735 result: Box::into_raw(Box::new(o)),
741 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
742 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
743 CResult_TxCreationKeysDecodeErrorZ {
744 contents: CResult_TxCreationKeysDecodeErrorZPtr {
745 err: Box::into_raw(Box::new(e)),
750 /// Checks if the given object is currently in the success state
752 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
756 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
757 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
758 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
761 if unsafe { !(self.contents.result as *mut ()).is_null() } {
762 let _ = unsafe { Box::from_raw(self.contents.result) };
765 if unsafe { !(self.contents.err as *mut ()).is_null() } {
766 let _ = unsafe { Box::from_raw(self.contents.err) };
771 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
772 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
773 let contents = if o.result_ok {
774 let result = unsafe { o.contents.result };
775 unsafe { o.contents.result = core::ptr::null_mut() };
776 CResult_TxCreationKeysDecodeErrorZPtr { result }
778 let err = unsafe { o.contents.err };
779 unsafe { o.contents.err = core::ptr::null_mut(); }
780 CResult_TxCreationKeysDecodeErrorZPtr { err }
784 result_ok: o.result_ok,
788 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
789 fn clone(&self) -> Self {
791 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
792 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
795 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
796 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
802 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
803 /// but with all dynamically-allocated buffers duplicated in new buffers.
804 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
806 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
807 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
808 /// A pointer to the contents in the success state.
809 /// Reading from this pointer when `result_ok` is not set is undefined.
810 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
811 /// A pointer to the contents in the error state.
812 /// Reading from this pointer when `result_ok` is set is undefined.
813 pub err: *mut crate::lightning::ln::msgs::DecodeError,
816 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
817 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
819 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
820 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
821 /// `err` or `result` depending on the state of `result_ok`.
822 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
823 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
827 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
828 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
829 CResult_ChannelPublicKeysDecodeErrorZ {
830 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
831 result: Box::into_raw(Box::new(o)),
837 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
838 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
839 CResult_ChannelPublicKeysDecodeErrorZ {
840 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
841 err: Box::into_raw(Box::new(e)),
846 /// Checks if the given object is currently in the success state
848 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
852 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
853 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
854 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
857 if unsafe { !(self.contents.result as *mut ()).is_null() } {
858 let _ = unsafe { Box::from_raw(self.contents.result) };
861 if unsafe { !(self.contents.err as *mut ()).is_null() } {
862 let _ = unsafe { Box::from_raw(self.contents.err) };
867 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
868 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
869 let contents = if o.result_ok {
870 let result = unsafe { o.contents.result };
871 unsafe { o.contents.result = core::ptr::null_mut() };
872 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
874 let err = unsafe { o.contents.err };
875 unsafe { o.contents.err = core::ptr::null_mut(); }
876 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
880 result_ok: o.result_ok,
884 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
885 fn clone(&self) -> Self {
887 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
888 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
891 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
892 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
898 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
899 /// but with all dynamically-allocated buffers duplicated in new buffers.
900 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
903 /// An enum which can either contain a u32 or not
904 pub enum COption_u32Z {
905 /// When we're in this state, this COption_u32Z contains a u32
907 /// When we're in this state, this COption_u32Z contains nothing
911 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
912 if let Self::None = self { false } else { true }
914 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
917 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
918 if let Self::Some(v) = self { v } else { unreachable!() }
922 /// Constructs a new COption_u32Z containing a u32
923 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
924 COption_u32Z::Some(o)
927 /// Constructs a new COption_u32Z containing nothing
928 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
932 /// Frees any resources associated with the u32, if we are in the Some state
933 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
935 /// Creates a new COption_u32Z which has the same data as `orig`
936 /// but with all dynamically-allocated buffers duplicated in new buffers.
937 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
939 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
940 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
941 /// A pointer to the contents in the success state.
942 /// Reading from this pointer when `result_ok` is not set is undefined.
943 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
944 /// A pointer to the contents in the error state.
945 /// Reading from this pointer when `result_ok` is set is undefined.
946 pub err: *mut crate::lightning::ln::msgs::DecodeError,
949 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
950 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
952 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
953 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
954 /// `err` or `result` depending on the state of `result_ok`.
955 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
956 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
960 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
961 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
962 CResult_HTLCOutputInCommitmentDecodeErrorZ {
963 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
964 result: Box::into_raw(Box::new(o)),
970 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
971 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
972 CResult_HTLCOutputInCommitmentDecodeErrorZ {
973 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
974 err: Box::into_raw(Box::new(e)),
979 /// Checks if the given object is currently in the success state
981 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
985 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
986 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
987 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
990 if unsafe { !(self.contents.result as *mut ()).is_null() } {
991 let _ = unsafe { Box::from_raw(self.contents.result) };
994 if unsafe { !(self.contents.err as *mut ()).is_null() } {
995 let _ = unsafe { Box::from_raw(self.contents.err) };
1000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1001 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
1002 let contents = if o.result_ok {
1003 let result = unsafe { o.contents.result };
1004 unsafe { o.contents.result = core::ptr::null_mut() };
1005 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
1007 let err = unsafe { o.contents.err };
1008 unsafe { o.contents.err = core::ptr::null_mut(); }
1009 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
1013 result_ok: o.result_ok,
1017 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1018 fn clone(&self) -> Self {
1020 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1021 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
1024 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1025 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1031 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
1032 /// but with all dynamically-allocated buffers duplicated in new buffers.
1033 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
1035 /// An enum which can either contain a or not
1036 pub enum COption_NoneZ {
1037 /// When we're in this state, this COption_NoneZ contains a
1039 /// When we're in this state, this COption_NoneZ contains nothing
1042 impl COption_NoneZ {
1043 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1044 if let Self::None = self { false } else { true }
1046 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1051 /// Constructs a new COption_NoneZ containing a
1052 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
1056 /// Constructs a new COption_NoneZ containing nothing
1057 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
1061 /// Frees any resources associated with the , if we are in the Some state
1062 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
1064 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1065 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1066 /// A pointer to the contents in the success state.
1067 /// Reading from this pointer when `result_ok` is not set is undefined.
1068 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
1069 /// A pointer to the contents in the error state.
1070 /// Reading from this pointer when `result_ok` is set is undefined.
1071 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1074 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1075 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1076 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1077 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1078 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1079 /// `err` or `result` depending on the state of `result_ok`.
1080 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
1081 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1082 pub result_ok: bool,
1085 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
1086 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1087 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1088 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1089 result: Box::into_raw(Box::new(o)),
1095 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
1096 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1097 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1098 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1099 err: Box::into_raw(Box::new(e)),
1104 /// Checks if the given object is currently in the success state
1106 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
1110 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
1111 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
1112 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1113 fn drop(&mut self) {
1115 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1116 let _ = unsafe { Box::from_raw(self.contents.result) };
1119 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1120 let _ = unsafe { Box::from_raw(self.contents.err) };
1125 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1126 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1127 let contents = if o.result_ok {
1128 let result = unsafe { o.contents.result };
1129 unsafe { o.contents.result = core::ptr::null_mut() };
1130 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
1132 let err = unsafe { o.contents.err };
1133 unsafe { o.contents.err = core::ptr::null_mut(); }
1134 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
1138 result_ok: o.result_ok,
1142 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1143 fn clone(&self) -> Self {
1145 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1146 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1149 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1150 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1156 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1157 /// but with all dynamically-allocated buffers duplicated in new buffers.
1158 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1160 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1161 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
1162 /// A pointer to the contents in the success state.
1163 /// Reading from this pointer when `result_ok` is not set is undefined.
1164 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
1165 /// A pointer to the contents in the error state.
1166 /// Reading from this pointer when `result_ok` is set is undefined.
1167 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1170 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1171 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1173 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
1174 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1175 /// `err` or `result` depending on the state of `result_ok`.
1176 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
1177 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1178 pub result_ok: bool,
1181 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
1182 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
1183 CResult_ChannelTransactionParametersDecodeErrorZ {
1184 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1185 result: Box::into_raw(Box::new(o)),
1191 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
1192 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
1193 CResult_ChannelTransactionParametersDecodeErrorZ {
1194 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1195 err: Box::into_raw(Box::new(e)),
1200 /// Checks if the given object is currently in the success state
1202 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
1206 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
1207 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
1208 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
1209 fn drop(&mut self) {
1211 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1212 let _ = unsafe { Box::from_raw(self.contents.result) };
1215 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1216 let _ = unsafe { Box::from_raw(self.contents.err) };
1221 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
1222 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1223 let contents = if o.result_ok {
1224 let result = unsafe { o.contents.result };
1225 unsafe { o.contents.result = core::ptr::null_mut() };
1226 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1228 let err = unsafe { o.contents.err };
1229 unsafe { o.contents.err = core::ptr::null_mut(); }
1230 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1234 result_ok: o.result_ok,
1238 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1239 fn clone(&self) -> Self {
1241 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1242 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1245 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1246 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1252 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1253 /// but with all dynamically-allocated buffers duplicated in new buffers.
1254 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1256 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1257 /// This corresponds to std::vector in C++
1258 pub struct CVec_SignatureZ {
1259 /// The elements in the array.
1260 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1261 pub data: *mut crate::c_types::Signature,
1262 /// The number of elements pointed to by `data`.
1265 impl CVec_SignatureZ {
1266 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1267 if self.datalen == 0 { return Vec::new(); }
1268 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1269 self.data = core::ptr::null_mut();
1273 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1274 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1277 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1278 fn from(v: Vec<crate::c_types::Signature>) -> Self {
1279 let datalen = v.len();
1280 let data = Box::into_raw(v.into_boxed_slice());
1281 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1285 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1286 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1287 impl Drop for CVec_SignatureZ {
1288 fn drop(&mut self) {
1289 if self.datalen == 0 { return; }
1290 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1293 impl Clone for CVec_SignatureZ {
1294 fn clone(&self) -> Self {
1295 let mut res = Vec::new();
1296 if self.datalen == 0 { return Self::from(res); }
1297 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1302 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1303 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1304 /// A pointer to the contents in the success state.
1305 /// Reading from this pointer when `result_ok` is not set is undefined.
1306 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1307 /// A pointer to the contents in the error state.
1308 /// Reading from this pointer when `result_ok` is set is undefined.
1309 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1312 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1313 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1315 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1316 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1317 /// `err` or `result` depending on the state of `result_ok`.
1318 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1319 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1320 pub result_ok: bool,
1323 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1324 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1325 CResult_HolderCommitmentTransactionDecodeErrorZ {
1326 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1327 result: Box::into_raw(Box::new(o)),
1333 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1334 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1335 CResult_HolderCommitmentTransactionDecodeErrorZ {
1336 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1337 err: Box::into_raw(Box::new(e)),
1342 /// Checks if the given object is currently in the success state
1344 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1348 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1349 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1350 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1351 fn drop(&mut self) {
1353 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1354 let _ = unsafe { Box::from_raw(self.contents.result) };
1357 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1358 let _ = unsafe { Box::from_raw(self.contents.err) };
1363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1364 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1365 let contents = if o.result_ok {
1366 let result = unsafe { o.contents.result };
1367 unsafe { o.contents.result = core::ptr::null_mut() };
1368 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1370 let err = unsafe { o.contents.err };
1371 unsafe { o.contents.err = core::ptr::null_mut(); }
1372 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1376 result_ok: o.result_ok,
1380 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1381 fn clone(&self) -> Self {
1383 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1384 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1387 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1388 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1394 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1395 /// but with all dynamically-allocated buffers duplicated in new buffers.
1396 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1398 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1399 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1400 /// A pointer to the contents in the success state.
1401 /// Reading from this pointer when `result_ok` is not set is undefined.
1402 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1403 /// A pointer to the contents in the error state.
1404 /// Reading from this pointer when `result_ok` is set is undefined.
1405 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1408 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1409 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1411 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1412 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1413 /// `err` or `result` depending on the state of `result_ok`.
1414 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1415 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1416 pub result_ok: bool,
1419 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1420 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1421 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1422 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1423 result: Box::into_raw(Box::new(o)),
1429 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1430 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1431 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1432 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1433 err: Box::into_raw(Box::new(e)),
1438 /// Checks if the given object is currently in the success state
1440 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1444 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1445 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1446 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1447 fn drop(&mut self) {
1449 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1450 let _ = unsafe { Box::from_raw(self.contents.result) };
1453 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1454 let _ = unsafe { Box::from_raw(self.contents.err) };
1459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1460 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1461 let contents = if o.result_ok {
1462 let result = unsafe { o.contents.result };
1463 unsafe { o.contents.result = core::ptr::null_mut() };
1464 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1466 let err = unsafe { o.contents.err };
1467 unsafe { o.contents.err = core::ptr::null_mut(); }
1468 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1472 result_ok: o.result_ok,
1476 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1477 fn clone(&self) -> Self {
1479 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1480 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1483 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1484 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1490 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1491 /// but with all dynamically-allocated buffers duplicated in new buffers.
1492 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1494 /// The contents of CResult_TrustedClosingTransactionNoneZ
1495 pub union CResult_TrustedClosingTransactionNoneZPtr {
1496 /// A pointer to the contents in the success state.
1497 /// Reading from this pointer when `result_ok` is not set is undefined.
1498 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1499 /// Note that this value is always NULL, as there are no contents in the Err variant
1500 pub err: *mut core::ffi::c_void,
1503 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1504 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1506 pub struct CResult_TrustedClosingTransactionNoneZ {
1507 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1508 /// `err` or `result` depending on the state of `result_ok`.
1509 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1510 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1511 pub result_ok: bool,
1514 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1515 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1516 CResult_TrustedClosingTransactionNoneZ {
1517 contents: CResult_TrustedClosingTransactionNoneZPtr {
1518 result: Box::into_raw(Box::new(o)),
1524 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1525 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1526 CResult_TrustedClosingTransactionNoneZ {
1527 contents: CResult_TrustedClosingTransactionNoneZPtr {
1528 err: core::ptr::null_mut(),
1533 /// Checks if the given object is currently in the success state
1535 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1539 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1540 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1541 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1542 fn drop(&mut self) {
1544 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1545 let _ = unsafe { Box::from_raw(self.contents.result) };
1551 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1552 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1553 let contents = if o.result_ok {
1554 let result = unsafe { o.contents.result };
1555 unsafe { o.contents.result = core::ptr::null_mut() };
1556 CResult_TrustedClosingTransactionNoneZPtr { result }
1558 let _ = unsafe { Box::from_raw(o.contents.err) };
1559 o.contents.err = core::ptr::null_mut();
1560 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1564 result_ok: o.result_ok,
1569 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1570 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1571 /// A pointer to the contents in the success state.
1572 /// Reading from this pointer when `result_ok` is not set is undefined.
1573 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1574 /// A pointer to the contents in the error state.
1575 /// Reading from this pointer when `result_ok` is set is undefined.
1576 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1579 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1580 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1582 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1583 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1584 /// `err` or `result` depending on the state of `result_ok`.
1585 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1586 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1587 pub result_ok: bool,
1590 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1591 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1592 CResult_CommitmentTransactionDecodeErrorZ {
1593 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1594 result: Box::into_raw(Box::new(o)),
1600 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1601 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1602 CResult_CommitmentTransactionDecodeErrorZ {
1603 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1604 err: Box::into_raw(Box::new(e)),
1609 /// Checks if the given object is currently in the success state
1611 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1615 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1616 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1617 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1618 fn drop(&mut self) {
1620 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1621 let _ = unsafe { Box::from_raw(self.contents.result) };
1624 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1625 let _ = unsafe { Box::from_raw(self.contents.err) };
1630 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1631 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1632 let contents = if o.result_ok {
1633 let result = unsafe { o.contents.result };
1634 unsafe { o.contents.result = core::ptr::null_mut() };
1635 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1637 let err = unsafe { o.contents.err };
1638 unsafe { o.contents.err = core::ptr::null_mut(); }
1639 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1643 result_ok: o.result_ok,
1647 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1648 fn clone(&self) -> Self {
1650 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1651 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1654 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1655 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1661 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1662 /// but with all dynamically-allocated buffers duplicated in new buffers.
1663 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1665 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1666 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1667 /// A pointer to the contents in the success state.
1668 /// Reading from this pointer when `result_ok` is not set is undefined.
1669 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1670 /// Note that this value is always NULL, as there are no contents in the Err variant
1671 pub err: *mut core::ffi::c_void,
1674 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1675 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1676 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1677 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1678 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1679 /// `err` or `result` depending on the state of `result_ok`.
1680 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1681 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1682 pub result_ok: bool,
1685 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1686 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1687 CResult_TrustedCommitmentTransactionNoneZ {
1688 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1689 result: Box::into_raw(Box::new(o)),
1695 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1696 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1697 CResult_TrustedCommitmentTransactionNoneZ {
1698 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1699 err: core::ptr::null_mut(),
1704 /// Checks if the given object is currently in the success state
1706 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1710 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1711 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1712 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1713 fn drop(&mut self) {
1715 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1716 let _ = unsafe { Box::from_raw(self.contents.result) };
1722 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1723 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1724 let contents = if o.result_ok {
1725 let result = unsafe { o.contents.result };
1726 unsafe { o.contents.result = core::ptr::null_mut() };
1727 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1729 let _ = unsafe { Box::from_raw(o.contents.err) };
1730 o.contents.err = core::ptr::null_mut();
1731 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1735 result_ok: o.result_ok,
1740 /// The contents of CResult_CVec_SignatureZNoneZ
1741 pub union CResult_CVec_SignatureZNoneZPtr {
1742 /// A pointer to the contents in the success state.
1743 /// Reading from this pointer when `result_ok` is not set is undefined.
1744 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1745 /// Note that this value is always NULL, as there are no contents in the Err variant
1746 pub err: *mut core::ffi::c_void,
1749 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1750 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1751 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1752 pub struct CResult_CVec_SignatureZNoneZ {
1753 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1754 /// `err` or `result` depending on the state of `result_ok`.
1755 pub contents: CResult_CVec_SignatureZNoneZPtr,
1756 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1757 pub result_ok: bool,
1760 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1761 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1762 CResult_CVec_SignatureZNoneZ {
1763 contents: CResult_CVec_SignatureZNoneZPtr {
1764 result: Box::into_raw(Box::new(o)),
1770 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1771 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1772 CResult_CVec_SignatureZNoneZ {
1773 contents: CResult_CVec_SignatureZNoneZPtr {
1774 err: core::ptr::null_mut(),
1779 /// Checks if the given object is currently in the success state
1781 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1785 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1786 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1787 impl Drop for CResult_CVec_SignatureZNoneZ {
1788 fn drop(&mut self) {
1790 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1791 let _ = unsafe { Box::from_raw(self.contents.result) };
1797 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1798 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1799 let contents = if o.result_ok {
1800 let result = unsafe { o.contents.result };
1801 unsafe { o.contents.result = core::ptr::null_mut() };
1802 CResult_CVec_SignatureZNoneZPtr { result }
1804 let _ = unsafe { Box::from_raw(o.contents.err) };
1805 o.contents.err = core::ptr::null_mut();
1806 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1810 result_ok: o.result_ok,
1814 impl Clone for CResult_CVec_SignatureZNoneZ {
1815 fn clone(&self) -> Self {
1817 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1818 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1821 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1822 err: core::ptr::null_mut()
1828 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1829 /// but with all dynamically-allocated buffers duplicated in new buffers.
1830 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1832 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1833 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1834 /// A pointer to the contents in the success state.
1835 /// Reading from this pointer when `result_ok` is not set is undefined.
1836 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1837 /// A pointer to the contents in the error state.
1838 /// Reading from this pointer when `result_ok` is set is undefined.
1839 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1842 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1843 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1844 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1845 pub struct CResult_ShutdownScriptDecodeErrorZ {
1846 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1847 /// `err` or `result` depending on the state of `result_ok`.
1848 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1849 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1850 pub result_ok: bool,
1853 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1854 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1855 CResult_ShutdownScriptDecodeErrorZ {
1856 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1857 result: Box::into_raw(Box::new(o)),
1863 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1864 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1865 CResult_ShutdownScriptDecodeErrorZ {
1866 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1867 err: Box::into_raw(Box::new(e)),
1872 /// Checks if the given object is currently in the success state
1874 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1878 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1879 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1880 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1881 fn drop(&mut self) {
1883 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1884 let _ = unsafe { Box::from_raw(self.contents.result) };
1887 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1888 let _ = unsafe { Box::from_raw(self.contents.err) };
1893 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1894 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1895 let contents = if o.result_ok {
1896 let result = unsafe { o.contents.result };
1897 unsafe { o.contents.result = core::ptr::null_mut() };
1898 CResult_ShutdownScriptDecodeErrorZPtr { result }
1900 let err = unsafe { o.contents.err };
1901 unsafe { o.contents.err = core::ptr::null_mut(); }
1902 CResult_ShutdownScriptDecodeErrorZPtr { err }
1906 result_ok: o.result_ok,
1910 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1911 fn clone(&self) -> Self {
1913 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1914 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1917 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1918 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1924 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1925 /// but with all dynamically-allocated buffers duplicated in new buffers.
1926 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1928 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1929 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1930 /// A pointer to the contents in the success state.
1931 /// Reading from this pointer when `result_ok` is not set is undefined.
1932 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1933 /// A pointer to the contents in the error state.
1934 /// Reading from this pointer when `result_ok` is set is undefined.
1935 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1938 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1939 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1941 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1942 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1943 /// `err` or `result` depending on the state of `result_ok`.
1944 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1945 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1946 pub result_ok: bool,
1949 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1950 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1951 CResult_ShutdownScriptInvalidShutdownScriptZ {
1952 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1953 result: Box::into_raw(Box::new(o)),
1959 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1960 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1961 CResult_ShutdownScriptInvalidShutdownScriptZ {
1962 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1963 err: Box::into_raw(Box::new(e)),
1968 /// Checks if the given object is currently in the success state
1970 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1974 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1975 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1976 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1977 fn drop(&mut self) {
1979 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1980 let _ = unsafe { Box::from_raw(self.contents.result) };
1983 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1984 let _ = unsafe { Box::from_raw(self.contents.err) };
1989 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1990 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1991 let contents = if o.result_ok {
1992 let result = unsafe { o.contents.result };
1993 unsafe { o.contents.result = core::ptr::null_mut() };
1994 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1996 let err = unsafe { o.contents.err };
1997 unsafe { o.contents.err = core::ptr::null_mut(); }
1998 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
2002 result_ok: o.result_ok,
2006 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
2007 fn clone(&self) -> Self {
2009 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2010 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2013 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2014 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
2020 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
2021 /// but with all dynamically-allocated buffers duplicated in new buffers.
2022 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
2024 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
2025 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
2026 /// A pointer to the contents in the success state.
2027 /// Reading from this pointer when `result_ok` is not set is undefined.
2028 pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
2029 /// A pointer to the contents in the error state.
2030 /// Reading from this pointer when `result_ok` is set is undefined.
2031 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2034 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
2035 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
2036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2037 pub struct CResult_BlindedPayInfoDecodeErrorZ {
2038 /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
2039 /// `err` or `result` depending on the state of `result_ok`.
2040 pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
2041 /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
2042 pub result_ok: bool,
2045 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
2046 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
2047 CResult_BlindedPayInfoDecodeErrorZ {
2048 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2049 result: Box::into_raw(Box::new(o)),
2055 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
2056 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
2057 CResult_BlindedPayInfoDecodeErrorZ {
2058 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2059 err: Box::into_raw(Box::new(e)),
2064 /// Checks if the given object is currently in the success state
2066 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
2070 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
2071 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
2072 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
2073 fn drop(&mut self) {
2075 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2076 let _ = unsafe { Box::from_raw(self.contents.result) };
2079 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2080 let _ = unsafe { Box::from_raw(self.contents.err) };
2085 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
2086 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
2087 let contents = if o.result_ok {
2088 let result = unsafe { o.contents.result };
2089 unsafe { o.contents.result = core::ptr::null_mut() };
2090 CResult_BlindedPayInfoDecodeErrorZPtr { result }
2092 let err = unsafe { o.contents.err };
2093 unsafe { o.contents.err = core::ptr::null_mut(); }
2094 CResult_BlindedPayInfoDecodeErrorZPtr { err }
2098 result_ok: o.result_ok,
2102 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
2103 fn clone(&self) -> Self {
2105 Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2106 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
2109 Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2110 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2116 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
2117 /// but with all dynamically-allocated buffers duplicated in new buffers.
2118 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
2120 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2121 pub enum COption_WriteableScoreZ {
2122 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2123 Some(crate::lightning::routing::scoring::WriteableScore),
2124 /// When we're in this state, this COption_WriteableScoreZ contains nothing
2127 impl COption_WriteableScoreZ {
2128 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2129 if let Self::None = self { false } else { true }
2131 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2134 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
2135 if let Self::Some(v) = self { v } else { unreachable!() }
2139 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
2140 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
2141 COption_WriteableScoreZ::Some(o)
2144 /// Constructs a new COption_WriteableScoreZ containing nothing
2145 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
2146 COption_WriteableScoreZ::None
2149 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
2150 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
2152 /// The contents of CResult_NoneErrorZ
2153 pub union CResult_NoneErrorZPtr {
2154 /// Note that this value is always NULL, as there are no contents in the OK variant
2155 pub result: *mut core::ffi::c_void,
2156 /// A pointer to the contents in the error state.
2157 /// Reading from this pointer when `result_ok` is set is undefined.
2158 pub err: *mut crate::c_types::IOError,
2161 /// A CResult_NoneErrorZ represents the result of a fallible operation,
2162 /// containing a () on success and a crate::c_types::IOError on failure.
2163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2164 pub struct CResult_NoneErrorZ {
2165 /// The contents of this CResult_NoneErrorZ, accessible via either
2166 /// `err` or `result` depending on the state of `result_ok`.
2167 pub contents: CResult_NoneErrorZPtr,
2168 /// Whether this CResult_NoneErrorZ represents a success state.
2169 pub result_ok: bool,
2172 /// Creates a new CResult_NoneErrorZ in the success state.
2173 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
2174 CResult_NoneErrorZ {
2175 contents: CResult_NoneErrorZPtr {
2176 result: core::ptr::null_mut(),
2182 /// Creates a new CResult_NoneErrorZ in the error state.
2183 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
2184 CResult_NoneErrorZ {
2185 contents: CResult_NoneErrorZPtr {
2186 err: Box::into_raw(Box::new(e)),
2191 /// Checks if the given object is currently in the success state
2193 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
2197 /// Frees any resources used by the CResult_NoneErrorZ.
2198 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
2199 impl Drop for CResult_NoneErrorZ {
2200 fn drop(&mut self) {
2203 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2204 let _ = unsafe { Box::from_raw(self.contents.err) };
2209 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
2210 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
2211 let contents = if o.result_ok {
2212 let _ = unsafe { Box::from_raw(o.contents.result) };
2213 o.contents.result = core::ptr::null_mut();
2214 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
2216 let err = unsafe { o.contents.err };
2217 unsafe { o.contents.err = core::ptr::null_mut(); }
2218 CResult_NoneErrorZPtr { err }
2222 result_ok: o.result_ok,
2226 impl Clone for CResult_NoneErrorZ {
2227 fn clone(&self) -> Self {
2229 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
2230 result: core::ptr::null_mut()
2233 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
2234 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
2240 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
2241 /// but with all dynamically-allocated buffers duplicated in new buffers.
2242 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
2244 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2245 /// This corresponds to std::vector in C++
2246 pub struct CVec_ChannelDetailsZ {
2247 /// The elements in the array.
2248 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2249 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2250 /// The number of elements pointed to by `data`.
2253 impl CVec_ChannelDetailsZ {
2254 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2255 if self.datalen == 0 { return Vec::new(); }
2256 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2257 self.data = core::ptr::null_mut();
2261 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2262 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2265 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2266 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2267 let datalen = v.len();
2268 let data = Box::into_raw(v.into_boxed_slice());
2269 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2273 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2274 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2275 impl Drop for CVec_ChannelDetailsZ {
2276 fn drop(&mut self) {
2277 if self.datalen == 0 { return; }
2278 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2281 impl Clone for CVec_ChannelDetailsZ {
2282 fn clone(&self) -> Self {
2283 let mut res = Vec::new();
2284 if self.datalen == 0 { return Self::from(res); }
2285 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2290 /// The contents of CResult_RouteLightningErrorZ
2291 pub union CResult_RouteLightningErrorZPtr {
2292 /// A pointer to the contents in the success state.
2293 /// Reading from this pointer when `result_ok` is not set is undefined.
2294 pub result: *mut crate::lightning::routing::router::Route,
2295 /// A pointer to the contents in the error state.
2296 /// Reading from this pointer when `result_ok` is set is undefined.
2297 pub err: *mut crate::lightning::ln::msgs::LightningError,
2300 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2301 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2303 pub struct CResult_RouteLightningErrorZ {
2304 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2305 /// `err` or `result` depending on the state of `result_ok`.
2306 pub contents: CResult_RouteLightningErrorZPtr,
2307 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2308 pub result_ok: bool,
2311 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2312 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2313 CResult_RouteLightningErrorZ {
2314 contents: CResult_RouteLightningErrorZPtr {
2315 result: Box::into_raw(Box::new(o)),
2321 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2322 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2323 CResult_RouteLightningErrorZ {
2324 contents: CResult_RouteLightningErrorZPtr {
2325 err: Box::into_raw(Box::new(e)),
2330 /// Checks if the given object is currently in the success state
2332 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2336 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2337 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2338 impl Drop for CResult_RouteLightningErrorZ {
2339 fn drop(&mut self) {
2341 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2342 let _ = unsafe { Box::from_raw(self.contents.result) };
2345 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2346 let _ = unsafe { Box::from_raw(self.contents.err) };
2351 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2352 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2353 let contents = if o.result_ok {
2354 let result = unsafe { o.contents.result };
2355 unsafe { o.contents.result = core::ptr::null_mut() };
2356 CResult_RouteLightningErrorZPtr { result }
2358 let err = unsafe { o.contents.err };
2359 unsafe { o.contents.err = core::ptr::null_mut(); }
2360 CResult_RouteLightningErrorZPtr { err }
2364 result_ok: o.result_ok,
2368 impl Clone for CResult_RouteLightningErrorZ {
2369 fn clone(&self) -> Self {
2371 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2372 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2375 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2376 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2382 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2383 /// but with all dynamically-allocated buffers duplicated in new buffers.
2384 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2386 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
2387 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
2388 /// A pointer to the contents in the success state.
2389 /// Reading from this pointer when `result_ok` is not set is undefined.
2390 pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
2391 /// A pointer to the contents in the error state.
2392 /// Reading from this pointer when `result_ok` is set is undefined.
2393 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2396 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2397 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2399 pub struct CResult_InFlightHtlcsDecodeErrorZ {
2400 /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
2401 /// `err` or `result` depending on the state of `result_ok`.
2402 pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
2403 /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
2404 pub result_ok: bool,
2407 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
2408 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
2409 CResult_InFlightHtlcsDecodeErrorZ {
2410 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2411 result: Box::into_raw(Box::new(o)),
2417 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
2418 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
2419 CResult_InFlightHtlcsDecodeErrorZ {
2420 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2421 err: Box::into_raw(Box::new(e)),
2426 /// Checks if the given object is currently in the success state
2428 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
2432 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
2433 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
2434 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
2435 fn drop(&mut self) {
2437 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2438 let _ = unsafe { Box::from_raw(self.contents.result) };
2441 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2442 let _ = unsafe { Box::from_raw(self.contents.err) };
2447 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
2448 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
2449 let contents = if o.result_ok {
2450 let result = unsafe { o.contents.result };
2451 unsafe { o.contents.result = core::ptr::null_mut() };
2452 CResult_InFlightHtlcsDecodeErrorZPtr { result }
2454 let err = unsafe { o.contents.err };
2455 unsafe { o.contents.err = core::ptr::null_mut(); }
2456 CResult_InFlightHtlcsDecodeErrorZPtr { err }
2460 result_ok: o.result_ok,
2464 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
2465 fn clone(&self) -> Self {
2467 Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2468 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
2471 Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2472 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2478 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
2479 /// but with all dynamically-allocated buffers duplicated in new buffers.
2480 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
2482 /// The contents of CResult_RouteHopDecodeErrorZ
2483 pub union CResult_RouteHopDecodeErrorZPtr {
2484 /// A pointer to the contents in the success state.
2485 /// Reading from this pointer when `result_ok` is not set is undefined.
2486 pub result: *mut crate::lightning::routing::router::RouteHop,
2487 /// A pointer to the contents in the error state.
2488 /// Reading from this pointer when `result_ok` is set is undefined.
2489 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2492 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2493 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2495 pub struct CResult_RouteHopDecodeErrorZ {
2496 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2497 /// `err` or `result` depending on the state of `result_ok`.
2498 pub contents: CResult_RouteHopDecodeErrorZPtr,
2499 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2500 pub result_ok: bool,
2503 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
2504 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
2505 CResult_RouteHopDecodeErrorZ {
2506 contents: CResult_RouteHopDecodeErrorZPtr {
2507 result: Box::into_raw(Box::new(o)),
2513 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
2514 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
2515 CResult_RouteHopDecodeErrorZ {
2516 contents: CResult_RouteHopDecodeErrorZPtr {
2517 err: Box::into_raw(Box::new(e)),
2522 /// Checks if the given object is currently in the success state
2524 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
2528 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
2529 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
2530 impl Drop for CResult_RouteHopDecodeErrorZ {
2531 fn drop(&mut self) {
2533 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2534 let _ = unsafe { Box::from_raw(self.contents.result) };
2537 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2538 let _ = unsafe { Box::from_raw(self.contents.err) };
2543 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
2544 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2545 let contents = if o.result_ok {
2546 let result = unsafe { o.contents.result };
2547 unsafe { o.contents.result = core::ptr::null_mut() };
2548 CResult_RouteHopDecodeErrorZPtr { result }
2550 let err = unsafe { o.contents.err };
2551 unsafe { o.contents.err = core::ptr::null_mut(); }
2552 CResult_RouteHopDecodeErrorZPtr { err }
2556 result_ok: o.result_ok,
2560 impl Clone for CResult_RouteHopDecodeErrorZ {
2561 fn clone(&self) -> Self {
2563 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2564 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2567 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2568 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2574 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2575 /// but with all dynamically-allocated buffers duplicated in new buffers.
2576 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2578 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
2579 /// This corresponds to std::vector in C++
2580 pub struct CVec_BlindedHopZ {
2581 /// The elements in the array.
2582 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2583 pub data: *mut crate::lightning::blinded_path::BlindedHop,
2584 /// The number of elements pointed to by `data`.
2587 impl CVec_BlindedHopZ {
2588 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
2589 if self.datalen == 0 { return Vec::new(); }
2590 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2591 self.data = core::ptr::null_mut();
2595 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
2596 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2599 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
2600 fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
2601 let datalen = v.len();
2602 let data = Box::into_raw(v.into_boxed_slice());
2603 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2607 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2608 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
2609 impl Drop for CVec_BlindedHopZ {
2610 fn drop(&mut self) {
2611 if self.datalen == 0 { return; }
2612 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2615 impl Clone for CVec_BlindedHopZ {
2616 fn clone(&self) -> Self {
2617 let mut res = Vec::new();
2618 if self.datalen == 0 { return Self::from(res); }
2619 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2624 /// The contents of CResult_BlindedTailDecodeErrorZ
2625 pub union CResult_BlindedTailDecodeErrorZPtr {
2626 /// A pointer to the contents in the success state.
2627 /// Reading from this pointer when `result_ok` is not set is undefined.
2628 pub result: *mut crate::lightning::routing::router::BlindedTail,
2629 /// A pointer to the contents in the error state.
2630 /// Reading from this pointer when `result_ok` is set is undefined.
2631 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2634 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
2635 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
2636 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2637 pub struct CResult_BlindedTailDecodeErrorZ {
2638 /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
2639 /// `err` or `result` depending on the state of `result_ok`.
2640 pub contents: CResult_BlindedTailDecodeErrorZPtr,
2641 /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
2642 pub result_ok: bool,
2645 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
2646 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
2647 CResult_BlindedTailDecodeErrorZ {
2648 contents: CResult_BlindedTailDecodeErrorZPtr {
2649 result: Box::into_raw(Box::new(o)),
2655 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
2656 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
2657 CResult_BlindedTailDecodeErrorZ {
2658 contents: CResult_BlindedTailDecodeErrorZPtr {
2659 err: Box::into_raw(Box::new(e)),
2664 /// Checks if the given object is currently in the success state
2666 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
2670 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
2671 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
2672 impl Drop for CResult_BlindedTailDecodeErrorZ {
2673 fn drop(&mut self) {
2675 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2676 let _ = unsafe { Box::from_raw(self.contents.result) };
2679 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2680 let _ = unsafe { Box::from_raw(self.contents.err) };
2685 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
2686 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
2687 let contents = if o.result_ok {
2688 let result = unsafe { o.contents.result };
2689 unsafe { o.contents.result = core::ptr::null_mut() };
2690 CResult_BlindedTailDecodeErrorZPtr { result }
2692 let err = unsafe { o.contents.err };
2693 unsafe { o.contents.err = core::ptr::null_mut(); }
2694 CResult_BlindedTailDecodeErrorZPtr { err }
2698 result_ok: o.result_ok,
2702 impl Clone for CResult_BlindedTailDecodeErrorZ {
2703 fn clone(&self) -> Self {
2705 Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
2706 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
2709 Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
2710 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2716 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
2717 /// but with all dynamically-allocated buffers duplicated in new buffers.
2718 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
2720 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2721 /// This corresponds to std::vector in C++
2722 pub struct CVec_RouteHopZ {
2723 /// The elements in the array.
2724 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2725 pub data: *mut crate::lightning::routing::router::RouteHop,
2726 /// The number of elements pointed to by `data`.
2729 impl CVec_RouteHopZ {
2730 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2731 if self.datalen == 0 { return Vec::new(); }
2732 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2733 self.data = core::ptr::null_mut();
2737 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2738 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2741 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2742 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2743 let datalen = v.len();
2744 let data = Box::into_raw(v.into_boxed_slice());
2745 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2749 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2750 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2751 impl Drop for CVec_RouteHopZ {
2752 fn drop(&mut self) {
2753 if self.datalen == 0 { return; }
2754 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2757 impl Clone for CVec_RouteHopZ {
2758 fn clone(&self) -> Self {
2759 let mut res = Vec::new();
2760 if self.datalen == 0 { return Self::from(res); }
2761 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2766 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
2767 /// This corresponds to std::vector in C++
2768 pub struct CVec_PathZ {
2769 /// The elements in the array.
2770 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2771 pub data: *mut crate::lightning::routing::router::Path,
2772 /// The number of elements pointed to by `data`.
2776 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
2777 if self.datalen == 0 { return Vec::new(); }
2778 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2779 self.data = core::ptr::null_mut();
2783 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
2784 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2787 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
2788 fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
2789 let datalen = v.len();
2790 let data = Box::into_raw(v.into_boxed_slice());
2791 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2795 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2796 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
2797 impl Drop for CVec_PathZ {
2798 fn drop(&mut self) {
2799 if self.datalen == 0 { return; }
2800 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2803 impl Clone for CVec_PathZ {
2804 fn clone(&self) -> Self {
2805 let mut res = Vec::new();
2806 if self.datalen == 0 { return Self::from(res); }
2807 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2812 /// The contents of CResult_RouteDecodeErrorZ
2813 pub union CResult_RouteDecodeErrorZPtr {
2814 /// A pointer to the contents in the success state.
2815 /// Reading from this pointer when `result_ok` is not set is undefined.
2816 pub result: *mut crate::lightning::routing::router::Route,
2817 /// A pointer to the contents in the error state.
2818 /// Reading from this pointer when `result_ok` is set is undefined.
2819 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2822 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2823 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2825 pub struct CResult_RouteDecodeErrorZ {
2826 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2827 /// `err` or `result` depending on the state of `result_ok`.
2828 pub contents: CResult_RouteDecodeErrorZPtr,
2829 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2830 pub result_ok: bool,
2833 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2834 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2835 CResult_RouteDecodeErrorZ {
2836 contents: CResult_RouteDecodeErrorZPtr {
2837 result: Box::into_raw(Box::new(o)),
2843 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2844 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2845 CResult_RouteDecodeErrorZ {
2846 contents: CResult_RouteDecodeErrorZPtr {
2847 err: Box::into_raw(Box::new(e)),
2852 /// Checks if the given object is currently in the success state
2854 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2858 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2859 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2860 impl Drop for CResult_RouteDecodeErrorZ {
2861 fn drop(&mut self) {
2863 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2864 let _ = unsafe { Box::from_raw(self.contents.result) };
2867 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2868 let _ = unsafe { Box::from_raw(self.contents.err) };
2873 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2874 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2875 let contents = if o.result_ok {
2876 let result = unsafe { o.contents.result };
2877 unsafe { o.contents.result = core::ptr::null_mut() };
2878 CResult_RouteDecodeErrorZPtr { result }
2880 let err = unsafe { o.contents.err };
2881 unsafe { o.contents.err = core::ptr::null_mut(); }
2882 CResult_RouteDecodeErrorZPtr { err }
2886 result_ok: o.result_ok,
2890 impl Clone for CResult_RouteDecodeErrorZ {
2891 fn clone(&self) -> Self {
2893 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2894 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2897 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2898 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2904 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2905 /// but with all dynamically-allocated buffers duplicated in new buffers.
2906 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2908 /// The contents of CResult_RouteParametersDecodeErrorZ
2909 pub union CResult_RouteParametersDecodeErrorZPtr {
2910 /// A pointer to the contents in the success state.
2911 /// Reading from this pointer when `result_ok` is not set is undefined.
2912 pub result: *mut crate::lightning::routing::router::RouteParameters,
2913 /// A pointer to the contents in the error state.
2914 /// Reading from this pointer when `result_ok` is set is undefined.
2915 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2918 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2919 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2920 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2921 pub struct CResult_RouteParametersDecodeErrorZ {
2922 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2923 /// `err` or `result` depending on the state of `result_ok`.
2924 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2925 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2926 pub result_ok: bool,
2929 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2930 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2931 CResult_RouteParametersDecodeErrorZ {
2932 contents: CResult_RouteParametersDecodeErrorZPtr {
2933 result: Box::into_raw(Box::new(o)),
2939 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2940 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2941 CResult_RouteParametersDecodeErrorZ {
2942 contents: CResult_RouteParametersDecodeErrorZPtr {
2943 err: Box::into_raw(Box::new(e)),
2948 /// Checks if the given object is currently in the success state
2950 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2954 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2955 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2956 impl Drop for CResult_RouteParametersDecodeErrorZ {
2957 fn drop(&mut self) {
2959 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2960 let _ = unsafe { Box::from_raw(self.contents.result) };
2963 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2964 let _ = unsafe { Box::from_raw(self.contents.err) };
2969 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2970 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2971 let contents = if o.result_ok {
2972 let result = unsafe { o.contents.result };
2973 unsafe { o.contents.result = core::ptr::null_mut() };
2974 CResult_RouteParametersDecodeErrorZPtr { result }
2976 let err = unsafe { o.contents.err };
2977 unsafe { o.contents.err = core::ptr::null_mut(); }
2978 CResult_RouteParametersDecodeErrorZPtr { err }
2982 result_ok: o.result_ok,
2986 impl Clone for CResult_RouteParametersDecodeErrorZ {
2987 fn clone(&self) -> Self {
2989 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2990 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2993 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2994 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3000 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
3001 /// but with all dynamically-allocated buffers duplicated in new buffers.
3002 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
3004 /// A dynamically-allocated array of u64s of arbitrary size.
3005 /// This corresponds to std::vector in C++
3006 pub struct CVec_u64Z {
3007 /// The elements in the array.
3008 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3010 /// The number of elements pointed to by `data`.
3014 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
3015 if self.datalen == 0 { return Vec::new(); }
3016 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3017 self.data = core::ptr::null_mut();
3021 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
3022 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3025 impl From<Vec<u64>> for CVec_u64Z {
3026 fn from(v: Vec<u64>) -> Self {
3027 let datalen = v.len();
3028 let data = Box::into_raw(v.into_boxed_slice());
3029 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3033 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3034 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
3035 impl Drop for CVec_u64Z {
3036 fn drop(&mut self) {
3037 if self.datalen == 0 { return; }
3038 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3041 impl Clone for CVec_u64Z {
3042 fn clone(&self) -> Self {
3043 let mut res = Vec::new();
3044 if self.datalen == 0 { return Self::from(res); }
3045 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3050 /// The contents of CResult_PaymentParametersDecodeErrorZ
3051 pub union CResult_PaymentParametersDecodeErrorZPtr {
3052 /// A pointer to the contents in the success state.
3053 /// Reading from this pointer when `result_ok` is not set is undefined.
3054 pub result: *mut crate::lightning::routing::router::PaymentParameters,
3055 /// A pointer to the contents in the error state.
3056 /// Reading from this pointer when `result_ok` is set is undefined.
3057 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3060 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
3061 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3062 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3063 pub struct CResult_PaymentParametersDecodeErrorZ {
3064 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
3065 /// `err` or `result` depending on the state of `result_ok`.
3066 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
3067 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
3068 pub result_ok: bool,
3071 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
3072 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
3073 CResult_PaymentParametersDecodeErrorZ {
3074 contents: CResult_PaymentParametersDecodeErrorZPtr {
3075 result: Box::into_raw(Box::new(o)),
3081 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
3082 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
3083 CResult_PaymentParametersDecodeErrorZ {
3084 contents: CResult_PaymentParametersDecodeErrorZPtr {
3085 err: Box::into_raw(Box::new(e)),
3090 /// Checks if the given object is currently in the success state
3092 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
3096 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
3097 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
3098 impl Drop for CResult_PaymentParametersDecodeErrorZ {
3099 fn drop(&mut self) {
3101 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3102 let _ = unsafe { Box::from_raw(self.contents.result) };
3105 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3106 let _ = unsafe { Box::from_raw(self.contents.err) };
3111 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
3112 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3113 let contents = if o.result_ok {
3114 let result = unsafe { o.contents.result };
3115 unsafe { o.contents.result = core::ptr::null_mut() };
3116 CResult_PaymentParametersDecodeErrorZPtr { result }
3118 let err = unsafe { o.contents.err };
3119 unsafe { o.contents.err = core::ptr::null_mut(); }
3120 CResult_PaymentParametersDecodeErrorZPtr { err }
3124 result_ok: o.result_ok,
3128 impl Clone for CResult_PaymentParametersDecodeErrorZ {
3129 fn clone(&self) -> Self {
3131 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
3132 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
3135 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
3136 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3142 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
3143 /// but with all dynamically-allocated buffers duplicated in new buffers.
3144 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
3146 /// A tuple of 2 elements. See the individual fields for the types contained.
3147 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3148 /// The element at position 0
3149 pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3150 /// The element at position 1
3151 pub b: crate::lightning::blinded_path::BlindedPath,
3153 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3154 fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3161 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3162 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3166 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3167 fn clone(&self) -> Self {
3169 a: Clone::clone(&self.a),
3170 b: Clone::clone(&self.b),
3175 /// Creates a new tuple which has the same data as `orig`
3176 /// but with all dynamically-allocated buffers duplicated in new buffers.
3177 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3178 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3180 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3181 C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3185 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3186 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
3188 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
3189 /// This corresponds to std::vector in C++
3190 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3191 /// The elements in the array.
3192 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3193 pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
3194 /// The number of elements pointed to by `data`.
3197 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3198 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
3199 if self.datalen == 0 { return Vec::new(); }
3200 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3201 self.data = core::ptr::null_mut();
3205 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
3206 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3209 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3210 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
3211 let datalen = v.len();
3212 let data = Box::into_raw(v.into_boxed_slice());
3213 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3217 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3218 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
3219 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3220 fn drop(&mut self) {
3221 if self.datalen == 0 { return; }
3222 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3225 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3226 fn clone(&self) -> Self {
3227 let mut res = Vec::new();
3228 if self.datalen == 0 { return Self::from(res); }
3229 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3234 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
3235 /// This corresponds to std::vector in C++
3236 pub struct CVec_RouteHintZ {
3237 /// The elements in the array.
3238 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3239 pub data: *mut crate::lightning::routing::router::RouteHint,
3240 /// The number of elements pointed to by `data`.
3243 impl CVec_RouteHintZ {
3244 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
3245 if self.datalen == 0 { return Vec::new(); }
3246 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3247 self.data = core::ptr::null_mut();
3251 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
3252 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3255 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
3256 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
3257 let datalen = v.len();
3258 let data = Box::into_raw(v.into_boxed_slice());
3259 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3263 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3264 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
3265 impl Drop for CVec_RouteHintZ {
3266 fn drop(&mut self) {
3267 if self.datalen == 0 { return; }
3268 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3271 impl Clone for CVec_RouteHintZ {
3272 fn clone(&self) -> Self {
3273 let mut res = Vec::new();
3274 if self.datalen == 0 { return Self::from(res); }
3275 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3280 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
3281 /// This corresponds to std::vector in C++
3282 pub struct CVec_RouteHintHopZ {
3283 /// The elements in the array.
3284 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3285 pub data: *mut crate::lightning::routing::router::RouteHintHop,
3286 /// The number of elements pointed to by `data`.
3289 impl CVec_RouteHintHopZ {
3290 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
3291 if self.datalen == 0 { return Vec::new(); }
3292 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3293 self.data = core::ptr::null_mut();
3297 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
3298 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3301 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
3302 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
3303 let datalen = v.len();
3304 let data = Box::into_raw(v.into_boxed_slice());
3305 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3309 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3310 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
3311 impl Drop for CVec_RouteHintHopZ {
3312 fn drop(&mut self) {
3313 if self.datalen == 0 { return; }
3314 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3317 impl Clone for CVec_RouteHintHopZ {
3318 fn clone(&self) -> Self {
3319 let mut res = Vec::new();
3320 if self.datalen == 0 { return Self::from(res); }
3321 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3326 /// The contents of CResult_RouteHintDecodeErrorZ
3327 pub union CResult_RouteHintDecodeErrorZPtr {
3328 /// A pointer to the contents in the success state.
3329 /// Reading from this pointer when `result_ok` is not set is undefined.
3330 pub result: *mut crate::lightning::routing::router::RouteHint,
3331 /// A pointer to the contents in the error state.
3332 /// Reading from this pointer when `result_ok` is set is undefined.
3333 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3336 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
3337 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
3338 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3339 pub struct CResult_RouteHintDecodeErrorZ {
3340 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
3341 /// `err` or `result` depending on the state of `result_ok`.
3342 pub contents: CResult_RouteHintDecodeErrorZPtr,
3343 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
3344 pub result_ok: bool,
3347 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
3348 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
3349 CResult_RouteHintDecodeErrorZ {
3350 contents: CResult_RouteHintDecodeErrorZPtr {
3351 result: Box::into_raw(Box::new(o)),
3357 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
3358 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
3359 CResult_RouteHintDecodeErrorZ {
3360 contents: CResult_RouteHintDecodeErrorZPtr {
3361 err: Box::into_raw(Box::new(e)),
3366 /// Checks if the given object is currently in the success state
3368 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
3372 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
3373 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
3374 impl Drop for CResult_RouteHintDecodeErrorZ {
3375 fn drop(&mut self) {
3377 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3378 let _ = unsafe { Box::from_raw(self.contents.result) };
3381 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3382 let _ = unsafe { Box::from_raw(self.contents.err) };
3387 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
3388 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
3389 let contents = if o.result_ok {
3390 let result = unsafe { o.contents.result };
3391 unsafe { o.contents.result = core::ptr::null_mut() };
3392 CResult_RouteHintDecodeErrorZPtr { result }
3394 let err = unsafe { o.contents.err };
3395 unsafe { o.contents.err = core::ptr::null_mut(); }
3396 CResult_RouteHintDecodeErrorZPtr { err }
3400 result_ok: o.result_ok,
3404 impl Clone for CResult_RouteHintDecodeErrorZ {
3405 fn clone(&self) -> Self {
3407 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
3408 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
3411 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
3412 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3418 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
3419 /// but with all dynamically-allocated buffers duplicated in new buffers.
3420 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
3422 /// The contents of CResult_RouteHintHopDecodeErrorZ
3423 pub union CResult_RouteHintHopDecodeErrorZPtr {
3424 /// A pointer to the contents in the success state.
3425 /// Reading from this pointer when `result_ok` is not set is undefined.
3426 pub result: *mut crate::lightning::routing::router::RouteHintHop,
3427 /// A pointer to the contents in the error state.
3428 /// Reading from this pointer when `result_ok` is set is undefined.
3429 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3432 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
3433 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3435 pub struct CResult_RouteHintHopDecodeErrorZ {
3436 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
3437 /// `err` or `result` depending on the state of `result_ok`.
3438 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
3439 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
3440 pub result_ok: bool,
3443 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
3444 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
3445 CResult_RouteHintHopDecodeErrorZ {
3446 contents: CResult_RouteHintHopDecodeErrorZPtr {
3447 result: Box::into_raw(Box::new(o)),
3453 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
3454 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
3455 CResult_RouteHintHopDecodeErrorZ {
3456 contents: CResult_RouteHintHopDecodeErrorZPtr {
3457 err: Box::into_raw(Box::new(e)),
3462 /// Checks if the given object is currently in the success state
3464 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
3468 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
3469 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
3470 impl Drop for CResult_RouteHintHopDecodeErrorZ {
3471 fn drop(&mut self) {
3473 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3474 let _ = unsafe { Box::from_raw(self.contents.result) };
3477 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3478 let _ = unsafe { Box::from_raw(self.contents.err) };
3483 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
3484 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3485 let contents = if o.result_ok {
3486 let result = unsafe { o.contents.result };
3487 unsafe { o.contents.result = core::ptr::null_mut() };
3488 CResult_RouteHintHopDecodeErrorZPtr { result }
3490 let err = unsafe { o.contents.err };
3491 unsafe { o.contents.err = core::ptr::null_mut(); }
3492 CResult_RouteHintHopDecodeErrorZPtr { err }
3496 result_ok: o.result_ok,
3500 impl Clone for CResult_RouteHintHopDecodeErrorZ {
3501 fn clone(&self) -> Self {
3503 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
3504 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
3507 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
3508 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3514 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
3515 /// but with all dynamically-allocated buffers duplicated in new buffers.
3516 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
3518 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3519 /// This corresponds to std::vector in C++
3520 pub struct CVec_PublicKeyZ {
3521 /// The elements in the array.
3522 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3523 pub data: *mut crate::c_types::PublicKey,
3524 /// The number of elements pointed to by `data`.
3527 impl CVec_PublicKeyZ {
3528 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
3529 if self.datalen == 0 { return Vec::new(); }
3530 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3531 self.data = core::ptr::null_mut();
3535 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
3536 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3539 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
3540 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
3541 let datalen = v.len();
3542 let data = Box::into_raw(v.into_boxed_slice());
3543 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3547 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3548 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
3549 impl Drop for CVec_PublicKeyZ {
3550 fn drop(&mut self) {
3551 if self.datalen == 0 { return; }
3552 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3555 impl Clone for CVec_PublicKeyZ {
3556 fn clone(&self) -> Self {
3557 let mut res = Vec::new();
3558 if self.datalen == 0 { return Self::from(res); }
3559 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3564 /// A tuple of 2 elements. See the individual fields for the types contained.
3565 pub struct C2Tuple_usizeTransactionZ {
3566 /// The element at position 0
3568 /// The element at position 1
3569 pub b: crate::c_types::Transaction,
3571 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3572 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3579 impl C2Tuple_usizeTransactionZ {
3580 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3584 impl Clone for C2Tuple_usizeTransactionZ {
3585 fn clone(&self) -> Self {
3587 a: Clone::clone(&self.a),
3588 b: Clone::clone(&self.b),
3593 /// Creates a new tuple which has the same data as `orig`
3594 /// but with all dynamically-allocated buffers duplicated in new buffers.
3595 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3596 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3598 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3599 C2Tuple_usizeTransactionZ { a, b, }
3603 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3604 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3606 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3607 /// This corresponds to std::vector in C++
3608 pub struct CVec_C2Tuple_usizeTransactionZZ {
3609 /// The elements in the array.
3610 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3611 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3612 /// The number of elements pointed to by `data`.
3615 impl CVec_C2Tuple_usizeTransactionZZ {
3616 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3617 if self.datalen == 0 { return Vec::new(); }
3618 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3619 self.data = core::ptr::null_mut();
3623 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3624 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3627 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3628 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3629 let datalen = v.len();
3630 let data = Box::into_raw(v.into_boxed_slice());
3631 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3635 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3636 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3637 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3638 fn drop(&mut self) {
3639 if self.datalen == 0 { return; }
3640 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3643 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3644 fn clone(&self) -> Self {
3645 let mut res = Vec::new();
3646 if self.datalen == 0 { return Self::from(res); }
3647 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3652 /// A tuple of 2 elements. See the individual fields for the types contained.
3653 pub struct C2Tuple_TxidBlockHashZ {
3654 /// The element at position 0
3655 pub a: crate::c_types::ThirtyTwoBytes,
3656 /// The element at position 1
3657 pub b: crate::c_types::ThirtyTwoBytes,
3659 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_TxidBlockHashZ {
3660 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
3667 impl C2Tuple_TxidBlockHashZ {
3668 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
3672 impl Clone for C2Tuple_TxidBlockHashZ {
3673 fn clone(&self) -> Self {
3675 a: Clone::clone(&self.a),
3676 b: Clone::clone(&self.b),
3681 /// Creates a new tuple which has the same data as `orig`
3682 /// but with all dynamically-allocated buffers duplicated in new buffers.
3683 pub extern "C" fn C2Tuple_TxidBlockHashZ_clone(orig: &C2Tuple_TxidBlockHashZ) -> C2Tuple_TxidBlockHashZ { Clone::clone(&orig) }
3684 /// Creates a new C2Tuple_TxidBlockHashZ from the contained elements.
3686 pub extern "C" fn C2Tuple_TxidBlockHashZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_TxidBlockHashZ {
3687 C2Tuple_TxidBlockHashZ { a, b, }
3691 /// Frees any resources used by the C2Tuple_TxidBlockHashZ.
3692 pub extern "C" fn C2Tuple_TxidBlockHashZ_free(_res: C2Tuple_TxidBlockHashZ) { }
3694 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
3695 /// This corresponds to std::vector in C++
3696 pub struct CVec_C2Tuple_TxidBlockHashZZ {
3697 /// The elements in the array.
3698 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3699 pub data: *mut crate::c_types::derived::C2Tuple_TxidBlockHashZ,
3700 /// The number of elements pointed to by `data`.
3703 impl CVec_C2Tuple_TxidBlockHashZZ {
3704 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ> {
3705 if self.datalen == 0 { return Vec::new(); }
3706 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3707 self.data = core::ptr::null_mut();
3711 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidBlockHashZ] {
3712 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3715 impl From<Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>> for CVec_C2Tuple_TxidBlockHashZZ {
3716 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>) -> Self {
3717 let datalen = v.len();
3718 let data = Box::into_raw(v.into_boxed_slice());
3719 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3723 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3724 pub extern "C" fn CVec_C2Tuple_TxidBlockHashZZ_free(_res: CVec_C2Tuple_TxidBlockHashZZ) { }
3725 impl Drop for CVec_C2Tuple_TxidBlockHashZZ {
3726 fn drop(&mut self) {
3727 if self.datalen == 0 { return; }
3728 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3731 impl Clone for CVec_C2Tuple_TxidBlockHashZZ {
3732 fn clone(&self) -> Self {
3733 let mut res = Vec::new();
3734 if self.datalen == 0 { return Self::from(res); }
3735 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3740 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3741 /// This corresponds to std::vector in C++
3742 pub struct CVec_MonitorEventZ {
3743 /// The elements in the array.
3744 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3745 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3746 /// The number of elements pointed to by `data`.
3749 impl CVec_MonitorEventZ {
3750 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3751 if self.datalen == 0 { return Vec::new(); }
3752 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3753 self.data = core::ptr::null_mut();
3757 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3758 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3761 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3762 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3763 let datalen = v.len();
3764 let data = Box::into_raw(v.into_boxed_slice());
3765 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3769 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3770 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3771 impl Drop for CVec_MonitorEventZ {
3772 fn drop(&mut self) {
3773 if self.datalen == 0 { return; }
3774 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3777 impl Clone for CVec_MonitorEventZ {
3778 fn clone(&self) -> Self {
3779 let mut res = Vec::new();
3780 if self.datalen == 0 { return Self::from(res); }
3781 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3786 /// A tuple of 3 elements. See the individual fields for the types contained.
3787 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3788 /// The element at position 0
3789 pub a: crate::lightning::chain::transaction::OutPoint,
3790 /// The element at position 1
3791 pub b: crate::c_types::derived::CVec_MonitorEventZ,
3792 /// The element at position 2
3793 pub c: crate::c_types::PublicKey,
3795 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3796 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
3804 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3805 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
3806 (self.a, self.b, self.c)
3809 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3810 fn clone(&self) -> Self {
3812 a: Clone::clone(&self.a),
3813 b: Clone::clone(&self.b),
3814 c: Clone::clone(&self.c),
3819 /// Creates a new tuple which has the same data as `orig`
3820 /// but with all dynamically-allocated buffers duplicated in new buffers.
3821 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
3822 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
3824 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ, c: crate::c_types::PublicKey) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3825 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
3829 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
3830 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
3832 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
3833 /// This corresponds to std::vector in C++
3834 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3835 /// The elements in the array.
3836 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3837 pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
3838 /// The number of elements pointed to by `data`.
3841 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3842 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
3843 if self.datalen == 0 { return Vec::new(); }
3844 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3845 self.data = core::ptr::null_mut();
3849 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
3850 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3853 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3854 fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
3855 let datalen = v.len();
3856 let data = Box::into_raw(v.into_boxed_slice());
3857 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3861 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3862 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
3863 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3864 fn drop(&mut self) {
3865 if self.datalen == 0 { return; }
3866 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3869 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3870 fn clone(&self) -> Self {
3871 let mut res = Vec::new();
3872 if self.datalen == 0 { return Self::from(res); }
3873 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3878 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3879 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3880 /// A pointer to the contents in the success state.
3881 /// Reading from this pointer when `result_ok` is not set is undefined.
3882 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3883 /// A pointer to the contents in the error state.
3884 /// Reading from this pointer when `result_ok` is set is undefined.
3885 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3888 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3889 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3891 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3892 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3893 /// `err` or `result` depending on the state of `result_ok`.
3894 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3895 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3896 pub result_ok: bool,
3899 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3900 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3901 CResult_FixedPenaltyScorerDecodeErrorZ {
3902 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3903 result: Box::into_raw(Box::new(o)),
3909 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3910 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3911 CResult_FixedPenaltyScorerDecodeErrorZ {
3912 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3913 err: Box::into_raw(Box::new(e)),
3918 /// Checks if the given object is currently in the success state
3920 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3924 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3925 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3926 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3927 fn drop(&mut self) {
3929 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3930 let _ = unsafe { Box::from_raw(self.contents.result) };
3933 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3934 let _ = unsafe { Box::from_raw(self.contents.err) };
3939 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3940 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3941 let contents = if o.result_ok {
3942 let result = unsafe { o.contents.result };
3943 unsafe { o.contents.result = core::ptr::null_mut() };
3944 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3946 let err = unsafe { o.contents.err };
3947 unsafe { o.contents.err = core::ptr::null_mut(); }
3948 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3952 result_ok: o.result_ok,
3956 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3957 fn clone(&self) -> Self {
3959 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3960 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3963 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3964 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3970 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3971 /// but with all dynamically-allocated buffers duplicated in new buffers.
3972 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3974 /// A tuple of 2 elements. See the individual fields for the types contained.
3975 pub struct C2Tuple_u64u64Z {
3976 /// The element at position 0
3978 /// The element at position 1
3981 impl From<(u64, u64)> for C2Tuple_u64u64Z {
3982 fn from (tup: (u64, u64)) -> Self {
3989 impl C2Tuple_u64u64Z {
3990 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
3994 impl Clone for C2Tuple_u64u64Z {
3995 fn clone(&self) -> Self {
3997 a: Clone::clone(&self.a),
3998 b: Clone::clone(&self.b),
4003 /// Creates a new tuple which has the same data as `orig`
4004 /// but with all dynamically-allocated buffers duplicated in new buffers.
4005 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4006 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4008 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4009 C2Tuple_u64u64Z { a, b, }
4013 /// Frees any resources used by the C2Tuple_u64u64Z.
4014 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4017 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4018 pub enum COption_C2Tuple_u64u64ZZ {
4019 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4020 Some(crate::c_types::derived::C2Tuple_u64u64Z),
4021 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4024 impl COption_C2Tuple_u64u64ZZ {
4025 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4026 if let Self::None = self { false } else { true }
4028 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4031 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4032 if let Self::Some(v) = self { v } else { unreachable!() }
4036 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4037 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4038 COption_C2Tuple_u64u64ZZ::Some(o)
4041 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4042 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4043 COption_C2Tuple_u64u64ZZ::None
4046 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4047 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4049 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4050 /// but with all dynamically-allocated buffers duplicated in new buffers.
4051 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4053 /// A tuple of 2 elements. See the individual fields for the types contained.
4054 pub struct C2Tuple_Z {
4055 /// The element at position 0
4056 pub a: crate::c_types::EightU16s,
4057 /// The element at position 1
4058 pub b: crate::c_types::EightU16s,
4060 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple_Z {
4061 fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4069 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4073 impl Clone for C2Tuple_Z {
4074 fn clone(&self) -> Self {
4076 a: Clone::clone(&self.a),
4077 b: Clone::clone(&self.b),
4082 /// Creates a new tuple which has the same data as `orig`
4083 /// but with all dynamically-allocated buffers duplicated in new buffers.
4084 pub extern "C" fn C2Tuple_Z_clone(orig: &C2Tuple_Z) -> C2Tuple_Z { Clone::clone(&orig) }
4085 /// Creates a new C2Tuple_Z from the contained elements.
4087 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple_Z {
4092 /// Frees any resources used by the C2Tuple_Z.
4093 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4095 /// A tuple of 2 elements. See the individual fields for the types contained.
4096 pub struct C2Tuple__u168_u168Z {
4097 /// The element at position 0
4098 pub a: crate::c_types::EightU16s,
4099 /// The element at position 1
4100 pub b: crate::c_types::EightU16s,
4102 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple__u168_u168Z {
4103 fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4110 impl C2Tuple__u168_u168Z {
4111 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4115 impl Clone for C2Tuple__u168_u168Z {
4116 fn clone(&self) -> Self {
4118 a: Clone::clone(&self.a),
4119 b: Clone::clone(&self.b),
4124 /// Creates a new tuple which has the same data as `orig`
4125 /// but with all dynamically-allocated buffers duplicated in new buffers.
4126 pub extern "C" fn C2Tuple__u168_u168Z_clone(orig: &C2Tuple__u168_u168Z) -> C2Tuple__u168_u168Z { Clone::clone(&orig) }
4127 /// Creates a new C2Tuple__u168_u168Z from the contained elements.
4129 pub extern "C" fn C2Tuple__u168_u168Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple__u168_u168Z {
4130 C2Tuple__u168_u168Z { a, b, }
4134 /// Frees any resources used by the C2Tuple__u168_u168Z.
4135 pub extern "C" fn C2Tuple__u168_u168Z_free(_res: C2Tuple__u168_u168Z) { }
4138 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
4139 pub enum COption_C2Tuple_EightU16sEightU16sZZ {
4140 /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
4141 Some(crate::c_types::derived::C2Tuple__u168_u168Z),
4142 /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
4145 impl COption_C2Tuple_EightU16sEightU16sZZ {
4146 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4147 if let Self::None = self { false } else { true }
4149 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4152 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u168_u168Z {
4153 if let Self::Some(v) = self { v } else { unreachable!() }
4157 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z
4158 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_some(o: crate::c_types::derived::C2Tuple__u168_u168Z) -> COption_C2Tuple_EightU16sEightU16sZZ {
4159 COption_C2Tuple_EightU16sEightU16sZZ::Some(o)
4162 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing
4163 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_none() -> COption_C2Tuple_EightU16sEightU16sZZ {
4164 COption_C2Tuple_EightU16sEightU16sZZ::None
4167 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state
4168 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_free(_res: COption_C2Tuple_EightU16sEightU16sZZ) { }
4170 /// Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig`
4171 /// but with all dynamically-allocated buffers duplicated in new buffers.
4172 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_clone(orig: &COption_C2Tuple_EightU16sEightU16sZZ) -> COption_C2Tuple_EightU16sEightU16sZZ { Clone::clone(&orig) }
4174 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4175 /// This corresponds to std::vector in C++
4176 pub struct CVec_NodeIdZ {
4177 /// The elements in the array.
4178 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4179 pub data: *mut crate::lightning::routing::gossip::NodeId,
4180 /// The number of elements pointed to by `data`.
4184 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4185 if self.datalen == 0 { return Vec::new(); }
4186 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4187 self.data = core::ptr::null_mut();
4191 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4192 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4195 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4196 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4197 let datalen = v.len();
4198 let data = Box::into_raw(v.into_boxed_slice());
4199 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4203 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4204 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4205 impl Drop for CVec_NodeIdZ {
4206 fn drop(&mut self) {
4207 if self.datalen == 0 { return; }
4208 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4211 impl Clone for CVec_NodeIdZ {
4212 fn clone(&self) -> Self {
4213 let mut res = Vec::new();
4214 if self.datalen == 0 { return Self::from(res); }
4215 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4220 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4221 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4222 /// A pointer to the contents in the success state.
4223 /// Reading from this pointer when `result_ok` is not set is undefined.
4224 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4225 /// A pointer to the contents in the error state.
4226 /// Reading from this pointer when `result_ok` is set is undefined.
4227 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4230 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4231 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4233 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4234 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4235 /// `err` or `result` depending on the state of `result_ok`.
4236 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4237 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4238 pub result_ok: bool,
4241 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4242 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4243 CResult_ProbabilisticScorerDecodeErrorZ {
4244 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4245 result: Box::into_raw(Box::new(o)),
4251 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4252 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4253 CResult_ProbabilisticScorerDecodeErrorZ {
4254 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4255 err: Box::into_raw(Box::new(e)),
4260 /// Checks if the given object is currently in the success state
4262 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4266 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4267 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4268 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4269 fn drop(&mut self) {
4271 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4272 let _ = unsafe { Box::from_raw(self.contents.result) };
4275 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4276 let _ = unsafe { Box::from_raw(self.contents.err) };
4281 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4282 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4283 let contents = if o.result_ok {
4284 let result = unsafe { o.contents.result };
4285 unsafe { o.contents.result = core::ptr::null_mut() };
4286 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4288 let err = unsafe { o.contents.err };
4289 unsafe { o.contents.err = core::ptr::null_mut(); }
4290 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4294 result_ok: o.result_ok,
4299 /// The contents of CResult_InitFeaturesDecodeErrorZ
4300 pub union CResult_InitFeaturesDecodeErrorZPtr {
4301 /// A pointer to the contents in the success state.
4302 /// Reading from this pointer when `result_ok` is not set is undefined.
4303 pub result: *mut crate::lightning::ln::features::InitFeatures,
4304 /// A pointer to the contents in the error state.
4305 /// Reading from this pointer when `result_ok` is set is undefined.
4306 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4309 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4310 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4311 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4312 pub struct CResult_InitFeaturesDecodeErrorZ {
4313 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4314 /// `err` or `result` depending on the state of `result_ok`.
4315 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4316 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4317 pub result_ok: bool,
4320 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4321 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4322 CResult_InitFeaturesDecodeErrorZ {
4323 contents: CResult_InitFeaturesDecodeErrorZPtr {
4324 result: Box::into_raw(Box::new(o)),
4330 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4331 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4332 CResult_InitFeaturesDecodeErrorZ {
4333 contents: CResult_InitFeaturesDecodeErrorZPtr {
4334 err: Box::into_raw(Box::new(e)),
4339 /// Checks if the given object is currently in the success state
4341 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4345 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4346 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4347 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4348 fn drop(&mut self) {
4350 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4351 let _ = unsafe { Box::from_raw(self.contents.result) };
4354 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4355 let _ = unsafe { Box::from_raw(self.contents.err) };
4360 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4361 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4362 let contents = if o.result_ok {
4363 let result = unsafe { o.contents.result };
4364 unsafe { o.contents.result = core::ptr::null_mut() };
4365 CResult_InitFeaturesDecodeErrorZPtr { result }
4367 let err = unsafe { o.contents.err };
4368 unsafe { o.contents.err = core::ptr::null_mut(); }
4369 CResult_InitFeaturesDecodeErrorZPtr { err }
4373 result_ok: o.result_ok,
4377 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4378 fn clone(&self) -> Self {
4380 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4381 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4384 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4385 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4391 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4392 /// but with all dynamically-allocated buffers duplicated in new buffers.
4393 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4395 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4396 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4397 /// A pointer to the contents in the success state.
4398 /// Reading from this pointer when `result_ok` is not set is undefined.
4399 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4400 /// A pointer to the contents in the error state.
4401 /// Reading from this pointer when `result_ok` is set is undefined.
4402 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4405 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4406 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4408 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4409 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4410 /// `err` or `result` depending on the state of `result_ok`.
4411 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4412 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4413 pub result_ok: bool,
4416 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4417 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4418 CResult_ChannelFeaturesDecodeErrorZ {
4419 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4420 result: Box::into_raw(Box::new(o)),
4426 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4427 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4428 CResult_ChannelFeaturesDecodeErrorZ {
4429 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4430 err: Box::into_raw(Box::new(e)),
4435 /// Checks if the given object is currently in the success state
4437 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4441 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4442 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4443 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4444 fn drop(&mut self) {
4446 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4447 let _ = unsafe { Box::from_raw(self.contents.result) };
4450 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4451 let _ = unsafe { Box::from_raw(self.contents.err) };
4456 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4457 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4458 let contents = if o.result_ok {
4459 let result = unsafe { o.contents.result };
4460 unsafe { o.contents.result = core::ptr::null_mut() };
4461 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4463 let err = unsafe { o.contents.err };
4464 unsafe { o.contents.err = core::ptr::null_mut(); }
4465 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4469 result_ok: o.result_ok,
4473 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4474 fn clone(&self) -> Self {
4476 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4477 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4480 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4481 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4487 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4488 /// but with all dynamically-allocated buffers duplicated in new buffers.
4489 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4491 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4492 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4493 /// A pointer to the contents in the success state.
4494 /// Reading from this pointer when `result_ok` is not set is undefined.
4495 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4496 /// A pointer to the contents in the error state.
4497 /// Reading from this pointer when `result_ok` is set is undefined.
4498 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4501 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4502 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4504 pub struct CResult_NodeFeaturesDecodeErrorZ {
4505 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4506 /// `err` or `result` depending on the state of `result_ok`.
4507 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4508 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4509 pub result_ok: bool,
4512 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4513 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4514 CResult_NodeFeaturesDecodeErrorZ {
4515 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4516 result: Box::into_raw(Box::new(o)),
4522 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4523 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4524 CResult_NodeFeaturesDecodeErrorZ {
4525 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4526 err: Box::into_raw(Box::new(e)),
4531 /// Checks if the given object is currently in the success state
4533 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4537 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4538 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4539 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4540 fn drop(&mut self) {
4542 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4543 let _ = unsafe { Box::from_raw(self.contents.result) };
4546 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4547 let _ = unsafe { Box::from_raw(self.contents.err) };
4552 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4553 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4554 let contents = if o.result_ok {
4555 let result = unsafe { o.contents.result };
4556 unsafe { o.contents.result = core::ptr::null_mut() };
4557 CResult_NodeFeaturesDecodeErrorZPtr { result }
4559 let err = unsafe { o.contents.err };
4560 unsafe { o.contents.err = core::ptr::null_mut(); }
4561 CResult_NodeFeaturesDecodeErrorZPtr { err }
4565 result_ok: o.result_ok,
4569 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4570 fn clone(&self) -> Self {
4572 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4573 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4576 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4577 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4583 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4584 /// but with all dynamically-allocated buffers duplicated in new buffers.
4585 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4587 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4588 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4589 /// A pointer to the contents in the success state.
4590 /// Reading from this pointer when `result_ok` is not set is undefined.
4591 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4592 /// A pointer to the contents in the error state.
4593 /// Reading from this pointer when `result_ok` is set is undefined.
4594 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4597 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4598 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4600 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4601 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4602 /// `err` or `result` depending on the state of `result_ok`.
4603 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4604 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4605 pub result_ok: bool,
4608 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4609 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4610 CResult_InvoiceFeaturesDecodeErrorZ {
4611 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4612 result: Box::into_raw(Box::new(o)),
4618 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4619 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4620 CResult_InvoiceFeaturesDecodeErrorZ {
4621 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4622 err: Box::into_raw(Box::new(e)),
4627 /// Checks if the given object is currently in the success state
4629 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4633 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4634 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4635 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4636 fn drop(&mut self) {
4638 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4639 let _ = unsafe { Box::from_raw(self.contents.result) };
4642 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4643 let _ = unsafe { Box::from_raw(self.contents.err) };
4648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4649 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4650 let contents = if o.result_ok {
4651 let result = unsafe { o.contents.result };
4652 unsafe { o.contents.result = core::ptr::null_mut() };
4653 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4655 let err = unsafe { o.contents.err };
4656 unsafe { o.contents.err = core::ptr::null_mut(); }
4657 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4661 result_ok: o.result_ok,
4665 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4666 fn clone(&self) -> Self {
4668 Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4669 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4672 Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4673 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4679 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4680 /// but with all dynamically-allocated buffers duplicated in new buffers.
4681 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4683 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
4684 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
4685 /// A pointer to the contents in the success state.
4686 /// Reading from this pointer when `result_ok` is not set is undefined.
4687 pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
4688 /// A pointer to the contents in the error state.
4689 /// Reading from this pointer when `result_ok` is set is undefined.
4690 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4693 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
4694 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4696 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
4697 /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
4698 /// `err` or `result` depending on the state of `result_ok`.
4699 pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
4700 /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
4701 pub result_ok: bool,
4704 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
4705 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
4706 CResult_BlindedHopFeaturesDecodeErrorZ {
4707 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4708 result: Box::into_raw(Box::new(o)),
4714 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
4715 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
4716 CResult_BlindedHopFeaturesDecodeErrorZ {
4717 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4718 err: Box::into_raw(Box::new(e)),
4723 /// Checks if the given object is currently in the success state
4725 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
4729 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
4730 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
4731 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
4732 fn drop(&mut self) {
4734 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4735 let _ = unsafe { Box::from_raw(self.contents.result) };
4738 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4739 let _ = unsafe { Box::from_raw(self.contents.err) };
4744 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
4745 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4746 let contents = if o.result_ok {
4747 let result = unsafe { o.contents.result };
4748 unsafe { o.contents.result = core::ptr::null_mut() };
4749 CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
4751 let err = unsafe { o.contents.err };
4752 unsafe { o.contents.err = core::ptr::null_mut(); }
4753 CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
4757 result_ok: o.result_ok,
4761 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
4762 fn clone(&self) -> Self {
4764 Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4765 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
4768 Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4769 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4775 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
4776 /// but with all dynamically-allocated buffers duplicated in new buffers.
4777 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
4779 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4780 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4781 /// A pointer to the contents in the success state.
4782 /// Reading from this pointer when `result_ok` is not set is undefined.
4783 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4784 /// A pointer to the contents in the error state.
4785 /// Reading from this pointer when `result_ok` is set is undefined.
4786 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4789 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4790 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4792 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4793 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4794 /// `err` or `result` depending on the state of `result_ok`.
4795 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4796 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4797 pub result_ok: bool,
4800 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4801 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4802 CResult_ChannelTypeFeaturesDecodeErrorZ {
4803 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4804 result: Box::into_raw(Box::new(o)),
4810 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4811 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4812 CResult_ChannelTypeFeaturesDecodeErrorZ {
4813 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4814 err: Box::into_raw(Box::new(e)),
4819 /// Checks if the given object is currently in the success state
4821 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4825 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4826 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4827 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4828 fn drop(&mut self) {
4830 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4831 let _ = unsafe { Box::from_raw(self.contents.result) };
4834 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4835 let _ = unsafe { Box::from_raw(self.contents.err) };
4840 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4841 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4842 let contents = if o.result_ok {
4843 let result = unsafe { o.contents.result };
4844 unsafe { o.contents.result = core::ptr::null_mut() };
4845 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4847 let err = unsafe { o.contents.err };
4848 unsafe { o.contents.err = core::ptr::null_mut(); }
4849 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4853 result_ok: o.result_ok,
4857 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4858 fn clone(&self) -> Self {
4860 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4861 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4864 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4865 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4871 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4872 /// but with all dynamically-allocated buffers duplicated in new buffers.
4873 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4875 /// The contents of CResult_PaymentPurposeDecodeErrorZ
4876 pub union CResult_PaymentPurposeDecodeErrorZPtr {
4877 /// A pointer to the contents in the success state.
4878 /// Reading from this pointer when `result_ok` is not set is undefined.
4879 pub result: *mut crate::lightning::events::PaymentPurpose,
4880 /// A pointer to the contents in the error state.
4881 /// Reading from this pointer when `result_ok` is set is undefined.
4882 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4885 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
4886 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
4887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4888 pub struct CResult_PaymentPurposeDecodeErrorZ {
4889 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
4890 /// `err` or `result` depending on the state of `result_ok`.
4891 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
4892 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
4893 pub result_ok: bool,
4896 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
4897 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
4898 CResult_PaymentPurposeDecodeErrorZ {
4899 contents: CResult_PaymentPurposeDecodeErrorZPtr {
4900 result: Box::into_raw(Box::new(o)),
4906 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
4907 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
4908 CResult_PaymentPurposeDecodeErrorZ {
4909 contents: CResult_PaymentPurposeDecodeErrorZPtr {
4910 err: Box::into_raw(Box::new(e)),
4915 /// Checks if the given object is currently in the success state
4917 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
4921 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
4922 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
4923 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
4924 fn drop(&mut self) {
4926 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4927 let _ = unsafe { Box::from_raw(self.contents.result) };
4930 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4931 let _ = unsafe { Box::from_raw(self.contents.err) };
4936 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
4937 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
4938 let contents = if o.result_ok {
4939 let result = unsafe { o.contents.result };
4940 unsafe { o.contents.result = core::ptr::null_mut() };
4941 CResult_PaymentPurposeDecodeErrorZPtr { result }
4943 let err = unsafe { o.contents.err };
4944 unsafe { o.contents.err = core::ptr::null_mut(); }
4945 CResult_PaymentPurposeDecodeErrorZPtr { err }
4949 result_ok: o.result_ok,
4953 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
4954 fn clone(&self) -> Self {
4956 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
4957 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
4960 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
4961 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4967 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
4968 /// but with all dynamically-allocated buffers duplicated in new buffers.
4969 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
4972 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
4973 pub enum COption_NetworkUpdateZ {
4974 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
4975 Some(crate::lightning::routing::gossip::NetworkUpdate),
4976 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
4979 impl COption_NetworkUpdateZ {
4980 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4981 if let Self::None = self { false } else { true }
4983 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4986 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
4987 if let Self::Some(v) = self { v } else { unreachable!() }
4991 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
4992 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
4993 COption_NetworkUpdateZ::Some(o)
4996 /// Constructs a new COption_NetworkUpdateZ containing nothing
4997 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
4998 COption_NetworkUpdateZ::None
5001 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
5002 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
5004 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
5005 /// but with all dynamically-allocated buffers duplicated in new buffers.
5006 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
5009 /// An enum which can either contain a crate::lightning::events::PathFailure or not
5010 pub enum COption_PathFailureZ {
5011 /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
5012 Some(crate::lightning::events::PathFailure),
5013 /// When we're in this state, this COption_PathFailureZ contains nothing
5016 impl COption_PathFailureZ {
5017 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5018 if let Self::None = self { false } else { true }
5020 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5023 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
5024 if let Self::Some(v) = self { v } else { unreachable!() }
5028 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
5029 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
5030 COption_PathFailureZ::Some(o)
5033 /// Constructs a new COption_PathFailureZ containing nothing
5034 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
5035 COption_PathFailureZ::None
5038 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
5039 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
5041 /// Creates a new COption_PathFailureZ which has the same data as `orig`
5042 /// but with all dynamically-allocated buffers duplicated in new buffers.
5043 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
5045 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
5046 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
5047 /// A pointer to the contents in the success state.
5048 /// Reading from this pointer when `result_ok` is not set is undefined.
5049 pub result: *mut crate::c_types::derived::COption_PathFailureZ,
5050 /// A pointer to the contents in the error state.
5051 /// Reading from this pointer when `result_ok` is set is undefined.
5052 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5055 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
5056 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5058 pub struct CResult_COption_PathFailureZDecodeErrorZ {
5059 /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
5060 /// `err` or `result` depending on the state of `result_ok`.
5061 pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
5062 /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
5063 pub result_ok: bool,
5066 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
5067 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
5068 CResult_COption_PathFailureZDecodeErrorZ {
5069 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5070 result: Box::into_raw(Box::new(o)),
5076 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
5077 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
5078 CResult_COption_PathFailureZDecodeErrorZ {
5079 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5080 err: Box::into_raw(Box::new(e)),
5085 /// Checks if the given object is currently in the success state
5087 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
5091 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
5092 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
5093 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
5094 fn drop(&mut self) {
5096 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5097 let _ = unsafe { Box::from_raw(self.contents.result) };
5100 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5101 let _ = unsafe { Box::from_raw(self.contents.err) };
5106 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
5107 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5108 let contents = if o.result_ok {
5109 let result = unsafe { o.contents.result };
5110 unsafe { o.contents.result = core::ptr::null_mut() };
5111 CResult_COption_PathFailureZDecodeErrorZPtr { result }
5113 let err = unsafe { o.contents.err };
5114 unsafe { o.contents.err = core::ptr::null_mut(); }
5115 CResult_COption_PathFailureZDecodeErrorZPtr { err }
5119 result_ok: o.result_ok,
5123 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
5124 fn clone(&self) -> Self {
5126 Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5127 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
5130 Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5131 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5137 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
5138 /// but with all dynamically-allocated buffers duplicated in new buffers.
5139 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
5142 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
5143 pub enum COption_ClosureReasonZ {
5144 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
5145 Some(crate::lightning::events::ClosureReason),
5146 /// When we're in this state, this COption_ClosureReasonZ contains nothing
5149 impl COption_ClosureReasonZ {
5150 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5151 if let Self::None = self { false } else { true }
5153 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5156 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
5157 if let Self::Some(v) = self { v } else { unreachable!() }
5161 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
5162 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
5163 COption_ClosureReasonZ::Some(o)
5166 /// Constructs a new COption_ClosureReasonZ containing nothing
5167 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
5168 COption_ClosureReasonZ::None
5171 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
5172 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
5174 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
5175 /// but with all dynamically-allocated buffers duplicated in new buffers.
5176 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
5178 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
5179 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
5180 /// A pointer to the contents in the success state.
5181 /// Reading from this pointer when `result_ok` is not set is undefined.
5182 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
5183 /// A pointer to the contents in the error state.
5184 /// Reading from this pointer when `result_ok` is set is undefined.
5185 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5188 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
5189 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5191 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
5192 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
5193 /// `err` or `result` depending on the state of `result_ok`.
5194 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
5195 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
5196 pub result_ok: bool,
5199 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
5200 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
5201 CResult_COption_ClosureReasonZDecodeErrorZ {
5202 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5203 result: Box::into_raw(Box::new(o)),
5209 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
5210 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
5211 CResult_COption_ClosureReasonZDecodeErrorZ {
5212 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5213 err: Box::into_raw(Box::new(e)),
5218 /// Checks if the given object is currently in the success state
5220 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
5224 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
5225 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
5226 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
5227 fn drop(&mut self) {
5229 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5230 let _ = unsafe { Box::from_raw(self.contents.result) };
5233 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5234 let _ = unsafe { Box::from_raw(self.contents.err) };
5239 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
5240 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5241 let contents = if o.result_ok {
5242 let result = unsafe { o.contents.result };
5243 unsafe { o.contents.result = core::ptr::null_mut() };
5244 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
5246 let err = unsafe { o.contents.err };
5247 unsafe { o.contents.err = core::ptr::null_mut(); }
5248 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
5252 result_ok: o.result_ok,
5256 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
5257 fn clone(&self) -> Self {
5259 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5260 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
5263 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5264 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5270 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
5271 /// but with all dynamically-allocated buffers duplicated in new buffers.
5272 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
5275 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
5276 pub enum COption_HTLCDestinationZ {
5277 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
5278 Some(crate::lightning::events::HTLCDestination),
5279 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
5282 impl COption_HTLCDestinationZ {
5283 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5284 if let Self::None = self { false } else { true }
5286 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5289 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
5290 if let Self::Some(v) = self { v } else { unreachable!() }
5294 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
5295 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
5296 COption_HTLCDestinationZ::Some(o)
5299 /// Constructs a new COption_HTLCDestinationZ containing nothing
5300 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
5301 COption_HTLCDestinationZ::None
5304 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
5305 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
5307 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
5308 /// but with all dynamically-allocated buffers duplicated in new buffers.
5309 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
5311 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
5312 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5313 /// A pointer to the contents in the success state.
5314 /// Reading from this pointer when `result_ok` is not set is undefined.
5315 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
5316 /// A pointer to the contents in the error state.
5317 /// Reading from this pointer when `result_ok` is set is undefined.
5318 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5321 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
5322 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5324 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
5325 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
5326 /// `err` or `result` depending on the state of `result_ok`.
5327 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
5328 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
5329 pub result_ok: bool,
5332 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
5333 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
5334 CResult_COption_HTLCDestinationZDecodeErrorZ {
5335 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5336 result: Box::into_raw(Box::new(o)),
5342 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
5343 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
5344 CResult_COption_HTLCDestinationZDecodeErrorZ {
5345 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5346 err: Box::into_raw(Box::new(e)),
5351 /// Checks if the given object is currently in the success state
5353 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
5357 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
5358 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
5359 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
5360 fn drop(&mut self) {
5362 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5363 let _ = unsafe { Box::from_raw(self.contents.result) };
5366 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5367 let _ = unsafe { Box::from_raw(self.contents.err) };
5372 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
5373 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5374 let contents = if o.result_ok {
5375 let result = unsafe { o.contents.result };
5376 unsafe { o.contents.result = core::ptr::null_mut() };
5377 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
5379 let err = unsafe { o.contents.err };
5380 unsafe { o.contents.err = core::ptr::null_mut(); }
5381 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
5385 result_ok: o.result_ok,
5389 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
5390 fn clone(&self) -> Self {
5392 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5393 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
5396 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5397 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5403 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
5404 /// but with all dynamically-allocated buffers duplicated in new buffers.
5405 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
5407 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
5408 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
5409 /// A pointer to the contents in the success state.
5410 /// Reading from this pointer when `result_ok` is not set is undefined.
5411 pub result: *mut crate::lightning::events::PaymentFailureReason,
5412 /// A pointer to the contents in the error state.
5413 /// Reading from this pointer when `result_ok` is set is undefined.
5414 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5417 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
5418 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
5419 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5420 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
5421 /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
5422 /// `err` or `result` depending on the state of `result_ok`.
5423 pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
5424 /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
5425 pub result_ok: bool,
5428 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
5429 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
5430 CResult_PaymentFailureReasonDecodeErrorZ {
5431 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5432 result: Box::into_raw(Box::new(o)),
5438 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
5439 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
5440 CResult_PaymentFailureReasonDecodeErrorZ {
5441 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5442 err: Box::into_raw(Box::new(e)),
5447 /// Checks if the given object is currently in the success state
5449 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
5453 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
5454 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
5455 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
5456 fn drop(&mut self) {
5458 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5459 let _ = unsafe { Box::from_raw(self.contents.result) };
5462 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5463 let _ = unsafe { Box::from_raw(self.contents.err) };
5468 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
5469 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
5470 let contents = if o.result_ok {
5471 let result = unsafe { o.contents.result };
5472 unsafe { o.contents.result = core::ptr::null_mut() };
5473 CResult_PaymentFailureReasonDecodeErrorZPtr { result }
5475 let err = unsafe { o.contents.err };
5476 unsafe { o.contents.err = core::ptr::null_mut(); }
5477 CResult_PaymentFailureReasonDecodeErrorZPtr { err }
5481 result_ok: o.result_ok,
5485 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
5486 fn clone(&self) -> Self {
5488 Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5489 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
5492 Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5493 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5499 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
5500 /// but with all dynamically-allocated buffers duplicated in new buffers.
5501 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
5504 /// An enum which can either contain a crate::c_types::U128 or not
5505 pub enum COption_u128Z {
5506 /// When we're in this state, this COption_u128Z contains a crate::c_types::U128
5507 Some(crate::c_types::U128),
5508 /// When we're in this state, this COption_u128Z contains nothing
5511 impl COption_u128Z {
5512 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5513 if let Self::None = self { false } else { true }
5515 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5518 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
5519 if let Self::Some(v) = self { v } else { unreachable!() }
5523 /// Constructs a new COption_u128Z containing a crate::c_types::U128
5524 pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z {
5525 COption_u128Z::Some(o)
5528 /// Constructs a new COption_u128Z containing nothing
5529 pub extern "C" fn COption_u128Z_none() -> COption_u128Z {
5533 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
5534 pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { }
5536 /// Creates a new COption_u128Z which has the same data as `orig`
5537 /// but with all dynamically-allocated buffers duplicated in new buffers.
5538 pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) }
5541 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
5542 pub enum COption_PaymentFailureReasonZ {
5543 /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
5544 Some(crate::lightning::events::PaymentFailureReason),
5545 /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
5548 impl COption_PaymentFailureReasonZ {
5549 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5550 if let Self::None = self { false } else { true }
5552 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5555 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
5556 if let Self::Some(v) = self { v } else { unreachable!() }
5560 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
5561 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
5562 COption_PaymentFailureReasonZ::Some(o)
5565 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
5566 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
5567 COption_PaymentFailureReasonZ::None
5570 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
5571 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
5573 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
5574 /// but with all dynamically-allocated buffers duplicated in new buffers.
5575 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
5577 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
5578 /// This corresponds to std::vector in C++
5579 pub struct CVec_SpendableOutputDescriptorZ {
5580 /// The elements in the array.
5581 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5582 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
5583 /// The number of elements pointed to by `data`.
5586 impl CVec_SpendableOutputDescriptorZ {
5587 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
5588 if self.datalen == 0 { return Vec::new(); }
5589 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5590 self.data = core::ptr::null_mut();
5594 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
5595 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5598 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
5599 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
5600 let datalen = v.len();
5601 let data = Box::into_raw(v.into_boxed_slice());
5602 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5606 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5607 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
5608 impl Drop for CVec_SpendableOutputDescriptorZ {
5609 fn drop(&mut self) {
5610 if self.datalen == 0 { return; }
5611 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5614 impl Clone for CVec_SpendableOutputDescriptorZ {
5615 fn clone(&self) -> Self {
5616 let mut res = Vec::new();
5617 if self.datalen == 0 { return Self::from(res); }
5618 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5624 /// An enum which can either contain a crate::lightning::events::Event or not
5625 pub enum COption_EventZ {
5626 /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
5627 Some(crate::lightning::events::Event),
5628 /// When we're in this state, this COption_EventZ contains nothing
5631 impl COption_EventZ {
5632 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5633 if let Self::None = self { false } else { true }
5635 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5638 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
5639 if let Self::Some(v) = self { v } else { unreachable!() }
5643 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
5644 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
5645 COption_EventZ::Some(o)
5648 /// Constructs a new COption_EventZ containing nothing
5649 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
5650 COption_EventZ::None
5653 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
5654 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
5656 /// Creates a new COption_EventZ which has the same data as `orig`
5657 /// but with all dynamically-allocated buffers duplicated in new buffers.
5658 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
5660 /// The contents of CResult_COption_EventZDecodeErrorZ
5661 pub union CResult_COption_EventZDecodeErrorZPtr {
5662 /// A pointer to the contents in the success state.
5663 /// Reading from this pointer when `result_ok` is not set is undefined.
5664 pub result: *mut crate::c_types::derived::COption_EventZ,
5665 /// A pointer to the contents in the error state.
5666 /// Reading from this pointer when `result_ok` is set is undefined.
5667 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5670 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
5671 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5672 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5673 pub struct CResult_COption_EventZDecodeErrorZ {
5674 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
5675 /// `err` or `result` depending on the state of `result_ok`.
5676 pub contents: CResult_COption_EventZDecodeErrorZPtr,
5677 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
5678 pub result_ok: bool,
5681 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
5682 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
5683 CResult_COption_EventZDecodeErrorZ {
5684 contents: CResult_COption_EventZDecodeErrorZPtr {
5685 result: Box::into_raw(Box::new(o)),
5691 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
5692 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
5693 CResult_COption_EventZDecodeErrorZ {
5694 contents: CResult_COption_EventZDecodeErrorZPtr {
5695 err: Box::into_raw(Box::new(e)),
5700 /// Checks if the given object is currently in the success state
5702 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
5706 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
5707 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
5708 impl Drop for CResult_COption_EventZDecodeErrorZ {
5709 fn drop(&mut self) {
5711 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5712 let _ = unsafe { Box::from_raw(self.contents.result) };
5715 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5716 let _ = unsafe { Box::from_raw(self.contents.err) };
5721 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
5722 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5723 let contents = if o.result_ok {
5724 let result = unsafe { o.contents.result };
5725 unsafe { o.contents.result = core::ptr::null_mut() };
5726 CResult_COption_EventZDecodeErrorZPtr { result }
5728 let err = unsafe { o.contents.err };
5729 unsafe { o.contents.err = core::ptr::null_mut(); }
5730 CResult_COption_EventZDecodeErrorZPtr { err }
5734 result_ok: o.result_ok,
5738 impl Clone for CResult_COption_EventZDecodeErrorZ {
5739 fn clone(&self) -> Self {
5741 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
5742 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
5745 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
5746 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5752 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
5753 /// but with all dynamically-allocated buffers duplicated in new buffers.
5754 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
5756 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
5757 /// This corresponds to std::vector in C++
5758 pub struct CVec_MessageSendEventZ {
5759 /// The elements in the array.
5760 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5761 pub data: *mut crate::lightning::events::MessageSendEvent,
5762 /// The number of elements pointed to by `data`.
5765 impl CVec_MessageSendEventZ {
5766 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
5767 if self.datalen == 0 { return Vec::new(); }
5768 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5769 self.data = core::ptr::null_mut();
5773 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
5774 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5777 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
5778 fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
5779 let datalen = v.len();
5780 let data = Box::into_raw(v.into_boxed_slice());
5781 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5785 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5786 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
5787 impl Drop for CVec_MessageSendEventZ {
5788 fn drop(&mut self) {
5789 if self.datalen == 0 { return; }
5790 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5793 impl Clone for CVec_MessageSendEventZ {
5794 fn clone(&self) -> Self {
5795 let mut res = Vec::new();
5796 if self.datalen == 0 { return Self::from(res); }
5797 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5802 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
5803 /// This corresponds to std::vector in C++
5804 pub struct CVec_ChainHashZ {
5805 /// The elements in the array.
5806 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5807 pub data: *mut crate::c_types::ThirtyTwoBytes,
5808 /// The number of elements pointed to by `data`.
5811 impl CVec_ChainHashZ {
5812 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
5813 if self.datalen == 0 { return Vec::new(); }
5814 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5815 self.data = core::ptr::null_mut();
5819 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
5820 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5823 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ChainHashZ {
5824 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
5825 let datalen = v.len();
5826 let data = Box::into_raw(v.into_boxed_slice());
5827 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5832 pub extern "C" fn CVec_ChainHashZ_free(_res: CVec_ChainHashZ) { }
5833 impl Drop for CVec_ChainHashZ {
5834 fn drop(&mut self) {
5835 if self.datalen == 0 { return; }
5836 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5839 impl Clone for CVec_ChainHashZ {
5840 fn clone(&self) -> Self {
5841 let mut res = Vec::new();
5842 if self.datalen == 0 { return Self::from(res); }
5843 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5848 /// The contents of CResult_PublicKeyErrorZ
5849 pub union CResult_PublicKeyErrorZPtr {
5850 /// A pointer to the contents in the success state.
5851 /// Reading from this pointer when `result_ok` is not set is undefined.
5852 pub result: *mut crate::c_types::PublicKey,
5853 /// A pointer to the contents in the error state.
5854 /// Reading from this pointer when `result_ok` is set is undefined.
5855 pub err: *mut crate::c_types::Secp256k1Error,
5858 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
5859 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
5860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5861 pub struct CResult_PublicKeyErrorZ {
5862 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
5863 /// `err` or `result` depending on the state of `result_ok`.
5864 pub contents: CResult_PublicKeyErrorZPtr,
5865 /// Whether this CResult_PublicKeyErrorZ represents a success state.
5866 pub result_ok: bool,
5869 /// Creates a new CResult_PublicKeyErrorZ in the success state.
5870 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
5871 CResult_PublicKeyErrorZ {
5872 contents: CResult_PublicKeyErrorZPtr {
5873 result: Box::into_raw(Box::new(o)),
5879 /// Creates a new CResult_PublicKeyErrorZ in the error state.
5880 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
5881 CResult_PublicKeyErrorZ {
5882 contents: CResult_PublicKeyErrorZPtr {
5883 err: Box::into_raw(Box::new(e)),
5888 /// Checks if the given object is currently in the success state
5890 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
5894 /// Frees any resources used by the CResult_PublicKeyErrorZ.
5895 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
5896 impl Drop for CResult_PublicKeyErrorZ {
5897 fn drop(&mut self) {
5899 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5900 let _ = unsafe { Box::from_raw(self.contents.result) };
5903 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5904 let _ = unsafe { Box::from_raw(self.contents.err) };
5909 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
5910 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
5911 let contents = if o.result_ok {
5912 let result = unsafe { o.contents.result };
5913 unsafe { o.contents.result = core::ptr::null_mut() };
5914 CResult_PublicKeyErrorZPtr { result }
5916 let err = unsafe { o.contents.err };
5917 unsafe { o.contents.err = core::ptr::null_mut(); }
5918 CResult_PublicKeyErrorZPtr { err }
5922 result_ok: o.result_ok,
5926 impl Clone for CResult_PublicKeyErrorZ {
5927 fn clone(&self) -> Self {
5929 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
5930 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
5933 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
5934 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5940 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
5941 /// but with all dynamically-allocated buffers duplicated in new buffers.
5942 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
5944 /// The contents of CResult_NodeIdDecodeErrorZ
5945 pub union CResult_NodeIdDecodeErrorZPtr {
5946 /// A pointer to the contents in the success state.
5947 /// Reading from this pointer when `result_ok` is not set is undefined.
5948 pub result: *mut crate::lightning::routing::gossip::NodeId,
5949 /// A pointer to the contents in the error state.
5950 /// Reading from this pointer when `result_ok` is set is undefined.
5951 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5954 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5955 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5956 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5957 pub struct CResult_NodeIdDecodeErrorZ {
5958 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5959 /// `err` or `result` depending on the state of `result_ok`.
5960 pub contents: CResult_NodeIdDecodeErrorZPtr,
5961 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5962 pub result_ok: bool,
5965 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5966 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5967 CResult_NodeIdDecodeErrorZ {
5968 contents: CResult_NodeIdDecodeErrorZPtr {
5969 result: Box::into_raw(Box::new(o)),
5975 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5976 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5977 CResult_NodeIdDecodeErrorZ {
5978 contents: CResult_NodeIdDecodeErrorZPtr {
5979 err: Box::into_raw(Box::new(e)),
5984 /// Checks if the given object is currently in the success state
5986 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5990 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5991 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5992 impl Drop for CResult_NodeIdDecodeErrorZ {
5993 fn drop(&mut self) {
5995 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5996 let _ = unsafe { Box::from_raw(self.contents.result) };
5999 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6000 let _ = unsafe { Box::from_raw(self.contents.err) };
6005 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
6006 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
6007 let contents = if o.result_ok {
6008 let result = unsafe { o.contents.result };
6009 unsafe { o.contents.result = core::ptr::null_mut() };
6010 CResult_NodeIdDecodeErrorZPtr { result }
6012 let err = unsafe { o.contents.err };
6013 unsafe { o.contents.err = core::ptr::null_mut(); }
6014 CResult_NodeIdDecodeErrorZPtr { err }
6018 result_ok: o.result_ok,
6022 impl Clone for CResult_NodeIdDecodeErrorZ {
6023 fn clone(&self) -> Self {
6025 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
6026 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
6029 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
6030 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6036 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
6037 /// but with all dynamically-allocated buffers duplicated in new buffers.
6038 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
6040 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6041 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6042 /// A pointer to the contents in the success state.
6043 /// Reading from this pointer when `result_ok` is not set is undefined.
6044 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6045 /// A pointer to the contents in the error state.
6046 /// Reading from this pointer when `result_ok` is set is undefined.
6047 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6050 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6051 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6053 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6054 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6055 /// `err` or `result` depending on the state of `result_ok`.
6056 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6057 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6058 pub result_ok: bool,
6061 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6062 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6063 CResult_COption_NetworkUpdateZDecodeErrorZ {
6064 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6065 result: Box::into_raw(Box::new(o)),
6071 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6072 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6073 CResult_COption_NetworkUpdateZDecodeErrorZ {
6074 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6075 err: Box::into_raw(Box::new(e)),
6080 /// Checks if the given object is currently in the success state
6082 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6086 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6087 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6088 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6089 fn drop(&mut self) {
6091 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6092 let _ = unsafe { Box::from_raw(self.contents.result) };
6095 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6096 let _ = unsafe { Box::from_raw(self.contents.err) };
6101 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6102 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6103 let contents = if o.result_ok {
6104 let result = unsafe { o.contents.result };
6105 unsafe { o.contents.result = core::ptr::null_mut() };
6106 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6108 let err = unsafe { o.contents.err };
6109 unsafe { o.contents.err = core::ptr::null_mut(); }
6110 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6114 result_ok: o.result_ok,
6118 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6119 fn clone(&self) -> Self {
6121 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6122 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6125 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6126 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6132 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6133 /// but with all dynamically-allocated buffers duplicated in new buffers.
6134 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6136 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6137 pub enum COption_UtxoLookupZ {
6138 /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6139 Some(crate::lightning::routing::utxo::UtxoLookup),
6140 /// When we're in this state, this COption_UtxoLookupZ contains nothing
6143 impl COption_UtxoLookupZ {
6144 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6145 if let Self::None = self { false } else { true }
6147 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6150 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6151 if let Self::Some(v) = self { v } else { unreachable!() }
6155 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6156 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6157 COption_UtxoLookupZ::Some(o)
6160 /// Constructs a new COption_UtxoLookupZ containing nothing
6161 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6162 COption_UtxoLookupZ::None
6165 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6166 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6168 /// The contents of CResult_boolLightningErrorZ
6169 pub union CResult_boolLightningErrorZPtr {
6170 /// A pointer to the contents in the success state.
6171 /// Reading from this pointer when `result_ok` is not set is undefined.
6172 pub result: *mut bool,
6173 /// A pointer to the contents in the error state.
6174 /// Reading from this pointer when `result_ok` is set is undefined.
6175 pub err: *mut crate::lightning::ln::msgs::LightningError,
6178 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6179 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6180 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6181 pub struct CResult_boolLightningErrorZ {
6182 /// The contents of this CResult_boolLightningErrorZ, accessible via either
6183 /// `err` or `result` depending on the state of `result_ok`.
6184 pub contents: CResult_boolLightningErrorZPtr,
6185 /// Whether this CResult_boolLightningErrorZ represents a success state.
6186 pub result_ok: bool,
6189 /// Creates a new CResult_boolLightningErrorZ in the success state.
6190 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6191 CResult_boolLightningErrorZ {
6192 contents: CResult_boolLightningErrorZPtr {
6193 result: Box::into_raw(Box::new(o)),
6199 /// Creates a new CResult_boolLightningErrorZ in the error state.
6200 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6201 CResult_boolLightningErrorZ {
6202 contents: CResult_boolLightningErrorZPtr {
6203 err: Box::into_raw(Box::new(e)),
6208 /// Checks if the given object is currently in the success state
6210 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
6214 /// Frees any resources used by the CResult_boolLightningErrorZ.
6215 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6216 impl Drop for CResult_boolLightningErrorZ {
6217 fn drop(&mut self) {
6219 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6220 let _ = unsafe { Box::from_raw(self.contents.result) };
6223 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6224 let _ = unsafe { Box::from_raw(self.contents.err) };
6229 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6230 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6231 let contents = if o.result_ok {
6232 let result = unsafe { o.contents.result };
6233 unsafe { o.contents.result = core::ptr::null_mut() };
6234 CResult_boolLightningErrorZPtr { result }
6236 let err = unsafe { o.contents.err };
6237 unsafe { o.contents.err = core::ptr::null_mut(); }
6238 CResult_boolLightningErrorZPtr { err }
6242 result_ok: o.result_ok,
6246 impl Clone for CResult_boolLightningErrorZ {
6247 fn clone(&self) -> Self {
6249 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6250 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6253 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6254 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6260 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6261 /// but with all dynamically-allocated buffers duplicated in new buffers.
6262 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
6264 /// A tuple of 3 elements. See the individual fields for the types contained.
6265 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6266 /// The element at position 0
6267 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6268 /// The element at position 1
6269 pub b: crate::lightning::ln::msgs::ChannelUpdate,
6270 /// The element at position 2
6271 pub c: crate::lightning::ln::msgs::ChannelUpdate,
6273 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6274 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6282 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6283 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6284 (self.a, self.b, self.c)
6287 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6288 fn clone(&self) -> Self {
6290 a: Clone::clone(&self.a),
6291 b: Clone::clone(&self.b),
6292 c: Clone::clone(&self.c),
6297 /// Creates a new tuple which has the same data as `orig`
6298 /// but with all dynamically-allocated buffers duplicated in new buffers.
6299 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
6300 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6302 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 {
6303 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6307 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6308 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6311 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6312 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6313 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6314 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
6315 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6318 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6319 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6320 if let Self::None = self { false } else { true }
6322 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6325 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6326 if let Self::Some(v) = self { v } else { unreachable!() }
6330 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6331 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6332 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
6335 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
6336 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6337 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
6340 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
6341 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6343 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
6344 /// but with all dynamically-allocated buffers duplicated in new buffers.
6345 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
6347 /// The contents of CResult_NoneLightningErrorZ
6348 pub union CResult_NoneLightningErrorZPtr {
6349 /// Note that this value is always NULL, as there are no contents in the OK variant
6350 pub result: *mut core::ffi::c_void,
6351 /// A pointer to the contents in the error state.
6352 /// Reading from this pointer when `result_ok` is set is undefined.
6353 pub err: *mut crate::lightning::ln::msgs::LightningError,
6356 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6357 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6359 pub struct CResult_NoneLightningErrorZ {
6360 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6361 /// `err` or `result` depending on the state of `result_ok`.
6362 pub contents: CResult_NoneLightningErrorZPtr,
6363 /// Whether this CResult_NoneLightningErrorZ represents a success state.
6364 pub result_ok: bool,
6367 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6368 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6369 CResult_NoneLightningErrorZ {
6370 contents: CResult_NoneLightningErrorZPtr {
6371 result: core::ptr::null_mut(),
6377 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6378 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6379 CResult_NoneLightningErrorZ {
6380 contents: CResult_NoneLightningErrorZPtr {
6381 err: Box::into_raw(Box::new(e)),
6386 /// Checks if the given object is currently in the success state
6388 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6392 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6393 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6394 impl Drop for CResult_NoneLightningErrorZ {
6395 fn drop(&mut self) {
6398 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6399 let _ = unsafe { Box::from_raw(self.contents.err) };
6404 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6405 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6406 let contents = if o.result_ok {
6407 let _ = unsafe { Box::from_raw(o.contents.result) };
6408 o.contents.result = core::ptr::null_mut();
6409 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6411 let err = unsafe { o.contents.err };
6412 unsafe { o.contents.err = core::ptr::null_mut(); }
6413 CResult_NoneLightningErrorZPtr { err }
6417 result_ok: o.result_ok,
6421 impl Clone for CResult_NoneLightningErrorZ {
6422 fn clone(&self) -> Self {
6424 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6425 result: core::ptr::null_mut()
6428 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6429 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6435 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6436 /// but with all dynamically-allocated buffers duplicated in new buffers.
6437 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
6439 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6440 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
6441 /// A pointer to the contents in the success state.
6442 /// Reading from this pointer when `result_ok` is not set is undefined.
6443 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
6444 /// A pointer to the contents in the error state.
6445 /// Reading from this pointer when `result_ok` is set is undefined.
6446 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6449 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6450 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6452 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
6453 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6454 /// `err` or `result` depending on the state of `result_ok`.
6455 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
6456 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6457 pub result_ok: bool,
6460 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
6461 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6462 CResult_ChannelUpdateInfoDecodeErrorZ {
6463 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6464 result: Box::into_raw(Box::new(o)),
6470 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
6471 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6472 CResult_ChannelUpdateInfoDecodeErrorZ {
6473 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6474 err: Box::into_raw(Box::new(e)),
6479 /// Checks if the given object is currently in the success state
6481 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
6485 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
6486 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
6487 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
6488 fn drop(&mut self) {
6490 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6491 let _ = unsafe { Box::from_raw(self.contents.result) };
6494 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6495 let _ = unsafe { Box::from_raw(self.contents.err) };
6500 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
6501 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6502 let contents = if o.result_ok {
6503 let result = unsafe { o.contents.result };
6504 unsafe { o.contents.result = core::ptr::null_mut() };
6505 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
6507 let err = unsafe { o.contents.err };
6508 unsafe { o.contents.err = core::ptr::null_mut(); }
6509 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
6513 result_ok: o.result_ok,
6517 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
6518 fn clone(&self) -> Self {
6520 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6521 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
6524 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6525 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6531 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
6532 /// but with all dynamically-allocated buffers duplicated in new buffers.
6533 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
6535 /// The contents of CResult_ChannelInfoDecodeErrorZ
6536 pub union CResult_ChannelInfoDecodeErrorZPtr {
6537 /// A pointer to the contents in the success state.
6538 /// Reading from this pointer when `result_ok` is not set is undefined.
6539 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
6540 /// A pointer to the contents in the error state.
6541 /// Reading from this pointer when `result_ok` is set is undefined.
6542 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6545 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6546 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6548 pub struct CResult_ChannelInfoDecodeErrorZ {
6549 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6550 /// `err` or `result` depending on the state of `result_ok`.
6551 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
6552 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6553 pub result_ok: bool,
6556 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
6557 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
6558 CResult_ChannelInfoDecodeErrorZ {
6559 contents: CResult_ChannelInfoDecodeErrorZPtr {
6560 result: Box::into_raw(Box::new(o)),
6566 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
6567 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
6568 CResult_ChannelInfoDecodeErrorZ {
6569 contents: CResult_ChannelInfoDecodeErrorZPtr {
6570 err: Box::into_raw(Box::new(e)),
6575 /// Checks if the given object is currently in the success state
6577 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
6581 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
6582 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
6583 impl Drop for CResult_ChannelInfoDecodeErrorZ {
6584 fn drop(&mut self) {
6586 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6587 let _ = unsafe { Box::from_raw(self.contents.result) };
6590 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6591 let _ = unsafe { Box::from_raw(self.contents.err) };
6596 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
6597 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6598 let contents = if o.result_ok {
6599 let result = unsafe { o.contents.result };
6600 unsafe { o.contents.result = core::ptr::null_mut() };
6601 CResult_ChannelInfoDecodeErrorZPtr { result }
6603 let err = unsafe { o.contents.err };
6604 unsafe { o.contents.err = core::ptr::null_mut(); }
6605 CResult_ChannelInfoDecodeErrorZPtr { err }
6609 result_ok: o.result_ok,
6613 impl Clone for CResult_ChannelInfoDecodeErrorZ {
6614 fn clone(&self) -> Self {
6616 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
6617 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
6620 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
6621 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6627 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
6628 /// but with all dynamically-allocated buffers duplicated in new buffers.
6629 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
6631 /// The contents of CResult_RoutingFeesDecodeErrorZ
6632 pub union CResult_RoutingFeesDecodeErrorZPtr {
6633 /// A pointer to the contents in the success state.
6634 /// Reading from this pointer when `result_ok` is not set is undefined.
6635 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
6636 /// A pointer to the contents in the error state.
6637 /// Reading from this pointer when `result_ok` is set is undefined.
6638 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6641 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6642 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6643 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6644 pub struct CResult_RoutingFeesDecodeErrorZ {
6645 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6646 /// `err` or `result` depending on the state of `result_ok`.
6647 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
6648 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6649 pub result_ok: bool,
6652 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
6653 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
6654 CResult_RoutingFeesDecodeErrorZ {
6655 contents: CResult_RoutingFeesDecodeErrorZPtr {
6656 result: Box::into_raw(Box::new(o)),
6662 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
6663 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
6664 CResult_RoutingFeesDecodeErrorZ {
6665 contents: CResult_RoutingFeesDecodeErrorZPtr {
6666 err: Box::into_raw(Box::new(e)),
6671 /// Checks if the given object is currently in the success state
6673 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
6677 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
6678 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
6679 impl Drop for CResult_RoutingFeesDecodeErrorZ {
6680 fn drop(&mut self) {
6682 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6683 let _ = unsafe { Box::from_raw(self.contents.result) };
6686 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6687 let _ = unsafe { Box::from_raw(self.contents.err) };
6692 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
6693 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
6694 let contents = if o.result_ok {
6695 let result = unsafe { o.contents.result };
6696 unsafe { o.contents.result = core::ptr::null_mut() };
6697 CResult_RoutingFeesDecodeErrorZPtr { result }
6699 let err = unsafe { o.contents.err };
6700 unsafe { o.contents.err = core::ptr::null_mut(); }
6701 CResult_RoutingFeesDecodeErrorZPtr { err }
6705 result_ok: o.result_ok,
6709 impl Clone for CResult_RoutingFeesDecodeErrorZ {
6710 fn clone(&self) -> Self {
6712 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
6713 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
6716 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
6717 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6723 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
6724 /// but with all dynamically-allocated buffers duplicated in new buffers.
6725 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
6727 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6728 /// This corresponds to std::vector in C++
6729 pub struct CVec_NetAddressZ {
6730 /// The elements in the array.
6731 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6732 pub data: *mut crate::lightning::ln::msgs::NetAddress,
6733 /// The number of elements pointed to by `data`.
6736 impl CVec_NetAddressZ {
6737 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6738 if self.datalen == 0 { return Vec::new(); }
6739 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6740 self.data = core::ptr::null_mut();
6744 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6745 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6748 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6749 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6750 let datalen = v.len();
6751 let data = Box::into_raw(v.into_boxed_slice());
6752 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6756 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6757 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6758 impl Drop for CVec_NetAddressZ {
6759 fn drop(&mut self) {
6760 if self.datalen == 0 { return; }
6761 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6764 impl Clone for CVec_NetAddressZ {
6765 fn clone(&self) -> Self {
6766 let mut res = Vec::new();
6767 if self.datalen == 0 { return Self::from(res); }
6768 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6773 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6774 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6775 /// A pointer to the contents in the success state.
6776 /// Reading from this pointer when `result_ok` is not set is undefined.
6777 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
6778 /// A pointer to the contents in the error state.
6779 /// Reading from this pointer when `result_ok` is set is undefined.
6780 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6783 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6784 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6786 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
6787 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6788 /// `err` or `result` depending on the state of `result_ok`.
6789 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
6790 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6791 pub result_ok: bool,
6794 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
6795 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6796 CResult_NodeAnnouncementInfoDecodeErrorZ {
6797 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6798 result: Box::into_raw(Box::new(o)),
6804 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
6805 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6806 CResult_NodeAnnouncementInfoDecodeErrorZ {
6807 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6808 err: Box::into_raw(Box::new(e)),
6813 /// Checks if the given object is currently in the success state
6815 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
6819 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
6820 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
6821 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
6822 fn drop(&mut self) {
6824 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6825 let _ = unsafe { Box::from_raw(self.contents.result) };
6828 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6829 let _ = unsafe { Box::from_raw(self.contents.err) };
6834 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
6835 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6836 let contents = if o.result_ok {
6837 let result = unsafe { o.contents.result };
6838 unsafe { o.contents.result = core::ptr::null_mut() };
6839 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
6841 let err = unsafe { o.contents.err };
6842 unsafe { o.contents.err = core::ptr::null_mut(); }
6843 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
6847 result_ok: o.result_ok,
6851 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
6852 fn clone(&self) -> Self {
6854 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6855 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
6858 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6859 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6865 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
6866 /// but with all dynamically-allocated buffers duplicated in new buffers.
6867 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
6869 /// The contents of CResult_NodeAliasDecodeErrorZ
6870 pub union CResult_NodeAliasDecodeErrorZPtr {
6871 /// A pointer to the contents in the success state.
6872 /// Reading from this pointer when `result_ok` is not set is undefined.
6873 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
6874 /// A pointer to the contents in the error state.
6875 /// Reading from this pointer when `result_ok` is set is undefined.
6876 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6879 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6880 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6881 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6882 pub struct CResult_NodeAliasDecodeErrorZ {
6883 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6884 /// `err` or `result` depending on the state of `result_ok`.
6885 pub contents: CResult_NodeAliasDecodeErrorZPtr,
6886 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6887 pub result_ok: bool,
6890 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
6891 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
6892 CResult_NodeAliasDecodeErrorZ {
6893 contents: CResult_NodeAliasDecodeErrorZPtr {
6894 result: Box::into_raw(Box::new(o)),
6900 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6901 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6902 CResult_NodeAliasDecodeErrorZ {
6903 contents: CResult_NodeAliasDecodeErrorZPtr {
6904 err: Box::into_raw(Box::new(e)),
6909 /// Checks if the given object is currently in the success state
6911 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6915 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6916 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6917 impl Drop for CResult_NodeAliasDecodeErrorZ {
6918 fn drop(&mut self) {
6920 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6921 let _ = unsafe { Box::from_raw(self.contents.result) };
6924 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6925 let _ = unsafe { Box::from_raw(self.contents.err) };
6930 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6931 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6932 let contents = if o.result_ok {
6933 let result = unsafe { o.contents.result };
6934 unsafe { o.contents.result = core::ptr::null_mut() };
6935 CResult_NodeAliasDecodeErrorZPtr { result }
6937 let err = unsafe { o.contents.err };
6938 unsafe { o.contents.err = core::ptr::null_mut(); }
6939 CResult_NodeAliasDecodeErrorZPtr { err }
6943 result_ok: o.result_ok,
6947 impl Clone for CResult_NodeAliasDecodeErrorZ {
6948 fn clone(&self) -> Self {
6950 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6951 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6954 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6955 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6961 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6962 /// but with all dynamically-allocated buffers duplicated in new buffers.
6963 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6965 /// The contents of CResult_NodeInfoDecodeErrorZ
6966 pub union CResult_NodeInfoDecodeErrorZPtr {
6967 /// A pointer to the contents in the success state.
6968 /// Reading from this pointer when `result_ok` is not set is undefined.
6969 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6970 /// A pointer to the contents in the error state.
6971 /// Reading from this pointer when `result_ok` is set is undefined.
6972 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6975 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6976 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6977 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6978 pub struct CResult_NodeInfoDecodeErrorZ {
6979 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6980 /// `err` or `result` depending on the state of `result_ok`.
6981 pub contents: CResult_NodeInfoDecodeErrorZPtr,
6982 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6983 pub result_ok: bool,
6986 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6987 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6988 CResult_NodeInfoDecodeErrorZ {
6989 contents: CResult_NodeInfoDecodeErrorZPtr {
6990 result: Box::into_raw(Box::new(o)),
6996 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6997 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6998 CResult_NodeInfoDecodeErrorZ {
6999 contents: CResult_NodeInfoDecodeErrorZPtr {
7000 err: Box::into_raw(Box::new(e)),
7005 /// Checks if the given object is currently in the success state
7007 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7011 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7012 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7013 impl Drop for CResult_NodeInfoDecodeErrorZ {
7014 fn drop(&mut self) {
7016 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7017 let _ = unsafe { Box::from_raw(self.contents.result) };
7020 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7021 let _ = unsafe { Box::from_raw(self.contents.err) };
7026 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7027 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7028 let contents = if o.result_ok {
7029 let result = unsafe { o.contents.result };
7030 unsafe { o.contents.result = core::ptr::null_mut() };
7031 CResult_NodeInfoDecodeErrorZPtr { result }
7033 let err = unsafe { o.contents.err };
7034 unsafe { o.contents.err = core::ptr::null_mut(); }
7035 CResult_NodeInfoDecodeErrorZPtr { err }
7039 result_ok: o.result_ok,
7043 impl Clone for CResult_NodeInfoDecodeErrorZ {
7044 fn clone(&self) -> Self {
7046 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7047 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7050 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7051 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7057 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7058 /// but with all dynamically-allocated buffers duplicated in new buffers.
7059 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7061 /// The contents of CResult_NetworkGraphDecodeErrorZ
7062 pub union CResult_NetworkGraphDecodeErrorZPtr {
7063 /// A pointer to the contents in the success state.
7064 /// Reading from this pointer when `result_ok` is not set is undefined.
7065 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7066 /// A pointer to the contents in the error state.
7067 /// Reading from this pointer when `result_ok` is set is undefined.
7068 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7071 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7072 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7073 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7074 pub struct CResult_NetworkGraphDecodeErrorZ {
7075 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7076 /// `err` or `result` depending on the state of `result_ok`.
7077 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7078 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7079 pub result_ok: bool,
7082 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7083 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7084 CResult_NetworkGraphDecodeErrorZ {
7085 contents: CResult_NetworkGraphDecodeErrorZPtr {
7086 result: Box::into_raw(Box::new(o)),
7092 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7093 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7094 CResult_NetworkGraphDecodeErrorZ {
7095 contents: CResult_NetworkGraphDecodeErrorZPtr {
7096 err: Box::into_raw(Box::new(e)),
7101 /// Checks if the given object is currently in the success state
7103 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7107 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7108 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7109 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7110 fn drop(&mut self) {
7112 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7113 let _ = unsafe { Box::from_raw(self.contents.result) };
7116 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7117 let _ = unsafe { Box::from_raw(self.contents.err) };
7122 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7123 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7124 let contents = if o.result_ok {
7125 let result = unsafe { o.contents.result };
7126 unsafe { o.contents.result = core::ptr::null_mut() };
7127 CResult_NetworkGraphDecodeErrorZPtr { result }
7129 let err = unsafe { o.contents.err };
7130 unsafe { o.contents.err = core::ptr::null_mut(); }
7131 CResult_NetworkGraphDecodeErrorZPtr { err }
7135 result_ok: o.result_ok,
7141 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7142 pub enum COption_CVec_NetAddressZZ {
7143 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7144 Some(crate::c_types::derived::CVec_NetAddressZ),
7145 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7148 impl COption_CVec_NetAddressZZ {
7149 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7150 if let Self::None = self { false } else { true }
7152 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7155 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
7156 if let Self::Some(v) = self { v } else { unreachable!() }
7160 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
7161 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
7162 COption_CVec_NetAddressZZ::Some(o)
7165 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
7166 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
7167 COption_CVec_NetAddressZZ::None
7170 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
7171 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
7173 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
7174 /// but with all dynamically-allocated buffers duplicated in new buffers.
7175 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
7177 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
7178 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7179 /// A pointer to the contents in the success state.
7180 /// Reading from this pointer when `result_ok` is not set is undefined.
7181 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
7182 /// A pointer to the contents in the error state.
7183 /// Reading from this pointer when `result_ok` is set is undefined.
7184 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7187 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7188 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7190 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7191 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
7192 /// `err` or `result` depending on the state of `result_ok`.
7193 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
7194 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
7195 pub result_ok: bool,
7198 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
7199 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7200 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7201 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7202 result: Box::into_raw(Box::new(o)),
7208 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
7209 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7210 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7211 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7212 err: Box::into_raw(Box::new(e)),
7217 /// Checks if the given object is currently in the success state
7219 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
7223 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
7224 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
7225 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7226 fn drop(&mut self) {
7228 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7229 let _ = unsafe { Box::from_raw(self.contents.result) };
7232 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7233 let _ = unsafe { Box::from_raw(self.contents.err) };
7238 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7239 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7240 let contents = if o.result_ok {
7241 let result = unsafe { o.contents.result };
7242 unsafe { o.contents.result = core::ptr::null_mut() };
7243 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
7245 let err = unsafe { o.contents.err };
7246 unsafe { o.contents.err = core::ptr::null_mut(); }
7247 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
7251 result_ok: o.result_ok,
7255 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7256 fn clone(&self) -> Self {
7258 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7259 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7262 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7263 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7269 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
7270 /// but with all dynamically-allocated buffers duplicated in new buffers.
7271 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
7273 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
7274 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7275 /// A pointer to the contents in the success state.
7276 /// Reading from this pointer when `result_ok` is not set is undefined.
7277 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
7278 /// A pointer to the contents in the error state.
7279 /// Reading from this pointer when `result_ok` is set is undefined.
7280 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7283 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7284 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7286 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7287 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
7288 /// `err` or `result` depending on the state of `result_ok`.
7289 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
7290 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
7291 pub result_ok: bool,
7294 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
7295 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7296 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7297 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7298 result: Box::into_raw(Box::new(o)),
7304 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
7305 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7306 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7307 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7308 err: Box::into_raw(Box::new(e)),
7313 /// Checks if the given object is currently in the success state
7315 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
7319 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
7320 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
7321 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7322 fn drop(&mut self) {
7324 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7325 let _ = unsafe { Box::from_raw(self.contents.result) };
7328 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7329 let _ = unsafe { Box::from_raw(self.contents.err) };
7334 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7335 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7336 let contents = if o.result_ok {
7337 let result = unsafe { o.contents.result };
7338 unsafe { o.contents.result = core::ptr::null_mut() };
7339 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
7341 let err = unsafe { o.contents.err };
7342 unsafe { o.contents.err = core::ptr::null_mut(); }
7343 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
7347 result_ok: o.result_ok,
7351 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7352 fn clone(&self) -> Self {
7354 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7355 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7358 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7359 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7365 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
7366 /// but with all dynamically-allocated buffers duplicated in new buffers.
7367 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
7369 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
7370 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7371 /// A pointer to the contents in the success state.
7372 /// Reading from this pointer when `result_ok` is not set is undefined.
7373 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
7374 /// A pointer to the contents in the error state.
7375 /// Reading from this pointer when `result_ok` is set is undefined.
7376 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7379 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7380 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7382 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
7383 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
7384 /// `err` or `result` depending on the state of `result_ok`.
7385 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
7386 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
7387 pub result_ok: bool,
7390 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
7391 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7392 CResult_SpendableOutputDescriptorDecodeErrorZ {
7393 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7394 result: Box::into_raw(Box::new(o)),
7400 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
7401 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7402 CResult_SpendableOutputDescriptorDecodeErrorZ {
7403 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7404 err: Box::into_raw(Box::new(e)),
7409 /// Checks if the given object is currently in the success state
7411 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
7415 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
7416 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
7417 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
7418 fn drop(&mut self) {
7420 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7421 let _ = unsafe { Box::from_raw(self.contents.result) };
7424 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7425 let _ = unsafe { Box::from_raw(self.contents.err) };
7430 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
7431 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7432 let contents = if o.result_ok {
7433 let result = unsafe { o.contents.result };
7434 unsafe { o.contents.result = core::ptr::null_mut() };
7435 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
7437 let err = unsafe { o.contents.err };
7438 unsafe { o.contents.err = core::ptr::null_mut(); }
7439 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
7443 result_ok: o.result_ok,
7447 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
7448 fn clone(&self) -> Self {
7450 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7451 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7454 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7455 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7461 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
7462 /// but with all dynamically-allocated buffers duplicated in new buffers.
7463 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
7465 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
7466 /// This corresponds to std::vector in C++
7467 pub struct CVec_PaymentPreimageZ {
7468 /// The elements in the array.
7469 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7470 pub data: *mut crate::c_types::ThirtyTwoBytes,
7471 /// The number of elements pointed to by `data`.
7474 impl CVec_PaymentPreimageZ {
7475 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
7476 if self.datalen == 0 { return Vec::new(); }
7477 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7478 self.data = core::ptr::null_mut();
7482 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
7483 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7486 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
7487 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
7488 let datalen = v.len();
7489 let data = Box::into_raw(v.into_boxed_slice());
7490 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7494 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7495 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
7496 impl Drop for CVec_PaymentPreimageZ {
7497 fn drop(&mut self) {
7498 if self.datalen == 0 { return; }
7499 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7502 impl Clone for CVec_PaymentPreimageZ {
7503 fn clone(&self) -> Self {
7504 let mut res = Vec::new();
7505 if self.datalen == 0 { return Self::from(res); }
7506 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7511 /// A tuple of 2 elements. See the individual fields for the types contained.
7512 pub struct C2Tuple_SignatureCVec_SignatureZZ {
7513 /// The element at position 0
7514 pub a: crate::c_types::Signature,
7515 /// The element at position 1
7516 pub b: crate::c_types::derived::CVec_SignatureZ,
7518 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
7519 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
7526 impl C2Tuple_SignatureCVec_SignatureZZ {
7527 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
7531 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
7532 fn clone(&self) -> Self {
7534 a: Clone::clone(&self.a),
7535 b: Clone::clone(&self.b),
7540 /// Creates a new tuple which has the same data as `orig`
7541 /// but with all dynamically-allocated buffers duplicated in new buffers.
7542 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
7543 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
7545 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
7546 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
7550 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
7551 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
7553 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
7554 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7555 /// A pointer to the contents in the success state.
7556 /// Reading from this pointer when `result_ok` is not set is undefined.
7557 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
7558 /// Note that this value is always NULL, as there are no contents in the Err variant
7559 pub err: *mut core::ffi::c_void,
7562 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
7563 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
7564 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7565 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7566 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
7567 /// `err` or `result` depending on the state of `result_ok`.
7568 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
7569 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
7570 pub result_ok: bool,
7573 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
7574 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7575 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7576 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7577 result: Box::into_raw(Box::new(o)),
7583 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
7584 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7585 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7586 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7587 err: core::ptr::null_mut(),
7592 /// Checks if the given object is currently in the success state
7594 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
7598 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
7599 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
7600 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7601 fn drop(&mut self) {
7603 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7604 let _ = unsafe { Box::from_raw(self.contents.result) };
7610 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7611 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
7612 let contents = if o.result_ok {
7613 let result = unsafe { o.contents.result };
7614 unsafe { o.contents.result = core::ptr::null_mut() };
7615 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
7617 let _ = unsafe { Box::from_raw(o.contents.err) };
7618 o.contents.err = core::ptr::null_mut();
7619 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
7623 result_ok: o.result_ok,
7627 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7628 fn clone(&self) -> Self {
7630 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7631 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
7634 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7635 err: core::ptr::null_mut()
7641 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
7642 /// but with all dynamically-allocated buffers duplicated in new buffers.
7643 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
7645 /// The contents of CResult_SignatureNoneZ
7646 pub union CResult_SignatureNoneZPtr {
7647 /// A pointer to the contents in the success state.
7648 /// Reading from this pointer when `result_ok` is not set is undefined.
7649 pub result: *mut crate::c_types::Signature,
7650 /// Note that this value is always NULL, as there are no contents in the Err variant
7651 pub err: *mut core::ffi::c_void,
7654 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
7655 /// containing a crate::c_types::Signature on success and a () on failure.
7656 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7657 pub struct CResult_SignatureNoneZ {
7658 /// The contents of this CResult_SignatureNoneZ, accessible via either
7659 /// `err` or `result` depending on the state of `result_ok`.
7660 pub contents: CResult_SignatureNoneZPtr,
7661 /// Whether this CResult_SignatureNoneZ represents a success state.
7662 pub result_ok: bool,
7665 /// Creates a new CResult_SignatureNoneZ in the success state.
7666 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
7667 CResult_SignatureNoneZ {
7668 contents: CResult_SignatureNoneZPtr {
7669 result: Box::into_raw(Box::new(o)),
7675 /// Creates a new CResult_SignatureNoneZ in the error state.
7676 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
7677 CResult_SignatureNoneZ {
7678 contents: CResult_SignatureNoneZPtr {
7679 err: core::ptr::null_mut(),
7684 /// Checks if the given object is currently in the success state
7686 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
7690 /// Frees any resources used by the CResult_SignatureNoneZ.
7691 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
7692 impl Drop for CResult_SignatureNoneZ {
7693 fn drop(&mut self) {
7695 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7696 let _ = unsafe { Box::from_raw(self.contents.result) };
7702 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
7703 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
7704 let contents = if o.result_ok {
7705 let result = unsafe { o.contents.result };
7706 unsafe { o.contents.result = core::ptr::null_mut() };
7707 CResult_SignatureNoneZPtr { result }
7709 let _ = unsafe { Box::from_raw(o.contents.err) };
7710 o.contents.err = core::ptr::null_mut();
7711 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
7715 result_ok: o.result_ok,
7719 impl Clone for CResult_SignatureNoneZ {
7720 fn clone(&self) -> Self {
7722 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
7723 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
7726 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
7727 err: core::ptr::null_mut()
7733 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
7734 /// but with all dynamically-allocated buffers duplicated in new buffers.
7735 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
7737 /// The contents of CResult_PublicKeyNoneZ
7738 pub union CResult_PublicKeyNoneZPtr {
7739 /// A pointer to the contents in the success state.
7740 /// Reading from this pointer when `result_ok` is not set is undefined.
7741 pub result: *mut crate::c_types::PublicKey,
7742 /// Note that this value is always NULL, as there are no contents in the Err variant
7743 pub err: *mut core::ffi::c_void,
7746 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
7747 /// containing a crate::c_types::PublicKey on success and a () on failure.
7748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7749 pub struct CResult_PublicKeyNoneZ {
7750 /// The contents of this CResult_PublicKeyNoneZ, accessible via either
7751 /// `err` or `result` depending on the state of `result_ok`.
7752 pub contents: CResult_PublicKeyNoneZPtr,
7753 /// Whether this CResult_PublicKeyNoneZ represents a success state.
7754 pub result_ok: bool,
7757 /// Creates a new CResult_PublicKeyNoneZ in the success state.
7758 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
7759 CResult_PublicKeyNoneZ {
7760 contents: CResult_PublicKeyNoneZPtr {
7761 result: Box::into_raw(Box::new(o)),
7767 /// Creates a new CResult_PublicKeyNoneZ in the error state.
7768 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
7769 CResult_PublicKeyNoneZ {
7770 contents: CResult_PublicKeyNoneZPtr {
7771 err: core::ptr::null_mut(),
7776 /// Checks if the given object is currently in the success state
7778 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
7782 /// Frees any resources used by the CResult_PublicKeyNoneZ.
7783 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
7784 impl Drop for CResult_PublicKeyNoneZ {
7785 fn drop(&mut self) {
7787 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7788 let _ = unsafe { Box::from_raw(self.contents.result) };
7794 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
7795 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
7796 let contents = if o.result_ok {
7797 let result = unsafe { o.contents.result };
7798 unsafe { o.contents.result = core::ptr::null_mut() };
7799 CResult_PublicKeyNoneZPtr { result }
7801 let _ = unsafe { Box::from_raw(o.contents.err) };
7802 o.contents.err = core::ptr::null_mut();
7803 CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
7807 result_ok: o.result_ok,
7811 impl Clone for CResult_PublicKeyNoneZ {
7812 fn clone(&self) -> Self {
7814 Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
7815 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7818 Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
7819 err: core::ptr::null_mut()
7825 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
7826 /// but with all dynamically-allocated buffers duplicated in new buffers.
7827 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
7829 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
7830 pub enum COption_ScalarZ {
7831 /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7832 Some(crate::c_types::BigEndianScalar),
7833 /// When we're in this state, this COption_ScalarZ contains nothing
7836 impl COption_ScalarZ {
7837 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7838 if let Self::None = self { false } else { true }
7840 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7843 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
7844 if let Self::Some(v) = self { v } else { unreachable!() }
7848 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
7849 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
7850 COption_ScalarZ::Some(o)
7853 /// Constructs a new COption_ScalarZ containing nothing
7854 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
7855 COption_ScalarZ::None
7858 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
7859 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
7861 /// The contents of CResult_SharedSecretNoneZ
7862 pub union CResult_SharedSecretNoneZPtr {
7863 /// A pointer to the contents in the success state.
7864 /// Reading from this pointer when `result_ok` is not set is undefined.
7865 pub result: *mut crate::c_types::ThirtyTwoBytes,
7866 /// Note that this value is always NULL, as there are no contents in the Err variant
7867 pub err: *mut core::ffi::c_void,
7870 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7871 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7872 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7873 pub struct CResult_SharedSecretNoneZ {
7874 /// The contents of this CResult_SharedSecretNoneZ, accessible via either
7875 /// `err` or `result` depending on the state of `result_ok`.
7876 pub contents: CResult_SharedSecretNoneZPtr,
7877 /// Whether this CResult_SharedSecretNoneZ represents a success state.
7878 pub result_ok: bool,
7881 /// Creates a new CResult_SharedSecretNoneZ in the success state.
7882 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
7883 CResult_SharedSecretNoneZ {
7884 contents: CResult_SharedSecretNoneZPtr {
7885 result: Box::into_raw(Box::new(o)),
7891 /// Creates a new CResult_SharedSecretNoneZ in the error state.
7892 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
7893 CResult_SharedSecretNoneZ {
7894 contents: CResult_SharedSecretNoneZPtr {
7895 err: core::ptr::null_mut(),
7900 /// Checks if the given object is currently in the success state
7902 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
7906 /// Frees any resources used by the CResult_SharedSecretNoneZ.
7907 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
7908 impl Drop for CResult_SharedSecretNoneZ {
7909 fn drop(&mut self) {
7911 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7912 let _ = unsafe { Box::from_raw(self.contents.result) };
7918 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
7919 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7920 let contents = if o.result_ok {
7921 let result = unsafe { o.contents.result };
7922 unsafe { o.contents.result = core::ptr::null_mut() };
7923 CResult_SharedSecretNoneZPtr { result }
7925 let _ = unsafe { Box::from_raw(o.contents.err) };
7926 o.contents.err = core::ptr::null_mut();
7927 CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
7931 result_ok: o.result_ok,
7935 impl Clone for CResult_SharedSecretNoneZ {
7936 fn clone(&self) -> Self {
7938 Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
7939 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7942 Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
7943 err: core::ptr::null_mut()
7949 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
7950 /// but with all dynamically-allocated buffers duplicated in new buffers.
7951 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
7953 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7954 /// This corresponds to std::vector in C++
7955 pub struct CVec_U5Z {
7956 /// The elements in the array.
7957 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7958 pub data: *mut crate::c_types::U5,
7959 /// The number of elements pointed to by `data`.
7963 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
7964 if self.datalen == 0 { return Vec::new(); }
7965 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7966 self.data = core::ptr::null_mut();
7970 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
7971 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7974 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
7975 fn from(v: Vec<crate::c_types::U5>) -> Self {
7976 let datalen = v.len();
7977 let data = Box::into_raw(v.into_boxed_slice());
7978 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7982 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7983 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
7984 impl Drop for CVec_U5Z {
7985 fn drop(&mut self) {
7986 if self.datalen == 0 { return; }
7987 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7990 impl Clone for CVec_U5Z {
7991 fn clone(&self) -> Self {
7992 let mut res = Vec::new();
7993 if self.datalen == 0 { return Self::from(res); }
7994 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7999 /// The contents of CResult_RecoverableSignatureNoneZ
8000 pub union CResult_RecoverableSignatureNoneZPtr {
8001 /// A pointer to the contents in the success state.
8002 /// Reading from this pointer when `result_ok` is not set is undefined.
8003 pub result: *mut crate::c_types::RecoverableSignature,
8004 /// Note that this value is always NULL, as there are no contents in the Err variant
8005 pub err: *mut core::ffi::c_void,
8008 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
8009 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
8010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8011 pub struct CResult_RecoverableSignatureNoneZ {
8012 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
8013 /// `err` or `result` depending on the state of `result_ok`.
8014 pub contents: CResult_RecoverableSignatureNoneZPtr,
8015 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
8016 pub result_ok: bool,
8019 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
8020 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
8021 CResult_RecoverableSignatureNoneZ {
8022 contents: CResult_RecoverableSignatureNoneZPtr {
8023 result: Box::into_raw(Box::new(o)),
8029 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
8030 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
8031 CResult_RecoverableSignatureNoneZ {
8032 contents: CResult_RecoverableSignatureNoneZPtr {
8033 err: core::ptr::null_mut(),
8038 /// Checks if the given object is currently in the success state
8040 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
8044 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
8045 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
8046 impl Drop for CResult_RecoverableSignatureNoneZ {
8047 fn drop(&mut self) {
8049 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8050 let _ = unsafe { Box::from_raw(self.contents.result) };
8056 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
8057 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
8058 let contents = if o.result_ok {
8059 let result = unsafe { o.contents.result };
8060 unsafe { o.contents.result = core::ptr::null_mut() };
8061 CResult_RecoverableSignatureNoneZPtr { result }
8063 let _ = unsafe { Box::from_raw(o.contents.err) };
8064 o.contents.err = core::ptr::null_mut();
8065 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
8069 result_ok: o.result_ok,
8073 impl Clone for CResult_RecoverableSignatureNoneZ {
8074 fn clone(&self) -> Self {
8076 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
8077 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
8080 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
8081 err: core::ptr::null_mut()
8087 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
8088 /// but with all dynamically-allocated buffers duplicated in new buffers.
8089 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
8091 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
8092 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8093 /// A pointer to the contents in the success state.
8094 /// Reading from this pointer when `result_ok` is not set is undefined.
8095 pub result: *mut crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner,
8096 /// A pointer to the contents in the error state.
8097 /// Reading from this pointer when `result_ok` is set is undefined.
8098 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8101 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
8102 /// containing a crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8103 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8104 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8105 /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
8106 /// `err` or `result` depending on the state of `result_ok`.
8107 pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
8108 /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
8109 pub result_ok: bool,
8112 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
8113 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8114 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8115 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8116 result: Box::into_raw(Box::new(o)),
8122 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
8123 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8124 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8125 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8126 err: Box::into_raw(Box::new(e)),
8131 /// Checks if the given object is currently in the success state
8133 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
8137 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
8138 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
8139 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8140 fn drop(&mut self) {
8142 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8143 let _ = unsafe { Box::from_raw(self.contents.result) };
8146 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8147 let _ = unsafe { Box::from_raw(self.contents.err) };
8152 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8153 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8154 let contents = if o.result_ok {
8155 let result = unsafe { o.contents.result };
8156 unsafe { o.contents.result = core::ptr::null_mut() };
8157 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
8159 let err = unsafe { o.contents.err };
8160 unsafe { o.contents.err = core::ptr::null_mut(); }
8161 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
8165 result_ok: o.result_ok,
8170 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
8171 /// This corresponds to std::vector in C++
8172 pub struct CVec_CVec_u8ZZ {
8173 /// The elements in the array.
8174 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8175 pub data: *mut crate::c_types::derived::CVec_u8Z,
8176 /// The number of elements pointed to by `data`.
8179 impl CVec_CVec_u8ZZ {
8180 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
8181 if self.datalen == 0 { return Vec::new(); }
8182 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8183 self.data = core::ptr::null_mut();
8187 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
8188 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8191 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
8192 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
8193 let datalen = v.len();
8194 let data = Box::into_raw(v.into_boxed_slice());
8195 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8199 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8200 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
8201 impl Drop for CVec_CVec_u8ZZ {
8202 fn drop(&mut self) {
8203 if self.datalen == 0 { return; }
8204 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8207 impl Clone for CVec_CVec_u8ZZ {
8208 fn clone(&self) -> Self {
8209 let mut res = Vec::new();
8210 if self.datalen == 0 { return Self::from(res); }
8211 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8216 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
8217 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
8218 /// A pointer to the contents in the success state.
8219 /// Reading from this pointer when `result_ok` is not set is undefined.
8220 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
8221 /// Note that this value is always NULL, as there are no contents in the Err variant
8222 pub err: *mut core::ffi::c_void,
8225 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
8226 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
8227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8228 pub struct CResult_CVec_CVec_u8ZZNoneZ {
8229 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
8230 /// `err` or `result` depending on the state of `result_ok`.
8231 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
8232 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
8233 pub result_ok: bool,
8236 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
8237 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
8238 CResult_CVec_CVec_u8ZZNoneZ {
8239 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8240 result: Box::into_raw(Box::new(o)),
8246 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
8247 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
8248 CResult_CVec_CVec_u8ZZNoneZ {
8249 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8250 err: core::ptr::null_mut(),
8255 /// Checks if the given object is currently in the success state
8257 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
8261 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
8262 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
8263 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
8264 fn drop(&mut self) {
8266 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8267 let _ = unsafe { Box::from_raw(self.contents.result) };
8273 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
8274 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
8275 let contents = if o.result_ok {
8276 let result = unsafe { o.contents.result };
8277 unsafe { o.contents.result = core::ptr::null_mut() };
8278 CResult_CVec_CVec_u8ZZNoneZPtr { result }
8280 let _ = unsafe { Box::from_raw(o.contents.err) };
8281 o.contents.err = core::ptr::null_mut();
8282 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
8286 result_ok: o.result_ok,
8290 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
8291 fn clone(&self) -> Self {
8293 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8294 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
8297 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8298 err: core::ptr::null_mut()
8304 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
8305 /// but with all dynamically-allocated buffers duplicated in new buffers.
8306 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
8308 /// The contents of CResult_InMemorySignerDecodeErrorZ
8309 pub union CResult_InMemorySignerDecodeErrorZPtr {
8310 /// A pointer to the contents in the success state.
8311 /// Reading from this pointer when `result_ok` is not set is undefined.
8312 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
8313 /// A pointer to the contents in the error state.
8314 /// Reading from this pointer when `result_ok` is set is undefined.
8315 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8318 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
8319 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8321 pub struct CResult_InMemorySignerDecodeErrorZ {
8322 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
8323 /// `err` or `result` depending on the state of `result_ok`.
8324 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
8325 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
8326 pub result_ok: bool,
8329 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
8330 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
8331 CResult_InMemorySignerDecodeErrorZ {
8332 contents: CResult_InMemorySignerDecodeErrorZPtr {
8333 result: Box::into_raw(Box::new(o)),
8339 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
8340 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
8341 CResult_InMemorySignerDecodeErrorZ {
8342 contents: CResult_InMemorySignerDecodeErrorZPtr {
8343 err: Box::into_raw(Box::new(e)),
8348 /// Checks if the given object is currently in the success state
8350 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
8354 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
8355 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
8356 impl Drop for CResult_InMemorySignerDecodeErrorZ {
8357 fn drop(&mut self) {
8359 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8360 let _ = unsafe { Box::from_raw(self.contents.result) };
8363 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8364 let _ = unsafe { Box::from_raw(self.contents.err) };
8369 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
8370 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8371 let contents = if o.result_ok {
8372 let result = unsafe { o.contents.result };
8373 unsafe { o.contents.result = core::ptr::null_mut() };
8374 CResult_InMemorySignerDecodeErrorZPtr { result }
8376 let err = unsafe { o.contents.err };
8377 unsafe { o.contents.err = core::ptr::null_mut(); }
8378 CResult_InMemorySignerDecodeErrorZPtr { err }
8382 result_ok: o.result_ok,
8386 impl Clone for CResult_InMemorySignerDecodeErrorZ {
8387 fn clone(&self) -> Self {
8389 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
8390 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
8393 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
8394 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8400 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
8401 /// but with all dynamically-allocated buffers duplicated in new buffers.
8402 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
8404 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
8405 /// This corresponds to std::vector in C++
8406 pub struct CVec_TxOutZ {
8407 /// The elements in the array.
8408 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8409 pub data: *mut crate::c_types::TxOut,
8410 /// The number of elements pointed to by `data`.
8414 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
8415 if self.datalen == 0 { return Vec::new(); }
8416 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8417 self.data = core::ptr::null_mut();
8421 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
8422 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8425 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
8426 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
8427 let datalen = v.len();
8428 let data = Box::into_raw(v.into_boxed_slice());
8429 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8433 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8434 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
8435 impl Drop for CVec_TxOutZ {
8436 fn drop(&mut self) {
8437 if self.datalen == 0 { return; }
8438 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8441 impl Clone for CVec_TxOutZ {
8442 fn clone(&self) -> Self {
8443 let mut res = Vec::new();
8444 if self.datalen == 0 { return Self::from(res); }
8445 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8450 /// The contents of CResult_TransactionNoneZ
8451 pub union CResult_TransactionNoneZPtr {
8452 /// A pointer to the contents in the success state.
8453 /// Reading from this pointer when `result_ok` is not set is undefined.
8454 pub result: *mut crate::c_types::Transaction,
8455 /// Note that this value is always NULL, as there are no contents in the Err variant
8456 pub err: *mut core::ffi::c_void,
8459 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
8460 /// containing a crate::c_types::Transaction on success and a () on failure.
8461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8462 pub struct CResult_TransactionNoneZ {
8463 /// The contents of this CResult_TransactionNoneZ, accessible via either
8464 /// `err` or `result` depending on the state of `result_ok`.
8465 pub contents: CResult_TransactionNoneZPtr,
8466 /// Whether this CResult_TransactionNoneZ represents a success state.
8467 pub result_ok: bool,
8470 /// Creates a new CResult_TransactionNoneZ in the success state.
8471 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
8472 CResult_TransactionNoneZ {
8473 contents: CResult_TransactionNoneZPtr {
8474 result: Box::into_raw(Box::new(o)),
8480 /// Creates a new CResult_TransactionNoneZ in the error state.
8481 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
8482 CResult_TransactionNoneZ {
8483 contents: CResult_TransactionNoneZPtr {
8484 err: core::ptr::null_mut(),
8489 /// Checks if the given object is currently in the success state
8491 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
8495 /// Frees any resources used by the CResult_TransactionNoneZ.
8496 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
8497 impl Drop for CResult_TransactionNoneZ {
8498 fn drop(&mut self) {
8500 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8501 let _ = unsafe { Box::from_raw(self.contents.result) };
8507 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
8508 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
8509 let contents = if o.result_ok {
8510 let result = unsafe { o.contents.result };
8511 unsafe { o.contents.result = core::ptr::null_mut() };
8512 CResult_TransactionNoneZPtr { result }
8514 let _ = unsafe { Box::from_raw(o.contents.err) };
8515 o.contents.err = core::ptr::null_mut();
8516 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
8520 result_ok: o.result_ok,
8524 impl Clone for CResult_TransactionNoneZ {
8525 fn clone(&self) -> Self {
8527 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
8528 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
8531 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
8532 err: core::ptr::null_mut()
8538 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
8539 /// but with all dynamically-allocated buffers duplicated in new buffers.
8540 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
8542 /// A tuple of 2 elements. See the individual fields for the types contained.
8543 pub struct C2Tuple_BlockHashChannelMonitorZ {
8544 /// The element at position 0
8545 pub a: crate::c_types::ThirtyTwoBytes,
8546 /// The element at position 1
8547 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
8549 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
8550 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
8557 impl C2Tuple_BlockHashChannelMonitorZ {
8558 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
8562 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8564 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
8565 C2Tuple_BlockHashChannelMonitorZ { a, b, }
8569 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8570 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
8572 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8573 /// This corresponds to std::vector in C++
8574 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
8575 /// The elements in the array.
8576 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8577 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8578 /// The number of elements pointed to by `data`.
8581 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
8582 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
8583 if self.datalen == 0 { return Vec::new(); }
8584 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8585 self.data = core::ptr::null_mut();
8589 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
8590 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8593 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8594 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
8595 let datalen = v.len();
8596 let data = Box::into_raw(v.into_boxed_slice());
8597 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8601 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8602 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
8603 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8604 fn drop(&mut self) {
8605 if self.datalen == 0 { return; }
8606 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8610 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8611 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8612 /// A pointer to the contents in the success state.
8613 /// Reading from this pointer when `result_ok` is not set is undefined.
8614 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
8615 /// A pointer to the contents in the error state.
8616 /// Reading from this pointer when `result_ok` is set is undefined.
8617 pub err: *mut crate::c_types::IOError,
8620 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8621 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8623 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8624 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8625 /// `err` or `result` depending on the state of `result_ok`.
8626 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
8627 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8628 pub result_ok: bool,
8631 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
8632 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8633 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8634 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8635 result: Box::into_raw(Box::new(o)),
8641 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
8642 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8643 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8644 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8645 err: Box::into_raw(Box::new(e)),
8650 /// Checks if the given object is currently in the success state
8652 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
8656 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
8657 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
8658 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8659 fn drop(&mut self) {
8661 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8662 let _ = unsafe { Box::from_raw(self.contents.result) };
8665 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8666 let _ = unsafe { Box::from_raw(self.contents.err) };
8671 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8672 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
8673 let contents = if o.result_ok {
8674 let result = unsafe { o.contents.result };
8675 unsafe { o.contents.result = core::ptr::null_mut() };
8676 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
8678 let err = unsafe { o.contents.err };
8679 unsafe { o.contents.err = core::ptr::null_mut(); }
8680 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
8684 result_ok: o.result_ok,
8690 /// An enum which can either contain a u16 or not
8691 pub enum COption_u16Z {
8692 /// When we're in this state, this COption_u16Z contains a u16
8694 /// When we're in this state, this COption_u16Z contains nothing
8698 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8699 if let Self::None = self { false } else { true }
8701 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8704 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
8705 if let Self::Some(v) = self { v } else { unreachable!() }
8709 /// Constructs a new COption_u16Z containing a u16
8710 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
8711 COption_u16Z::Some(o)
8714 /// Constructs a new COption_u16Z containing nothing
8715 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
8719 /// Frees any resources associated with the u16, if we are in the Some state
8720 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
8722 /// Creates a new COption_u16Z which has the same data as `orig`
8723 /// but with all dynamically-allocated buffers duplicated in new buffers.
8724 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
8726 /// The contents of CResult__u832APIErrorZ
8727 pub union CResult__u832APIErrorZPtr {
8728 /// A pointer to the contents in the success state.
8729 /// Reading from this pointer when `result_ok` is not set is undefined.
8730 pub result: *mut crate::c_types::ThirtyTwoBytes,
8731 /// A pointer to the contents in the error state.
8732 /// Reading from this pointer when `result_ok` is set is undefined.
8733 pub err: *mut crate::lightning::util::errors::APIError,
8736 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
8737 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8738 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8739 pub struct CResult__u832APIErrorZ {
8740 /// The contents of this CResult__u832APIErrorZ, accessible via either
8741 /// `err` or `result` depending on the state of `result_ok`.
8742 pub contents: CResult__u832APIErrorZPtr,
8743 /// Whether this CResult__u832APIErrorZ represents a success state.
8744 pub result_ok: bool,
8747 /// Creates a new CResult__u832APIErrorZ in the success state.
8748 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
8749 CResult__u832APIErrorZ {
8750 contents: CResult__u832APIErrorZPtr {
8751 result: Box::into_raw(Box::new(o)),
8757 /// Creates a new CResult__u832APIErrorZ in the error state.
8758 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
8759 CResult__u832APIErrorZ {
8760 contents: CResult__u832APIErrorZPtr {
8761 err: Box::into_raw(Box::new(e)),
8766 /// Checks if the given object is currently in the success state
8768 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
8772 /// Frees any resources used by the CResult__u832APIErrorZ.
8773 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
8774 impl Drop for CResult__u832APIErrorZ {
8775 fn drop(&mut self) {
8777 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8778 let _ = unsafe { Box::from_raw(self.contents.result) };
8781 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8782 let _ = unsafe { Box::from_raw(self.contents.err) };
8787 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
8788 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8789 let contents = if o.result_ok {
8790 let result = unsafe { o.contents.result };
8791 unsafe { o.contents.result = core::ptr::null_mut() };
8792 CResult__u832APIErrorZPtr { result }
8794 let err = unsafe { o.contents.err };
8795 unsafe { o.contents.err = core::ptr::null_mut(); }
8796 CResult__u832APIErrorZPtr { err }
8800 result_ok: o.result_ok,
8804 impl Clone for CResult__u832APIErrorZ {
8805 fn clone(&self) -> Self {
8807 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
8808 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8811 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8812 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8818 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8819 /// but with all dynamically-allocated buffers duplicated in new buffers.
8820 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8822 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8823 /// This corresponds to std::vector in C++
8824 pub struct CVec_RecentPaymentDetailsZ {
8825 /// The elements in the array.
8826 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8827 pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
8828 /// The number of elements pointed to by `data`.
8831 impl CVec_RecentPaymentDetailsZ {
8832 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
8833 if self.datalen == 0 { return Vec::new(); }
8834 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8835 self.data = core::ptr::null_mut();
8839 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
8840 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8843 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
8844 fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
8845 let datalen = v.len();
8846 let data = Box::into_raw(v.into_boxed_slice());
8847 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8851 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8852 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
8853 impl Drop for CVec_RecentPaymentDetailsZ {
8854 fn drop(&mut self) {
8855 if self.datalen == 0 { return; }
8856 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8860 /// The contents of CResult_NonePaymentSendFailureZ
8861 pub union CResult_NonePaymentSendFailureZPtr {
8862 /// Note that this value is always NULL, as there are no contents in the OK variant
8863 pub result: *mut core::ffi::c_void,
8864 /// A pointer to the contents in the error state.
8865 /// Reading from this pointer when `result_ok` is set is undefined.
8866 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8869 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8870 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8871 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8872 pub struct CResult_NonePaymentSendFailureZ {
8873 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8874 /// `err` or `result` depending on the state of `result_ok`.
8875 pub contents: CResult_NonePaymentSendFailureZPtr,
8876 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8877 pub result_ok: bool,
8880 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8881 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8882 CResult_NonePaymentSendFailureZ {
8883 contents: CResult_NonePaymentSendFailureZPtr {
8884 result: core::ptr::null_mut(),
8890 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8891 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8892 CResult_NonePaymentSendFailureZ {
8893 contents: CResult_NonePaymentSendFailureZPtr {
8894 err: Box::into_raw(Box::new(e)),
8899 /// Checks if the given object is currently in the success state
8901 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8905 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8906 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8907 impl Drop for CResult_NonePaymentSendFailureZ {
8908 fn drop(&mut self) {
8911 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8912 let _ = unsafe { Box::from_raw(self.contents.err) };
8917 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8918 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8919 let contents = if o.result_ok {
8920 let _ = unsafe { Box::from_raw(o.contents.result) };
8921 o.contents.result = core::ptr::null_mut();
8922 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8924 let err = unsafe { o.contents.err };
8925 unsafe { o.contents.err = core::ptr::null_mut(); }
8926 CResult_NonePaymentSendFailureZPtr { err }
8930 result_ok: o.result_ok,
8934 impl Clone for CResult_NonePaymentSendFailureZ {
8935 fn clone(&self) -> Self {
8937 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8938 result: core::ptr::null_mut()
8941 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8942 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8948 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8949 /// but with all dynamically-allocated buffers duplicated in new buffers.
8950 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8952 /// The contents of CResult_NoneRetryableSendFailureZ
8953 pub union CResult_NoneRetryableSendFailureZPtr {
8954 /// Note that this value is always NULL, as there are no contents in the OK variant
8955 pub result: *mut core::ffi::c_void,
8956 /// A pointer to the contents in the error state.
8957 /// Reading from this pointer when `result_ok` is set is undefined.
8958 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8961 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8962 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8964 pub struct CResult_NoneRetryableSendFailureZ {
8965 /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8966 /// `err` or `result` depending on the state of `result_ok`.
8967 pub contents: CResult_NoneRetryableSendFailureZPtr,
8968 /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8969 pub result_ok: bool,
8972 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
8973 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8974 CResult_NoneRetryableSendFailureZ {
8975 contents: CResult_NoneRetryableSendFailureZPtr {
8976 result: core::ptr::null_mut(),
8982 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8983 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8984 CResult_NoneRetryableSendFailureZ {
8985 contents: CResult_NoneRetryableSendFailureZPtr {
8986 err: Box::into_raw(Box::new(e)),
8991 /// Checks if the given object is currently in the success state
8993 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8997 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
8998 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
8999 impl Drop for CResult_NoneRetryableSendFailureZ {
9000 fn drop(&mut self) {
9003 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9004 let _ = unsafe { Box::from_raw(self.contents.err) };
9009 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
9010 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9011 let contents = if o.result_ok {
9012 let _ = unsafe { Box::from_raw(o.contents.result) };
9013 o.contents.result = core::ptr::null_mut();
9014 CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
9016 let err = unsafe { o.contents.err };
9017 unsafe { o.contents.err = core::ptr::null_mut(); }
9018 CResult_NoneRetryableSendFailureZPtr { err }
9022 result_ok: o.result_ok,
9026 impl Clone for CResult_NoneRetryableSendFailureZ {
9027 fn clone(&self) -> Self {
9029 Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
9030 result: core::ptr::null_mut()
9033 Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
9034 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9040 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
9041 /// but with all dynamically-allocated buffers duplicated in new buffers.
9042 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
9044 /// The contents of CResult_PaymentHashPaymentSendFailureZ
9045 pub union CResult_PaymentHashPaymentSendFailureZPtr {
9046 /// A pointer to the contents in the success state.
9047 /// Reading from this pointer when `result_ok` is not set is undefined.
9048 pub result: *mut crate::c_types::ThirtyTwoBytes,
9049 /// A pointer to the contents in the error state.
9050 /// Reading from this pointer when `result_ok` is set is undefined.
9051 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9054 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
9055 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9057 pub struct CResult_PaymentHashPaymentSendFailureZ {
9058 /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
9059 /// `err` or `result` depending on the state of `result_ok`.
9060 pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
9061 /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
9062 pub result_ok: bool,
9065 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
9066 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
9067 CResult_PaymentHashPaymentSendFailureZ {
9068 contents: CResult_PaymentHashPaymentSendFailureZPtr {
9069 result: Box::into_raw(Box::new(o)),
9075 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
9076 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
9077 CResult_PaymentHashPaymentSendFailureZ {
9078 contents: CResult_PaymentHashPaymentSendFailureZPtr {
9079 err: Box::into_raw(Box::new(e)),
9084 /// Checks if the given object is currently in the success state
9086 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool {
9090 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
9091 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
9092 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
9093 fn drop(&mut self) {
9095 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9096 let _ = unsafe { Box::from_raw(self.contents.result) };
9099 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9100 let _ = unsafe { Box::from_raw(self.contents.err) };
9105 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
9106 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9107 let contents = if o.result_ok {
9108 let result = unsafe { o.contents.result };
9109 unsafe { o.contents.result = core::ptr::null_mut() };
9110 CResult_PaymentHashPaymentSendFailureZPtr { result }
9112 let err = unsafe { o.contents.err };
9113 unsafe { o.contents.err = core::ptr::null_mut(); }
9114 CResult_PaymentHashPaymentSendFailureZPtr { err }
9118 result_ok: o.result_ok,
9122 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
9123 fn clone(&self) -> Self {
9125 Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
9126 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9129 Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
9130 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9136 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
9137 /// but with all dynamically-allocated buffers duplicated in new buffers.
9138 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
9140 /// The contents of CResult_PaymentHashRetryableSendFailureZ
9141 pub union CResult_PaymentHashRetryableSendFailureZPtr {
9142 /// A pointer to the contents in the success state.
9143 /// Reading from this pointer when `result_ok` is not set is undefined.
9144 pub result: *mut crate::c_types::ThirtyTwoBytes,
9145 /// A pointer to the contents in the error state.
9146 /// Reading from this pointer when `result_ok` is set is undefined.
9147 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9150 /// A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
9151 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9152 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9153 pub struct CResult_PaymentHashRetryableSendFailureZ {
9154 /// The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
9155 /// `err` or `result` depending on the state of `result_ok`.
9156 pub contents: CResult_PaymentHashRetryableSendFailureZPtr,
9157 /// Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
9158 pub result_ok: bool,
9161 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
9162 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashRetryableSendFailureZ {
9163 CResult_PaymentHashRetryableSendFailureZ {
9164 contents: CResult_PaymentHashRetryableSendFailureZPtr {
9165 result: Box::into_raw(Box::new(o)),
9171 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
9172 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_PaymentHashRetryableSendFailureZ {
9173 CResult_PaymentHashRetryableSendFailureZ {
9174 contents: CResult_PaymentHashRetryableSendFailureZPtr {
9175 err: Box::into_raw(Box::new(e)),
9180 /// Checks if the given object is currently in the success state
9182 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_is_ok(o: &CResult_PaymentHashRetryableSendFailureZ) -> bool {
9186 /// Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
9187 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_free(_res: CResult_PaymentHashRetryableSendFailureZ) { }
9188 impl Drop for CResult_PaymentHashRetryableSendFailureZ {
9189 fn drop(&mut self) {
9191 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9192 let _ = unsafe { Box::from_raw(self.contents.result) };
9195 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9196 let _ = unsafe { Box::from_raw(self.contents.err) };
9201 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_PaymentHashRetryableSendFailureZ {
9202 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9203 let contents = if o.result_ok {
9204 let result = unsafe { o.contents.result };
9205 unsafe { o.contents.result = core::ptr::null_mut() };
9206 CResult_PaymentHashRetryableSendFailureZPtr { result }
9208 let err = unsafe { o.contents.err };
9209 unsafe { o.contents.err = core::ptr::null_mut(); }
9210 CResult_PaymentHashRetryableSendFailureZPtr { err }
9214 result_ok: o.result_ok,
9218 impl Clone for CResult_PaymentHashRetryableSendFailureZ {
9219 fn clone(&self) -> Self {
9221 Self { result_ok: true, contents: CResult_PaymentHashRetryableSendFailureZPtr {
9222 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9225 Self { result_ok: false, contents: CResult_PaymentHashRetryableSendFailureZPtr {
9226 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9232 /// Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
9233 /// but with all dynamically-allocated buffers duplicated in new buffers.
9234 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_clone(orig: &CResult_PaymentHashRetryableSendFailureZ) -> CResult_PaymentHashRetryableSendFailureZ { Clone::clone(&orig) }
9236 /// A tuple of 2 elements. See the individual fields for the types contained.
9237 pub struct C2Tuple_PaymentHashPaymentIdZ {
9238 /// The element at position 0
9239 pub a: crate::c_types::ThirtyTwoBytes,
9240 /// The element at position 1
9241 pub b: crate::c_types::ThirtyTwoBytes,
9243 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
9244 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9251 impl C2Tuple_PaymentHashPaymentIdZ {
9252 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9256 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
9257 fn clone(&self) -> Self {
9259 a: Clone::clone(&self.a),
9260 b: Clone::clone(&self.b),
9265 /// Creates a new tuple which has the same data as `orig`
9266 /// but with all dynamically-allocated buffers duplicated in new buffers.
9267 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
9268 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
9270 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
9271 C2Tuple_PaymentHashPaymentIdZ { a, b, }
9275 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
9276 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
9278 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
9279 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9280 /// A pointer to the contents in the success state.
9281 /// Reading from this pointer when `result_ok` is not set is undefined.
9282 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
9283 /// A pointer to the contents in the error state.
9284 /// Reading from this pointer when `result_ok` is set is undefined.
9285 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9288 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
9289 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9290 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9291 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9292 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
9293 /// `err` or `result` depending on the state of `result_ok`.
9294 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
9295 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
9296 pub result_ok: bool,
9299 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
9300 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9301 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9302 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9303 result: Box::into_raw(Box::new(o)),
9309 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
9310 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9311 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9312 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9313 err: Box::into_raw(Box::new(e)),
9318 /// Checks if the given object is currently in the success state
9320 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
9324 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
9325 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
9326 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9327 fn drop(&mut self) {
9329 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9330 let _ = unsafe { Box::from_raw(self.contents.result) };
9333 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9334 let _ = unsafe { Box::from_raw(self.contents.err) };
9339 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9340 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9341 let contents = if o.result_ok {
9342 let result = unsafe { o.contents.result };
9343 unsafe { o.contents.result = core::ptr::null_mut() };
9344 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
9346 let err = unsafe { o.contents.err };
9347 unsafe { o.contents.err = core::ptr::null_mut(); }
9348 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
9352 result_ok: o.result_ok,
9356 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9357 fn clone(&self) -> Self {
9359 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9360 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
9363 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9364 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9370 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
9371 /// but with all dynamically-allocated buffers duplicated in new buffers.
9372 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
9374 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
9375 /// This corresponds to std::vector in C++
9376 pub struct CVec_ThirtyTwoBytesZ {
9377 /// The elements in the array.
9378 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9379 pub data: *mut crate::c_types::ThirtyTwoBytes,
9380 /// The number of elements pointed to by `data`.
9383 impl CVec_ThirtyTwoBytesZ {
9384 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
9385 if self.datalen == 0 { return Vec::new(); }
9386 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9387 self.data = core::ptr::null_mut();
9391 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
9392 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9395 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
9396 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
9397 let datalen = v.len();
9398 let data = Box::into_raw(v.into_boxed_slice());
9399 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9403 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9404 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
9405 impl Drop for CVec_ThirtyTwoBytesZ {
9406 fn drop(&mut self) {
9407 if self.datalen == 0 { return; }
9408 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9411 impl Clone for CVec_ThirtyTwoBytesZ {
9412 fn clone(&self) -> Self {
9413 let mut res = Vec::new();
9414 if self.datalen == 0 { return Self::from(res); }
9415 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9420 /// A tuple of 2 elements. See the individual fields for the types contained.
9421 pub struct C2Tuple_PaymentHashPaymentSecretZ {
9422 /// The element at position 0
9423 pub a: crate::c_types::ThirtyTwoBytes,
9424 /// The element at position 1
9425 pub b: crate::c_types::ThirtyTwoBytes,
9427 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
9428 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9435 impl C2Tuple_PaymentHashPaymentSecretZ {
9436 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9440 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
9441 fn clone(&self) -> Self {
9443 a: Clone::clone(&self.a),
9444 b: Clone::clone(&self.b),
9449 /// Creates a new tuple which has the same data as `orig`
9450 /// but with all dynamically-allocated buffers duplicated in new buffers.
9451 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
9452 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
9454 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
9455 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
9459 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
9460 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
9462 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
9463 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9464 /// A pointer to the contents in the success state.
9465 /// Reading from this pointer when `result_ok` is not set is undefined.
9466 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
9467 /// Note that this value is always NULL, as there are no contents in the Err variant
9468 pub err: *mut core::ffi::c_void,
9471 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
9472 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
9473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9474 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9475 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
9476 /// `err` or `result` depending on the state of `result_ok`.
9477 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
9478 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
9479 pub result_ok: bool,
9482 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
9483 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9484 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9485 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9486 result: Box::into_raw(Box::new(o)),
9492 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
9493 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9494 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9495 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9496 err: core::ptr::null_mut(),
9501 /// Checks if the given object is currently in the success state
9503 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
9507 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
9508 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
9509 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9510 fn drop(&mut self) {
9512 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9513 let _ = unsafe { Box::from_raw(self.contents.result) };
9519 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9520 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
9521 let contents = if o.result_ok {
9522 let result = unsafe { o.contents.result };
9523 unsafe { o.contents.result = core::ptr::null_mut() };
9524 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
9526 let _ = unsafe { Box::from_raw(o.contents.err) };
9527 o.contents.err = core::ptr::null_mut();
9528 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
9532 result_ok: o.result_ok,
9536 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9537 fn clone(&self) -> Self {
9539 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9540 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9543 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9544 err: core::ptr::null_mut()
9550 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
9551 /// but with all dynamically-allocated buffers duplicated in new buffers.
9552 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
9554 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
9555 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9556 /// A pointer to the contents in the success state.
9557 /// Reading from this pointer when `result_ok` is not set is undefined.
9558 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
9559 /// A pointer to the contents in the error state.
9560 /// Reading from this pointer when `result_ok` is set is undefined.
9561 pub err: *mut crate::lightning::util::errors::APIError,
9564 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
9565 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
9566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9567 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9568 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
9569 /// `err` or `result` depending on the state of `result_ok`.
9570 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
9571 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
9572 pub result_ok: bool,
9575 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
9576 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9577 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9578 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9579 result: Box::into_raw(Box::new(o)),
9585 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
9586 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9587 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9588 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9589 err: Box::into_raw(Box::new(e)),
9594 /// Checks if the given object is currently in the success state
9596 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
9600 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
9601 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
9602 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9603 fn drop(&mut self) {
9605 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9606 let _ = unsafe { Box::from_raw(self.contents.result) };
9609 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9610 let _ = unsafe { Box::from_raw(self.contents.err) };
9615 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9616 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
9617 let contents = if o.result_ok {
9618 let result = unsafe { o.contents.result };
9619 unsafe { o.contents.result = core::ptr::null_mut() };
9620 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
9622 let err = unsafe { o.contents.err };
9623 unsafe { o.contents.err = core::ptr::null_mut(); }
9624 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
9628 result_ok: o.result_ok,
9632 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9633 fn clone(&self) -> Self {
9635 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9636 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9639 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9640 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9646 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
9647 /// but with all dynamically-allocated buffers duplicated in new buffers.
9648 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
9650 /// The contents of CResult_PaymentSecretNoneZ
9651 pub union CResult_PaymentSecretNoneZPtr {
9652 /// A pointer to the contents in the success state.
9653 /// Reading from this pointer when `result_ok` is not set is undefined.
9654 pub result: *mut crate::c_types::ThirtyTwoBytes,
9655 /// Note that this value is always NULL, as there are no contents in the Err variant
9656 pub err: *mut core::ffi::c_void,
9659 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
9660 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
9661 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9662 pub struct CResult_PaymentSecretNoneZ {
9663 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
9664 /// `err` or `result` depending on the state of `result_ok`.
9665 pub contents: CResult_PaymentSecretNoneZPtr,
9666 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
9667 pub result_ok: bool,
9670 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
9671 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
9672 CResult_PaymentSecretNoneZ {
9673 contents: CResult_PaymentSecretNoneZPtr {
9674 result: Box::into_raw(Box::new(o)),
9680 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
9681 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
9682 CResult_PaymentSecretNoneZ {
9683 contents: CResult_PaymentSecretNoneZPtr {
9684 err: core::ptr::null_mut(),
9689 /// Checks if the given object is currently in the success state
9691 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
9695 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
9696 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
9697 impl Drop for CResult_PaymentSecretNoneZ {
9698 fn drop(&mut self) {
9700 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9701 let _ = unsafe { Box::from_raw(self.contents.result) };
9707 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
9708 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
9709 let contents = if o.result_ok {
9710 let result = unsafe { o.contents.result };
9711 unsafe { o.contents.result = core::ptr::null_mut() };
9712 CResult_PaymentSecretNoneZPtr { result }
9714 let _ = unsafe { Box::from_raw(o.contents.err) };
9715 o.contents.err = core::ptr::null_mut();
9716 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
9720 result_ok: o.result_ok,
9724 impl Clone for CResult_PaymentSecretNoneZ {
9725 fn clone(&self) -> Self {
9727 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
9728 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9731 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
9732 err: core::ptr::null_mut()
9738 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
9739 /// but with all dynamically-allocated buffers duplicated in new buffers.
9740 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
9742 /// The contents of CResult_PaymentSecretAPIErrorZ
9743 pub union CResult_PaymentSecretAPIErrorZPtr {
9744 /// A pointer to the contents in the success state.
9745 /// Reading from this pointer when `result_ok` is not set is undefined.
9746 pub result: *mut crate::c_types::ThirtyTwoBytes,
9747 /// A pointer to the contents in the error state.
9748 /// Reading from this pointer when `result_ok` is set is undefined.
9749 pub err: *mut crate::lightning::util::errors::APIError,
9752 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9753 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9754 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9755 pub struct CResult_PaymentSecretAPIErrorZ {
9756 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9757 /// `err` or `result` depending on the state of `result_ok`.
9758 pub contents: CResult_PaymentSecretAPIErrorZPtr,
9759 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9760 pub result_ok: bool,
9763 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9764 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9765 CResult_PaymentSecretAPIErrorZ {
9766 contents: CResult_PaymentSecretAPIErrorZPtr {
9767 result: Box::into_raw(Box::new(o)),
9773 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9774 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9775 CResult_PaymentSecretAPIErrorZ {
9776 contents: CResult_PaymentSecretAPIErrorZPtr {
9777 err: Box::into_raw(Box::new(e)),
9782 /// Checks if the given object is currently in the success state
9784 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
9788 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9789 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9790 impl Drop for CResult_PaymentSecretAPIErrorZ {
9791 fn drop(&mut self) {
9793 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9794 let _ = unsafe { Box::from_raw(self.contents.result) };
9797 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9798 let _ = unsafe { Box::from_raw(self.contents.err) };
9803 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9804 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9805 let contents = if o.result_ok {
9806 let result = unsafe { o.contents.result };
9807 unsafe { o.contents.result = core::ptr::null_mut() };
9808 CResult_PaymentSecretAPIErrorZPtr { result }
9810 let err = unsafe { o.contents.err };
9811 unsafe { o.contents.err = core::ptr::null_mut(); }
9812 CResult_PaymentSecretAPIErrorZPtr { err }
9816 result_ok: o.result_ok,
9820 impl Clone for CResult_PaymentSecretAPIErrorZ {
9821 fn clone(&self) -> Self {
9823 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
9824 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9827 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
9828 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9834 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9835 /// but with all dynamically-allocated buffers duplicated in new buffers.
9836 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
9838 /// The contents of CResult_PaymentPreimageAPIErrorZ
9839 pub union CResult_PaymentPreimageAPIErrorZPtr {
9840 /// A pointer to the contents in the success state.
9841 /// Reading from this pointer when `result_ok` is not set is undefined.
9842 pub result: *mut crate::c_types::ThirtyTwoBytes,
9843 /// A pointer to the contents in the error state.
9844 /// Reading from this pointer when `result_ok` is set is undefined.
9845 pub err: *mut crate::lightning::util::errors::APIError,
9848 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
9849 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9850 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9851 pub struct CResult_PaymentPreimageAPIErrorZ {
9852 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
9853 /// `err` or `result` depending on the state of `result_ok`.
9854 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
9855 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9856 pub result_ok: bool,
9859 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
9860 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
9861 CResult_PaymentPreimageAPIErrorZ {
9862 contents: CResult_PaymentPreimageAPIErrorZPtr {
9863 result: Box::into_raw(Box::new(o)),
9869 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
9870 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
9871 CResult_PaymentPreimageAPIErrorZ {
9872 contents: CResult_PaymentPreimageAPIErrorZPtr {
9873 err: Box::into_raw(Box::new(e)),
9878 /// Checks if the given object is currently in the success state
9880 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
9884 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
9885 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
9886 impl Drop for CResult_PaymentPreimageAPIErrorZ {
9887 fn drop(&mut self) {
9889 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9890 let _ = unsafe { Box::from_raw(self.contents.result) };
9893 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9894 let _ = unsafe { Box::from_raw(self.contents.err) };
9899 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
9900 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9901 let contents = if o.result_ok {
9902 let result = unsafe { o.contents.result };
9903 unsafe { o.contents.result = core::ptr::null_mut() };
9904 CResult_PaymentPreimageAPIErrorZPtr { result }
9906 let err = unsafe { o.contents.err };
9907 unsafe { o.contents.err = core::ptr::null_mut(); }
9908 CResult_PaymentPreimageAPIErrorZPtr { err }
9912 result_ok: o.result_ok,
9916 impl Clone for CResult_PaymentPreimageAPIErrorZ {
9917 fn clone(&self) -> Self {
9919 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
9920 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9923 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
9924 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9930 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
9931 /// but with all dynamically-allocated buffers duplicated in new buffers.
9932 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
9934 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9935 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9936 /// A pointer to the contents in the success state.
9937 /// Reading from this pointer when `result_ok` is not set is undefined.
9938 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9939 /// A pointer to the contents in the error state.
9940 /// Reading from this pointer when `result_ok` is set is undefined.
9941 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9944 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9945 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9946 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9947 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9948 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9949 /// `err` or `result` depending on the state of `result_ok`.
9950 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9951 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9952 pub result_ok: bool,
9955 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9956 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9957 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9958 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9959 result: Box::into_raw(Box::new(o)),
9965 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9966 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9967 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9968 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9969 err: Box::into_raw(Box::new(e)),
9974 /// Checks if the given object is currently in the success state
9976 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9980 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9981 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9982 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9983 fn drop(&mut self) {
9985 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9986 let _ = unsafe { Box::from_raw(self.contents.result) };
9989 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9990 let _ = unsafe { Box::from_raw(self.contents.err) };
9995 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9996 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9997 let contents = if o.result_ok {
9998 let result = unsafe { o.contents.result };
9999 unsafe { o.contents.result = core::ptr::null_mut() };
10000 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
10002 let err = unsafe { o.contents.err };
10003 unsafe { o.contents.err = core::ptr::null_mut(); }
10004 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
10008 result_ok: o.result_ok,
10012 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10013 fn clone(&self) -> Self {
10014 if self.result_ok {
10015 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10016 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
10019 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10020 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10026 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
10027 /// but with all dynamically-allocated buffers duplicated in new buffers.
10028 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
10030 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
10031 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
10032 /// A pointer to the contents in the success state.
10033 /// Reading from this pointer when `result_ok` is not set is undefined.
10034 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
10035 /// A pointer to the contents in the error state.
10036 /// Reading from this pointer when `result_ok` is set is undefined.
10037 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10040 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
10041 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
10042 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10043 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
10044 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
10045 /// `err` or `result` depending on the state of `result_ok`.
10046 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
10047 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
10048 pub result_ok: bool,
10051 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
10052 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
10053 CResult_ChannelCounterpartyDecodeErrorZ {
10054 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10055 result: Box::into_raw(Box::new(o)),
10061 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
10062 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
10063 CResult_ChannelCounterpartyDecodeErrorZ {
10064 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10065 err: Box::into_raw(Box::new(e)),
10070 /// Checks if the given object is currently in the success state
10072 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
10076 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
10077 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
10078 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
10079 fn drop(&mut self) {
10080 if self.result_ok {
10081 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10082 let _ = unsafe { Box::from_raw(self.contents.result) };
10085 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10086 let _ = unsafe { Box::from_raw(self.contents.err) };
10091 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
10092 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
10093 let contents = if o.result_ok {
10094 let result = unsafe { o.contents.result };
10095 unsafe { o.contents.result = core::ptr::null_mut() };
10096 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
10098 let err = unsafe { o.contents.err };
10099 unsafe { o.contents.err = core::ptr::null_mut(); }
10100 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
10104 result_ok: o.result_ok,
10108 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
10109 fn clone(&self) -> Self {
10110 if self.result_ok {
10111 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10112 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
10115 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10116 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10122 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
10123 /// but with all dynamically-allocated buffers duplicated in new buffers.
10124 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
10126 /// The contents of CResult_ChannelDetailsDecodeErrorZ
10127 pub union CResult_ChannelDetailsDecodeErrorZPtr {
10128 /// A pointer to the contents in the success state.
10129 /// Reading from this pointer when `result_ok` is not set is undefined.
10130 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
10131 /// A pointer to the contents in the error state.
10132 /// Reading from this pointer when `result_ok` is set is undefined.
10133 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10136 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
10137 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
10138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10139 pub struct CResult_ChannelDetailsDecodeErrorZ {
10140 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
10141 /// `err` or `result` depending on the state of `result_ok`.
10142 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
10143 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
10144 pub result_ok: bool,
10147 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
10148 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
10149 CResult_ChannelDetailsDecodeErrorZ {
10150 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10151 result: Box::into_raw(Box::new(o)),
10157 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
10158 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
10159 CResult_ChannelDetailsDecodeErrorZ {
10160 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10161 err: Box::into_raw(Box::new(e)),
10166 /// Checks if the given object is currently in the success state
10168 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
10172 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
10173 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
10174 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
10175 fn drop(&mut self) {
10176 if self.result_ok {
10177 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10178 let _ = unsafe { Box::from_raw(self.contents.result) };
10181 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10182 let _ = unsafe { Box::from_raw(self.contents.err) };
10187 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
10188 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
10189 let contents = if o.result_ok {
10190 let result = unsafe { o.contents.result };
10191 unsafe { o.contents.result = core::ptr::null_mut() };
10192 CResult_ChannelDetailsDecodeErrorZPtr { result }
10194 let err = unsafe { o.contents.err };
10195 unsafe { o.contents.err = core::ptr::null_mut(); }
10196 CResult_ChannelDetailsDecodeErrorZPtr { err }
10200 result_ok: o.result_ok,
10204 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
10205 fn clone(&self) -> Self {
10206 if self.result_ok {
10207 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10208 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
10211 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10212 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10218 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
10219 /// but with all dynamically-allocated buffers duplicated in new buffers.
10220 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
10222 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
10223 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
10224 /// A pointer to the contents in the success state.
10225 /// Reading from this pointer when `result_ok` is not set is undefined.
10226 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
10227 /// A pointer to the contents in the error state.
10228 /// Reading from this pointer when `result_ok` is set is undefined.
10229 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10232 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
10233 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
10234 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10235 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
10236 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
10237 /// `err` or `result` depending on the state of `result_ok`.
10238 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
10239 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
10240 pub result_ok: bool,
10243 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
10244 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
10245 CResult_PhantomRouteHintsDecodeErrorZ {
10246 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10247 result: Box::into_raw(Box::new(o)),
10253 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
10254 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
10255 CResult_PhantomRouteHintsDecodeErrorZ {
10256 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10257 err: Box::into_raw(Box::new(e)),
10262 /// Checks if the given object is currently in the success state
10264 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
10268 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
10269 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
10270 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
10271 fn drop(&mut self) {
10272 if self.result_ok {
10273 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10274 let _ = unsafe { Box::from_raw(self.contents.result) };
10277 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10278 let _ = unsafe { Box::from_raw(self.contents.err) };
10283 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
10284 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
10285 let contents = if o.result_ok {
10286 let result = unsafe { o.contents.result };
10287 unsafe { o.contents.result = core::ptr::null_mut() };
10288 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
10290 let err = unsafe { o.contents.err };
10291 unsafe { o.contents.err = core::ptr::null_mut(); }
10292 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
10296 result_ok: o.result_ok,
10300 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
10301 fn clone(&self) -> Self {
10302 if self.result_ok {
10303 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10304 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
10307 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10308 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10314 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
10315 /// but with all dynamically-allocated buffers duplicated in new buffers.
10316 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
10318 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
10319 /// This corresponds to std::vector in C++
10320 pub struct CVec_ChannelMonitorZ {
10321 /// The elements in the array.
10322 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10323 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
10324 /// The number of elements pointed to by `data`.
10327 impl CVec_ChannelMonitorZ {
10328 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
10329 if self.datalen == 0 { return Vec::new(); }
10330 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10331 self.data = core::ptr::null_mut();
10335 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
10336 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10339 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
10340 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
10341 let datalen = v.len();
10342 let data = Box::into_raw(v.into_boxed_slice());
10343 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10347 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10348 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10349 impl Drop for CVec_ChannelMonitorZ {
10350 fn drop(&mut self) {
10351 if self.datalen == 0 { return; }
10352 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10356 /// A tuple of 2 elements. See the individual fields for the types contained.
10357 pub struct C2Tuple_BlockHashChannelManagerZ {
10358 /// The element at position 0
10359 pub a: crate::c_types::ThirtyTwoBytes,
10360 /// The element at position 1
10361 pub b: crate::lightning::ln::channelmanager::ChannelManager,
10363 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
10364 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10371 impl C2Tuple_BlockHashChannelManagerZ {
10372 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10376 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10378 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
10379 C2Tuple_BlockHashChannelManagerZ { a, b, }
10383 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10384 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
10386 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
10387 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10388 /// A pointer to the contents in the success state.
10389 /// Reading from this pointer when `result_ok` is not set is undefined.
10390 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
10391 /// A pointer to the contents in the error state.
10392 /// Reading from this pointer when `result_ok` is set is undefined.
10393 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10396 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10397 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10399 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10400 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
10401 /// `err` or `result` depending on the state of `result_ok`.
10402 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
10403 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
10404 pub result_ok: bool,
10407 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10408 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10409 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10410 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10411 result: Box::into_raw(Box::new(o)),
10417 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10418 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10419 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10420 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10421 err: Box::into_raw(Box::new(e)),
10426 /// Checks if the given object is currently in the success state
10428 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
10432 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10433 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
10434 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10435 fn drop(&mut self) {
10436 if self.result_ok {
10437 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10438 let _ = unsafe { Box::from_raw(self.contents.result) };
10441 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10442 let _ = unsafe { Box::from_raw(self.contents.err) };
10447 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10448 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10449 let contents = if o.result_ok {
10450 let result = unsafe { o.contents.result };
10451 unsafe { o.contents.result = core::ptr::null_mut() };
10452 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
10454 let err = unsafe { o.contents.err };
10455 unsafe { o.contents.err = core::ptr::null_mut(); }
10456 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
10460 result_ok: o.result_ok,
10465 /// The contents of CResult_ChannelConfigDecodeErrorZ
10466 pub union CResult_ChannelConfigDecodeErrorZPtr {
10467 /// A pointer to the contents in the success state.
10468 /// Reading from this pointer when `result_ok` is not set is undefined.
10469 pub result: *mut crate::lightning::util::config::ChannelConfig,
10470 /// A pointer to the contents in the error state.
10471 /// Reading from this pointer when `result_ok` is set is undefined.
10472 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10475 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
10476 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
10477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10478 pub struct CResult_ChannelConfigDecodeErrorZ {
10479 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
10480 /// `err` or `result` depending on the state of `result_ok`.
10481 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
10482 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
10483 pub result_ok: bool,
10486 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10487 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
10488 CResult_ChannelConfigDecodeErrorZ {
10489 contents: CResult_ChannelConfigDecodeErrorZPtr {
10490 result: Box::into_raw(Box::new(o)),
10496 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10497 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
10498 CResult_ChannelConfigDecodeErrorZ {
10499 contents: CResult_ChannelConfigDecodeErrorZPtr {
10500 err: Box::into_raw(Box::new(e)),
10505 /// Checks if the given object is currently in the success state
10507 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
10511 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10512 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
10513 impl Drop for CResult_ChannelConfigDecodeErrorZ {
10514 fn drop(&mut self) {
10515 if self.result_ok {
10516 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10517 let _ = unsafe { Box::from_raw(self.contents.result) };
10520 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10521 let _ = unsafe { Box::from_raw(self.contents.err) };
10526 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
10527 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
10528 let contents = if o.result_ok {
10529 let result = unsafe { o.contents.result };
10530 unsafe { o.contents.result = core::ptr::null_mut() };
10531 CResult_ChannelConfigDecodeErrorZPtr { result }
10533 let err = unsafe { o.contents.err };
10534 unsafe { o.contents.err = core::ptr::null_mut(); }
10535 CResult_ChannelConfigDecodeErrorZPtr { err }
10539 result_ok: o.result_ok,
10543 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10544 fn clone(&self) -> Self {
10545 if self.result_ok {
10546 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10547 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10550 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
10551 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10557 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10558 /// but with all dynamically-allocated buffers duplicated in new buffers.
10559 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
10562 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
10563 pub enum COption_APIErrorZ {
10564 /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
10565 Some(crate::lightning::util::errors::APIError),
10566 /// When we're in this state, this COption_APIErrorZ contains nothing
10569 impl COption_APIErrorZ {
10570 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10571 if let Self::None = self { false } else { true }
10573 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10576 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
10577 if let Self::Some(v) = self { v } else { unreachable!() }
10581 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
10582 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
10583 COption_APIErrorZ::Some(o)
10586 /// Constructs a new COption_APIErrorZ containing nothing
10587 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
10588 COption_APIErrorZ::None
10591 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
10592 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
10594 /// Creates a new COption_APIErrorZ which has the same data as `orig`
10595 /// but with all dynamically-allocated buffers duplicated in new buffers.
10596 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
10598 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
10599 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
10600 /// A pointer to the contents in the success state.
10601 /// Reading from this pointer when `result_ok` is not set is undefined.
10602 pub result: *mut crate::c_types::derived::COption_APIErrorZ,
10603 /// A pointer to the contents in the error state.
10604 /// Reading from this pointer when `result_ok` is set is undefined.
10605 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10608 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
10609 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10611 pub struct CResult_COption_APIErrorZDecodeErrorZ {
10612 /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
10613 /// `err` or `result` depending on the state of `result_ok`.
10614 pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
10615 /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
10616 pub result_ok: bool,
10619 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
10620 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
10621 CResult_COption_APIErrorZDecodeErrorZ {
10622 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10623 result: Box::into_raw(Box::new(o)),
10629 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
10630 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
10631 CResult_COption_APIErrorZDecodeErrorZ {
10632 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10633 err: Box::into_raw(Box::new(e)),
10638 /// Checks if the given object is currently in the success state
10640 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
10644 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
10645 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
10646 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
10647 fn drop(&mut self) {
10648 if self.result_ok {
10649 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10650 let _ = unsafe { Box::from_raw(self.contents.result) };
10653 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10654 let _ = unsafe { Box::from_raw(self.contents.err) };
10659 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
10660 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10661 let contents = if o.result_ok {
10662 let result = unsafe { o.contents.result };
10663 unsafe { o.contents.result = core::ptr::null_mut() };
10664 CResult_COption_APIErrorZDecodeErrorZPtr { result }
10666 let err = unsafe { o.contents.err };
10667 unsafe { o.contents.err = core::ptr::null_mut(); }
10668 CResult_COption_APIErrorZDecodeErrorZPtr { err }
10672 result_ok: o.result_ok,
10676 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
10677 fn clone(&self) -> Self {
10678 if self.result_ok {
10679 Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10680 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
10683 Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10684 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10690 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
10691 /// but with all dynamically-allocated buffers duplicated in new buffers.
10692 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
10694 /// The contents of CResult_UntrustedStringDecodeErrorZ
10695 pub union CResult_UntrustedStringDecodeErrorZPtr {
10696 /// A pointer to the contents in the success state.
10697 /// Reading from this pointer when `result_ok` is not set is undefined.
10698 pub result: *mut crate::lightning::util::string::UntrustedString,
10699 /// A pointer to the contents in the error state.
10700 /// Reading from this pointer when `result_ok` is set is undefined.
10701 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10704 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
10705 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
10706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10707 pub struct CResult_UntrustedStringDecodeErrorZ {
10708 /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
10709 /// `err` or `result` depending on the state of `result_ok`.
10710 pub contents: CResult_UntrustedStringDecodeErrorZPtr,
10711 /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
10712 pub result_ok: bool,
10715 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
10716 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
10717 CResult_UntrustedStringDecodeErrorZ {
10718 contents: CResult_UntrustedStringDecodeErrorZPtr {
10719 result: Box::into_raw(Box::new(o)),
10725 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
10726 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
10727 CResult_UntrustedStringDecodeErrorZ {
10728 contents: CResult_UntrustedStringDecodeErrorZPtr {
10729 err: Box::into_raw(Box::new(e)),
10734 /// Checks if the given object is currently in the success state
10736 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
10740 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
10741 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
10742 impl Drop for CResult_UntrustedStringDecodeErrorZ {
10743 fn drop(&mut self) {
10744 if self.result_ok {
10745 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10746 let _ = unsafe { Box::from_raw(self.contents.result) };
10749 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10750 let _ = unsafe { Box::from_raw(self.contents.err) };
10755 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
10756 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
10757 let contents = if o.result_ok {
10758 let result = unsafe { o.contents.result };
10759 unsafe { o.contents.result = core::ptr::null_mut() };
10760 CResult_UntrustedStringDecodeErrorZPtr { result }
10762 let err = unsafe { o.contents.err };
10763 unsafe { o.contents.err = core::ptr::null_mut(); }
10764 CResult_UntrustedStringDecodeErrorZPtr { err }
10768 result_ok: o.result_ok,
10772 impl Clone for CResult_UntrustedStringDecodeErrorZ {
10773 fn clone(&self) -> Self {
10774 if self.result_ok {
10775 Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
10776 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
10779 Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
10780 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10786 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
10787 /// but with all dynamically-allocated buffers duplicated in new buffers.
10788 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
10790 /// The contents of CResult_OutPointDecodeErrorZ
10791 pub union CResult_OutPointDecodeErrorZPtr {
10792 /// A pointer to the contents in the success state.
10793 /// Reading from this pointer when `result_ok` is not set is undefined.
10794 pub result: *mut crate::lightning::chain::transaction::OutPoint,
10795 /// A pointer to the contents in the error state.
10796 /// Reading from this pointer when `result_ok` is set is undefined.
10797 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10800 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
10801 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
10802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10803 pub struct CResult_OutPointDecodeErrorZ {
10804 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
10805 /// `err` or `result` depending on the state of `result_ok`.
10806 pub contents: CResult_OutPointDecodeErrorZPtr,
10807 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
10808 pub result_ok: bool,
10811 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
10812 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
10813 CResult_OutPointDecodeErrorZ {
10814 contents: CResult_OutPointDecodeErrorZPtr {
10815 result: Box::into_raw(Box::new(o)),
10821 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
10822 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
10823 CResult_OutPointDecodeErrorZ {
10824 contents: CResult_OutPointDecodeErrorZPtr {
10825 err: Box::into_raw(Box::new(e)),
10830 /// Checks if the given object is currently in the success state
10832 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
10836 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
10837 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
10838 impl Drop for CResult_OutPointDecodeErrorZ {
10839 fn drop(&mut self) {
10840 if self.result_ok {
10841 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10842 let _ = unsafe { Box::from_raw(self.contents.result) };
10845 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10846 let _ = unsafe { Box::from_raw(self.contents.err) };
10851 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
10852 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
10853 let contents = if o.result_ok {
10854 let result = unsafe { o.contents.result };
10855 unsafe { o.contents.result = core::ptr::null_mut() };
10856 CResult_OutPointDecodeErrorZPtr { result }
10858 let err = unsafe { o.contents.err };
10859 unsafe { o.contents.err = core::ptr::null_mut(); }
10860 CResult_OutPointDecodeErrorZPtr { err }
10864 result_ok: o.result_ok,
10868 impl Clone for CResult_OutPointDecodeErrorZ {
10869 fn clone(&self) -> Self {
10870 if self.result_ok {
10871 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
10872 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
10875 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
10876 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10882 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10883 /// but with all dynamically-allocated buffers duplicated in new buffers.
10884 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
10886 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
10887 pub enum COption_TypeZ {
10888 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10889 Some(crate::lightning::ln::wire::Type),
10890 /// When we're in this state, this COption_TypeZ contains nothing
10893 impl COption_TypeZ {
10894 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10895 if let Self::None = self { false } else { true }
10897 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10900 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
10901 if let Self::Some(v) = self { v } else { unreachable!() }
10905 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
10906 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
10907 COption_TypeZ::Some(o)
10910 /// Constructs a new COption_TypeZ containing nothing
10911 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
10912 COption_TypeZ::None
10915 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
10916 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
10918 /// The contents of CResult_COption_TypeZDecodeErrorZ
10919 pub union CResult_COption_TypeZDecodeErrorZPtr {
10920 /// A pointer to the contents in the success state.
10921 /// Reading from this pointer when `result_ok` is not set is undefined.
10922 pub result: *mut crate::c_types::derived::COption_TypeZ,
10923 /// A pointer to the contents in the error state.
10924 /// Reading from this pointer when `result_ok` is set is undefined.
10925 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10928 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10929 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10931 pub struct CResult_COption_TypeZDecodeErrorZ {
10932 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10933 /// `err` or `result` depending on the state of `result_ok`.
10934 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
10935 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10936 pub result_ok: bool,
10939 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
10940 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
10941 CResult_COption_TypeZDecodeErrorZ {
10942 contents: CResult_COption_TypeZDecodeErrorZPtr {
10943 result: Box::into_raw(Box::new(o)),
10949 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
10950 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
10951 CResult_COption_TypeZDecodeErrorZ {
10952 contents: CResult_COption_TypeZDecodeErrorZPtr {
10953 err: Box::into_raw(Box::new(e)),
10958 /// Checks if the given object is currently in the success state
10960 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
10964 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
10965 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
10966 impl Drop for CResult_COption_TypeZDecodeErrorZ {
10967 fn drop(&mut self) {
10968 if self.result_ok {
10969 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10970 let _ = unsafe { Box::from_raw(self.contents.result) };
10973 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10974 let _ = unsafe { Box::from_raw(self.contents.err) };
10979 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
10980 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10981 let contents = if o.result_ok {
10982 let result = unsafe { o.contents.result };
10983 unsafe { o.contents.result = core::ptr::null_mut() };
10984 CResult_COption_TypeZDecodeErrorZPtr { result }
10986 let err = unsafe { o.contents.err };
10987 unsafe { o.contents.err = core::ptr::null_mut(); }
10988 CResult_COption_TypeZDecodeErrorZPtr { err }
10992 result_ok: o.result_ok,
10997 /// The contents of CResult_PaymentIdPaymentErrorZ
10998 pub union CResult_PaymentIdPaymentErrorZPtr {
10999 /// A pointer to the contents in the success state.
11000 /// Reading from this pointer when `result_ok` is not set is undefined.
11001 pub result: *mut crate::c_types::ThirtyTwoBytes,
11002 /// A pointer to the contents in the error state.
11003 /// Reading from this pointer when `result_ok` is set is undefined.
11004 pub err: *mut crate::lightning_invoice::payment::PaymentError,
11007 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
11008 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
11009 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11010 pub struct CResult_PaymentIdPaymentErrorZ {
11011 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
11012 /// `err` or `result` depending on the state of `result_ok`.
11013 pub contents: CResult_PaymentIdPaymentErrorZPtr,
11014 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
11015 pub result_ok: bool,
11018 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
11019 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
11020 CResult_PaymentIdPaymentErrorZ {
11021 contents: CResult_PaymentIdPaymentErrorZPtr {
11022 result: Box::into_raw(Box::new(o)),
11028 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
11029 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
11030 CResult_PaymentIdPaymentErrorZ {
11031 contents: CResult_PaymentIdPaymentErrorZPtr {
11032 err: Box::into_raw(Box::new(e)),
11037 /// Checks if the given object is currently in the success state
11039 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
11043 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
11044 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
11045 impl Drop for CResult_PaymentIdPaymentErrorZ {
11046 fn drop(&mut self) {
11047 if self.result_ok {
11048 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11049 let _ = unsafe { Box::from_raw(self.contents.result) };
11052 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11053 let _ = unsafe { Box::from_raw(self.contents.err) };
11058 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
11059 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
11060 let contents = if o.result_ok {
11061 let result = unsafe { o.contents.result };
11062 unsafe { o.contents.result = core::ptr::null_mut() };
11063 CResult_PaymentIdPaymentErrorZPtr { result }
11065 let err = unsafe { o.contents.err };
11066 unsafe { o.contents.err = core::ptr::null_mut(); }
11067 CResult_PaymentIdPaymentErrorZPtr { err }
11071 result_ok: o.result_ok,
11075 impl Clone for CResult_PaymentIdPaymentErrorZ {
11076 fn clone(&self) -> Self {
11077 if self.result_ok {
11078 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
11079 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
11082 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
11083 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
11089 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
11090 /// but with all dynamically-allocated buffers duplicated in new buffers.
11091 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
11093 /// The contents of CResult_NonePaymentErrorZ
11094 pub union CResult_NonePaymentErrorZPtr {
11095 /// Note that this value is always NULL, as there are no contents in the OK variant
11096 pub result: *mut core::ffi::c_void,
11097 /// A pointer to the contents in the error state.
11098 /// Reading from this pointer when `result_ok` is set is undefined.
11099 pub err: *mut crate::lightning_invoice::payment::PaymentError,
11102 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
11103 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
11104 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11105 pub struct CResult_NonePaymentErrorZ {
11106 /// The contents of this CResult_NonePaymentErrorZ, accessible via either
11107 /// `err` or `result` depending on the state of `result_ok`.
11108 pub contents: CResult_NonePaymentErrorZPtr,
11109 /// Whether this CResult_NonePaymentErrorZ represents a success state.
11110 pub result_ok: bool,
11113 /// Creates a new CResult_NonePaymentErrorZ in the success state.
11114 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
11115 CResult_NonePaymentErrorZ {
11116 contents: CResult_NonePaymentErrorZPtr {
11117 result: core::ptr::null_mut(),
11123 /// Creates a new CResult_NonePaymentErrorZ in the error state.
11124 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
11125 CResult_NonePaymentErrorZ {
11126 contents: CResult_NonePaymentErrorZPtr {
11127 err: Box::into_raw(Box::new(e)),
11132 /// Checks if the given object is currently in the success state
11134 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
11138 /// Frees any resources used by the CResult_NonePaymentErrorZ.
11139 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
11140 impl Drop for CResult_NonePaymentErrorZ {
11141 fn drop(&mut self) {
11142 if self.result_ok {
11144 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11145 let _ = unsafe { Box::from_raw(self.contents.err) };
11150 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
11151 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
11152 let contents = if o.result_ok {
11153 let _ = unsafe { Box::from_raw(o.contents.result) };
11154 o.contents.result = core::ptr::null_mut();
11155 CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
11157 let err = unsafe { o.contents.err };
11158 unsafe { o.contents.err = core::ptr::null_mut(); }
11159 CResult_NonePaymentErrorZPtr { err }
11163 result_ok: o.result_ok,
11167 impl Clone for CResult_NonePaymentErrorZ {
11168 fn clone(&self) -> Self {
11169 if self.result_ok {
11170 Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
11171 result: core::ptr::null_mut()
11174 Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
11175 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
11181 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
11182 /// but with all dynamically-allocated buffers duplicated in new buffers.
11183 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
11185 /// The contents of CResult_StringErrorZ
11186 pub union CResult_StringErrorZPtr {
11187 /// A pointer to the contents in the success state.
11188 /// Reading from this pointer when `result_ok` is not set is undefined.
11189 pub result: *mut crate::c_types::Str,
11190 /// A pointer to the contents in the error state.
11191 /// Reading from this pointer when `result_ok` is set is undefined.
11192 pub err: *mut crate::c_types::Secp256k1Error,
11195 /// A CResult_StringErrorZ represents the result of a fallible operation,
11196 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
11197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11198 pub struct CResult_StringErrorZ {
11199 /// The contents of this CResult_StringErrorZ, accessible via either
11200 /// `err` or `result` depending on the state of `result_ok`.
11201 pub contents: CResult_StringErrorZPtr,
11202 /// Whether this CResult_StringErrorZ represents a success state.
11203 pub result_ok: bool,
11206 /// Creates a new CResult_StringErrorZ in the success state.
11207 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
11208 CResult_StringErrorZ {
11209 contents: CResult_StringErrorZPtr {
11210 result: Box::into_raw(Box::new(o)),
11216 /// Creates a new CResult_StringErrorZ in the error state.
11217 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
11218 CResult_StringErrorZ {
11219 contents: CResult_StringErrorZPtr {
11220 err: Box::into_raw(Box::new(e)),
11225 /// Checks if the given object is currently in the success state
11227 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
11231 /// Frees any resources used by the CResult_StringErrorZ.
11232 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
11233 impl Drop for CResult_StringErrorZ {
11234 fn drop(&mut self) {
11235 if self.result_ok {
11236 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11237 let _ = unsafe { Box::from_raw(self.contents.result) };
11240 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11241 let _ = unsafe { Box::from_raw(self.contents.err) };
11246 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
11247 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
11248 let contents = if o.result_ok {
11249 let result = unsafe { o.contents.result };
11250 unsafe { o.contents.result = core::ptr::null_mut() };
11251 CResult_StringErrorZPtr { result }
11253 let err = unsafe { o.contents.err };
11254 unsafe { o.contents.err = core::ptr::null_mut(); }
11255 CResult_StringErrorZPtr { err }
11259 result_ok: o.result_ok,
11263 impl Clone for CResult_StringErrorZ {
11264 fn clone(&self) -> Self {
11265 if self.result_ok {
11266 Self { result_ok: true, contents: CResult_StringErrorZPtr {
11267 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
11270 Self { result_ok: false, contents: CResult_StringErrorZPtr {
11271 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
11277 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
11278 /// but with all dynamically-allocated buffers duplicated in new buffers.
11279 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
11281 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
11282 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11283 /// A pointer to the contents in the success state.
11284 /// Reading from this pointer when `result_ok` is not set is undefined.
11285 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
11286 /// A pointer to the contents in the error state.
11287 /// Reading from this pointer when `result_ok` is set is undefined.
11288 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11291 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
11292 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11294 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
11295 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
11296 /// `err` or `result` depending on the state of `result_ok`.
11297 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
11298 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
11299 pub result_ok: bool,
11302 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
11303 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11304 CResult_ChannelMonitorUpdateDecodeErrorZ {
11305 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11306 result: Box::into_raw(Box::new(o)),
11312 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
11313 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11314 CResult_ChannelMonitorUpdateDecodeErrorZ {
11315 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11316 err: Box::into_raw(Box::new(e)),
11321 /// Checks if the given object is currently in the success state
11323 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
11327 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
11328 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
11329 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
11330 fn drop(&mut self) {
11331 if self.result_ok {
11332 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11333 let _ = unsafe { Box::from_raw(self.contents.result) };
11336 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11337 let _ = unsafe { Box::from_raw(self.contents.err) };
11342 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
11343 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11344 let contents = if o.result_ok {
11345 let result = unsafe { o.contents.result };
11346 unsafe { o.contents.result = core::ptr::null_mut() };
11347 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
11349 let err = unsafe { o.contents.err };
11350 unsafe { o.contents.err = core::ptr::null_mut(); }
11351 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
11355 result_ok: o.result_ok,
11359 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
11360 fn clone(&self) -> Self {
11361 if self.result_ok {
11362 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11363 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
11366 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11367 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11373 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
11374 /// but with all dynamically-allocated buffers duplicated in new buffers.
11375 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
11378 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
11379 pub enum COption_MonitorEventZ {
11380 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
11381 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
11382 /// When we're in this state, this COption_MonitorEventZ contains nothing
11385 impl COption_MonitorEventZ {
11386 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11387 if let Self::None = self { false } else { true }
11389 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11392 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
11393 if let Self::Some(v) = self { v } else { unreachable!() }
11397 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
11398 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
11399 COption_MonitorEventZ::Some(o)
11402 /// Constructs a new COption_MonitorEventZ containing nothing
11403 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
11404 COption_MonitorEventZ::None
11407 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
11408 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
11410 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
11411 /// but with all dynamically-allocated buffers duplicated in new buffers.
11412 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
11414 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
11415 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
11416 /// A pointer to the contents in the success state.
11417 /// Reading from this pointer when `result_ok` is not set is undefined.
11418 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
11419 /// A pointer to the contents in the error state.
11420 /// Reading from this pointer when `result_ok` is set is undefined.
11421 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11424 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
11425 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11427 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
11428 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
11429 /// `err` or `result` depending on the state of `result_ok`.
11430 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
11431 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
11432 pub result_ok: bool,
11435 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
11436 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
11437 CResult_COption_MonitorEventZDecodeErrorZ {
11438 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11439 result: Box::into_raw(Box::new(o)),
11445 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
11446 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
11447 CResult_COption_MonitorEventZDecodeErrorZ {
11448 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11449 err: Box::into_raw(Box::new(e)),
11454 /// Checks if the given object is currently in the success state
11456 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
11460 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
11461 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
11462 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
11463 fn drop(&mut self) {
11464 if self.result_ok {
11465 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11466 let _ = unsafe { Box::from_raw(self.contents.result) };
11469 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11470 let _ = unsafe { Box::from_raw(self.contents.err) };
11475 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
11476 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11477 let contents = if o.result_ok {
11478 let result = unsafe { o.contents.result };
11479 unsafe { o.contents.result = core::ptr::null_mut() };
11480 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
11482 let err = unsafe { o.contents.err };
11483 unsafe { o.contents.err = core::ptr::null_mut(); }
11484 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
11488 result_ok: o.result_ok,
11492 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
11493 fn clone(&self) -> Self {
11494 if self.result_ok {
11495 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11496 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
11499 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11500 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11506 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
11507 /// but with all dynamically-allocated buffers duplicated in new buffers.
11508 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
11510 /// The contents of CResult_HTLCUpdateDecodeErrorZ
11511 pub union CResult_HTLCUpdateDecodeErrorZPtr {
11512 /// A pointer to the contents in the success state.
11513 /// Reading from this pointer when `result_ok` is not set is undefined.
11514 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
11515 /// A pointer to the contents in the error state.
11516 /// Reading from this pointer when `result_ok` is set is undefined.
11517 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11520 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
11521 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11522 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11523 pub struct CResult_HTLCUpdateDecodeErrorZ {
11524 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
11525 /// `err` or `result` depending on the state of `result_ok`.
11526 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
11527 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
11528 pub result_ok: bool,
11531 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11532 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11533 CResult_HTLCUpdateDecodeErrorZ {
11534 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11535 result: Box::into_raw(Box::new(o)),
11541 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11542 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11543 CResult_HTLCUpdateDecodeErrorZ {
11544 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11545 err: Box::into_raw(Box::new(e)),
11550 /// Checks if the given object is currently in the success state
11552 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11556 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11557 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11558 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11559 fn drop(&mut self) {
11560 if self.result_ok {
11561 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11562 let _ = unsafe { Box::from_raw(self.contents.result) };
11565 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11566 let _ = unsafe { Box::from_raw(self.contents.err) };
11571 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11572 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11573 let contents = if o.result_ok {
11574 let result = unsafe { o.contents.result };
11575 unsafe { o.contents.result = core::ptr::null_mut() };
11576 CResult_HTLCUpdateDecodeErrorZPtr { result }
11578 let err = unsafe { o.contents.err };
11579 unsafe { o.contents.err = core::ptr::null_mut(); }
11580 CResult_HTLCUpdateDecodeErrorZPtr { err }
11584 result_ok: o.result_ok,
11588 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11589 fn clone(&self) -> Self {
11590 if self.result_ok {
11591 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11592 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11595 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11596 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11602 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11603 /// but with all dynamically-allocated buffers duplicated in new buffers.
11604 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11606 /// A tuple of 2 elements. See the individual fields for the types contained.
11607 pub struct C2Tuple_OutPointScriptZ {
11608 /// The element at position 0
11609 pub a: crate::lightning::chain::transaction::OutPoint,
11610 /// The element at position 1
11611 pub b: crate::c_types::derived::CVec_u8Z,
11613 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11614 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11621 impl C2Tuple_OutPointScriptZ {
11622 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11626 impl Clone for C2Tuple_OutPointScriptZ {
11627 fn clone(&self) -> Self {
11629 a: Clone::clone(&self.a),
11630 b: Clone::clone(&self.b),
11635 /// Creates a new tuple which has the same data as `orig`
11636 /// but with all dynamically-allocated buffers duplicated in new buffers.
11637 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11638 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11640 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11641 C2Tuple_OutPointScriptZ { a, b, }
11645 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11646 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11648 /// A tuple of 2 elements. See the individual fields for the types contained.
11649 pub struct C2Tuple_u32ScriptZ {
11650 /// The element at position 0
11652 /// The element at position 1
11653 pub b: crate::c_types::derived::CVec_u8Z,
11655 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11656 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11663 impl C2Tuple_u32ScriptZ {
11664 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11668 impl Clone for C2Tuple_u32ScriptZ {
11669 fn clone(&self) -> Self {
11671 a: Clone::clone(&self.a),
11672 b: Clone::clone(&self.b),
11677 /// Creates a new tuple which has the same data as `orig`
11678 /// but with all dynamically-allocated buffers duplicated in new buffers.
11679 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11680 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11682 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11683 C2Tuple_u32ScriptZ { a, b, }
11687 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11688 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11690 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11691 /// This corresponds to std::vector in C++
11692 pub struct CVec_C2Tuple_u32ScriptZZ {
11693 /// The elements in the array.
11694 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11695 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11696 /// The number of elements pointed to by `data`.
11699 impl CVec_C2Tuple_u32ScriptZZ {
11700 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11701 if self.datalen == 0 { return Vec::new(); }
11702 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11703 self.data = core::ptr::null_mut();
11707 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11708 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11711 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11712 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11713 let datalen = v.len();
11714 let data = Box::into_raw(v.into_boxed_slice());
11715 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11719 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11720 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11721 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11722 fn drop(&mut self) {
11723 if self.datalen == 0 { return; }
11724 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11727 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11728 fn clone(&self) -> Self {
11729 let mut res = Vec::new();
11730 if self.datalen == 0 { return Self::from(res); }
11731 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11736 /// A tuple of 2 elements. See the individual fields for the types contained.
11737 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11738 /// The element at position 0
11739 pub a: crate::c_types::ThirtyTwoBytes,
11740 /// The element at position 1
11741 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11743 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11744 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11751 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11752 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11756 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11757 fn clone(&self) -> Self {
11759 a: Clone::clone(&self.a),
11760 b: Clone::clone(&self.b),
11765 /// Creates a new tuple which has the same data as `orig`
11766 /// but with all dynamically-allocated buffers duplicated in new buffers.
11767 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11768 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11770 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11771 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11775 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11776 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11778 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11779 /// This corresponds to std::vector in C++
11780 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11781 /// The elements in the array.
11782 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11783 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11784 /// The number of elements pointed to by `data`.
11787 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11788 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11789 if self.datalen == 0 { return Vec::new(); }
11790 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11791 self.data = core::ptr::null_mut();
11795 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11796 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11799 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11800 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11801 let datalen = v.len();
11802 let data = Box::into_raw(v.into_boxed_slice());
11803 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11807 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11808 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11809 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11810 fn drop(&mut self) {
11811 if self.datalen == 0 { return; }
11812 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11815 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11816 fn clone(&self) -> Self {
11817 let mut res = Vec::new();
11818 if self.datalen == 0 { return Self::from(res); }
11819 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11824 /// A dynamically-allocated array of crate::lightning::events::Events of arbitrary size.
11825 /// This corresponds to std::vector in C++
11826 pub struct CVec_EventZ {
11827 /// The elements in the array.
11828 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11829 pub data: *mut crate::lightning::events::Event,
11830 /// The number of elements pointed to by `data`.
11834 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::Event> {
11835 if self.datalen == 0 { return Vec::new(); }
11836 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11837 self.data = core::ptr::null_mut();
11841 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::Event] {
11842 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11845 impl From<Vec<crate::lightning::events::Event>> for CVec_EventZ {
11846 fn from(v: Vec<crate::lightning::events::Event>) -> Self {
11847 let datalen = v.len();
11848 let data = Box::into_raw(v.into_boxed_slice());
11849 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11853 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11854 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11855 impl Drop for CVec_EventZ {
11856 fn drop(&mut self) {
11857 if self.datalen == 0 { return; }
11858 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11861 impl Clone for CVec_EventZ {
11862 fn clone(&self) -> Self {
11863 let mut res = Vec::new();
11864 if self.datalen == 0 { return Self::from(res); }
11865 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11870 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11871 /// This corresponds to std::vector in C++
11872 pub struct CVec_TransactionZ {
11873 /// The elements in the array.
11874 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11875 pub data: *mut crate::c_types::Transaction,
11876 /// The number of elements pointed to by `data`.
11879 impl CVec_TransactionZ {
11880 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11881 if self.datalen == 0 { return Vec::new(); }
11882 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11883 self.data = core::ptr::null_mut();
11887 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11888 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11891 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11892 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11893 let datalen = v.len();
11894 let data = Box::into_raw(v.into_boxed_slice());
11895 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11899 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11900 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11901 impl Drop for CVec_TransactionZ {
11902 fn drop(&mut self) {
11903 if self.datalen == 0 { return; }
11904 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11907 impl Clone for CVec_TransactionZ {
11908 fn clone(&self) -> Self {
11909 let mut res = Vec::new();
11910 if self.datalen == 0 { return Self::from(res); }
11911 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11916 /// A tuple of 2 elements. See the individual fields for the types contained.
11917 pub struct C2Tuple_u32TxOutZ {
11918 /// The element at position 0
11920 /// The element at position 1
11921 pub b: crate::c_types::TxOut,
11923 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11924 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11931 impl C2Tuple_u32TxOutZ {
11932 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11936 impl Clone for C2Tuple_u32TxOutZ {
11937 fn clone(&self) -> Self {
11939 a: Clone::clone(&self.a),
11940 b: Clone::clone(&self.b),
11945 /// Creates a new tuple which has the same data as `orig`
11946 /// but with all dynamically-allocated buffers duplicated in new buffers.
11947 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11948 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11950 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11951 C2Tuple_u32TxOutZ { a, b, }
11955 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11956 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11958 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11959 /// This corresponds to std::vector in C++
11960 pub struct CVec_C2Tuple_u32TxOutZZ {
11961 /// The elements in the array.
11962 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11963 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11964 /// The number of elements pointed to by `data`.
11967 impl CVec_C2Tuple_u32TxOutZZ {
11968 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11969 if self.datalen == 0 { return Vec::new(); }
11970 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11971 self.data = core::ptr::null_mut();
11975 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11976 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11979 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11980 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11981 let datalen = v.len();
11982 let data = Box::into_raw(v.into_boxed_slice());
11983 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11987 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11988 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11989 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11990 fn drop(&mut self) {
11991 if self.datalen == 0 { return; }
11992 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11995 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11996 fn clone(&self) -> Self {
11997 let mut res = Vec::new();
11998 if self.datalen == 0 { return Self::from(res); }
11999 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12004 /// A tuple of 2 elements. See the individual fields for the types contained.
12005 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12006 /// The element at position 0
12007 pub a: crate::c_types::ThirtyTwoBytes,
12008 /// The element at position 1
12009 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
12011 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12012 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
12019 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12020 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
12024 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12025 fn clone(&self) -> Self {
12027 a: Clone::clone(&self.a),
12028 b: Clone::clone(&self.b),
12033 /// Creates a new tuple which has the same data as `orig`
12034 /// but with all dynamically-allocated buffers duplicated in new buffers.
12035 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
12036 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12038 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12039 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
12043 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
12044 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
12046 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12047 /// This corresponds to std::vector in C++
12048 pub struct CVec_TransactionOutputsZ {
12049 /// The elements in the array.
12050 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12051 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
12052 /// The number of elements pointed to by `data`.
12055 impl CVec_TransactionOutputsZ {
12056 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
12057 if self.datalen == 0 { return Vec::new(); }
12058 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12059 self.data = core::ptr::null_mut();
12063 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
12064 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12067 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
12068 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
12069 let datalen = v.len();
12070 let data = Box::into_raw(v.into_boxed_slice());
12071 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12075 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12076 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
12077 impl Drop for CVec_TransactionOutputsZ {
12078 fn drop(&mut self) {
12079 if self.datalen == 0 { return; }
12080 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12083 impl Clone for CVec_TransactionOutputsZ {
12084 fn clone(&self) -> Self {
12085 let mut res = Vec::new();
12086 if self.datalen == 0 { return Self::from(res); }
12087 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12092 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
12093 /// This corresponds to std::vector in C++
12094 pub struct CVec_BalanceZ {
12095 /// The elements in the array.
12096 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12097 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
12098 /// The number of elements pointed to by `data`.
12101 impl CVec_BalanceZ {
12102 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12103 if self.datalen == 0 { return Vec::new(); }
12104 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12105 self.data = core::ptr::null_mut();
12109 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
12110 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12113 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
12114 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
12115 let datalen = v.len();
12116 let data = Box::into_raw(v.into_boxed_slice());
12117 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12121 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12122 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
12123 impl Drop for CVec_BalanceZ {
12124 fn drop(&mut self) {
12125 if self.datalen == 0 { return; }
12126 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12129 impl Clone for CVec_BalanceZ {
12130 fn clone(&self) -> Self {
12131 let mut res = Vec::new();
12132 if self.datalen == 0 { return Self::from(res); }
12133 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12138 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
12139 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12140 /// A pointer to the contents in the success state.
12141 /// Reading from this pointer when `result_ok` is not set is undefined.
12142 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
12143 /// A pointer to the contents in the error state.
12144 /// Reading from this pointer when `result_ok` is set is undefined.
12145 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12148 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
12149 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12151 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12152 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
12153 /// `err` or `result` depending on the state of `result_ok`.
12154 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
12155 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
12156 pub result_ok: bool,
12159 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
12160 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12161 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12162 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12163 result: Box::into_raw(Box::new(o)),
12169 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
12170 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12171 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12172 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12173 err: Box::into_raw(Box::new(e)),
12178 /// Checks if the given object is currently in the success state
12180 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
12184 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
12185 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
12186 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12187 fn drop(&mut self) {
12188 if self.result_ok {
12189 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12190 let _ = unsafe { Box::from_raw(self.contents.result) };
12193 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12194 let _ = unsafe { Box::from_raw(self.contents.err) };
12199 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12200 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12201 let contents = if o.result_ok {
12202 let result = unsafe { o.contents.result };
12203 unsafe { o.contents.result = core::ptr::null_mut() };
12204 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
12206 let err = unsafe { o.contents.err };
12207 unsafe { o.contents.err = core::ptr::null_mut(); }
12208 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
12212 result_ok: o.result_ok,
12217 /// A tuple of 2 elements. See the individual fields for the types contained.
12218 pub struct C2Tuple_PublicKeyTypeZ {
12219 /// The element at position 0
12220 pub a: crate::c_types::PublicKey,
12221 /// The element at position 1
12222 pub b: crate::lightning::ln::wire::Type,
12224 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
12225 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
12232 impl C2Tuple_PublicKeyTypeZ {
12233 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
12237 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12239 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
12240 C2Tuple_PublicKeyTypeZ { a, b, }
12244 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12245 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
12247 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
12248 /// This corresponds to std::vector in C++
12249 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
12250 /// The elements in the array.
12251 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12252 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
12253 /// The number of elements pointed to by `data`.
12256 impl CVec_C2Tuple_PublicKeyTypeZZ {
12257 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
12258 if self.datalen == 0 { return Vec::new(); }
12259 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12260 self.data = core::ptr::null_mut();
12264 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
12265 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12268 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
12269 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
12270 let datalen = v.len();
12271 let data = Box::into_raw(v.into_boxed_slice());
12272 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12276 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12277 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
12278 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
12279 fn drop(&mut self) {
12280 if self.datalen == 0 { return; }
12281 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12285 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
12286 pub enum COption_CustomOnionMessageContentsZ {
12287 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
12288 Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
12289 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
12292 impl COption_CustomOnionMessageContentsZ {
12293 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12294 if let Self::None = self { false } else { true }
12296 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12299 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
12300 if let Self::Some(v) = self { v } else { unreachable!() }
12304 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
12305 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
12306 COption_CustomOnionMessageContentsZ::Some(o)
12309 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
12310 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
12311 COption_CustomOnionMessageContentsZ::None
12314 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
12315 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
12317 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
12318 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12319 /// A pointer to the contents in the success state.
12320 /// Reading from this pointer when `result_ok` is not set is undefined.
12321 pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
12322 /// A pointer to the contents in the error state.
12323 /// Reading from this pointer when `result_ok` is set is undefined.
12324 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12327 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
12328 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12330 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12331 /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
12332 /// `err` or `result` depending on the state of `result_ok`.
12333 pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
12334 /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
12335 pub result_ok: bool,
12338 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
12339 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12340 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12341 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12342 result: Box::into_raw(Box::new(o)),
12348 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
12349 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12350 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12351 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12352 err: Box::into_raw(Box::new(e)),
12357 /// Checks if the given object is currently in the success state
12359 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
12363 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
12364 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
12365 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12366 fn drop(&mut self) {
12367 if self.result_ok {
12368 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12369 let _ = unsafe { Box::from_raw(self.contents.result) };
12372 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12373 let _ = unsafe { Box::from_raw(self.contents.err) };
12378 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12379 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12380 let contents = if o.result_ok {
12381 let result = unsafe { o.contents.result };
12382 unsafe { o.contents.result = core::ptr::null_mut() };
12383 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
12385 let err = unsafe { o.contents.err };
12386 unsafe { o.contents.err = core::ptr::null_mut(); }
12387 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
12391 result_ok: o.result_ok,
12397 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
12398 pub enum COption_NetAddressZ {
12399 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
12400 Some(crate::lightning::ln::msgs::NetAddress),
12401 /// When we're in this state, this COption_NetAddressZ contains nothing
12404 impl COption_NetAddressZ {
12405 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12406 if let Self::None = self { false } else { true }
12408 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12411 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
12412 if let Self::Some(v) = self { v } else { unreachable!() }
12416 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
12417 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
12418 COption_NetAddressZ::Some(o)
12421 /// Constructs a new COption_NetAddressZ containing nothing
12422 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
12423 COption_NetAddressZ::None
12426 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
12427 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
12429 /// Creates a new COption_NetAddressZ which has the same data as `orig`
12430 /// but with all dynamically-allocated buffers duplicated in new buffers.
12431 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
12433 /// A tuple of 2 elements. See the individual fields for the types contained.
12434 pub struct C2Tuple_PublicKeyCOption_NetAddressZZ {
12435 /// The element at position 0
12436 pub a: crate::c_types::PublicKey,
12437 /// The element at position 1
12438 pub b: crate::c_types::derived::COption_NetAddressZ,
12440 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)> for C2Tuple_PublicKeyCOption_NetAddressZZ {
12441 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)) -> Self {
12448 impl C2Tuple_PublicKeyCOption_NetAddressZZ {
12449 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ) {
12453 impl Clone for C2Tuple_PublicKeyCOption_NetAddressZZ {
12454 fn clone(&self) -> Self {
12456 a: Clone::clone(&self.a),
12457 b: Clone::clone(&self.b),
12462 /// Creates a new tuple which has the same data as `orig`
12463 /// but with all dynamically-allocated buffers duplicated in new buffers.
12464 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_NetAddressZZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ { Clone::clone(&orig) }
12465 /// Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
12467 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_NetAddressZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ {
12468 C2Tuple_PublicKeyCOption_NetAddressZZ { a, b, }
12472 /// Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
12473 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res: C2Tuple_PublicKeyCOption_NetAddressZZ) { }
12475 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
12476 /// This corresponds to std::vector in C++
12477 pub struct CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12478 /// The elements in the array.
12479 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12480 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ,
12481 /// The number of elements pointed to by `data`.
12484 impl CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12485 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ> {
12486 if self.datalen == 0 { return Vec::new(); }
12487 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12488 self.data = core::ptr::null_mut();
12492 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ] {
12493 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12496 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12497 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>) -> Self {
12498 let datalen = v.len();
12499 let data = Box::into_raw(v.into_boxed_slice());
12500 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12504 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12505 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ) { }
12506 impl Drop for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12507 fn drop(&mut self) {
12508 if self.datalen == 0 { return; }
12509 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12512 impl Clone for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12513 fn clone(&self) -> Self {
12514 let mut res = Vec::new();
12515 if self.datalen == 0 { return Self::from(res); }
12516 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12521 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12522 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12523 /// A pointer to the contents in the success state.
12524 /// Reading from this pointer when `result_ok` is not set is undefined.
12525 pub result: *mut crate::c_types::derived::CVec_u8Z,
12526 /// A pointer to the contents in the error state.
12527 /// Reading from this pointer when `result_ok` is set is undefined.
12528 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12531 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12532 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12533 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12534 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12535 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12536 /// `err` or `result` depending on the state of `result_ok`.
12537 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12538 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12539 pub result_ok: bool,
12542 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12543 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12544 CResult_CVec_u8ZPeerHandleErrorZ {
12545 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12546 result: Box::into_raw(Box::new(o)),
12552 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12553 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12554 CResult_CVec_u8ZPeerHandleErrorZ {
12555 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12556 err: Box::into_raw(Box::new(e)),
12561 /// Checks if the given object is currently in the success state
12563 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12567 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12568 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12569 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12570 fn drop(&mut self) {
12571 if self.result_ok {
12572 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12573 let _ = unsafe { Box::from_raw(self.contents.result) };
12576 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12577 let _ = unsafe { Box::from_raw(self.contents.err) };
12582 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12583 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12584 let contents = if o.result_ok {
12585 let result = unsafe { o.contents.result };
12586 unsafe { o.contents.result = core::ptr::null_mut() };
12587 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12589 let err = unsafe { o.contents.err };
12590 unsafe { o.contents.err = core::ptr::null_mut(); }
12591 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12595 result_ok: o.result_ok,
12599 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12600 fn clone(&self) -> Self {
12601 if self.result_ok {
12602 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12603 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12606 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12607 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12613 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12614 /// but with all dynamically-allocated buffers duplicated in new buffers.
12615 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12617 /// The contents of CResult_NonePeerHandleErrorZ
12618 pub union CResult_NonePeerHandleErrorZPtr {
12619 /// Note that this value is always NULL, as there are no contents in the OK variant
12620 pub result: *mut core::ffi::c_void,
12621 /// A pointer to the contents in the error state.
12622 /// Reading from this pointer when `result_ok` is set is undefined.
12623 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12626 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12627 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12628 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12629 pub struct CResult_NonePeerHandleErrorZ {
12630 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12631 /// `err` or `result` depending on the state of `result_ok`.
12632 pub contents: CResult_NonePeerHandleErrorZPtr,
12633 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12634 pub result_ok: bool,
12637 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12638 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12639 CResult_NonePeerHandleErrorZ {
12640 contents: CResult_NonePeerHandleErrorZPtr {
12641 result: core::ptr::null_mut(),
12647 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12648 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12649 CResult_NonePeerHandleErrorZ {
12650 contents: CResult_NonePeerHandleErrorZPtr {
12651 err: Box::into_raw(Box::new(e)),
12656 /// Checks if the given object is currently in the success state
12658 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12662 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12663 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12664 impl Drop for CResult_NonePeerHandleErrorZ {
12665 fn drop(&mut self) {
12666 if self.result_ok {
12668 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12669 let _ = unsafe { Box::from_raw(self.contents.err) };
12674 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12675 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12676 let contents = if o.result_ok {
12677 let _ = unsafe { Box::from_raw(o.contents.result) };
12678 o.contents.result = core::ptr::null_mut();
12679 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12681 let err = unsafe { o.contents.err };
12682 unsafe { o.contents.err = core::ptr::null_mut(); }
12683 CResult_NonePeerHandleErrorZPtr { err }
12687 result_ok: o.result_ok,
12691 impl Clone for CResult_NonePeerHandleErrorZ {
12692 fn clone(&self) -> Self {
12693 if self.result_ok {
12694 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12695 result: core::ptr::null_mut()
12698 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12699 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12705 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12706 /// but with all dynamically-allocated buffers duplicated in new buffers.
12707 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12709 /// The contents of CResult_boolPeerHandleErrorZ
12710 pub union CResult_boolPeerHandleErrorZPtr {
12711 /// A pointer to the contents in the success state.
12712 /// Reading from this pointer when `result_ok` is not set is undefined.
12713 pub result: *mut bool,
12714 /// A pointer to the contents in the error state.
12715 /// Reading from this pointer when `result_ok` is set is undefined.
12716 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12719 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12720 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12721 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12722 pub struct CResult_boolPeerHandleErrorZ {
12723 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12724 /// `err` or `result` depending on the state of `result_ok`.
12725 pub contents: CResult_boolPeerHandleErrorZPtr,
12726 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12727 pub result_ok: bool,
12730 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12731 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12732 CResult_boolPeerHandleErrorZ {
12733 contents: CResult_boolPeerHandleErrorZPtr {
12734 result: Box::into_raw(Box::new(o)),
12740 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12741 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12742 CResult_boolPeerHandleErrorZ {
12743 contents: CResult_boolPeerHandleErrorZPtr {
12744 err: Box::into_raw(Box::new(e)),
12749 /// Checks if the given object is currently in the success state
12751 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12755 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12756 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12757 impl Drop for CResult_boolPeerHandleErrorZ {
12758 fn drop(&mut self) {
12759 if self.result_ok {
12760 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12761 let _ = unsafe { Box::from_raw(self.contents.result) };
12764 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12765 let _ = unsafe { Box::from_raw(self.contents.err) };
12770 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12771 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12772 let contents = if o.result_ok {
12773 let result = unsafe { o.contents.result };
12774 unsafe { o.contents.result = core::ptr::null_mut() };
12775 CResult_boolPeerHandleErrorZPtr { result }
12777 let err = unsafe { o.contents.err };
12778 unsafe { o.contents.err = core::ptr::null_mut(); }
12779 CResult_boolPeerHandleErrorZPtr { err }
12783 result_ok: o.result_ok,
12787 impl Clone for CResult_boolPeerHandleErrorZ {
12788 fn clone(&self) -> Self {
12789 if self.result_ok {
12790 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12791 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12794 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12795 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12801 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12802 /// but with all dynamically-allocated buffers duplicated in new buffers.
12803 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12805 /// The contents of CResult_TxOutUtxoLookupErrorZ
12806 pub union CResult_TxOutUtxoLookupErrorZPtr {
12807 /// A pointer to the contents in the success state.
12808 /// Reading from this pointer when `result_ok` is not set is undefined.
12809 pub result: *mut crate::c_types::TxOut,
12810 /// A pointer to the contents in the error state.
12811 /// Reading from this pointer when `result_ok` is set is undefined.
12812 pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
12815 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
12816 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
12817 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12818 pub struct CResult_TxOutUtxoLookupErrorZ {
12819 /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
12820 /// `err` or `result` depending on the state of `result_ok`.
12821 pub contents: CResult_TxOutUtxoLookupErrorZPtr,
12822 /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
12823 pub result_ok: bool,
12826 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
12827 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
12828 CResult_TxOutUtxoLookupErrorZ {
12829 contents: CResult_TxOutUtxoLookupErrorZPtr {
12830 result: Box::into_raw(Box::new(o)),
12836 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
12837 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
12838 CResult_TxOutUtxoLookupErrorZ {
12839 contents: CResult_TxOutUtxoLookupErrorZPtr {
12840 err: Box::into_raw(Box::new(e)),
12845 /// Checks if the given object is currently in the success state
12847 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
12851 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
12852 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
12853 impl Drop for CResult_TxOutUtxoLookupErrorZ {
12854 fn drop(&mut self) {
12855 if self.result_ok {
12856 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12857 let _ = unsafe { Box::from_raw(self.contents.result) };
12860 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12861 let _ = unsafe { Box::from_raw(self.contents.err) };
12866 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
12867 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
12868 let contents = if o.result_ok {
12869 let result = unsafe { o.contents.result };
12870 unsafe { o.contents.result = core::ptr::null_mut() };
12871 CResult_TxOutUtxoLookupErrorZPtr { result }
12873 let err = unsafe { o.contents.err };
12874 unsafe { o.contents.err = core::ptr::null_mut(); }
12875 CResult_TxOutUtxoLookupErrorZPtr { err }
12879 result_ok: o.result_ok,
12883 impl Clone for CResult_TxOutUtxoLookupErrorZ {
12884 fn clone(&self) -> Self {
12885 if self.result_ok {
12886 Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
12887 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
12890 Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
12891 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
12897 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
12898 /// but with all dynamically-allocated buffers duplicated in new buffers.
12899 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
12901 /// The contents of CResult_NoneSendErrorZ
12902 pub union CResult_NoneSendErrorZPtr {
12903 /// Note that this value is always NULL, as there are no contents in the OK variant
12904 pub result: *mut core::ffi::c_void,
12905 /// A pointer to the contents in the error state.
12906 /// Reading from this pointer when `result_ok` is set is undefined.
12907 pub err: *mut crate::lightning::onion_message::messenger::SendError,
12910 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
12911 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12913 pub struct CResult_NoneSendErrorZ {
12914 /// The contents of this CResult_NoneSendErrorZ, accessible via either
12915 /// `err` or `result` depending on the state of `result_ok`.
12916 pub contents: CResult_NoneSendErrorZPtr,
12917 /// Whether this CResult_NoneSendErrorZ represents a success state.
12918 pub result_ok: bool,
12921 /// Creates a new CResult_NoneSendErrorZ in the success state.
12922 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12923 CResult_NoneSendErrorZ {
12924 contents: CResult_NoneSendErrorZPtr {
12925 result: core::ptr::null_mut(),
12931 /// Creates a new CResult_NoneSendErrorZ in the error state.
12932 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12933 CResult_NoneSendErrorZ {
12934 contents: CResult_NoneSendErrorZPtr {
12935 err: Box::into_raw(Box::new(e)),
12940 /// Checks if the given object is currently in the success state
12942 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12946 /// Frees any resources used by the CResult_NoneSendErrorZ.
12947 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12948 impl Drop for CResult_NoneSendErrorZ {
12949 fn drop(&mut self) {
12950 if self.result_ok {
12952 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12953 let _ = unsafe { Box::from_raw(self.contents.err) };
12958 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12959 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12960 let contents = if o.result_ok {
12961 let _ = unsafe { Box::from_raw(o.contents.result) };
12962 o.contents.result = core::ptr::null_mut();
12963 CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12965 let err = unsafe { o.contents.err };
12966 unsafe { o.contents.err = core::ptr::null_mut(); }
12967 CResult_NoneSendErrorZPtr { err }
12971 result_ok: o.result_ok,
12976 /// The contents of CResult_BlindedPathNoneZ
12977 pub union CResult_BlindedPathNoneZPtr {
12978 /// A pointer to the contents in the success state.
12979 /// Reading from this pointer when `result_ok` is not set is undefined.
12980 pub result: *mut crate::lightning::blinded_path::BlindedPath,
12981 /// Note that this value is always NULL, as there are no contents in the Err variant
12982 pub err: *mut core::ffi::c_void,
12985 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
12986 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
12987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12988 pub struct CResult_BlindedPathNoneZ {
12989 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
12990 /// `err` or `result` depending on the state of `result_ok`.
12991 pub contents: CResult_BlindedPathNoneZPtr,
12992 /// Whether this CResult_BlindedPathNoneZ represents a success state.
12993 pub result_ok: bool,
12996 /// Creates a new CResult_BlindedPathNoneZ in the success state.
12997 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
12998 CResult_BlindedPathNoneZ {
12999 contents: CResult_BlindedPathNoneZPtr {
13000 result: Box::into_raw(Box::new(o)),
13006 /// Creates a new CResult_BlindedPathNoneZ in the error state.
13007 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
13008 CResult_BlindedPathNoneZ {
13009 contents: CResult_BlindedPathNoneZPtr {
13010 err: core::ptr::null_mut(),
13015 /// Checks if the given object is currently in the success state
13017 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
13021 /// Frees any resources used by the CResult_BlindedPathNoneZ.
13022 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
13023 impl Drop for CResult_BlindedPathNoneZ {
13024 fn drop(&mut self) {
13025 if self.result_ok {
13026 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13027 let _ = unsafe { Box::from_raw(self.contents.result) };
13033 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
13034 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
13035 let contents = if o.result_ok {
13036 let result = unsafe { o.contents.result };
13037 unsafe { o.contents.result = core::ptr::null_mut() };
13038 CResult_BlindedPathNoneZPtr { result }
13040 let _ = unsafe { Box::from_raw(o.contents.err) };
13041 o.contents.err = core::ptr::null_mut();
13042 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
13046 result_ok: o.result_ok,
13050 impl Clone for CResult_BlindedPathNoneZ {
13051 fn clone(&self) -> Self {
13052 if self.result_ok {
13053 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
13054 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
13057 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
13058 err: core::ptr::null_mut()
13064 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
13065 /// but with all dynamically-allocated buffers duplicated in new buffers.
13066 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
13068 /// The contents of CResult_BlindedPathDecodeErrorZ
13069 pub union CResult_BlindedPathDecodeErrorZPtr {
13070 /// A pointer to the contents in the success state.
13071 /// Reading from this pointer when `result_ok` is not set is undefined.
13072 pub result: *mut crate::lightning::blinded_path::BlindedPath,
13073 /// A pointer to the contents in the error state.
13074 /// Reading from this pointer when `result_ok` is set is undefined.
13075 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13078 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
13079 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
13080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13081 pub struct CResult_BlindedPathDecodeErrorZ {
13082 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
13083 /// `err` or `result` depending on the state of `result_ok`.
13084 pub contents: CResult_BlindedPathDecodeErrorZPtr,
13085 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
13086 pub result_ok: bool,
13089 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
13090 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
13091 CResult_BlindedPathDecodeErrorZ {
13092 contents: CResult_BlindedPathDecodeErrorZPtr {
13093 result: Box::into_raw(Box::new(o)),
13099 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
13100 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
13101 CResult_BlindedPathDecodeErrorZ {
13102 contents: CResult_BlindedPathDecodeErrorZPtr {
13103 err: Box::into_raw(Box::new(e)),
13108 /// Checks if the given object is currently in the success state
13110 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
13114 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
13115 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
13116 impl Drop for CResult_BlindedPathDecodeErrorZ {
13117 fn drop(&mut self) {
13118 if self.result_ok {
13119 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13120 let _ = unsafe { Box::from_raw(self.contents.result) };
13123 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13124 let _ = unsafe { Box::from_raw(self.contents.err) };
13129 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
13130 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
13131 let contents = if o.result_ok {
13132 let result = unsafe { o.contents.result };
13133 unsafe { o.contents.result = core::ptr::null_mut() };
13134 CResult_BlindedPathDecodeErrorZPtr { result }
13136 let err = unsafe { o.contents.err };
13137 unsafe { o.contents.err = core::ptr::null_mut(); }
13138 CResult_BlindedPathDecodeErrorZPtr { err }
13142 result_ok: o.result_ok,
13146 impl Clone for CResult_BlindedPathDecodeErrorZ {
13147 fn clone(&self) -> Self {
13148 if self.result_ok {
13149 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
13150 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
13153 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
13154 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13160 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
13161 /// but with all dynamically-allocated buffers duplicated in new buffers.
13162 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
13164 /// The contents of CResult_BlindedHopDecodeErrorZ
13165 pub union CResult_BlindedHopDecodeErrorZPtr {
13166 /// A pointer to the contents in the success state.
13167 /// Reading from this pointer when `result_ok` is not set is undefined.
13168 pub result: *mut crate::lightning::blinded_path::BlindedHop,
13169 /// A pointer to the contents in the error state.
13170 /// Reading from this pointer when `result_ok` is set is undefined.
13171 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13174 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
13175 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
13176 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13177 pub struct CResult_BlindedHopDecodeErrorZ {
13178 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
13179 /// `err` or `result` depending on the state of `result_ok`.
13180 pub contents: CResult_BlindedHopDecodeErrorZPtr,
13181 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
13182 pub result_ok: bool,
13185 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
13186 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
13187 CResult_BlindedHopDecodeErrorZ {
13188 contents: CResult_BlindedHopDecodeErrorZPtr {
13189 result: Box::into_raw(Box::new(o)),
13195 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
13196 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
13197 CResult_BlindedHopDecodeErrorZ {
13198 contents: CResult_BlindedHopDecodeErrorZPtr {
13199 err: Box::into_raw(Box::new(e)),
13204 /// Checks if the given object is currently in the success state
13206 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
13210 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
13211 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
13212 impl Drop for CResult_BlindedHopDecodeErrorZ {
13213 fn drop(&mut self) {
13214 if self.result_ok {
13215 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13216 let _ = unsafe { Box::from_raw(self.contents.result) };
13219 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13220 let _ = unsafe { Box::from_raw(self.contents.err) };
13225 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
13226 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
13227 let contents = if o.result_ok {
13228 let result = unsafe { o.contents.result };
13229 unsafe { o.contents.result = core::ptr::null_mut() };
13230 CResult_BlindedHopDecodeErrorZPtr { result }
13232 let err = unsafe { o.contents.err };
13233 unsafe { o.contents.err = core::ptr::null_mut(); }
13234 CResult_BlindedHopDecodeErrorZPtr { err }
13238 result_ok: o.result_ok,
13242 impl Clone for CResult_BlindedHopDecodeErrorZ {
13243 fn clone(&self) -> Self {
13244 if self.result_ok {
13245 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
13246 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
13249 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
13250 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13256 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
13257 /// but with all dynamically-allocated buffers duplicated in new buffers.
13258 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
13260 /// The contents of CResult_SiPrefixParseErrorZ
13261 pub union CResult_SiPrefixParseErrorZPtr {
13262 /// A pointer to the contents in the success state.
13263 /// Reading from this pointer when `result_ok` is not set is undefined.
13264 pub result: *mut crate::lightning_invoice::SiPrefix,
13265 /// A pointer to the contents in the error state.
13266 /// Reading from this pointer when `result_ok` is set is undefined.
13267 pub err: *mut crate::lightning_invoice::ParseError,
13270 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
13271 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
13272 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13273 pub struct CResult_SiPrefixParseErrorZ {
13274 /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
13275 /// `err` or `result` depending on the state of `result_ok`.
13276 pub contents: CResult_SiPrefixParseErrorZPtr,
13277 /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
13278 pub result_ok: bool,
13281 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
13282 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
13283 CResult_SiPrefixParseErrorZ {
13284 contents: CResult_SiPrefixParseErrorZPtr {
13285 result: Box::into_raw(Box::new(o)),
13291 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
13292 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
13293 CResult_SiPrefixParseErrorZ {
13294 contents: CResult_SiPrefixParseErrorZPtr {
13295 err: Box::into_raw(Box::new(e)),
13300 /// Checks if the given object is currently in the success state
13302 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
13306 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
13307 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
13308 impl Drop for CResult_SiPrefixParseErrorZ {
13309 fn drop(&mut self) {
13310 if self.result_ok {
13311 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13312 let _ = unsafe { Box::from_raw(self.contents.result) };
13315 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13316 let _ = unsafe { Box::from_raw(self.contents.err) };
13321 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
13322 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
13323 let contents = if o.result_ok {
13324 let result = unsafe { o.contents.result };
13325 unsafe { o.contents.result = core::ptr::null_mut() };
13326 CResult_SiPrefixParseErrorZPtr { result }
13328 let err = unsafe { o.contents.err };
13329 unsafe { o.contents.err = core::ptr::null_mut(); }
13330 CResult_SiPrefixParseErrorZPtr { err }
13334 result_ok: o.result_ok,
13338 impl Clone for CResult_SiPrefixParseErrorZ {
13339 fn clone(&self) -> Self {
13340 if self.result_ok {
13341 Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
13342 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
13345 Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
13346 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
13352 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
13353 /// but with all dynamically-allocated buffers duplicated in new buffers.
13354 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
13356 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
13357 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
13358 /// A pointer to the contents in the success state.
13359 /// Reading from this pointer when `result_ok` is not set is undefined.
13360 pub result: *mut crate::lightning_invoice::Invoice,
13361 /// A pointer to the contents in the error state.
13362 /// Reading from this pointer when `result_ok` is set is undefined.
13363 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
13366 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
13367 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
13368 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13369 pub struct CResult_InvoiceParseOrSemanticErrorZ {
13370 /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
13371 /// `err` or `result` depending on the state of `result_ok`.
13372 pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
13373 /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
13374 pub result_ok: bool,
13377 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
13378 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
13379 CResult_InvoiceParseOrSemanticErrorZ {
13380 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13381 result: Box::into_raw(Box::new(o)),
13387 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
13388 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
13389 CResult_InvoiceParseOrSemanticErrorZ {
13390 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13391 err: Box::into_raw(Box::new(e)),
13396 /// Checks if the given object is currently in the success state
13398 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
13402 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
13403 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
13404 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
13405 fn drop(&mut self) {
13406 if self.result_ok {
13407 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13408 let _ = unsafe { Box::from_raw(self.contents.result) };
13411 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13412 let _ = unsafe { Box::from_raw(self.contents.err) };
13417 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
13418 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
13419 let contents = if o.result_ok {
13420 let result = unsafe { o.contents.result };
13421 unsafe { o.contents.result = core::ptr::null_mut() };
13422 CResult_InvoiceParseOrSemanticErrorZPtr { result }
13424 let err = unsafe { o.contents.err };
13425 unsafe { o.contents.err = core::ptr::null_mut(); }
13426 CResult_InvoiceParseOrSemanticErrorZPtr { err }
13430 result_ok: o.result_ok,
13434 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
13435 fn clone(&self) -> Self {
13436 if self.result_ok {
13437 Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13438 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
13441 Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13442 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
13448 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
13449 /// but with all dynamically-allocated buffers duplicated in new buffers.
13450 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
13452 /// The contents of CResult_SignedRawInvoiceParseErrorZ
13453 pub union CResult_SignedRawInvoiceParseErrorZPtr {
13454 /// A pointer to the contents in the success state.
13455 /// Reading from this pointer when `result_ok` is not set is undefined.
13456 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
13457 /// A pointer to the contents in the error state.
13458 /// Reading from this pointer when `result_ok` is set is undefined.
13459 pub err: *mut crate::lightning_invoice::ParseError,
13462 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
13463 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
13464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13465 pub struct CResult_SignedRawInvoiceParseErrorZ {
13466 /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
13467 /// `err` or `result` depending on the state of `result_ok`.
13468 pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
13469 /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
13470 pub result_ok: bool,
13473 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
13474 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
13475 CResult_SignedRawInvoiceParseErrorZ {
13476 contents: CResult_SignedRawInvoiceParseErrorZPtr {
13477 result: Box::into_raw(Box::new(o)),
13483 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
13484 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
13485 CResult_SignedRawInvoiceParseErrorZ {
13486 contents: CResult_SignedRawInvoiceParseErrorZPtr {
13487 err: Box::into_raw(Box::new(e)),
13492 /// Checks if the given object is currently in the success state
13494 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
13498 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
13499 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
13500 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
13501 fn drop(&mut self) {
13502 if self.result_ok {
13503 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13504 let _ = unsafe { Box::from_raw(self.contents.result) };
13507 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13508 let _ = unsafe { Box::from_raw(self.contents.err) };
13513 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
13514 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
13515 let contents = if o.result_ok {
13516 let result = unsafe { o.contents.result };
13517 unsafe { o.contents.result = core::ptr::null_mut() };
13518 CResult_SignedRawInvoiceParseErrorZPtr { result }
13520 let err = unsafe { o.contents.err };
13521 unsafe { o.contents.err = core::ptr::null_mut(); }
13522 CResult_SignedRawInvoiceParseErrorZPtr { err }
13526 result_ok: o.result_ok,
13530 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
13531 fn clone(&self) -> Self {
13532 if self.result_ok {
13533 Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
13534 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
13537 Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
13538 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
13544 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
13545 /// but with all dynamically-allocated buffers duplicated in new buffers.
13546 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
13548 /// A tuple of 3 elements. See the individual fields for the types contained.
13549 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13550 /// The element at position 0
13551 pub a: crate::lightning_invoice::RawInvoice,
13552 /// The element at position 1
13553 pub b: crate::c_types::ThirtyTwoBytes,
13554 /// The element at position 2
13555 pub c: crate::lightning_invoice::InvoiceSignature,
13557 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13558 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
13566 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13567 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
13568 (self.a, self.b, self.c)
13571 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13572 fn clone(&self) -> Self {
13574 a: Clone::clone(&self.a),
13575 b: Clone::clone(&self.b),
13576 c: Clone::clone(&self.c),
13581 /// Creates a new tuple which has the same data as `orig`
13582 /// but with all dynamically-allocated buffers duplicated in new buffers.
13583 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
13584 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
13586 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a: crate::lightning_invoice::RawInvoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::InvoiceSignature) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13587 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
13591 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
13592 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
13594 /// The contents of CResult_PayeePubKeyErrorZ
13595 pub union CResult_PayeePubKeyErrorZPtr {
13596 /// A pointer to the contents in the success state.
13597 /// Reading from this pointer when `result_ok` is not set is undefined.
13598 pub result: *mut crate::lightning_invoice::PayeePubKey,
13599 /// A pointer to the contents in the error state.
13600 /// Reading from this pointer when `result_ok` is set is undefined.
13601 pub err: *mut crate::c_types::Secp256k1Error,
13604 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
13605 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
13606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13607 pub struct CResult_PayeePubKeyErrorZ {
13608 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
13609 /// `err` or `result` depending on the state of `result_ok`.
13610 pub contents: CResult_PayeePubKeyErrorZPtr,
13611 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
13612 pub result_ok: bool,
13615 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
13616 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
13617 CResult_PayeePubKeyErrorZ {
13618 contents: CResult_PayeePubKeyErrorZPtr {
13619 result: Box::into_raw(Box::new(o)),
13625 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
13626 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
13627 CResult_PayeePubKeyErrorZ {
13628 contents: CResult_PayeePubKeyErrorZPtr {
13629 err: Box::into_raw(Box::new(e)),
13634 /// Checks if the given object is currently in the success state
13636 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
13640 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
13641 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
13642 impl Drop for CResult_PayeePubKeyErrorZ {
13643 fn drop(&mut self) {
13644 if self.result_ok {
13645 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13646 let _ = unsafe { Box::from_raw(self.contents.result) };
13649 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13650 let _ = unsafe { Box::from_raw(self.contents.err) };
13655 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
13656 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
13657 let contents = if o.result_ok {
13658 let result = unsafe { o.contents.result };
13659 unsafe { o.contents.result = core::ptr::null_mut() };
13660 CResult_PayeePubKeyErrorZPtr { result }
13662 let err = unsafe { o.contents.err };
13663 unsafe { o.contents.err = core::ptr::null_mut(); }
13664 CResult_PayeePubKeyErrorZPtr { err }
13668 result_ok: o.result_ok,
13672 impl Clone for CResult_PayeePubKeyErrorZ {
13673 fn clone(&self) -> Self {
13674 if self.result_ok {
13675 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
13676 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
13679 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
13680 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
13686 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
13687 /// but with all dynamically-allocated buffers duplicated in new buffers.
13688 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
13690 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
13691 /// This corresponds to std::vector in C++
13692 pub struct CVec_PrivateRouteZ {
13693 /// The elements in the array.
13694 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13695 pub data: *mut crate::lightning_invoice::PrivateRoute,
13696 /// The number of elements pointed to by `data`.
13699 impl CVec_PrivateRouteZ {
13700 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
13701 if self.datalen == 0 { return Vec::new(); }
13702 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13703 self.data = core::ptr::null_mut();
13707 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
13708 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13711 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
13712 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
13713 let datalen = v.len();
13714 let data = Box::into_raw(v.into_boxed_slice());
13715 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13719 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13720 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
13721 impl Drop for CVec_PrivateRouteZ {
13722 fn drop(&mut self) {
13723 if self.datalen == 0 { return; }
13724 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13727 impl Clone for CVec_PrivateRouteZ {
13728 fn clone(&self) -> Self {
13729 let mut res = Vec::new();
13730 if self.datalen == 0 { return Self::from(res); }
13731 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13736 /// The contents of CResult_PositiveTimestampCreationErrorZ
13737 pub union CResult_PositiveTimestampCreationErrorZPtr {
13738 /// A pointer to the contents in the success state.
13739 /// Reading from this pointer when `result_ok` is not set is undefined.
13740 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
13741 /// A pointer to the contents in the error state.
13742 /// Reading from this pointer when `result_ok` is set is undefined.
13743 pub err: *mut crate::lightning_invoice::CreationError,
13746 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
13747 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
13748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13749 pub struct CResult_PositiveTimestampCreationErrorZ {
13750 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
13751 /// `err` or `result` depending on the state of `result_ok`.
13752 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
13753 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
13754 pub result_ok: bool,
13757 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
13758 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
13759 CResult_PositiveTimestampCreationErrorZ {
13760 contents: CResult_PositiveTimestampCreationErrorZPtr {
13761 result: Box::into_raw(Box::new(o)),
13767 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
13768 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
13769 CResult_PositiveTimestampCreationErrorZ {
13770 contents: CResult_PositiveTimestampCreationErrorZPtr {
13771 err: Box::into_raw(Box::new(e)),
13776 /// Checks if the given object is currently in the success state
13778 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
13782 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
13783 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
13784 impl Drop for CResult_PositiveTimestampCreationErrorZ {
13785 fn drop(&mut self) {
13786 if self.result_ok {
13787 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13788 let _ = unsafe { Box::from_raw(self.contents.result) };
13791 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13792 let _ = unsafe { Box::from_raw(self.contents.err) };
13797 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
13798 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
13799 let contents = if o.result_ok {
13800 let result = unsafe { o.contents.result };
13801 unsafe { o.contents.result = core::ptr::null_mut() };
13802 CResult_PositiveTimestampCreationErrorZPtr { result }
13804 let err = unsafe { o.contents.err };
13805 unsafe { o.contents.err = core::ptr::null_mut(); }
13806 CResult_PositiveTimestampCreationErrorZPtr { err }
13810 result_ok: o.result_ok,
13814 impl Clone for CResult_PositiveTimestampCreationErrorZ {
13815 fn clone(&self) -> Self {
13816 if self.result_ok {
13817 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
13818 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
13821 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
13822 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13828 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
13829 /// but with all dynamically-allocated buffers duplicated in new buffers.
13830 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
13832 /// The contents of CResult_NoneSemanticErrorZ
13833 pub union CResult_NoneSemanticErrorZPtr {
13834 /// Note that this value is always NULL, as there are no contents in the OK variant
13835 pub result: *mut core::ffi::c_void,
13836 /// A pointer to the contents in the error state.
13837 /// Reading from this pointer when `result_ok` is set is undefined.
13838 pub err: *mut crate::lightning_invoice::SemanticError,
13841 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
13842 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
13843 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13844 pub struct CResult_NoneSemanticErrorZ {
13845 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
13846 /// `err` or `result` depending on the state of `result_ok`.
13847 pub contents: CResult_NoneSemanticErrorZPtr,
13848 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
13849 pub result_ok: bool,
13852 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
13853 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
13854 CResult_NoneSemanticErrorZ {
13855 contents: CResult_NoneSemanticErrorZPtr {
13856 result: core::ptr::null_mut(),
13862 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
13863 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
13864 CResult_NoneSemanticErrorZ {
13865 contents: CResult_NoneSemanticErrorZPtr {
13866 err: Box::into_raw(Box::new(e)),
13871 /// Checks if the given object is currently in the success state
13873 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
13877 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
13878 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
13879 impl Drop for CResult_NoneSemanticErrorZ {
13880 fn drop(&mut self) {
13881 if self.result_ok {
13883 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13884 let _ = unsafe { Box::from_raw(self.contents.err) };
13889 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
13890 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
13891 let contents = if o.result_ok {
13892 let _ = unsafe { Box::from_raw(o.contents.result) };
13893 o.contents.result = core::ptr::null_mut();
13894 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
13896 let err = unsafe { o.contents.err };
13897 unsafe { o.contents.err = core::ptr::null_mut(); }
13898 CResult_NoneSemanticErrorZPtr { err }
13902 result_ok: o.result_ok,
13906 impl Clone for CResult_NoneSemanticErrorZ {
13907 fn clone(&self) -> Self {
13908 if self.result_ok {
13909 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
13910 result: core::ptr::null_mut()
13913 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
13914 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
13920 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
13921 /// but with all dynamically-allocated buffers duplicated in new buffers.
13922 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
13924 /// The contents of CResult_InvoiceSemanticErrorZ
13925 pub union CResult_InvoiceSemanticErrorZPtr {
13926 /// A pointer to the contents in the success state.
13927 /// Reading from this pointer when `result_ok` is not set is undefined.
13928 pub result: *mut crate::lightning_invoice::Invoice,
13929 /// A pointer to the contents in the error state.
13930 /// Reading from this pointer when `result_ok` is set is undefined.
13931 pub err: *mut crate::lightning_invoice::SemanticError,
13934 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
13935 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
13936 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13937 pub struct CResult_InvoiceSemanticErrorZ {
13938 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
13939 /// `err` or `result` depending on the state of `result_ok`.
13940 pub contents: CResult_InvoiceSemanticErrorZPtr,
13941 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
13942 pub result_ok: bool,
13945 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
13946 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
13947 CResult_InvoiceSemanticErrorZ {
13948 contents: CResult_InvoiceSemanticErrorZPtr {
13949 result: Box::into_raw(Box::new(o)),
13955 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
13956 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
13957 CResult_InvoiceSemanticErrorZ {
13958 contents: CResult_InvoiceSemanticErrorZPtr {
13959 err: Box::into_raw(Box::new(e)),
13964 /// Checks if the given object is currently in the success state
13966 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
13970 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
13971 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
13972 impl Drop for CResult_InvoiceSemanticErrorZ {
13973 fn drop(&mut self) {
13974 if self.result_ok {
13975 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13976 let _ = unsafe { Box::from_raw(self.contents.result) };
13979 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13980 let _ = unsafe { Box::from_raw(self.contents.err) };
13985 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
13986 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
13987 let contents = if o.result_ok {
13988 let result = unsafe { o.contents.result };
13989 unsafe { o.contents.result = core::ptr::null_mut() };
13990 CResult_InvoiceSemanticErrorZPtr { result }
13992 let err = unsafe { o.contents.err };
13993 unsafe { o.contents.err = core::ptr::null_mut(); }
13994 CResult_InvoiceSemanticErrorZPtr { err }
13998 result_ok: o.result_ok,
14002 impl Clone for CResult_InvoiceSemanticErrorZ {
14003 fn clone(&self) -> Self {
14004 if self.result_ok {
14005 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
14006 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
14009 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
14010 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
14016 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
14017 /// but with all dynamically-allocated buffers duplicated in new buffers.
14018 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
14020 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
14021 /// This corresponds to std::vector in C++
14022 pub struct CVec_AddressZ {
14023 /// The elements in the array.
14024 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14025 pub data: *mut crate::c_types::Str,
14026 /// The number of elements pointed to by `data`.
14029 impl CVec_AddressZ {
14030 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
14031 if self.datalen == 0 { return Vec::new(); }
14032 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14033 self.data = core::ptr::null_mut();
14037 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
14038 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14041 impl From<Vec<crate::c_types::Str>> for CVec_AddressZ {
14042 fn from(v: Vec<crate::c_types::Str>) -> Self {
14043 let datalen = v.len();
14044 let data = Box::into_raw(v.into_boxed_slice());
14045 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14049 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14050 pub extern "C" fn CVec_AddressZ_free(_res: CVec_AddressZ) { }
14051 impl Drop for CVec_AddressZ {
14052 fn drop(&mut self) {
14053 if self.datalen == 0 { return; }
14054 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14057 impl Clone for CVec_AddressZ {
14058 fn clone(&self) -> Self {
14059 let mut res = Vec::new();
14060 if self.datalen == 0 { return Self::from(res); }
14061 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14066 /// The contents of CResult_DescriptionCreationErrorZ
14067 pub union CResult_DescriptionCreationErrorZPtr {
14068 /// A pointer to the contents in the success state.
14069 /// Reading from this pointer when `result_ok` is not set is undefined.
14070 pub result: *mut crate::lightning_invoice::Description,
14071 /// A pointer to the contents in the error state.
14072 /// Reading from this pointer when `result_ok` is set is undefined.
14073 pub err: *mut crate::lightning_invoice::CreationError,
14076 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
14077 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
14078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14079 pub struct CResult_DescriptionCreationErrorZ {
14080 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
14081 /// `err` or `result` depending on the state of `result_ok`.
14082 pub contents: CResult_DescriptionCreationErrorZPtr,
14083 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
14084 pub result_ok: bool,
14087 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
14088 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
14089 CResult_DescriptionCreationErrorZ {
14090 contents: CResult_DescriptionCreationErrorZPtr {
14091 result: Box::into_raw(Box::new(o)),
14097 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
14098 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
14099 CResult_DescriptionCreationErrorZ {
14100 contents: CResult_DescriptionCreationErrorZPtr {
14101 err: Box::into_raw(Box::new(e)),
14106 /// Checks if the given object is currently in the success state
14108 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
14112 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
14113 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
14114 impl Drop for CResult_DescriptionCreationErrorZ {
14115 fn drop(&mut self) {
14116 if self.result_ok {
14117 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14118 let _ = unsafe { Box::from_raw(self.contents.result) };
14121 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14122 let _ = unsafe { Box::from_raw(self.contents.err) };
14127 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
14128 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
14129 let contents = if o.result_ok {
14130 let result = unsafe { o.contents.result };
14131 unsafe { o.contents.result = core::ptr::null_mut() };
14132 CResult_DescriptionCreationErrorZPtr { result }
14134 let err = unsafe { o.contents.err };
14135 unsafe { o.contents.err = core::ptr::null_mut(); }
14136 CResult_DescriptionCreationErrorZPtr { err }
14140 result_ok: o.result_ok,
14144 impl Clone for CResult_DescriptionCreationErrorZ {
14145 fn clone(&self) -> Self {
14146 if self.result_ok {
14147 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
14148 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
14151 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
14152 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
14158 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
14159 /// but with all dynamically-allocated buffers duplicated in new buffers.
14160 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
14162 /// The contents of CResult_PrivateRouteCreationErrorZ
14163 pub union CResult_PrivateRouteCreationErrorZPtr {
14164 /// A pointer to the contents in the success state.
14165 /// Reading from this pointer when `result_ok` is not set is undefined.
14166 pub result: *mut crate::lightning_invoice::PrivateRoute,
14167 /// A pointer to the contents in the error state.
14168 /// Reading from this pointer when `result_ok` is set is undefined.
14169 pub err: *mut crate::lightning_invoice::CreationError,
14172 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
14173 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
14174 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14175 pub struct CResult_PrivateRouteCreationErrorZ {
14176 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
14177 /// `err` or `result` depending on the state of `result_ok`.
14178 pub contents: CResult_PrivateRouteCreationErrorZPtr,
14179 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
14180 pub result_ok: bool,
14183 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
14184 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
14185 CResult_PrivateRouteCreationErrorZ {
14186 contents: CResult_PrivateRouteCreationErrorZPtr {
14187 result: Box::into_raw(Box::new(o)),
14193 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
14194 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
14195 CResult_PrivateRouteCreationErrorZ {
14196 contents: CResult_PrivateRouteCreationErrorZPtr {
14197 err: Box::into_raw(Box::new(e)),
14202 /// Checks if the given object is currently in the success state
14204 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
14208 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
14209 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
14210 impl Drop for CResult_PrivateRouteCreationErrorZ {
14211 fn drop(&mut self) {
14212 if self.result_ok {
14213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14214 let _ = unsafe { Box::from_raw(self.contents.result) };
14217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14218 let _ = unsafe { Box::from_raw(self.contents.err) };
14223 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
14224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
14225 let contents = if o.result_ok {
14226 let result = unsafe { o.contents.result };
14227 unsafe { o.contents.result = core::ptr::null_mut() };
14228 CResult_PrivateRouteCreationErrorZPtr { result }
14230 let err = unsafe { o.contents.err };
14231 unsafe { o.contents.err = core::ptr::null_mut(); }
14232 CResult_PrivateRouteCreationErrorZPtr { err }
14236 result_ok: o.result_ok,
14240 impl Clone for CResult_PrivateRouteCreationErrorZ {
14241 fn clone(&self) -> Self {
14242 if self.result_ok {
14243 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
14244 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
14247 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
14248 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
14254 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
14255 /// but with all dynamically-allocated buffers duplicated in new buffers.
14256 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
14258 /// The contents of CResult_NetAddressDecodeErrorZ
14259 pub union CResult_NetAddressDecodeErrorZPtr {
14260 /// A pointer to the contents in the success state.
14261 /// Reading from this pointer when `result_ok` is not set is undefined.
14262 pub result: *mut crate::lightning::ln::msgs::NetAddress,
14263 /// A pointer to the contents in the error state.
14264 /// Reading from this pointer when `result_ok` is set is undefined.
14265 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14268 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
14269 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
14270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14271 pub struct CResult_NetAddressDecodeErrorZ {
14272 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
14273 /// `err` or `result` depending on the state of `result_ok`.
14274 pub contents: CResult_NetAddressDecodeErrorZPtr,
14275 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
14276 pub result_ok: bool,
14279 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
14280 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
14281 CResult_NetAddressDecodeErrorZ {
14282 contents: CResult_NetAddressDecodeErrorZPtr {
14283 result: Box::into_raw(Box::new(o)),
14289 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
14290 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
14291 CResult_NetAddressDecodeErrorZ {
14292 contents: CResult_NetAddressDecodeErrorZPtr {
14293 err: Box::into_raw(Box::new(e)),
14298 /// Checks if the given object is currently in the success state
14300 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
14304 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
14305 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
14306 impl Drop for CResult_NetAddressDecodeErrorZ {
14307 fn drop(&mut self) {
14308 if self.result_ok {
14309 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14310 let _ = unsafe { Box::from_raw(self.contents.result) };
14313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14314 let _ = unsafe { Box::from_raw(self.contents.err) };
14319 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
14320 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
14321 let contents = if o.result_ok {
14322 let result = unsafe { o.contents.result };
14323 unsafe { o.contents.result = core::ptr::null_mut() };
14324 CResult_NetAddressDecodeErrorZPtr { result }
14326 let err = unsafe { o.contents.err };
14327 unsafe { o.contents.err = core::ptr::null_mut(); }
14328 CResult_NetAddressDecodeErrorZPtr { err }
14332 result_ok: o.result_ok,
14336 impl Clone for CResult_NetAddressDecodeErrorZ {
14337 fn clone(&self) -> Self {
14338 if self.result_ok {
14339 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
14340 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
14343 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
14344 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14350 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
14351 /// but with all dynamically-allocated buffers duplicated in new buffers.
14352 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
14354 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
14355 /// This corresponds to std::vector in C++
14356 pub struct CVec_UpdateAddHTLCZ {
14357 /// The elements in the array.
14358 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14359 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14360 /// The number of elements pointed to by `data`.
14363 impl CVec_UpdateAddHTLCZ {
14364 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
14365 if self.datalen == 0 { return Vec::new(); }
14366 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14367 self.data = core::ptr::null_mut();
14371 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
14372 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14375 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
14376 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
14377 let datalen = v.len();
14378 let data = Box::into_raw(v.into_boxed_slice());
14379 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14383 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14384 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
14385 impl Drop for CVec_UpdateAddHTLCZ {
14386 fn drop(&mut self) {
14387 if self.datalen == 0 { return; }
14388 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14391 impl Clone for CVec_UpdateAddHTLCZ {
14392 fn clone(&self) -> Self {
14393 let mut res = Vec::new();
14394 if self.datalen == 0 { return Self::from(res); }
14395 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14400 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
14401 /// This corresponds to std::vector in C++
14402 pub struct CVec_UpdateFulfillHTLCZ {
14403 /// The elements in the array.
14404 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14405 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14406 /// The number of elements pointed to by `data`.
14409 impl CVec_UpdateFulfillHTLCZ {
14410 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
14411 if self.datalen == 0 { return Vec::new(); }
14412 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14413 self.data = core::ptr::null_mut();
14417 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
14418 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14421 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
14422 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
14423 let datalen = v.len();
14424 let data = Box::into_raw(v.into_boxed_slice());
14425 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14429 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14430 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
14431 impl Drop for CVec_UpdateFulfillHTLCZ {
14432 fn drop(&mut self) {
14433 if self.datalen == 0 { return; }
14434 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14437 impl Clone for CVec_UpdateFulfillHTLCZ {
14438 fn clone(&self) -> Self {
14439 let mut res = Vec::new();
14440 if self.datalen == 0 { return Self::from(res); }
14441 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14446 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
14447 /// This corresponds to std::vector in C++
14448 pub struct CVec_UpdateFailHTLCZ {
14449 /// The elements in the array.
14450 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14451 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14452 /// The number of elements pointed to by `data`.
14455 impl CVec_UpdateFailHTLCZ {
14456 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
14457 if self.datalen == 0 { return Vec::new(); }
14458 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14459 self.data = core::ptr::null_mut();
14463 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
14464 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14467 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
14468 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
14469 let datalen = v.len();
14470 let data = Box::into_raw(v.into_boxed_slice());
14471 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14475 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14476 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
14477 impl Drop for CVec_UpdateFailHTLCZ {
14478 fn drop(&mut self) {
14479 if self.datalen == 0 { return; }
14480 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14483 impl Clone for CVec_UpdateFailHTLCZ {
14484 fn clone(&self) -> Self {
14485 let mut res = Vec::new();
14486 if self.datalen == 0 { return Self::from(res); }
14487 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14492 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
14493 /// This corresponds to std::vector in C++
14494 pub struct CVec_UpdateFailMalformedHTLCZ {
14495 /// The elements in the array.
14496 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14497 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14498 /// The number of elements pointed to by `data`.
14501 impl CVec_UpdateFailMalformedHTLCZ {
14502 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
14503 if self.datalen == 0 { return Vec::new(); }
14504 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14505 self.data = core::ptr::null_mut();
14509 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
14510 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14513 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
14514 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
14515 let datalen = v.len();
14516 let data = Box::into_raw(v.into_boxed_slice());
14517 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14521 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14522 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
14523 impl Drop for CVec_UpdateFailMalformedHTLCZ {
14524 fn drop(&mut self) {
14525 if self.datalen == 0 { return; }
14526 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14529 impl Clone for CVec_UpdateFailMalformedHTLCZ {
14530 fn clone(&self) -> Self {
14531 let mut res = Vec::new();
14532 if self.datalen == 0 { return Self::from(res); }
14533 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14538 /// The contents of CResult_AcceptChannelDecodeErrorZ
14539 pub union CResult_AcceptChannelDecodeErrorZPtr {
14540 /// A pointer to the contents in the success state.
14541 /// Reading from this pointer when `result_ok` is not set is undefined.
14542 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
14543 /// A pointer to the contents in the error state.
14544 /// Reading from this pointer when `result_ok` is set is undefined.
14545 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14548 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
14549 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14551 pub struct CResult_AcceptChannelDecodeErrorZ {
14552 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
14553 /// `err` or `result` depending on the state of `result_ok`.
14554 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
14555 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
14556 pub result_ok: bool,
14559 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
14560 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
14561 CResult_AcceptChannelDecodeErrorZ {
14562 contents: CResult_AcceptChannelDecodeErrorZPtr {
14563 result: Box::into_raw(Box::new(o)),
14569 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
14570 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
14571 CResult_AcceptChannelDecodeErrorZ {
14572 contents: CResult_AcceptChannelDecodeErrorZPtr {
14573 err: Box::into_raw(Box::new(e)),
14578 /// Checks if the given object is currently in the success state
14580 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
14584 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
14585 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
14586 impl Drop for CResult_AcceptChannelDecodeErrorZ {
14587 fn drop(&mut self) {
14588 if self.result_ok {
14589 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14590 let _ = unsafe { Box::from_raw(self.contents.result) };
14593 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14594 let _ = unsafe { Box::from_raw(self.contents.err) };
14599 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
14600 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14601 let contents = if o.result_ok {
14602 let result = unsafe { o.contents.result };
14603 unsafe { o.contents.result = core::ptr::null_mut() };
14604 CResult_AcceptChannelDecodeErrorZPtr { result }
14606 let err = unsafe { o.contents.err };
14607 unsafe { o.contents.err = core::ptr::null_mut(); }
14608 CResult_AcceptChannelDecodeErrorZPtr { err }
14612 result_ok: o.result_ok,
14616 impl Clone for CResult_AcceptChannelDecodeErrorZ {
14617 fn clone(&self) -> Self {
14618 if self.result_ok {
14619 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
14620 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
14623 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
14624 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14630 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
14631 /// but with all dynamically-allocated buffers duplicated in new buffers.
14632 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
14634 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
14635 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
14636 /// A pointer to the contents in the success state.
14637 /// Reading from this pointer when `result_ok` is not set is undefined.
14638 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
14639 /// A pointer to the contents in the error state.
14640 /// Reading from this pointer when `result_ok` is set is undefined.
14641 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14644 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
14645 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14646 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14647 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
14648 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
14649 /// `err` or `result` depending on the state of `result_ok`.
14650 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
14651 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
14652 pub result_ok: bool,
14655 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
14656 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14657 CResult_AnnouncementSignaturesDecodeErrorZ {
14658 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14659 result: Box::into_raw(Box::new(o)),
14665 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
14666 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14667 CResult_AnnouncementSignaturesDecodeErrorZ {
14668 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14669 err: Box::into_raw(Box::new(e)),
14674 /// Checks if the given object is currently in the success state
14676 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
14680 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
14681 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
14682 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
14683 fn drop(&mut self) {
14684 if self.result_ok {
14685 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14686 let _ = unsafe { Box::from_raw(self.contents.result) };
14689 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14690 let _ = unsafe { Box::from_raw(self.contents.err) };
14695 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
14696 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
14697 let contents = if o.result_ok {
14698 let result = unsafe { o.contents.result };
14699 unsafe { o.contents.result = core::ptr::null_mut() };
14700 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
14702 let err = unsafe { o.contents.err };
14703 unsafe { o.contents.err = core::ptr::null_mut(); }
14704 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
14708 result_ok: o.result_ok,
14712 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
14713 fn clone(&self) -> Self {
14714 if self.result_ok {
14715 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14716 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
14719 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14720 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14726 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
14727 /// but with all dynamically-allocated buffers duplicated in new buffers.
14728 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
14730 /// The contents of CResult_ChannelReestablishDecodeErrorZ
14731 pub union CResult_ChannelReestablishDecodeErrorZPtr {
14732 /// A pointer to the contents in the success state.
14733 /// Reading from this pointer when `result_ok` is not set is undefined.
14734 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
14735 /// A pointer to the contents in the error state.
14736 /// Reading from this pointer when `result_ok` is set is undefined.
14737 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14740 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
14741 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
14742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14743 pub struct CResult_ChannelReestablishDecodeErrorZ {
14744 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
14745 /// `err` or `result` depending on the state of `result_ok`.
14746 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
14747 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
14748 pub result_ok: bool,
14751 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
14752 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
14753 CResult_ChannelReestablishDecodeErrorZ {
14754 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14755 result: Box::into_raw(Box::new(o)),
14761 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
14762 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
14763 CResult_ChannelReestablishDecodeErrorZ {
14764 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14765 err: Box::into_raw(Box::new(e)),
14770 /// Checks if the given object is currently in the success state
14772 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
14776 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
14777 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
14778 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
14779 fn drop(&mut self) {
14780 if self.result_ok {
14781 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14782 let _ = unsafe { Box::from_raw(self.contents.result) };
14785 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14786 let _ = unsafe { Box::from_raw(self.contents.err) };
14791 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
14792 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
14793 let contents = if o.result_ok {
14794 let result = unsafe { o.contents.result };
14795 unsafe { o.contents.result = core::ptr::null_mut() };
14796 CResult_ChannelReestablishDecodeErrorZPtr { result }
14798 let err = unsafe { o.contents.err };
14799 unsafe { o.contents.err = core::ptr::null_mut(); }
14800 CResult_ChannelReestablishDecodeErrorZPtr { err }
14804 result_ok: o.result_ok,
14808 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
14809 fn clone(&self) -> Self {
14810 if self.result_ok {
14811 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14812 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
14815 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14816 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14822 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14823 /// but with all dynamically-allocated buffers duplicated in new buffers.
14824 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
14826 /// The contents of CResult_ClosingSignedDecodeErrorZ
14827 pub union CResult_ClosingSignedDecodeErrorZPtr {
14828 /// A pointer to the contents in the success state.
14829 /// Reading from this pointer when `result_ok` is not set is undefined.
14830 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
14831 /// A pointer to the contents in the error state.
14832 /// Reading from this pointer when `result_ok` is set is undefined.
14833 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14836 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
14837 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14839 pub struct CResult_ClosingSignedDecodeErrorZ {
14840 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
14841 /// `err` or `result` depending on the state of `result_ok`.
14842 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
14843 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
14844 pub result_ok: bool,
14847 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14848 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
14849 CResult_ClosingSignedDecodeErrorZ {
14850 contents: CResult_ClosingSignedDecodeErrorZPtr {
14851 result: Box::into_raw(Box::new(o)),
14857 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14858 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
14859 CResult_ClosingSignedDecodeErrorZ {
14860 contents: CResult_ClosingSignedDecodeErrorZPtr {
14861 err: Box::into_raw(Box::new(e)),
14866 /// Checks if the given object is currently in the success state
14868 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
14872 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14873 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
14874 impl Drop for CResult_ClosingSignedDecodeErrorZ {
14875 fn drop(&mut self) {
14876 if self.result_ok {
14877 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14878 let _ = unsafe { Box::from_raw(self.contents.result) };
14881 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14882 let _ = unsafe { Box::from_raw(self.contents.err) };
14887 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
14888 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14889 let contents = if o.result_ok {
14890 let result = unsafe { o.contents.result };
14891 unsafe { o.contents.result = core::ptr::null_mut() };
14892 CResult_ClosingSignedDecodeErrorZPtr { result }
14894 let err = unsafe { o.contents.err };
14895 unsafe { o.contents.err = core::ptr::null_mut(); }
14896 CResult_ClosingSignedDecodeErrorZPtr { err }
14900 result_ok: o.result_ok,
14904 impl Clone for CResult_ClosingSignedDecodeErrorZ {
14905 fn clone(&self) -> Self {
14906 if self.result_ok {
14907 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
14908 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
14911 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
14912 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14918 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14919 /// but with all dynamically-allocated buffers duplicated in new buffers.
14920 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
14922 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
14923 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14924 /// A pointer to the contents in the success state.
14925 /// Reading from this pointer when `result_ok` is not set is undefined.
14926 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
14927 /// A pointer to the contents in the error state.
14928 /// Reading from this pointer when `result_ok` is set is undefined.
14929 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14932 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
14933 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14934 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14935 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
14936 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
14937 /// `err` or `result` depending on the state of `result_ok`.
14938 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
14939 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
14940 pub result_ok: bool,
14943 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14944 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14945 CResult_ClosingSignedFeeRangeDecodeErrorZ {
14946 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14947 result: Box::into_raw(Box::new(o)),
14953 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14954 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14955 CResult_ClosingSignedFeeRangeDecodeErrorZ {
14956 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14957 err: Box::into_raw(Box::new(e)),
14962 /// Checks if the given object is currently in the success state
14964 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
14968 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14969 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
14970 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14971 fn drop(&mut self) {
14972 if self.result_ok {
14973 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14974 let _ = unsafe { Box::from_raw(self.contents.result) };
14977 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14978 let _ = unsafe { Box::from_raw(self.contents.err) };
14983 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14984 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14985 let contents = if o.result_ok {
14986 let result = unsafe { o.contents.result };
14987 unsafe { o.contents.result = core::ptr::null_mut() };
14988 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
14990 let err = unsafe { o.contents.err };
14991 unsafe { o.contents.err = core::ptr::null_mut(); }
14992 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
14996 result_ok: o.result_ok,
15000 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
15001 fn clone(&self) -> Self {
15002 if self.result_ok {
15003 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
15004 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
15007 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
15008 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15014 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
15015 /// but with all dynamically-allocated buffers duplicated in new buffers.
15016 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
15018 /// The contents of CResult_CommitmentSignedDecodeErrorZ
15019 pub union CResult_CommitmentSignedDecodeErrorZPtr {
15020 /// A pointer to the contents in the success state.
15021 /// Reading from this pointer when `result_ok` is not set is undefined.
15022 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
15023 /// A pointer to the contents in the error state.
15024 /// Reading from this pointer when `result_ok` is set is undefined.
15025 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15028 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
15029 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15031 pub struct CResult_CommitmentSignedDecodeErrorZ {
15032 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
15033 /// `err` or `result` depending on the state of `result_ok`.
15034 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
15035 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
15036 pub result_ok: bool,
15039 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
15040 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
15041 CResult_CommitmentSignedDecodeErrorZ {
15042 contents: CResult_CommitmentSignedDecodeErrorZPtr {
15043 result: Box::into_raw(Box::new(o)),
15049 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
15050 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
15051 CResult_CommitmentSignedDecodeErrorZ {
15052 contents: CResult_CommitmentSignedDecodeErrorZPtr {
15053 err: Box::into_raw(Box::new(e)),
15058 /// Checks if the given object is currently in the success state
15060 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
15064 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
15065 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
15066 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
15067 fn drop(&mut self) {
15068 if self.result_ok {
15069 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15070 let _ = unsafe { Box::from_raw(self.contents.result) };
15073 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15074 let _ = unsafe { Box::from_raw(self.contents.err) };
15079 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
15080 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15081 let contents = if o.result_ok {
15082 let result = unsafe { o.contents.result };
15083 unsafe { o.contents.result = core::ptr::null_mut() };
15084 CResult_CommitmentSignedDecodeErrorZPtr { result }
15086 let err = unsafe { o.contents.err };
15087 unsafe { o.contents.err = core::ptr::null_mut(); }
15088 CResult_CommitmentSignedDecodeErrorZPtr { err }
15092 result_ok: o.result_ok,
15096 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
15097 fn clone(&self) -> Self {
15098 if self.result_ok {
15099 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15100 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
15103 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15104 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15110 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
15111 /// but with all dynamically-allocated buffers duplicated in new buffers.
15112 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
15114 /// The contents of CResult_FundingCreatedDecodeErrorZ
15115 pub union CResult_FundingCreatedDecodeErrorZPtr {
15116 /// A pointer to the contents in the success state.
15117 /// Reading from this pointer when `result_ok` is not set is undefined.
15118 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
15119 /// A pointer to the contents in the error state.
15120 /// Reading from this pointer when `result_ok` is set is undefined.
15121 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15124 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
15125 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
15126 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15127 pub struct CResult_FundingCreatedDecodeErrorZ {
15128 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
15129 /// `err` or `result` depending on the state of `result_ok`.
15130 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
15131 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
15132 pub result_ok: bool,
15135 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
15136 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
15137 CResult_FundingCreatedDecodeErrorZ {
15138 contents: CResult_FundingCreatedDecodeErrorZPtr {
15139 result: Box::into_raw(Box::new(o)),
15145 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
15146 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
15147 CResult_FundingCreatedDecodeErrorZ {
15148 contents: CResult_FundingCreatedDecodeErrorZPtr {
15149 err: Box::into_raw(Box::new(e)),
15154 /// Checks if the given object is currently in the success state
15156 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
15160 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
15161 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
15162 impl Drop for CResult_FundingCreatedDecodeErrorZ {
15163 fn drop(&mut self) {
15164 if self.result_ok {
15165 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15166 let _ = unsafe { Box::from_raw(self.contents.result) };
15169 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15170 let _ = unsafe { Box::from_raw(self.contents.err) };
15175 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
15176 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
15177 let contents = if o.result_ok {
15178 let result = unsafe { o.contents.result };
15179 unsafe { o.contents.result = core::ptr::null_mut() };
15180 CResult_FundingCreatedDecodeErrorZPtr { result }
15182 let err = unsafe { o.contents.err };
15183 unsafe { o.contents.err = core::ptr::null_mut(); }
15184 CResult_FundingCreatedDecodeErrorZPtr { err }
15188 result_ok: o.result_ok,
15192 impl Clone for CResult_FundingCreatedDecodeErrorZ {
15193 fn clone(&self) -> Self {
15194 if self.result_ok {
15195 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
15196 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
15199 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
15200 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15206 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
15207 /// but with all dynamically-allocated buffers duplicated in new buffers.
15208 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
15210 /// The contents of CResult_FundingSignedDecodeErrorZ
15211 pub union CResult_FundingSignedDecodeErrorZPtr {
15212 /// A pointer to the contents in the success state.
15213 /// Reading from this pointer when `result_ok` is not set is undefined.
15214 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
15215 /// A pointer to the contents in the error state.
15216 /// Reading from this pointer when `result_ok` is set is undefined.
15217 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15220 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
15221 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15222 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15223 pub struct CResult_FundingSignedDecodeErrorZ {
15224 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
15225 /// `err` or `result` depending on the state of `result_ok`.
15226 pub contents: CResult_FundingSignedDecodeErrorZPtr,
15227 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
15228 pub result_ok: bool,
15231 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
15232 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
15233 CResult_FundingSignedDecodeErrorZ {
15234 contents: CResult_FundingSignedDecodeErrorZPtr {
15235 result: Box::into_raw(Box::new(o)),
15241 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
15242 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
15243 CResult_FundingSignedDecodeErrorZ {
15244 contents: CResult_FundingSignedDecodeErrorZPtr {
15245 err: Box::into_raw(Box::new(e)),
15250 /// Checks if the given object is currently in the success state
15252 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
15256 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
15257 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
15258 impl Drop for CResult_FundingSignedDecodeErrorZ {
15259 fn drop(&mut self) {
15260 if self.result_ok {
15261 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15262 let _ = unsafe { Box::from_raw(self.contents.result) };
15265 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15266 let _ = unsafe { Box::from_raw(self.contents.err) };
15271 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
15272 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15273 let contents = if o.result_ok {
15274 let result = unsafe { o.contents.result };
15275 unsafe { o.contents.result = core::ptr::null_mut() };
15276 CResult_FundingSignedDecodeErrorZPtr { result }
15278 let err = unsafe { o.contents.err };
15279 unsafe { o.contents.err = core::ptr::null_mut(); }
15280 CResult_FundingSignedDecodeErrorZPtr { err }
15284 result_ok: o.result_ok,
15288 impl Clone for CResult_FundingSignedDecodeErrorZ {
15289 fn clone(&self) -> Self {
15290 if self.result_ok {
15291 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
15292 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
15295 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
15296 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15302 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
15303 /// but with all dynamically-allocated buffers duplicated in new buffers.
15304 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
15306 /// The contents of CResult_ChannelReadyDecodeErrorZ
15307 pub union CResult_ChannelReadyDecodeErrorZPtr {
15308 /// A pointer to the contents in the success state.
15309 /// Reading from this pointer when `result_ok` is not set is undefined.
15310 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
15311 /// A pointer to the contents in the error state.
15312 /// Reading from this pointer when `result_ok` is set is undefined.
15313 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15316 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
15317 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
15318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15319 pub struct CResult_ChannelReadyDecodeErrorZ {
15320 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
15321 /// `err` or `result` depending on the state of `result_ok`.
15322 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
15323 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
15324 pub result_ok: bool,
15327 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
15328 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
15329 CResult_ChannelReadyDecodeErrorZ {
15330 contents: CResult_ChannelReadyDecodeErrorZPtr {
15331 result: Box::into_raw(Box::new(o)),
15337 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
15338 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
15339 CResult_ChannelReadyDecodeErrorZ {
15340 contents: CResult_ChannelReadyDecodeErrorZPtr {
15341 err: Box::into_raw(Box::new(e)),
15346 /// Checks if the given object is currently in the success state
15348 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
15352 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
15353 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
15354 impl Drop for CResult_ChannelReadyDecodeErrorZ {
15355 fn drop(&mut self) {
15356 if self.result_ok {
15357 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15358 let _ = unsafe { Box::from_raw(self.contents.result) };
15361 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15362 let _ = unsafe { Box::from_raw(self.contents.err) };
15367 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
15368 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
15369 let contents = if o.result_ok {
15370 let result = unsafe { o.contents.result };
15371 unsafe { o.contents.result = core::ptr::null_mut() };
15372 CResult_ChannelReadyDecodeErrorZPtr { result }
15374 let err = unsafe { o.contents.err };
15375 unsafe { o.contents.err = core::ptr::null_mut(); }
15376 CResult_ChannelReadyDecodeErrorZPtr { err }
15380 result_ok: o.result_ok,
15384 impl Clone for CResult_ChannelReadyDecodeErrorZ {
15385 fn clone(&self) -> Self {
15386 if self.result_ok {
15387 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
15388 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
15391 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
15392 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15398 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
15399 /// but with all dynamically-allocated buffers duplicated in new buffers.
15400 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
15402 /// The contents of CResult_InitDecodeErrorZ
15403 pub union CResult_InitDecodeErrorZPtr {
15404 /// A pointer to the contents in the success state.
15405 /// Reading from this pointer when `result_ok` is not set is undefined.
15406 pub result: *mut crate::lightning::ln::msgs::Init,
15407 /// A pointer to the contents in the error state.
15408 /// Reading from this pointer when `result_ok` is set is undefined.
15409 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15412 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
15413 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
15414 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15415 pub struct CResult_InitDecodeErrorZ {
15416 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
15417 /// `err` or `result` depending on the state of `result_ok`.
15418 pub contents: CResult_InitDecodeErrorZPtr,
15419 /// Whether this CResult_InitDecodeErrorZ represents a success state.
15420 pub result_ok: bool,
15423 /// Creates a new CResult_InitDecodeErrorZ in the success state.
15424 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
15425 CResult_InitDecodeErrorZ {
15426 contents: CResult_InitDecodeErrorZPtr {
15427 result: Box::into_raw(Box::new(o)),
15433 /// Creates a new CResult_InitDecodeErrorZ in the error state.
15434 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
15435 CResult_InitDecodeErrorZ {
15436 contents: CResult_InitDecodeErrorZPtr {
15437 err: Box::into_raw(Box::new(e)),
15442 /// Checks if the given object is currently in the success state
15444 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
15448 /// Frees any resources used by the CResult_InitDecodeErrorZ.
15449 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
15450 impl Drop for CResult_InitDecodeErrorZ {
15451 fn drop(&mut self) {
15452 if self.result_ok {
15453 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15454 let _ = unsafe { Box::from_raw(self.contents.result) };
15457 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15458 let _ = unsafe { Box::from_raw(self.contents.err) };
15463 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
15464 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
15465 let contents = if o.result_ok {
15466 let result = unsafe { o.contents.result };
15467 unsafe { o.contents.result = core::ptr::null_mut() };
15468 CResult_InitDecodeErrorZPtr { result }
15470 let err = unsafe { o.contents.err };
15471 unsafe { o.contents.err = core::ptr::null_mut(); }
15472 CResult_InitDecodeErrorZPtr { err }
15476 result_ok: o.result_ok,
15480 impl Clone for CResult_InitDecodeErrorZ {
15481 fn clone(&self) -> Self {
15482 if self.result_ok {
15483 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
15484 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
15487 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
15488 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15494 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15495 /// but with all dynamically-allocated buffers duplicated in new buffers.
15496 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
15498 /// The contents of CResult_OpenChannelDecodeErrorZ
15499 pub union CResult_OpenChannelDecodeErrorZPtr {
15500 /// A pointer to the contents in the success state.
15501 /// Reading from this pointer when `result_ok` is not set is undefined.
15502 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
15503 /// A pointer to the contents in the error state.
15504 /// Reading from this pointer when `result_ok` is set is undefined.
15505 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15508 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
15509 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15510 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15511 pub struct CResult_OpenChannelDecodeErrorZ {
15512 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
15513 /// `err` or `result` depending on the state of `result_ok`.
15514 pub contents: CResult_OpenChannelDecodeErrorZPtr,
15515 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
15516 pub result_ok: bool,
15519 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15520 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
15521 CResult_OpenChannelDecodeErrorZ {
15522 contents: CResult_OpenChannelDecodeErrorZPtr {
15523 result: Box::into_raw(Box::new(o)),
15529 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15530 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
15531 CResult_OpenChannelDecodeErrorZ {
15532 contents: CResult_OpenChannelDecodeErrorZPtr {
15533 err: Box::into_raw(Box::new(e)),
15538 /// Checks if the given object is currently in the success state
15540 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
15544 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15545 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
15546 impl Drop for CResult_OpenChannelDecodeErrorZ {
15547 fn drop(&mut self) {
15548 if self.result_ok {
15549 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15550 let _ = unsafe { Box::from_raw(self.contents.result) };
15553 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15554 let _ = unsafe { Box::from_raw(self.contents.err) };
15559 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
15560 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15561 let contents = if o.result_ok {
15562 let result = unsafe { o.contents.result };
15563 unsafe { o.contents.result = core::ptr::null_mut() };
15564 CResult_OpenChannelDecodeErrorZPtr { result }
15566 let err = unsafe { o.contents.err };
15567 unsafe { o.contents.err = core::ptr::null_mut(); }
15568 CResult_OpenChannelDecodeErrorZPtr { err }
15572 result_ok: o.result_ok,
15576 impl Clone for CResult_OpenChannelDecodeErrorZ {
15577 fn clone(&self) -> Self {
15578 if self.result_ok {
15579 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
15580 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
15583 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
15584 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15590 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15591 /// but with all dynamically-allocated buffers duplicated in new buffers.
15592 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
15594 /// The contents of CResult_RevokeAndACKDecodeErrorZ
15595 pub union CResult_RevokeAndACKDecodeErrorZPtr {
15596 /// A pointer to the contents in the success state.
15597 /// Reading from this pointer when `result_ok` is not set is undefined.
15598 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
15599 /// A pointer to the contents in the error state.
15600 /// Reading from this pointer when `result_ok` is set is undefined.
15601 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15604 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
15605 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
15606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15607 pub struct CResult_RevokeAndACKDecodeErrorZ {
15608 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
15609 /// `err` or `result` depending on the state of `result_ok`.
15610 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
15611 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
15612 pub result_ok: bool,
15615 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15616 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
15617 CResult_RevokeAndACKDecodeErrorZ {
15618 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15619 result: Box::into_raw(Box::new(o)),
15625 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15626 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
15627 CResult_RevokeAndACKDecodeErrorZ {
15628 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15629 err: Box::into_raw(Box::new(e)),
15634 /// Checks if the given object is currently in the success state
15636 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
15640 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15641 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
15642 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
15643 fn drop(&mut self) {
15644 if self.result_ok {
15645 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15646 let _ = unsafe { Box::from_raw(self.contents.result) };
15649 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15650 let _ = unsafe { Box::from_raw(self.contents.err) };
15655 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
15656 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
15657 let contents = if o.result_ok {
15658 let result = unsafe { o.contents.result };
15659 unsafe { o.contents.result = core::ptr::null_mut() };
15660 CResult_RevokeAndACKDecodeErrorZPtr { result }
15662 let err = unsafe { o.contents.err };
15663 unsafe { o.contents.err = core::ptr::null_mut(); }
15664 CResult_RevokeAndACKDecodeErrorZPtr { err }
15668 result_ok: o.result_ok,
15672 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
15673 fn clone(&self) -> Self {
15674 if self.result_ok {
15675 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15676 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
15679 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15680 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15686 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15687 /// but with all dynamically-allocated buffers duplicated in new buffers.
15688 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
15690 /// The contents of CResult_ShutdownDecodeErrorZ
15691 pub union CResult_ShutdownDecodeErrorZPtr {
15692 /// A pointer to the contents in the success state.
15693 /// Reading from this pointer when `result_ok` is not set is undefined.
15694 pub result: *mut crate::lightning::ln::msgs::Shutdown,
15695 /// A pointer to the contents in the error state.
15696 /// Reading from this pointer when `result_ok` is set is undefined.
15697 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15700 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
15701 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
15702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15703 pub struct CResult_ShutdownDecodeErrorZ {
15704 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
15705 /// `err` or `result` depending on the state of `result_ok`.
15706 pub contents: CResult_ShutdownDecodeErrorZPtr,
15707 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
15708 pub result_ok: bool,
15711 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15712 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
15713 CResult_ShutdownDecodeErrorZ {
15714 contents: CResult_ShutdownDecodeErrorZPtr {
15715 result: Box::into_raw(Box::new(o)),
15721 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15722 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
15723 CResult_ShutdownDecodeErrorZ {
15724 contents: CResult_ShutdownDecodeErrorZPtr {
15725 err: Box::into_raw(Box::new(e)),
15730 /// Checks if the given object is currently in the success state
15732 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
15736 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15737 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
15738 impl Drop for CResult_ShutdownDecodeErrorZ {
15739 fn drop(&mut self) {
15740 if self.result_ok {
15741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15742 let _ = unsafe { Box::from_raw(self.contents.result) };
15745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15746 let _ = unsafe { Box::from_raw(self.contents.err) };
15751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
15752 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
15753 let contents = if o.result_ok {
15754 let result = unsafe { o.contents.result };
15755 unsafe { o.contents.result = core::ptr::null_mut() };
15756 CResult_ShutdownDecodeErrorZPtr { result }
15758 let err = unsafe { o.contents.err };
15759 unsafe { o.contents.err = core::ptr::null_mut(); }
15760 CResult_ShutdownDecodeErrorZPtr { err }
15764 result_ok: o.result_ok,
15768 impl Clone for CResult_ShutdownDecodeErrorZ {
15769 fn clone(&self) -> Self {
15770 if self.result_ok {
15771 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
15772 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
15775 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
15776 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15782 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15783 /// but with all dynamically-allocated buffers duplicated in new buffers.
15784 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
15786 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
15787 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
15788 /// A pointer to the contents in the success state.
15789 /// Reading from this pointer when `result_ok` is not set is undefined.
15790 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15791 /// A pointer to the contents in the error state.
15792 /// Reading from this pointer when `result_ok` is set is undefined.
15793 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15796 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15797 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15799 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
15800 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15801 /// `err` or `result` depending on the state of `result_ok`.
15802 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
15803 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15804 pub result_ok: bool,
15807 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15808 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
15809 CResult_UpdateFailHTLCDecodeErrorZ {
15810 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15811 result: Box::into_raw(Box::new(o)),
15817 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15818 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
15819 CResult_UpdateFailHTLCDecodeErrorZ {
15820 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15821 err: Box::into_raw(Box::new(e)),
15826 /// Checks if the given object is currently in the success state
15828 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
15832 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15833 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
15834 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
15835 fn drop(&mut self) {
15836 if self.result_ok {
15837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15838 let _ = unsafe { Box::from_raw(self.contents.result) };
15841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15842 let _ = unsafe { Box::from_raw(self.contents.err) };
15847 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
15848 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15849 let contents = if o.result_ok {
15850 let result = unsafe { o.contents.result };
15851 unsafe { o.contents.result = core::ptr::null_mut() };
15852 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
15854 let err = unsafe { o.contents.err };
15855 unsafe { o.contents.err = core::ptr::null_mut(); }
15856 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
15860 result_ok: o.result_ok,
15864 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
15865 fn clone(&self) -> Self {
15866 if self.result_ok {
15867 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15868 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
15871 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15872 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15878 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15879 /// but with all dynamically-allocated buffers duplicated in new buffers.
15880 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
15882 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15883 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15884 /// A pointer to the contents in the success state.
15885 /// Reading from this pointer when `result_ok` is not set is undefined.
15886 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15887 /// A pointer to the contents in the error state.
15888 /// Reading from this pointer when `result_ok` is set is undefined.
15889 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15892 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15893 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15895 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15896 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15897 /// `err` or `result` depending on the state of `result_ok`.
15898 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
15899 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15900 pub result_ok: bool,
15903 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15904 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15905 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15906 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15907 result: Box::into_raw(Box::new(o)),
15913 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15914 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15915 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15916 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15917 err: Box::into_raw(Box::new(e)),
15922 /// Checks if the given object is currently in the success state
15924 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
15928 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15929 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
15930 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15931 fn drop(&mut self) {
15932 if self.result_ok {
15933 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15934 let _ = unsafe { Box::from_raw(self.contents.result) };
15937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15938 let _ = unsafe { Box::from_raw(self.contents.err) };
15943 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15944 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15945 let contents = if o.result_ok {
15946 let result = unsafe { o.contents.result };
15947 unsafe { o.contents.result = core::ptr::null_mut() };
15948 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
15950 let err = unsafe { o.contents.err };
15951 unsafe { o.contents.err = core::ptr::null_mut(); }
15952 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
15956 result_ok: o.result_ok,
15960 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15961 fn clone(&self) -> Self {
15962 if self.result_ok {
15963 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15964 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
15967 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15968 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15974 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15975 /// but with all dynamically-allocated buffers duplicated in new buffers.
15976 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
15978 /// The contents of CResult_UpdateFeeDecodeErrorZ
15979 pub union CResult_UpdateFeeDecodeErrorZPtr {
15980 /// A pointer to the contents in the success state.
15981 /// Reading from this pointer when `result_ok` is not set is undefined.
15982 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
15983 /// A pointer to the contents in the error state.
15984 /// Reading from this pointer when `result_ok` is set is undefined.
15985 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15988 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
15989 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
15990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15991 pub struct CResult_UpdateFeeDecodeErrorZ {
15992 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
15993 /// `err` or `result` depending on the state of `result_ok`.
15994 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
15995 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
15996 pub result_ok: bool,
15999 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16000 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
16001 CResult_UpdateFeeDecodeErrorZ {
16002 contents: CResult_UpdateFeeDecodeErrorZPtr {
16003 result: Box::into_raw(Box::new(o)),
16009 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16010 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
16011 CResult_UpdateFeeDecodeErrorZ {
16012 contents: CResult_UpdateFeeDecodeErrorZPtr {
16013 err: Box::into_raw(Box::new(e)),
16018 /// Checks if the given object is currently in the success state
16020 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
16024 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16025 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
16026 impl Drop for CResult_UpdateFeeDecodeErrorZ {
16027 fn drop(&mut self) {
16028 if self.result_ok {
16029 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16030 let _ = unsafe { Box::from_raw(self.contents.result) };
16033 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16034 let _ = unsafe { Box::from_raw(self.contents.err) };
16039 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
16040 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
16041 let contents = if o.result_ok {
16042 let result = unsafe { o.contents.result };
16043 unsafe { o.contents.result = core::ptr::null_mut() };
16044 CResult_UpdateFeeDecodeErrorZPtr { result }
16046 let err = unsafe { o.contents.err };
16047 unsafe { o.contents.err = core::ptr::null_mut(); }
16048 CResult_UpdateFeeDecodeErrorZPtr { err }
16052 result_ok: o.result_ok,
16056 impl Clone for CResult_UpdateFeeDecodeErrorZ {
16057 fn clone(&self) -> Self {
16058 if self.result_ok {
16059 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
16060 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
16063 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
16064 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16070 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16071 /// but with all dynamically-allocated buffers duplicated in new buffers.
16072 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
16074 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
16075 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16076 /// A pointer to the contents in the success state.
16077 /// Reading from this pointer when `result_ok` is not set is undefined.
16078 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
16079 /// A pointer to the contents in the error state.
16080 /// Reading from this pointer when `result_ok` is set is undefined.
16081 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16084 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
16085 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16087 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
16088 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
16089 /// `err` or `result` depending on the state of `result_ok`.
16090 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
16091 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
16092 pub result_ok: bool,
16095 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16096 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16097 CResult_UpdateFulfillHTLCDecodeErrorZ {
16098 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16099 result: Box::into_raw(Box::new(o)),
16105 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16106 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16107 CResult_UpdateFulfillHTLCDecodeErrorZ {
16108 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16109 err: Box::into_raw(Box::new(e)),
16114 /// Checks if the given object is currently in the success state
16116 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
16120 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16121 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
16122 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
16123 fn drop(&mut self) {
16124 if self.result_ok {
16125 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16126 let _ = unsafe { Box::from_raw(self.contents.result) };
16129 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16130 let _ = unsafe { Box::from_raw(self.contents.err) };
16135 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
16136 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16137 let contents = if o.result_ok {
16138 let result = unsafe { o.contents.result };
16139 unsafe { o.contents.result = core::ptr::null_mut() };
16140 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
16142 let err = unsafe { o.contents.err };
16143 unsafe { o.contents.err = core::ptr::null_mut(); }
16144 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
16148 result_ok: o.result_ok,
16152 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
16153 fn clone(&self) -> Self {
16154 if self.result_ok {
16155 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16156 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
16159 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16160 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16166 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16167 /// but with all dynamically-allocated buffers duplicated in new buffers.
16168 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
16170 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
16171 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
16172 /// A pointer to the contents in the success state.
16173 /// Reading from this pointer when `result_ok` is not set is undefined.
16174 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
16175 /// A pointer to the contents in the error state.
16176 /// Reading from this pointer when `result_ok` is set is undefined.
16177 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16180 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
16181 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16182 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16183 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
16184 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
16185 /// `err` or `result` depending on the state of `result_ok`.
16186 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
16187 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
16188 pub result_ok: bool,
16191 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16192 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
16193 CResult_UpdateAddHTLCDecodeErrorZ {
16194 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16195 result: Box::into_raw(Box::new(o)),
16201 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16202 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
16203 CResult_UpdateAddHTLCDecodeErrorZ {
16204 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16205 err: Box::into_raw(Box::new(e)),
16210 /// Checks if the given object is currently in the success state
16212 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
16216 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16217 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
16218 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
16219 fn drop(&mut self) {
16220 if self.result_ok {
16221 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16222 let _ = unsafe { Box::from_raw(self.contents.result) };
16225 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16226 let _ = unsafe { Box::from_raw(self.contents.err) };
16231 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
16232 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16233 let contents = if o.result_ok {
16234 let result = unsafe { o.contents.result };
16235 unsafe { o.contents.result = core::ptr::null_mut() };
16236 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
16238 let err = unsafe { o.contents.err };
16239 unsafe { o.contents.err = core::ptr::null_mut(); }
16240 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
16244 result_ok: o.result_ok,
16248 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
16249 fn clone(&self) -> Self {
16250 if self.result_ok {
16251 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16252 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
16255 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16256 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16262 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16263 /// but with all dynamically-allocated buffers duplicated in new buffers.
16264 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
16266 /// The contents of CResult_OnionMessageDecodeErrorZ
16267 pub union CResult_OnionMessageDecodeErrorZPtr {
16268 /// A pointer to the contents in the success state.
16269 /// Reading from this pointer when `result_ok` is not set is undefined.
16270 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
16271 /// A pointer to the contents in the error state.
16272 /// Reading from this pointer when `result_ok` is set is undefined.
16273 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16276 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
16277 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16279 pub struct CResult_OnionMessageDecodeErrorZ {
16280 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
16281 /// `err` or `result` depending on the state of `result_ok`.
16282 pub contents: CResult_OnionMessageDecodeErrorZPtr,
16283 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
16284 pub result_ok: bool,
16287 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
16288 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
16289 CResult_OnionMessageDecodeErrorZ {
16290 contents: CResult_OnionMessageDecodeErrorZPtr {
16291 result: Box::into_raw(Box::new(o)),
16297 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
16298 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
16299 CResult_OnionMessageDecodeErrorZ {
16300 contents: CResult_OnionMessageDecodeErrorZPtr {
16301 err: Box::into_raw(Box::new(e)),
16306 /// Checks if the given object is currently in the success state
16308 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
16312 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
16313 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
16314 impl Drop for CResult_OnionMessageDecodeErrorZ {
16315 fn drop(&mut self) {
16316 if self.result_ok {
16317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16318 let _ = unsafe { Box::from_raw(self.contents.result) };
16321 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16322 let _ = unsafe { Box::from_raw(self.contents.err) };
16327 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
16328 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16329 let contents = if o.result_ok {
16330 let result = unsafe { o.contents.result };
16331 unsafe { o.contents.result = core::ptr::null_mut() };
16332 CResult_OnionMessageDecodeErrorZPtr { result }
16334 let err = unsafe { o.contents.err };
16335 unsafe { o.contents.err = core::ptr::null_mut(); }
16336 CResult_OnionMessageDecodeErrorZPtr { err }
16340 result_ok: o.result_ok,
16344 impl Clone for CResult_OnionMessageDecodeErrorZ {
16345 fn clone(&self) -> Self {
16346 if self.result_ok {
16347 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
16348 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
16351 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
16352 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16358 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
16359 /// but with all dynamically-allocated buffers duplicated in new buffers.
16360 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
16362 /// The contents of CResult_PingDecodeErrorZ
16363 pub union CResult_PingDecodeErrorZPtr {
16364 /// A pointer to the contents in the success state.
16365 /// Reading from this pointer when `result_ok` is not set is undefined.
16366 pub result: *mut crate::lightning::ln::msgs::Ping,
16367 /// A pointer to the contents in the error state.
16368 /// Reading from this pointer when `result_ok` is set is undefined.
16369 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16372 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
16373 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
16374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16375 pub struct CResult_PingDecodeErrorZ {
16376 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
16377 /// `err` or `result` depending on the state of `result_ok`.
16378 pub contents: CResult_PingDecodeErrorZPtr,
16379 /// Whether this CResult_PingDecodeErrorZ represents a success state.
16380 pub result_ok: bool,
16383 /// Creates a new CResult_PingDecodeErrorZ in the success state.
16384 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
16385 CResult_PingDecodeErrorZ {
16386 contents: CResult_PingDecodeErrorZPtr {
16387 result: Box::into_raw(Box::new(o)),
16393 /// Creates a new CResult_PingDecodeErrorZ in the error state.
16394 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
16395 CResult_PingDecodeErrorZ {
16396 contents: CResult_PingDecodeErrorZPtr {
16397 err: Box::into_raw(Box::new(e)),
16402 /// Checks if the given object is currently in the success state
16404 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
16408 /// Frees any resources used by the CResult_PingDecodeErrorZ.
16409 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
16410 impl Drop for CResult_PingDecodeErrorZ {
16411 fn drop(&mut self) {
16412 if self.result_ok {
16413 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16414 let _ = unsafe { Box::from_raw(self.contents.result) };
16417 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16418 let _ = unsafe { Box::from_raw(self.contents.err) };
16423 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
16424 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
16425 let contents = if o.result_ok {
16426 let result = unsafe { o.contents.result };
16427 unsafe { o.contents.result = core::ptr::null_mut() };
16428 CResult_PingDecodeErrorZPtr { result }
16430 let err = unsafe { o.contents.err };
16431 unsafe { o.contents.err = core::ptr::null_mut(); }
16432 CResult_PingDecodeErrorZPtr { err }
16436 result_ok: o.result_ok,
16440 impl Clone for CResult_PingDecodeErrorZ {
16441 fn clone(&self) -> Self {
16442 if self.result_ok {
16443 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
16444 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
16447 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
16448 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16454 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16455 /// but with all dynamically-allocated buffers duplicated in new buffers.
16456 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
16458 /// The contents of CResult_PongDecodeErrorZ
16459 pub union CResult_PongDecodeErrorZPtr {
16460 /// A pointer to the contents in the success state.
16461 /// Reading from this pointer when `result_ok` is not set is undefined.
16462 pub result: *mut crate::lightning::ln::msgs::Pong,
16463 /// A pointer to the contents in the error state.
16464 /// Reading from this pointer when `result_ok` is set is undefined.
16465 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16468 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
16469 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
16470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16471 pub struct CResult_PongDecodeErrorZ {
16472 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
16473 /// `err` or `result` depending on the state of `result_ok`.
16474 pub contents: CResult_PongDecodeErrorZPtr,
16475 /// Whether this CResult_PongDecodeErrorZ represents a success state.
16476 pub result_ok: bool,
16479 /// Creates a new CResult_PongDecodeErrorZ in the success state.
16480 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
16481 CResult_PongDecodeErrorZ {
16482 contents: CResult_PongDecodeErrorZPtr {
16483 result: Box::into_raw(Box::new(o)),
16489 /// Creates a new CResult_PongDecodeErrorZ in the error state.
16490 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
16491 CResult_PongDecodeErrorZ {
16492 contents: CResult_PongDecodeErrorZPtr {
16493 err: Box::into_raw(Box::new(e)),
16498 /// Checks if the given object is currently in the success state
16500 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
16504 /// Frees any resources used by the CResult_PongDecodeErrorZ.
16505 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
16506 impl Drop for CResult_PongDecodeErrorZ {
16507 fn drop(&mut self) {
16508 if self.result_ok {
16509 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16510 let _ = unsafe { Box::from_raw(self.contents.result) };
16513 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16514 let _ = unsafe { Box::from_raw(self.contents.err) };
16519 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
16520 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
16521 let contents = if o.result_ok {
16522 let result = unsafe { o.contents.result };
16523 unsafe { o.contents.result = core::ptr::null_mut() };
16524 CResult_PongDecodeErrorZPtr { result }
16526 let err = unsafe { o.contents.err };
16527 unsafe { o.contents.err = core::ptr::null_mut(); }
16528 CResult_PongDecodeErrorZPtr { err }
16532 result_ok: o.result_ok,
16536 impl Clone for CResult_PongDecodeErrorZ {
16537 fn clone(&self) -> Self {
16538 if self.result_ok {
16539 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
16540 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
16543 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
16544 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16550 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16551 /// but with all dynamically-allocated buffers duplicated in new buffers.
16552 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
16554 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
16555 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16556 /// A pointer to the contents in the success state.
16557 /// Reading from this pointer when `result_ok` is not set is undefined.
16558 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
16559 /// A pointer to the contents in the error state.
16560 /// Reading from this pointer when `result_ok` is set is undefined.
16561 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16564 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16565 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16567 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16568 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
16569 /// `err` or `result` depending on the state of `result_ok`.
16570 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
16571 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
16572 pub result_ok: bool,
16575 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16576 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16577 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16578 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16579 result: Box::into_raw(Box::new(o)),
16585 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16586 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16587 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16588 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16589 err: Box::into_raw(Box::new(e)),
16594 /// Checks if the given object is currently in the success state
16596 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
16600 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16601 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
16602 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16603 fn drop(&mut self) {
16604 if self.result_ok {
16605 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16606 let _ = unsafe { Box::from_raw(self.contents.result) };
16609 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16610 let _ = unsafe { Box::from_raw(self.contents.err) };
16615 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16616 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16617 let contents = if o.result_ok {
16618 let result = unsafe { o.contents.result };
16619 unsafe { o.contents.result = core::ptr::null_mut() };
16620 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
16622 let err = unsafe { o.contents.err };
16623 unsafe { o.contents.err = core::ptr::null_mut(); }
16624 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
16628 result_ok: o.result_ok,
16632 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16633 fn clone(&self) -> Self {
16634 if self.result_ok {
16635 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16636 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16639 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16640 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16646 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16647 /// but with all dynamically-allocated buffers duplicated in new buffers.
16648 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16650 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
16651 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
16652 /// A pointer to the contents in the success state.
16653 /// Reading from this pointer when `result_ok` is not set is undefined.
16654 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
16655 /// A pointer to the contents in the error state.
16656 /// Reading from this pointer when `result_ok` is set is undefined.
16657 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16660 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16661 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16663 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
16664 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
16665 /// `err` or `result` depending on the state of `result_ok`.
16666 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
16667 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
16668 pub result_ok: bool,
16671 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16672 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
16673 CResult_ChannelAnnouncementDecodeErrorZ {
16674 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16675 result: Box::into_raw(Box::new(o)),
16681 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16682 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
16683 CResult_ChannelAnnouncementDecodeErrorZ {
16684 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16685 err: Box::into_raw(Box::new(e)),
16690 /// Checks if the given object is currently in the success state
16692 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
16696 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16697 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
16698 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
16699 fn drop(&mut self) {
16700 if self.result_ok {
16701 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16702 let _ = unsafe { Box::from_raw(self.contents.result) };
16705 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16706 let _ = unsafe { Box::from_raw(self.contents.err) };
16711 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
16712 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16713 let contents = if o.result_ok {
16714 let result = unsafe { o.contents.result };
16715 unsafe { o.contents.result = core::ptr::null_mut() };
16716 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
16718 let err = unsafe { o.contents.err };
16719 unsafe { o.contents.err = core::ptr::null_mut(); }
16720 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
16724 result_ok: o.result_ok,
16728 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
16729 fn clone(&self) -> Self {
16730 if self.result_ok {
16731 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16732 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16735 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16736 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16742 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16743 /// but with all dynamically-allocated buffers duplicated in new buffers.
16744 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16746 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
16747 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16748 /// A pointer to the contents in the success state.
16749 /// Reading from this pointer when `result_ok` is not set is undefined.
16750 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
16751 /// A pointer to the contents in the error state.
16752 /// Reading from this pointer when `result_ok` is set is undefined.
16753 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16756 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16757 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16759 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
16760 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
16761 /// `err` or `result` depending on the state of `result_ok`.
16762 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
16763 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
16764 pub result_ok: bool,
16767 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16768 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16769 CResult_UnsignedChannelUpdateDecodeErrorZ {
16770 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16771 result: Box::into_raw(Box::new(o)),
16777 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16778 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16779 CResult_UnsignedChannelUpdateDecodeErrorZ {
16780 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16781 err: Box::into_raw(Box::new(e)),
16786 /// Checks if the given object is currently in the success state
16788 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
16792 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16793 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
16794 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
16795 fn drop(&mut self) {
16796 if self.result_ok {
16797 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16798 let _ = unsafe { Box::from_raw(self.contents.result) };
16801 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16802 let _ = unsafe { Box::from_raw(self.contents.err) };
16807 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
16808 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16809 let contents = if o.result_ok {
16810 let result = unsafe { o.contents.result };
16811 unsafe { o.contents.result = core::ptr::null_mut() };
16812 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
16814 let err = unsafe { o.contents.err };
16815 unsafe { o.contents.err = core::ptr::null_mut(); }
16816 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
16820 result_ok: o.result_ok,
16824 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
16825 fn clone(&self) -> Self {
16826 if self.result_ok {
16827 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16828 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
16831 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16832 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16838 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16839 /// but with all dynamically-allocated buffers duplicated in new buffers.
16840 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16842 /// The contents of CResult_ChannelUpdateDecodeErrorZ
16843 pub union CResult_ChannelUpdateDecodeErrorZPtr {
16844 /// A pointer to the contents in the success state.
16845 /// Reading from this pointer when `result_ok` is not set is undefined.
16846 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
16847 /// A pointer to the contents in the error state.
16848 /// Reading from this pointer when `result_ok` is set is undefined.
16849 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16852 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16853 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16854 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16855 pub struct CResult_ChannelUpdateDecodeErrorZ {
16856 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16857 /// `err` or `result` depending on the state of `result_ok`.
16858 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
16859 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16860 pub result_ok: bool,
16863 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16864 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
16865 CResult_ChannelUpdateDecodeErrorZ {
16866 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16867 result: Box::into_raw(Box::new(o)),
16873 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16874 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
16875 CResult_ChannelUpdateDecodeErrorZ {
16876 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16877 err: Box::into_raw(Box::new(e)),
16882 /// Checks if the given object is currently in the success state
16884 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
16888 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16889 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
16890 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
16891 fn drop(&mut self) {
16892 if self.result_ok {
16893 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16894 let _ = unsafe { Box::from_raw(self.contents.result) };
16897 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16898 let _ = unsafe { Box::from_raw(self.contents.err) };
16903 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
16904 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16905 let contents = if o.result_ok {
16906 let result = unsafe { o.contents.result };
16907 unsafe { o.contents.result = core::ptr::null_mut() };
16908 CResult_ChannelUpdateDecodeErrorZPtr { result }
16910 let err = unsafe { o.contents.err };
16911 unsafe { o.contents.err = core::ptr::null_mut(); }
16912 CResult_ChannelUpdateDecodeErrorZPtr { err }
16916 result_ok: o.result_ok,
16920 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
16921 fn clone(&self) -> Self {
16922 if self.result_ok {
16923 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16924 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
16927 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16928 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16934 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16935 /// but with all dynamically-allocated buffers duplicated in new buffers.
16936 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16938 /// The contents of CResult_ErrorMessageDecodeErrorZ
16939 pub union CResult_ErrorMessageDecodeErrorZPtr {
16940 /// A pointer to the contents in the success state.
16941 /// Reading from this pointer when `result_ok` is not set is undefined.
16942 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
16943 /// A pointer to the contents in the error state.
16944 /// Reading from this pointer when `result_ok` is set is undefined.
16945 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16948 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16949 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16951 pub struct CResult_ErrorMessageDecodeErrorZ {
16952 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16953 /// `err` or `result` depending on the state of `result_ok`.
16954 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
16955 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16956 pub result_ok: bool,
16959 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16960 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
16961 CResult_ErrorMessageDecodeErrorZ {
16962 contents: CResult_ErrorMessageDecodeErrorZPtr {
16963 result: Box::into_raw(Box::new(o)),
16969 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16970 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
16971 CResult_ErrorMessageDecodeErrorZ {
16972 contents: CResult_ErrorMessageDecodeErrorZPtr {
16973 err: Box::into_raw(Box::new(e)),
16978 /// Checks if the given object is currently in the success state
16980 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
16984 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16985 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
16986 impl Drop for CResult_ErrorMessageDecodeErrorZ {
16987 fn drop(&mut self) {
16988 if self.result_ok {
16989 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16990 let _ = unsafe { Box::from_raw(self.contents.result) };
16993 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16994 let _ = unsafe { Box::from_raw(self.contents.err) };
16999 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
17000 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17001 let contents = if o.result_ok {
17002 let result = unsafe { o.contents.result };
17003 unsafe { o.contents.result = core::ptr::null_mut() };
17004 CResult_ErrorMessageDecodeErrorZPtr { result }
17006 let err = unsafe { o.contents.err };
17007 unsafe { o.contents.err = core::ptr::null_mut(); }
17008 CResult_ErrorMessageDecodeErrorZPtr { err }
17012 result_ok: o.result_ok,
17016 impl Clone for CResult_ErrorMessageDecodeErrorZ {
17017 fn clone(&self) -> Self {
17018 if self.result_ok {
17019 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
17020 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
17023 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
17024 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17030 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
17031 /// but with all dynamically-allocated buffers duplicated in new buffers.
17032 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
17034 /// The contents of CResult_WarningMessageDecodeErrorZ
17035 pub union CResult_WarningMessageDecodeErrorZPtr {
17036 /// A pointer to the contents in the success state.
17037 /// Reading from this pointer when `result_ok` is not set is undefined.
17038 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
17039 /// A pointer to the contents in the error state.
17040 /// Reading from this pointer when `result_ok` is set is undefined.
17041 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17044 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
17045 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
17046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17047 pub struct CResult_WarningMessageDecodeErrorZ {
17048 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
17049 /// `err` or `result` depending on the state of `result_ok`.
17050 pub contents: CResult_WarningMessageDecodeErrorZPtr,
17051 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
17052 pub result_ok: bool,
17055 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
17056 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
17057 CResult_WarningMessageDecodeErrorZ {
17058 contents: CResult_WarningMessageDecodeErrorZPtr {
17059 result: Box::into_raw(Box::new(o)),
17065 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
17066 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
17067 CResult_WarningMessageDecodeErrorZ {
17068 contents: CResult_WarningMessageDecodeErrorZPtr {
17069 err: Box::into_raw(Box::new(e)),
17074 /// Checks if the given object is currently in the success state
17076 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
17080 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
17081 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
17082 impl Drop for CResult_WarningMessageDecodeErrorZ {
17083 fn drop(&mut self) {
17084 if self.result_ok {
17085 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17086 let _ = unsafe { Box::from_raw(self.contents.result) };
17089 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17090 let _ = unsafe { Box::from_raw(self.contents.err) };
17095 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
17096 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17097 let contents = if o.result_ok {
17098 let result = unsafe { o.contents.result };
17099 unsafe { o.contents.result = core::ptr::null_mut() };
17100 CResult_WarningMessageDecodeErrorZPtr { result }
17102 let err = unsafe { o.contents.err };
17103 unsafe { o.contents.err = core::ptr::null_mut(); }
17104 CResult_WarningMessageDecodeErrorZPtr { err }
17108 result_ok: o.result_ok,
17112 impl Clone for CResult_WarningMessageDecodeErrorZ {
17113 fn clone(&self) -> Self {
17114 if self.result_ok {
17115 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
17116 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
17119 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
17120 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17126 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
17127 /// but with all dynamically-allocated buffers duplicated in new buffers.
17128 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
17130 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
17131 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17132 /// A pointer to the contents in the success state.
17133 /// Reading from this pointer when `result_ok` is not set is undefined.
17134 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
17135 /// A pointer to the contents in the error state.
17136 /// Reading from this pointer when `result_ok` is set is undefined.
17137 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17140 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17141 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17143 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17144 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
17145 /// `err` or `result` depending on the state of `result_ok`.
17146 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
17147 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
17148 pub result_ok: bool,
17151 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
17152 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17153 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17154 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17155 result: Box::into_raw(Box::new(o)),
17161 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
17162 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17163 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17164 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17165 err: Box::into_raw(Box::new(e)),
17170 /// Checks if the given object is currently in the success state
17172 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
17176 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
17177 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
17178 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17179 fn drop(&mut self) {
17180 if self.result_ok {
17181 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17182 let _ = unsafe { Box::from_raw(self.contents.result) };
17185 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17186 let _ = unsafe { Box::from_raw(self.contents.err) };
17191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17192 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17193 let contents = if o.result_ok {
17194 let result = unsafe { o.contents.result };
17195 unsafe { o.contents.result = core::ptr::null_mut() };
17196 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
17198 let err = unsafe { o.contents.err };
17199 unsafe { o.contents.err = core::ptr::null_mut(); }
17200 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
17204 result_ok: o.result_ok,
17208 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17209 fn clone(&self) -> Self {
17210 if self.result_ok {
17211 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17212 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17215 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17216 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17222 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
17223 /// but with all dynamically-allocated buffers duplicated in new buffers.
17224 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17226 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
17227 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
17228 /// A pointer to the contents in the success state.
17229 /// Reading from this pointer when `result_ok` is not set is undefined.
17230 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
17231 /// A pointer to the contents in the error state.
17232 /// Reading from this pointer when `result_ok` is set is undefined.
17233 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17236 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17237 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17239 pub struct CResult_NodeAnnouncementDecodeErrorZ {
17240 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
17241 /// `err` or `result` depending on the state of `result_ok`.
17242 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
17243 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
17244 pub result_ok: bool,
17247 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
17248 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
17249 CResult_NodeAnnouncementDecodeErrorZ {
17250 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17251 result: Box::into_raw(Box::new(o)),
17257 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
17258 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
17259 CResult_NodeAnnouncementDecodeErrorZ {
17260 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17261 err: Box::into_raw(Box::new(e)),
17266 /// Checks if the given object is currently in the success state
17268 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
17272 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
17273 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
17274 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
17275 fn drop(&mut self) {
17276 if self.result_ok {
17277 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17278 let _ = unsafe { Box::from_raw(self.contents.result) };
17281 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17282 let _ = unsafe { Box::from_raw(self.contents.err) };
17287 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
17288 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17289 let contents = if o.result_ok {
17290 let result = unsafe { o.contents.result };
17291 unsafe { o.contents.result = core::ptr::null_mut() };
17292 CResult_NodeAnnouncementDecodeErrorZPtr { result }
17294 let err = unsafe { o.contents.err };
17295 unsafe { o.contents.err = core::ptr::null_mut(); }
17296 CResult_NodeAnnouncementDecodeErrorZPtr { err }
17300 result_ok: o.result_ok,
17304 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
17305 fn clone(&self) -> Self {
17306 if self.result_ok {
17307 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17308 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17311 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17312 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17318 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
17319 /// but with all dynamically-allocated buffers duplicated in new buffers.
17320 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17322 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
17323 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
17324 /// A pointer to the contents in the success state.
17325 /// Reading from this pointer when `result_ok` is not set is undefined.
17326 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
17327 /// A pointer to the contents in the error state.
17328 /// Reading from this pointer when `result_ok` is set is undefined.
17329 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17332 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
17333 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
17334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17335 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
17336 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
17337 /// `err` or `result` depending on the state of `result_ok`.
17338 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
17339 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
17340 pub result_ok: bool,
17343 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
17344 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17345 CResult_QueryShortChannelIdsDecodeErrorZ {
17346 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17347 result: Box::into_raw(Box::new(o)),
17353 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
17354 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17355 CResult_QueryShortChannelIdsDecodeErrorZ {
17356 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17357 err: Box::into_raw(Box::new(e)),
17362 /// Checks if the given object is currently in the success state
17364 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
17368 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
17369 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
17370 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
17371 fn drop(&mut self) {
17372 if self.result_ok {
17373 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17374 let _ = unsafe { Box::from_raw(self.contents.result) };
17377 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17378 let _ = unsafe { Box::from_raw(self.contents.err) };
17383 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
17384 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
17385 let contents = if o.result_ok {
17386 let result = unsafe { o.contents.result };
17387 unsafe { o.contents.result = core::ptr::null_mut() };
17388 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
17390 let err = unsafe { o.contents.err };
17391 unsafe { o.contents.err = core::ptr::null_mut(); }
17392 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
17396 result_ok: o.result_ok,
17400 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
17401 fn clone(&self) -> Self {
17402 if self.result_ok {
17403 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17404 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
17407 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17408 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17414 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
17415 /// but with all dynamically-allocated buffers duplicated in new buffers.
17416 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
17418 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
17419 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17420 /// A pointer to the contents in the success state.
17421 /// Reading from this pointer when `result_ok` is not set is undefined.
17422 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
17423 /// A pointer to the contents in the error state.
17424 /// Reading from this pointer when `result_ok` is set is undefined.
17425 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17428 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
17429 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
17430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17431 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17432 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
17433 /// `err` or `result` depending on the state of `result_ok`.
17434 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
17435 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
17436 pub result_ok: bool,
17439 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
17440 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17441 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17442 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17443 result: Box::into_raw(Box::new(o)),
17449 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
17450 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17451 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17452 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17453 err: Box::into_raw(Box::new(e)),
17458 /// Checks if the given object is currently in the success state
17460 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
17464 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
17465 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
17466 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17467 fn drop(&mut self) {
17468 if self.result_ok {
17469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17470 let _ = unsafe { Box::from_raw(self.contents.result) };
17473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17474 let _ = unsafe { Box::from_raw(self.contents.err) };
17479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
17481 let contents = if o.result_ok {
17482 let result = unsafe { o.contents.result };
17483 unsafe { o.contents.result = core::ptr::null_mut() };
17484 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
17486 let err = unsafe { o.contents.err };
17487 unsafe { o.contents.err = core::ptr::null_mut(); }
17488 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
17492 result_ok: o.result_ok,
17496 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17497 fn clone(&self) -> Self {
17498 if self.result_ok {
17499 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17500 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
17503 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17504 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17510 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
17511 /// but with all dynamically-allocated buffers duplicated in new buffers.
17512 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
17514 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
17515 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
17516 /// A pointer to the contents in the success state.
17517 /// Reading from this pointer when `result_ok` is not set is undefined.
17518 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
17519 /// A pointer to the contents in the error state.
17520 /// Reading from this pointer when `result_ok` is set is undefined.
17521 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17524 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
17525 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17527 pub struct CResult_QueryChannelRangeDecodeErrorZ {
17528 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
17529 /// `err` or `result` depending on the state of `result_ok`.
17530 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
17531 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
17532 pub result_ok: bool,
17535 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
17536 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
17537 CResult_QueryChannelRangeDecodeErrorZ {
17538 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17539 result: Box::into_raw(Box::new(o)),
17545 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
17546 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
17547 CResult_QueryChannelRangeDecodeErrorZ {
17548 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17549 err: Box::into_raw(Box::new(e)),
17554 /// Checks if the given object is currently in the success state
17556 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
17560 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
17561 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
17562 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
17563 fn drop(&mut self) {
17564 if self.result_ok {
17565 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17566 let _ = unsafe { Box::from_raw(self.contents.result) };
17569 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17570 let _ = unsafe { Box::from_raw(self.contents.err) };
17575 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
17576 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17577 let contents = if o.result_ok {
17578 let result = unsafe { o.contents.result };
17579 unsafe { o.contents.result = core::ptr::null_mut() };
17580 CResult_QueryChannelRangeDecodeErrorZPtr { result }
17582 let err = unsafe { o.contents.err };
17583 unsafe { o.contents.err = core::ptr::null_mut(); }
17584 CResult_QueryChannelRangeDecodeErrorZPtr { err }
17588 result_ok: o.result_ok,
17592 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
17593 fn clone(&self) -> Self {
17594 if self.result_ok {
17595 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17596 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
17599 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17600 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17606 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
17607 /// but with all dynamically-allocated buffers duplicated in new buffers.
17608 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17610 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
17611 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
17612 /// A pointer to the contents in the success state.
17613 /// Reading from this pointer when `result_ok` is not set is undefined.
17614 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
17615 /// A pointer to the contents in the error state.
17616 /// Reading from this pointer when `result_ok` is set is undefined.
17617 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17620 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
17621 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17623 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
17624 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
17625 /// `err` or `result` depending on the state of `result_ok`.
17626 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
17627 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
17628 pub result_ok: bool,
17631 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
17632 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
17633 CResult_ReplyChannelRangeDecodeErrorZ {
17634 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17635 result: Box::into_raw(Box::new(o)),
17641 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
17642 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
17643 CResult_ReplyChannelRangeDecodeErrorZ {
17644 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17645 err: Box::into_raw(Box::new(e)),
17650 /// Checks if the given object is currently in the success state
17652 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
17656 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
17657 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
17658 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
17659 fn drop(&mut self) {
17660 if self.result_ok {
17661 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17662 let _ = unsafe { Box::from_raw(self.contents.result) };
17665 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17666 let _ = unsafe { Box::from_raw(self.contents.err) };
17671 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
17672 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17673 let contents = if o.result_ok {
17674 let result = unsafe { o.contents.result };
17675 unsafe { o.contents.result = core::ptr::null_mut() };
17676 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
17678 let err = unsafe { o.contents.err };
17679 unsafe { o.contents.err = core::ptr::null_mut(); }
17680 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
17684 result_ok: o.result_ok,
17688 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
17689 fn clone(&self) -> Self {
17690 if self.result_ok {
17691 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17692 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
17695 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17696 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17702 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
17703 /// but with all dynamically-allocated buffers duplicated in new buffers.
17704 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17706 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
17707 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
17708 /// A pointer to the contents in the success state.
17709 /// Reading from this pointer when `result_ok` is not set is undefined.
17710 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
17711 /// A pointer to the contents in the error state.
17712 /// Reading from this pointer when `result_ok` is set is undefined.
17713 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17716 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
17717 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
17718 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17719 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
17720 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
17721 /// `err` or `result` depending on the state of `result_ok`.
17722 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
17723 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
17724 pub result_ok: bool,
17727 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
17728 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
17729 CResult_GossipTimestampFilterDecodeErrorZ {
17730 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17731 result: Box::into_raw(Box::new(o)),
17737 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
17738 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
17739 CResult_GossipTimestampFilterDecodeErrorZ {
17740 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17741 err: Box::into_raw(Box::new(e)),
17746 /// Checks if the given object is currently in the success state
17748 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
17752 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
17753 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
17754 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
17755 fn drop(&mut self) {
17756 if self.result_ok {
17757 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17758 let _ = unsafe { Box::from_raw(self.contents.result) };
17761 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17762 let _ = unsafe { Box::from_raw(self.contents.err) };
17767 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
17768 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
17769 let contents = if o.result_ok {
17770 let result = unsafe { o.contents.result };
17771 unsafe { o.contents.result = core::ptr::null_mut() };
17772 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
17774 let err = unsafe { o.contents.err };
17775 unsafe { o.contents.err = core::ptr::null_mut(); }
17776 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
17780 result_ok: o.result_ok,
17784 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
17785 fn clone(&self) -> Self {
17786 if self.result_ok {
17787 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17788 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
17791 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17792 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17798 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17799 /// but with all dynamically-allocated buffers duplicated in new buffers.
17800 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
17802 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
17803 /// This corresponds to std::vector in C++
17804 pub struct CVec_PhantomRouteHintsZ {
17805 /// The elements in the array.
17806 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17807 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
17808 /// The number of elements pointed to by `data`.
17811 impl CVec_PhantomRouteHintsZ {
17812 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
17813 if self.datalen == 0 { return Vec::new(); }
17814 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17815 self.data = core::ptr::null_mut();
17819 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
17820 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17823 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
17824 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
17825 let datalen = v.len();
17826 let data = Box::into_raw(v.into_boxed_slice());
17827 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17832 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
17833 impl Drop for CVec_PhantomRouteHintsZ {
17834 fn drop(&mut self) {
17835 if self.datalen == 0 { return; }
17836 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17839 impl Clone for CVec_PhantomRouteHintsZ {
17840 fn clone(&self) -> Self {
17841 let mut res = Vec::new();
17842 if self.datalen == 0 { return Self::from(res); }
17843 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17848 /// The contents of CResult_InvoiceSignOrCreationErrorZ
17849 pub union CResult_InvoiceSignOrCreationErrorZPtr {
17850 /// A pointer to the contents in the success state.
17851 /// Reading from this pointer when `result_ok` is not set is undefined.
17852 pub result: *mut crate::lightning_invoice::Invoice,
17853 /// A pointer to the contents in the error state.
17854 /// Reading from this pointer when `result_ok` is set is undefined.
17855 pub err: *mut crate::lightning_invoice::SignOrCreationError,
17858 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
17859 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
17860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17861 pub struct CResult_InvoiceSignOrCreationErrorZ {
17862 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
17863 /// `err` or `result` depending on the state of `result_ok`.
17864 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
17865 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
17866 pub result_ok: bool,
17869 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
17870 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
17871 CResult_InvoiceSignOrCreationErrorZ {
17872 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17873 result: Box::into_raw(Box::new(o)),
17879 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
17880 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
17881 CResult_InvoiceSignOrCreationErrorZ {
17882 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17883 err: Box::into_raw(Box::new(e)),
17888 /// Checks if the given object is currently in the success state
17890 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
17894 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
17895 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
17896 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
17897 fn drop(&mut self) {
17898 if self.result_ok {
17899 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17900 let _ = unsafe { Box::from_raw(self.contents.result) };
17903 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17904 let _ = unsafe { Box::from_raw(self.contents.err) };
17909 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
17910 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
17911 let contents = if o.result_ok {
17912 let result = unsafe { o.contents.result };
17913 unsafe { o.contents.result = core::ptr::null_mut() };
17914 CResult_InvoiceSignOrCreationErrorZPtr { result }
17916 let err = unsafe { o.contents.err };
17917 unsafe { o.contents.err = core::ptr::null_mut(); }
17918 CResult_InvoiceSignOrCreationErrorZPtr { err }
17922 result_ok: o.result_ok,
17926 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
17927 fn clone(&self) -> Self {
17928 if self.result_ok {
17929 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17930 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
17933 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17934 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
17940 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
17941 /// but with all dynamically-allocated buffers duplicated in new buffers.
17942 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
17944 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
17945 /// This corresponds to std::vector in C++
17946 pub struct CVec_FutureZ {
17947 /// The elements in the array.
17948 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17949 pub data: *mut crate::lightning::util::wakers::Future,
17950 /// The number of elements pointed to by `data`.
17953 impl CVec_FutureZ {
17954 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
17955 if self.datalen == 0 { return Vec::new(); }
17956 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17957 self.data = core::ptr::null_mut();
17961 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
17962 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17965 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
17966 fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
17967 let datalen = v.len();
17968 let data = Box::into_raw(v.into_boxed_slice());
17969 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17973 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17974 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
17975 impl Drop for CVec_FutureZ {
17976 fn drop(&mut self) {
17977 if self.datalen == 0 { return; }
17978 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17981 impl Clone for CVec_FutureZ {
17982 fn clone(&self) -> Self {
17983 let mut res = Vec::new();
17984 if self.datalen == 0 { return Self::from(res); }
17985 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17990 /// An enum which can either contain a crate::lightning::chain::Filter or not
17991 pub enum COption_FilterZ {
17992 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
17993 Some(crate::lightning::chain::Filter),
17994 /// When we're in this state, this COption_FilterZ contains nothing
17997 impl COption_FilterZ {
17998 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
17999 if let Self::None = self { false } else { true }
18001 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18004 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
18005 if let Self::Some(v) = self { v } else { unreachable!() }
18009 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
18010 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
18011 COption_FilterZ::Some(o)
18014 /// Constructs a new COption_FilterZ containing nothing
18015 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
18016 COption_FilterZ::None
18019 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
18020 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
18022 /// The contents of CResult_LockedChannelMonitorNoneZ
18023 pub union CResult_LockedChannelMonitorNoneZPtr {
18024 /// A pointer to the contents in the success state.
18025 /// Reading from this pointer when `result_ok` is not set is undefined.
18026 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
18027 /// Note that this value is always NULL, as there are no contents in the Err variant
18028 pub err: *mut core::ffi::c_void,
18031 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
18032 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
18033 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18034 pub struct CResult_LockedChannelMonitorNoneZ {
18035 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
18036 /// `err` or `result` depending on the state of `result_ok`.
18037 pub contents: CResult_LockedChannelMonitorNoneZPtr,
18038 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
18039 pub result_ok: bool,
18042 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
18043 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
18044 CResult_LockedChannelMonitorNoneZ {
18045 contents: CResult_LockedChannelMonitorNoneZPtr {
18046 result: Box::into_raw(Box::new(o)),
18052 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
18053 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
18054 CResult_LockedChannelMonitorNoneZ {
18055 contents: CResult_LockedChannelMonitorNoneZPtr {
18056 err: core::ptr::null_mut(),
18061 /// Checks if the given object is currently in the success state
18063 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
18067 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
18068 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
18069 impl Drop for CResult_LockedChannelMonitorNoneZ {
18070 fn drop(&mut self) {
18071 if self.result_ok {
18072 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18073 let _ = unsafe { Box::from_raw(self.contents.result) };
18079 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
18080 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
18081 let contents = if o.result_ok {
18082 let result = unsafe { o.contents.result };
18083 unsafe { o.contents.result = core::ptr::null_mut() };
18084 CResult_LockedChannelMonitorNoneZPtr { result }
18086 let _ = unsafe { Box::from_raw(o.contents.err) };
18087 o.contents.err = core::ptr::null_mut();
18088 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
18092 result_ok: o.result_ok,
18097 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
18098 /// This corresponds to std::vector in C++
18099 pub struct CVec_OutPointZ {
18100 /// The elements in the array.
18101 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18102 pub data: *mut crate::lightning::chain::transaction::OutPoint,
18103 /// The number of elements pointed to by `data`.
18106 impl CVec_OutPointZ {
18107 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
18108 if self.datalen == 0 { return Vec::new(); }
18109 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18110 self.data = core::ptr::null_mut();
18114 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
18115 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18118 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
18119 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
18120 let datalen = v.len();
18121 let data = Box::into_raw(v.into_boxed_slice());
18122 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18126 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18127 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
18128 impl Drop for CVec_OutPointZ {
18129 fn drop(&mut self) {
18130 if self.datalen == 0 { return; }
18131 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18134 impl Clone for CVec_OutPointZ {
18135 fn clone(&self) -> Self {
18136 let mut res = Vec::new();
18137 if self.datalen == 0 { return Self::from(res); }
18138 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18143 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
18144 /// This corresponds to std::vector in C++
18145 pub struct CVec_MonitorUpdateIdZ {
18146 /// The elements in the array.
18147 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18148 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
18149 /// The number of elements pointed to by `data`.
18152 impl CVec_MonitorUpdateIdZ {
18153 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
18154 if self.datalen == 0 { return Vec::new(); }
18155 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18156 self.data = core::ptr::null_mut();
18160 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
18161 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18164 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
18165 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
18166 let datalen = v.len();
18167 let data = Box::into_raw(v.into_boxed_slice());
18168 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18172 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18173 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
18174 impl Drop for CVec_MonitorUpdateIdZ {
18175 fn drop(&mut self) {
18176 if self.datalen == 0 { return; }
18177 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18180 impl Clone for CVec_MonitorUpdateIdZ {
18181 fn clone(&self) -> Self {
18182 let mut res = Vec::new();
18183 if self.datalen == 0 { return Self::from(res); }
18184 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18189 /// A tuple of 2 elements. See the individual fields for the types contained.
18190 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18191 /// The element at position 0
18192 pub a: crate::lightning::chain::transaction::OutPoint,
18193 /// The element at position 1
18194 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
18196 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18197 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
18204 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18205 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
18209 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18210 fn clone(&self) -> Self {
18212 a: Clone::clone(&self.a),
18213 b: Clone::clone(&self.b),
18218 /// Creates a new tuple which has the same data as `orig`
18219 /// but with all dynamically-allocated buffers duplicated in new buffers.
18220 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
18221 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
18223 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18224 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
18228 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
18229 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
18231 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
18232 /// This corresponds to std::vector in C++
18233 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18234 /// The elements in the array.
18235 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18236 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
18237 /// The number of elements pointed to by `data`.
18240 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18241 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
18242 if self.datalen == 0 { return Vec::new(); }
18243 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18244 self.data = core::ptr::null_mut();
18248 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
18249 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18252 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18253 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
18254 let datalen = v.len();
18255 let data = Box::into_raw(v.into_boxed_slice());
18256 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18260 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18261 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
18262 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18263 fn drop(&mut self) {
18264 if self.datalen == 0 { return; }
18265 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18268 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18269 fn clone(&self) -> Self {
18270 let mut res = Vec::new();
18271 if self.datalen == 0 { return Self::from(res); }
18272 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18277 /// The contents of CResult_u32GraphSyncErrorZ
18278 pub union CResult_u32GraphSyncErrorZPtr {
18279 /// A pointer to the contents in the success state.
18280 /// Reading from this pointer when `result_ok` is not set is undefined.
18281 pub result: *mut u32,
18282 /// A pointer to the contents in the error state.
18283 /// Reading from this pointer when `result_ok` is set is undefined.
18284 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
18287 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
18288 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
18289 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18290 pub struct CResult_u32GraphSyncErrorZ {
18291 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
18292 /// `err` or `result` depending on the state of `result_ok`.
18293 pub contents: CResult_u32GraphSyncErrorZPtr,
18294 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
18295 pub result_ok: bool,
18298 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
18299 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
18300 CResult_u32GraphSyncErrorZ {
18301 contents: CResult_u32GraphSyncErrorZPtr {
18302 result: Box::into_raw(Box::new(o)),
18308 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
18309 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
18310 CResult_u32GraphSyncErrorZ {
18311 contents: CResult_u32GraphSyncErrorZPtr {
18312 err: Box::into_raw(Box::new(e)),
18317 /// Checks if the given object is currently in the success state
18319 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
18323 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
18324 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
18325 impl Drop for CResult_u32GraphSyncErrorZ {
18326 fn drop(&mut self) {
18327 if self.result_ok {
18328 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18329 let _ = unsafe { Box::from_raw(self.contents.result) };
18332 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18333 let _ = unsafe { Box::from_raw(self.contents.err) };
18338 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
18339 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
18340 let contents = if o.result_ok {
18341 let result = unsafe { o.contents.result };
18342 unsafe { o.contents.result = core::ptr::null_mut() };
18343 CResult_u32GraphSyncErrorZPtr { result }
18345 let err = unsafe { o.contents.err };
18346 unsafe { o.contents.err = core::ptr::null_mut(); }
18347 CResult_u32GraphSyncErrorZPtr { err }
18351 result_ok: o.result_ok,