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) }
7830 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
7831 pub enum COption_ScalarZ {
7832 /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7833 Some(crate::c_types::BigEndianScalar),
7834 /// When we're in this state, this COption_ScalarZ contains nothing
7837 impl COption_ScalarZ {
7838 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7839 if let Self::None = self { false } else { true }
7841 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7844 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
7845 if let Self::Some(v) = self { v } else { unreachable!() }
7849 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
7850 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
7851 COption_ScalarZ::Some(o)
7854 /// Constructs a new COption_ScalarZ containing nothing
7855 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
7856 COption_ScalarZ::None
7859 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
7860 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
7862 /// Creates a new COption_ScalarZ which has the same data as `orig`
7863 /// but with all dynamically-allocated buffers duplicated in new buffers.
7864 pub extern "C" fn COption_ScalarZ_clone(orig: &COption_ScalarZ) -> COption_ScalarZ { Clone::clone(&orig) }
7866 /// The contents of CResult_SharedSecretNoneZ
7867 pub union CResult_SharedSecretNoneZPtr {
7868 /// A pointer to the contents in the success state.
7869 /// Reading from this pointer when `result_ok` is not set is undefined.
7870 pub result: *mut crate::c_types::ThirtyTwoBytes,
7871 /// Note that this value is always NULL, as there are no contents in the Err variant
7872 pub err: *mut core::ffi::c_void,
7875 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7876 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7878 pub struct CResult_SharedSecretNoneZ {
7879 /// The contents of this CResult_SharedSecretNoneZ, accessible via either
7880 /// `err` or `result` depending on the state of `result_ok`.
7881 pub contents: CResult_SharedSecretNoneZPtr,
7882 /// Whether this CResult_SharedSecretNoneZ represents a success state.
7883 pub result_ok: bool,
7886 /// Creates a new CResult_SharedSecretNoneZ in the success state.
7887 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
7888 CResult_SharedSecretNoneZ {
7889 contents: CResult_SharedSecretNoneZPtr {
7890 result: Box::into_raw(Box::new(o)),
7896 /// Creates a new CResult_SharedSecretNoneZ in the error state.
7897 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
7898 CResult_SharedSecretNoneZ {
7899 contents: CResult_SharedSecretNoneZPtr {
7900 err: core::ptr::null_mut(),
7905 /// Checks if the given object is currently in the success state
7907 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
7911 /// Frees any resources used by the CResult_SharedSecretNoneZ.
7912 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
7913 impl Drop for CResult_SharedSecretNoneZ {
7914 fn drop(&mut self) {
7916 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7917 let _ = unsafe { Box::from_raw(self.contents.result) };
7923 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
7924 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7925 let contents = if o.result_ok {
7926 let result = unsafe { o.contents.result };
7927 unsafe { o.contents.result = core::ptr::null_mut() };
7928 CResult_SharedSecretNoneZPtr { result }
7930 let _ = unsafe { Box::from_raw(o.contents.err) };
7931 o.contents.err = core::ptr::null_mut();
7932 CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
7936 result_ok: o.result_ok,
7940 impl Clone for CResult_SharedSecretNoneZ {
7941 fn clone(&self) -> Self {
7943 Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
7944 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7947 Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
7948 err: core::ptr::null_mut()
7954 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
7955 /// but with all dynamically-allocated buffers duplicated in new buffers.
7956 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
7958 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7959 /// This corresponds to std::vector in C++
7960 pub struct CVec_U5Z {
7961 /// The elements in the array.
7962 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7963 pub data: *mut crate::c_types::U5,
7964 /// The number of elements pointed to by `data`.
7968 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
7969 if self.datalen == 0 { return Vec::new(); }
7970 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7971 self.data = core::ptr::null_mut();
7975 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
7976 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7979 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
7980 fn from(v: Vec<crate::c_types::U5>) -> Self {
7981 let datalen = v.len();
7982 let data = Box::into_raw(v.into_boxed_slice());
7983 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7987 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7988 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
7989 impl Drop for CVec_U5Z {
7990 fn drop(&mut self) {
7991 if self.datalen == 0 { return; }
7992 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7995 impl Clone for CVec_U5Z {
7996 fn clone(&self) -> Self {
7997 let mut res = Vec::new();
7998 if self.datalen == 0 { return Self::from(res); }
7999 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8004 /// The contents of CResult_RecoverableSignatureNoneZ
8005 pub union CResult_RecoverableSignatureNoneZPtr {
8006 /// A pointer to the contents in the success state.
8007 /// Reading from this pointer when `result_ok` is not set is undefined.
8008 pub result: *mut crate::c_types::RecoverableSignature,
8009 /// Note that this value is always NULL, as there are no contents in the Err variant
8010 pub err: *mut core::ffi::c_void,
8013 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
8014 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
8015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8016 pub struct CResult_RecoverableSignatureNoneZ {
8017 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
8018 /// `err` or `result` depending on the state of `result_ok`.
8019 pub contents: CResult_RecoverableSignatureNoneZPtr,
8020 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
8021 pub result_ok: bool,
8024 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
8025 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
8026 CResult_RecoverableSignatureNoneZ {
8027 contents: CResult_RecoverableSignatureNoneZPtr {
8028 result: Box::into_raw(Box::new(o)),
8034 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
8035 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
8036 CResult_RecoverableSignatureNoneZ {
8037 contents: CResult_RecoverableSignatureNoneZPtr {
8038 err: core::ptr::null_mut(),
8043 /// Checks if the given object is currently in the success state
8045 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
8049 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
8050 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
8051 impl Drop for CResult_RecoverableSignatureNoneZ {
8052 fn drop(&mut self) {
8054 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8055 let _ = unsafe { Box::from_raw(self.contents.result) };
8061 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
8062 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
8063 let contents = if o.result_ok {
8064 let result = unsafe { o.contents.result };
8065 unsafe { o.contents.result = core::ptr::null_mut() };
8066 CResult_RecoverableSignatureNoneZPtr { result }
8068 let _ = unsafe { Box::from_raw(o.contents.err) };
8069 o.contents.err = core::ptr::null_mut();
8070 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
8074 result_ok: o.result_ok,
8078 impl Clone for CResult_RecoverableSignatureNoneZ {
8079 fn clone(&self) -> Self {
8081 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
8082 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
8085 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
8086 err: core::ptr::null_mut()
8092 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
8093 /// but with all dynamically-allocated buffers duplicated in new buffers.
8094 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
8096 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
8097 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8098 /// A pointer to the contents in the success state.
8099 /// Reading from this pointer when `result_ok` is not set is undefined.
8100 pub result: *mut crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner,
8101 /// A pointer to the contents in the error state.
8102 /// Reading from this pointer when `result_ok` is set is undefined.
8103 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8106 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
8107 /// containing a crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8109 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8110 /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
8111 /// `err` or `result` depending on the state of `result_ok`.
8112 pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
8113 /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
8114 pub result_ok: bool,
8117 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
8118 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8119 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8120 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8121 result: Box::into_raw(Box::new(o)),
8127 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
8128 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8129 CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8130 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8131 err: Box::into_raw(Box::new(e)),
8136 /// Checks if the given object is currently in the success state
8138 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
8142 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
8143 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
8144 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8145 fn drop(&mut self) {
8147 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8148 let _ = unsafe { Box::from_raw(self.contents.result) };
8151 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8152 let _ = unsafe { Box::from_raw(self.contents.err) };
8157 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8158 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8159 let contents = if o.result_ok {
8160 let result = unsafe { o.contents.result };
8161 unsafe { o.contents.result = core::ptr::null_mut() };
8162 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
8164 let err = unsafe { o.contents.err };
8165 unsafe { o.contents.err = core::ptr::null_mut(); }
8166 CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
8170 result_ok: o.result_ok,
8175 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
8176 /// This corresponds to std::vector in C++
8177 pub struct CVec_CVec_u8ZZ {
8178 /// The elements in the array.
8179 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8180 pub data: *mut crate::c_types::derived::CVec_u8Z,
8181 /// The number of elements pointed to by `data`.
8184 impl CVec_CVec_u8ZZ {
8185 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
8186 if self.datalen == 0 { return Vec::new(); }
8187 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8188 self.data = core::ptr::null_mut();
8192 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
8193 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8196 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
8197 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
8198 let datalen = v.len();
8199 let data = Box::into_raw(v.into_boxed_slice());
8200 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8204 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8205 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
8206 impl Drop for CVec_CVec_u8ZZ {
8207 fn drop(&mut self) {
8208 if self.datalen == 0 { return; }
8209 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8212 impl Clone for CVec_CVec_u8ZZ {
8213 fn clone(&self) -> Self {
8214 let mut res = Vec::new();
8215 if self.datalen == 0 { return Self::from(res); }
8216 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8221 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
8222 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
8223 /// A pointer to the contents in the success state.
8224 /// Reading from this pointer when `result_ok` is not set is undefined.
8225 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
8226 /// Note that this value is always NULL, as there are no contents in the Err variant
8227 pub err: *mut core::ffi::c_void,
8230 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
8231 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
8232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8233 pub struct CResult_CVec_CVec_u8ZZNoneZ {
8234 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
8235 /// `err` or `result` depending on the state of `result_ok`.
8236 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
8237 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
8238 pub result_ok: bool,
8241 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
8242 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
8243 CResult_CVec_CVec_u8ZZNoneZ {
8244 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8245 result: Box::into_raw(Box::new(o)),
8251 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
8252 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
8253 CResult_CVec_CVec_u8ZZNoneZ {
8254 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8255 err: core::ptr::null_mut(),
8260 /// Checks if the given object is currently in the success state
8262 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
8266 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
8267 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
8268 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
8269 fn drop(&mut self) {
8271 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8272 let _ = unsafe { Box::from_raw(self.contents.result) };
8278 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
8279 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
8280 let contents = if o.result_ok {
8281 let result = unsafe { o.contents.result };
8282 unsafe { o.contents.result = core::ptr::null_mut() };
8283 CResult_CVec_CVec_u8ZZNoneZPtr { result }
8285 let _ = unsafe { Box::from_raw(o.contents.err) };
8286 o.contents.err = core::ptr::null_mut();
8287 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
8291 result_ok: o.result_ok,
8295 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
8296 fn clone(&self) -> Self {
8298 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8299 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
8302 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8303 err: core::ptr::null_mut()
8309 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
8310 /// but with all dynamically-allocated buffers duplicated in new buffers.
8311 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
8313 /// The contents of CResult_InMemorySignerDecodeErrorZ
8314 pub union CResult_InMemorySignerDecodeErrorZPtr {
8315 /// A pointer to the contents in the success state.
8316 /// Reading from this pointer when `result_ok` is not set is undefined.
8317 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
8318 /// A pointer to the contents in the error state.
8319 /// Reading from this pointer when `result_ok` is set is undefined.
8320 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8323 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
8324 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8325 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8326 pub struct CResult_InMemorySignerDecodeErrorZ {
8327 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
8328 /// `err` or `result` depending on the state of `result_ok`.
8329 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
8330 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
8331 pub result_ok: bool,
8334 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
8335 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
8336 CResult_InMemorySignerDecodeErrorZ {
8337 contents: CResult_InMemorySignerDecodeErrorZPtr {
8338 result: Box::into_raw(Box::new(o)),
8344 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
8345 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
8346 CResult_InMemorySignerDecodeErrorZ {
8347 contents: CResult_InMemorySignerDecodeErrorZPtr {
8348 err: Box::into_raw(Box::new(e)),
8353 /// Checks if the given object is currently in the success state
8355 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
8359 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
8360 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
8361 impl Drop for CResult_InMemorySignerDecodeErrorZ {
8362 fn drop(&mut self) {
8364 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8365 let _ = unsafe { Box::from_raw(self.contents.result) };
8368 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8369 let _ = unsafe { Box::from_raw(self.contents.err) };
8374 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
8375 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8376 let contents = if o.result_ok {
8377 let result = unsafe { o.contents.result };
8378 unsafe { o.contents.result = core::ptr::null_mut() };
8379 CResult_InMemorySignerDecodeErrorZPtr { result }
8381 let err = unsafe { o.contents.err };
8382 unsafe { o.contents.err = core::ptr::null_mut(); }
8383 CResult_InMemorySignerDecodeErrorZPtr { err }
8387 result_ok: o.result_ok,
8391 impl Clone for CResult_InMemorySignerDecodeErrorZ {
8392 fn clone(&self) -> Self {
8394 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
8395 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
8398 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
8399 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8405 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
8406 /// but with all dynamically-allocated buffers duplicated in new buffers.
8407 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
8409 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
8410 /// This corresponds to std::vector in C++
8411 pub struct CVec_TxOutZ {
8412 /// The elements in the array.
8413 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8414 pub data: *mut crate::c_types::TxOut,
8415 /// The number of elements pointed to by `data`.
8419 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
8420 if self.datalen == 0 { return Vec::new(); }
8421 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8422 self.data = core::ptr::null_mut();
8426 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
8427 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8430 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
8431 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
8432 let datalen = v.len();
8433 let data = Box::into_raw(v.into_boxed_slice());
8434 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8438 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8439 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
8440 impl Drop for CVec_TxOutZ {
8441 fn drop(&mut self) {
8442 if self.datalen == 0 { return; }
8443 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8446 impl Clone for CVec_TxOutZ {
8447 fn clone(&self) -> Self {
8448 let mut res = Vec::new();
8449 if self.datalen == 0 { return Self::from(res); }
8450 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8455 /// The contents of CResult_TransactionNoneZ
8456 pub union CResult_TransactionNoneZPtr {
8457 /// A pointer to the contents in the success state.
8458 /// Reading from this pointer when `result_ok` is not set is undefined.
8459 pub result: *mut crate::c_types::Transaction,
8460 /// Note that this value is always NULL, as there are no contents in the Err variant
8461 pub err: *mut core::ffi::c_void,
8464 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
8465 /// containing a crate::c_types::Transaction on success and a () on failure.
8466 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8467 pub struct CResult_TransactionNoneZ {
8468 /// The contents of this CResult_TransactionNoneZ, accessible via either
8469 /// `err` or `result` depending on the state of `result_ok`.
8470 pub contents: CResult_TransactionNoneZPtr,
8471 /// Whether this CResult_TransactionNoneZ represents a success state.
8472 pub result_ok: bool,
8475 /// Creates a new CResult_TransactionNoneZ in the success state.
8476 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
8477 CResult_TransactionNoneZ {
8478 contents: CResult_TransactionNoneZPtr {
8479 result: Box::into_raw(Box::new(o)),
8485 /// Creates a new CResult_TransactionNoneZ in the error state.
8486 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
8487 CResult_TransactionNoneZ {
8488 contents: CResult_TransactionNoneZPtr {
8489 err: core::ptr::null_mut(),
8494 /// Checks if the given object is currently in the success state
8496 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
8500 /// Frees any resources used by the CResult_TransactionNoneZ.
8501 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
8502 impl Drop for CResult_TransactionNoneZ {
8503 fn drop(&mut self) {
8505 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8506 let _ = unsafe { Box::from_raw(self.contents.result) };
8512 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
8513 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
8514 let contents = if o.result_ok {
8515 let result = unsafe { o.contents.result };
8516 unsafe { o.contents.result = core::ptr::null_mut() };
8517 CResult_TransactionNoneZPtr { result }
8519 let _ = unsafe { Box::from_raw(o.contents.err) };
8520 o.contents.err = core::ptr::null_mut();
8521 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
8525 result_ok: o.result_ok,
8529 impl Clone for CResult_TransactionNoneZ {
8530 fn clone(&self) -> Self {
8532 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
8533 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
8536 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
8537 err: core::ptr::null_mut()
8543 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
8544 /// but with all dynamically-allocated buffers duplicated in new buffers.
8545 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
8547 /// A tuple of 2 elements. See the individual fields for the types contained.
8548 pub struct C2Tuple_BlockHashChannelMonitorZ {
8549 /// The element at position 0
8550 pub a: crate::c_types::ThirtyTwoBytes,
8551 /// The element at position 1
8552 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
8554 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
8555 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
8562 impl C2Tuple_BlockHashChannelMonitorZ {
8563 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
8567 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8569 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
8570 C2Tuple_BlockHashChannelMonitorZ { a, b, }
8574 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8575 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
8577 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8578 /// This corresponds to std::vector in C++
8579 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
8580 /// The elements in the array.
8581 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8582 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8583 /// The number of elements pointed to by `data`.
8586 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
8587 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
8588 if self.datalen == 0 { return Vec::new(); }
8589 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8590 self.data = core::ptr::null_mut();
8594 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
8595 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8598 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8599 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
8600 let datalen = v.len();
8601 let data = Box::into_raw(v.into_boxed_slice());
8602 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8606 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8607 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
8608 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8609 fn drop(&mut self) {
8610 if self.datalen == 0 { return; }
8611 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8615 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8616 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8617 /// A pointer to the contents in the success state.
8618 /// Reading from this pointer when `result_ok` is not set is undefined.
8619 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
8620 /// A pointer to the contents in the error state.
8621 /// Reading from this pointer when `result_ok` is set is undefined.
8622 pub err: *mut crate::c_types::IOError,
8625 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8626 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8628 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8629 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8630 /// `err` or `result` depending on the state of `result_ok`.
8631 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
8632 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8633 pub result_ok: bool,
8636 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
8637 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8638 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8639 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8640 result: Box::into_raw(Box::new(o)),
8646 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
8647 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8648 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8649 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8650 err: Box::into_raw(Box::new(e)),
8655 /// Checks if the given object is currently in the success state
8657 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
8661 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
8662 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
8663 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8664 fn drop(&mut self) {
8666 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8667 let _ = unsafe { Box::from_raw(self.contents.result) };
8670 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8671 let _ = unsafe { Box::from_raw(self.contents.err) };
8676 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8677 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
8678 let contents = if o.result_ok {
8679 let result = unsafe { o.contents.result };
8680 unsafe { o.contents.result = core::ptr::null_mut() };
8681 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
8683 let err = unsafe { o.contents.err };
8684 unsafe { o.contents.err = core::ptr::null_mut(); }
8685 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
8689 result_ok: o.result_ok,
8695 /// An enum which can either contain a u16 or not
8696 pub enum COption_u16Z {
8697 /// When we're in this state, this COption_u16Z contains a u16
8699 /// When we're in this state, this COption_u16Z contains nothing
8703 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8704 if let Self::None = self { false } else { true }
8706 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8709 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
8710 if let Self::Some(v) = self { v } else { unreachable!() }
8714 /// Constructs a new COption_u16Z containing a u16
8715 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
8716 COption_u16Z::Some(o)
8719 /// Constructs a new COption_u16Z containing nothing
8720 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
8724 /// Frees any resources associated with the u16, if we are in the Some state
8725 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
8727 /// Creates a new COption_u16Z which has the same data as `orig`
8728 /// but with all dynamically-allocated buffers duplicated in new buffers.
8729 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
8731 /// The contents of CResult__u832APIErrorZ
8732 pub union CResult__u832APIErrorZPtr {
8733 /// A pointer to the contents in the success state.
8734 /// Reading from this pointer when `result_ok` is not set is undefined.
8735 pub result: *mut crate::c_types::ThirtyTwoBytes,
8736 /// A pointer to the contents in the error state.
8737 /// Reading from this pointer when `result_ok` is set is undefined.
8738 pub err: *mut crate::lightning::util::errors::APIError,
8741 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
8742 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8744 pub struct CResult__u832APIErrorZ {
8745 /// The contents of this CResult__u832APIErrorZ, accessible via either
8746 /// `err` or `result` depending on the state of `result_ok`.
8747 pub contents: CResult__u832APIErrorZPtr,
8748 /// Whether this CResult__u832APIErrorZ represents a success state.
8749 pub result_ok: bool,
8752 /// Creates a new CResult__u832APIErrorZ in the success state.
8753 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
8754 CResult__u832APIErrorZ {
8755 contents: CResult__u832APIErrorZPtr {
8756 result: Box::into_raw(Box::new(o)),
8762 /// Creates a new CResult__u832APIErrorZ in the error state.
8763 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
8764 CResult__u832APIErrorZ {
8765 contents: CResult__u832APIErrorZPtr {
8766 err: Box::into_raw(Box::new(e)),
8771 /// Checks if the given object is currently in the success state
8773 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
8777 /// Frees any resources used by the CResult__u832APIErrorZ.
8778 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
8779 impl Drop for CResult__u832APIErrorZ {
8780 fn drop(&mut self) {
8782 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8783 let _ = unsafe { Box::from_raw(self.contents.result) };
8786 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8787 let _ = unsafe { Box::from_raw(self.contents.err) };
8792 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
8793 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8794 let contents = if o.result_ok {
8795 let result = unsafe { o.contents.result };
8796 unsafe { o.contents.result = core::ptr::null_mut() };
8797 CResult__u832APIErrorZPtr { result }
8799 let err = unsafe { o.contents.err };
8800 unsafe { o.contents.err = core::ptr::null_mut(); }
8801 CResult__u832APIErrorZPtr { err }
8805 result_ok: o.result_ok,
8809 impl Clone for CResult__u832APIErrorZ {
8810 fn clone(&self) -> Self {
8812 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
8813 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8816 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8817 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8823 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8824 /// but with all dynamically-allocated buffers duplicated in new buffers.
8825 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8827 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8828 /// This corresponds to std::vector in C++
8829 pub struct CVec_RecentPaymentDetailsZ {
8830 /// The elements in the array.
8831 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8832 pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
8833 /// The number of elements pointed to by `data`.
8836 impl CVec_RecentPaymentDetailsZ {
8837 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
8838 if self.datalen == 0 { return Vec::new(); }
8839 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8840 self.data = core::ptr::null_mut();
8844 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
8845 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8848 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
8849 fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
8850 let datalen = v.len();
8851 let data = Box::into_raw(v.into_boxed_slice());
8852 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8856 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8857 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
8858 impl Drop for CVec_RecentPaymentDetailsZ {
8859 fn drop(&mut self) {
8860 if self.datalen == 0 { return; }
8861 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8865 /// The contents of CResult_NonePaymentSendFailureZ
8866 pub union CResult_NonePaymentSendFailureZPtr {
8867 /// Note that this value is always NULL, as there are no contents in the OK variant
8868 pub result: *mut core::ffi::c_void,
8869 /// A pointer to the contents in the error state.
8870 /// Reading from this pointer when `result_ok` is set is undefined.
8871 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8874 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8875 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8877 pub struct CResult_NonePaymentSendFailureZ {
8878 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8879 /// `err` or `result` depending on the state of `result_ok`.
8880 pub contents: CResult_NonePaymentSendFailureZPtr,
8881 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8882 pub result_ok: bool,
8885 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8886 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8887 CResult_NonePaymentSendFailureZ {
8888 contents: CResult_NonePaymentSendFailureZPtr {
8889 result: core::ptr::null_mut(),
8895 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8896 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8897 CResult_NonePaymentSendFailureZ {
8898 contents: CResult_NonePaymentSendFailureZPtr {
8899 err: Box::into_raw(Box::new(e)),
8904 /// Checks if the given object is currently in the success state
8906 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8910 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8911 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8912 impl Drop for CResult_NonePaymentSendFailureZ {
8913 fn drop(&mut self) {
8916 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8917 let _ = unsafe { Box::from_raw(self.contents.err) };
8922 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8923 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8924 let contents = if o.result_ok {
8925 let _ = unsafe { Box::from_raw(o.contents.result) };
8926 o.contents.result = core::ptr::null_mut();
8927 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8929 let err = unsafe { o.contents.err };
8930 unsafe { o.contents.err = core::ptr::null_mut(); }
8931 CResult_NonePaymentSendFailureZPtr { err }
8935 result_ok: o.result_ok,
8939 impl Clone for CResult_NonePaymentSendFailureZ {
8940 fn clone(&self) -> Self {
8942 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8943 result: core::ptr::null_mut()
8946 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8947 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8953 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8954 /// but with all dynamically-allocated buffers duplicated in new buffers.
8955 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8957 /// The contents of CResult_NoneRetryableSendFailureZ
8958 pub union CResult_NoneRetryableSendFailureZPtr {
8959 /// Note that this value is always NULL, as there are no contents in the OK variant
8960 pub result: *mut core::ffi::c_void,
8961 /// A pointer to the contents in the error state.
8962 /// Reading from this pointer when `result_ok` is set is undefined.
8963 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8966 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8967 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8968 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8969 pub struct CResult_NoneRetryableSendFailureZ {
8970 /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8971 /// `err` or `result` depending on the state of `result_ok`.
8972 pub contents: CResult_NoneRetryableSendFailureZPtr,
8973 /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8974 pub result_ok: bool,
8977 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
8978 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8979 CResult_NoneRetryableSendFailureZ {
8980 contents: CResult_NoneRetryableSendFailureZPtr {
8981 result: core::ptr::null_mut(),
8987 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8988 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8989 CResult_NoneRetryableSendFailureZ {
8990 contents: CResult_NoneRetryableSendFailureZPtr {
8991 err: Box::into_raw(Box::new(e)),
8996 /// Checks if the given object is currently in the success state
8998 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
9002 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
9003 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
9004 impl Drop for CResult_NoneRetryableSendFailureZ {
9005 fn drop(&mut self) {
9008 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9009 let _ = unsafe { Box::from_raw(self.contents.err) };
9014 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
9015 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9016 let contents = if o.result_ok {
9017 let _ = unsafe { Box::from_raw(o.contents.result) };
9018 o.contents.result = core::ptr::null_mut();
9019 CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
9021 let err = unsafe { o.contents.err };
9022 unsafe { o.contents.err = core::ptr::null_mut(); }
9023 CResult_NoneRetryableSendFailureZPtr { err }
9027 result_ok: o.result_ok,
9031 impl Clone for CResult_NoneRetryableSendFailureZ {
9032 fn clone(&self) -> Self {
9034 Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
9035 result: core::ptr::null_mut()
9038 Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
9039 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9045 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
9046 /// but with all dynamically-allocated buffers duplicated in new buffers.
9047 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
9049 /// The contents of CResult_PaymentHashPaymentSendFailureZ
9050 pub union CResult_PaymentHashPaymentSendFailureZPtr {
9051 /// A pointer to the contents in the success state.
9052 /// Reading from this pointer when `result_ok` is not set is undefined.
9053 pub result: *mut crate::c_types::ThirtyTwoBytes,
9054 /// A pointer to the contents in the error state.
9055 /// Reading from this pointer when `result_ok` is set is undefined.
9056 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9059 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
9060 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9061 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9062 pub struct CResult_PaymentHashPaymentSendFailureZ {
9063 /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
9064 /// `err` or `result` depending on the state of `result_ok`.
9065 pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
9066 /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
9067 pub result_ok: bool,
9070 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
9071 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
9072 CResult_PaymentHashPaymentSendFailureZ {
9073 contents: CResult_PaymentHashPaymentSendFailureZPtr {
9074 result: Box::into_raw(Box::new(o)),
9080 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
9081 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
9082 CResult_PaymentHashPaymentSendFailureZ {
9083 contents: CResult_PaymentHashPaymentSendFailureZPtr {
9084 err: Box::into_raw(Box::new(e)),
9089 /// Checks if the given object is currently in the success state
9091 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool {
9095 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
9096 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
9097 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
9098 fn drop(&mut self) {
9100 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9101 let _ = unsafe { Box::from_raw(self.contents.result) };
9104 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9105 let _ = unsafe { Box::from_raw(self.contents.err) };
9110 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
9111 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9112 let contents = if o.result_ok {
9113 let result = unsafe { o.contents.result };
9114 unsafe { o.contents.result = core::ptr::null_mut() };
9115 CResult_PaymentHashPaymentSendFailureZPtr { result }
9117 let err = unsafe { o.contents.err };
9118 unsafe { o.contents.err = core::ptr::null_mut(); }
9119 CResult_PaymentHashPaymentSendFailureZPtr { err }
9123 result_ok: o.result_ok,
9127 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
9128 fn clone(&self) -> Self {
9130 Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
9131 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9134 Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
9135 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9141 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
9142 /// but with all dynamically-allocated buffers duplicated in new buffers.
9143 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
9145 /// The contents of CResult_PaymentHashRetryableSendFailureZ
9146 pub union CResult_PaymentHashRetryableSendFailureZPtr {
9147 /// A pointer to the contents in the success state.
9148 /// Reading from this pointer when `result_ok` is not set is undefined.
9149 pub result: *mut crate::c_types::ThirtyTwoBytes,
9150 /// A pointer to the contents in the error state.
9151 /// Reading from this pointer when `result_ok` is set is undefined.
9152 pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9155 /// A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
9156 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9158 pub struct CResult_PaymentHashRetryableSendFailureZ {
9159 /// The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
9160 /// `err` or `result` depending on the state of `result_ok`.
9161 pub contents: CResult_PaymentHashRetryableSendFailureZPtr,
9162 /// Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
9163 pub result_ok: bool,
9166 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
9167 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashRetryableSendFailureZ {
9168 CResult_PaymentHashRetryableSendFailureZ {
9169 contents: CResult_PaymentHashRetryableSendFailureZPtr {
9170 result: Box::into_raw(Box::new(o)),
9176 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
9177 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_PaymentHashRetryableSendFailureZ {
9178 CResult_PaymentHashRetryableSendFailureZ {
9179 contents: CResult_PaymentHashRetryableSendFailureZPtr {
9180 err: Box::into_raw(Box::new(e)),
9185 /// Checks if the given object is currently in the success state
9187 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_is_ok(o: &CResult_PaymentHashRetryableSendFailureZ) -> bool {
9191 /// Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
9192 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_free(_res: CResult_PaymentHashRetryableSendFailureZ) { }
9193 impl Drop for CResult_PaymentHashRetryableSendFailureZ {
9194 fn drop(&mut self) {
9196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9197 let _ = unsafe { Box::from_raw(self.contents.result) };
9200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9201 let _ = unsafe { Box::from_raw(self.contents.err) };
9206 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_PaymentHashRetryableSendFailureZ {
9207 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9208 let contents = if o.result_ok {
9209 let result = unsafe { o.contents.result };
9210 unsafe { o.contents.result = core::ptr::null_mut() };
9211 CResult_PaymentHashRetryableSendFailureZPtr { result }
9213 let err = unsafe { o.contents.err };
9214 unsafe { o.contents.err = core::ptr::null_mut(); }
9215 CResult_PaymentHashRetryableSendFailureZPtr { err }
9219 result_ok: o.result_ok,
9223 impl Clone for CResult_PaymentHashRetryableSendFailureZ {
9224 fn clone(&self) -> Self {
9226 Self { result_ok: true, contents: CResult_PaymentHashRetryableSendFailureZPtr {
9227 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9230 Self { result_ok: false, contents: CResult_PaymentHashRetryableSendFailureZPtr {
9231 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9237 /// Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
9238 /// but with all dynamically-allocated buffers duplicated in new buffers.
9239 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_clone(orig: &CResult_PaymentHashRetryableSendFailureZ) -> CResult_PaymentHashRetryableSendFailureZ { Clone::clone(&orig) }
9241 /// A tuple of 2 elements. See the individual fields for the types contained.
9242 pub struct C2Tuple_PaymentHashPaymentIdZ {
9243 /// The element at position 0
9244 pub a: crate::c_types::ThirtyTwoBytes,
9245 /// The element at position 1
9246 pub b: crate::c_types::ThirtyTwoBytes,
9248 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
9249 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9256 impl C2Tuple_PaymentHashPaymentIdZ {
9257 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9261 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
9262 fn clone(&self) -> Self {
9264 a: Clone::clone(&self.a),
9265 b: Clone::clone(&self.b),
9270 /// Creates a new tuple which has the same data as `orig`
9271 /// but with all dynamically-allocated buffers duplicated in new buffers.
9272 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
9273 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
9275 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
9276 C2Tuple_PaymentHashPaymentIdZ { a, b, }
9280 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
9281 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
9283 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
9284 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9285 /// A pointer to the contents in the success state.
9286 /// Reading from this pointer when `result_ok` is not set is undefined.
9287 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
9288 /// A pointer to the contents in the error state.
9289 /// Reading from this pointer when `result_ok` is set is undefined.
9290 pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9293 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
9294 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9295 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9296 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9297 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
9298 /// `err` or `result` depending on the state of `result_ok`.
9299 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
9300 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
9301 pub result_ok: bool,
9304 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
9305 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9306 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9307 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9308 result: Box::into_raw(Box::new(o)),
9314 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
9315 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9316 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9317 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9318 err: Box::into_raw(Box::new(e)),
9323 /// Checks if the given object is currently in the success state
9325 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
9329 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
9330 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
9331 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9332 fn drop(&mut self) {
9334 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9335 let _ = unsafe { Box::from_raw(self.contents.result) };
9338 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9339 let _ = unsafe { Box::from_raw(self.contents.err) };
9344 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9345 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9346 let contents = if o.result_ok {
9347 let result = unsafe { o.contents.result };
9348 unsafe { o.contents.result = core::ptr::null_mut() };
9349 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
9351 let err = unsafe { o.contents.err };
9352 unsafe { o.contents.err = core::ptr::null_mut(); }
9353 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
9357 result_ok: o.result_ok,
9361 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9362 fn clone(&self) -> Self {
9364 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9365 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
9368 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9369 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9375 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
9376 /// but with all dynamically-allocated buffers duplicated in new buffers.
9377 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
9379 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
9380 /// This corresponds to std::vector in C++
9381 pub struct CVec_ThirtyTwoBytesZ {
9382 /// The elements in the array.
9383 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9384 pub data: *mut crate::c_types::ThirtyTwoBytes,
9385 /// The number of elements pointed to by `data`.
9388 impl CVec_ThirtyTwoBytesZ {
9389 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
9390 if self.datalen == 0 { return Vec::new(); }
9391 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9392 self.data = core::ptr::null_mut();
9396 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
9397 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9400 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
9401 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
9402 let datalen = v.len();
9403 let data = Box::into_raw(v.into_boxed_slice());
9404 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9408 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9409 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
9410 impl Drop for CVec_ThirtyTwoBytesZ {
9411 fn drop(&mut self) {
9412 if self.datalen == 0 { return; }
9413 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9416 impl Clone for CVec_ThirtyTwoBytesZ {
9417 fn clone(&self) -> Self {
9418 let mut res = Vec::new();
9419 if self.datalen == 0 { return Self::from(res); }
9420 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9425 /// A tuple of 2 elements. See the individual fields for the types contained.
9426 pub struct C2Tuple_PaymentHashPaymentSecretZ {
9427 /// The element at position 0
9428 pub a: crate::c_types::ThirtyTwoBytes,
9429 /// The element at position 1
9430 pub b: crate::c_types::ThirtyTwoBytes,
9432 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
9433 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9440 impl C2Tuple_PaymentHashPaymentSecretZ {
9441 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9445 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
9446 fn clone(&self) -> Self {
9448 a: Clone::clone(&self.a),
9449 b: Clone::clone(&self.b),
9454 /// Creates a new tuple which has the same data as `orig`
9455 /// but with all dynamically-allocated buffers duplicated in new buffers.
9456 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
9457 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
9459 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
9460 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
9464 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
9465 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
9467 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
9468 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9469 /// A pointer to the contents in the success state.
9470 /// Reading from this pointer when `result_ok` is not set is undefined.
9471 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
9472 /// Note that this value is always NULL, as there are no contents in the Err variant
9473 pub err: *mut core::ffi::c_void,
9476 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
9477 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
9478 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9479 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9480 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
9481 /// `err` or `result` depending on the state of `result_ok`.
9482 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
9483 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
9484 pub result_ok: bool,
9487 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
9488 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9489 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9490 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9491 result: Box::into_raw(Box::new(o)),
9497 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
9498 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9499 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9500 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9501 err: core::ptr::null_mut(),
9506 /// Checks if the given object is currently in the success state
9508 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
9512 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
9513 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
9514 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9515 fn drop(&mut self) {
9517 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9518 let _ = unsafe { Box::from_raw(self.contents.result) };
9524 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9525 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
9526 let contents = if o.result_ok {
9527 let result = unsafe { o.contents.result };
9528 unsafe { o.contents.result = core::ptr::null_mut() };
9529 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
9531 let _ = unsafe { Box::from_raw(o.contents.err) };
9532 o.contents.err = core::ptr::null_mut();
9533 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
9537 result_ok: o.result_ok,
9541 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9542 fn clone(&self) -> Self {
9544 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9545 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9548 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9549 err: core::ptr::null_mut()
9555 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
9556 /// but with all dynamically-allocated buffers duplicated in new buffers.
9557 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
9559 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
9560 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9561 /// A pointer to the contents in the success state.
9562 /// Reading from this pointer when `result_ok` is not set is undefined.
9563 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
9564 /// A pointer to the contents in the error state.
9565 /// Reading from this pointer when `result_ok` is set is undefined.
9566 pub err: *mut crate::lightning::util::errors::APIError,
9569 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
9570 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
9571 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9572 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9573 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
9574 /// `err` or `result` depending on the state of `result_ok`.
9575 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
9576 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
9577 pub result_ok: bool,
9580 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
9581 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9582 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9583 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9584 result: Box::into_raw(Box::new(o)),
9590 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
9591 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9592 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9593 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9594 err: Box::into_raw(Box::new(e)),
9599 /// Checks if the given object is currently in the success state
9601 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
9605 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
9606 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
9607 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9608 fn drop(&mut self) {
9610 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9611 let _ = unsafe { Box::from_raw(self.contents.result) };
9614 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9615 let _ = unsafe { Box::from_raw(self.contents.err) };
9620 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9621 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
9622 let contents = if o.result_ok {
9623 let result = unsafe { o.contents.result };
9624 unsafe { o.contents.result = core::ptr::null_mut() };
9625 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
9627 let err = unsafe { o.contents.err };
9628 unsafe { o.contents.err = core::ptr::null_mut(); }
9629 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
9633 result_ok: o.result_ok,
9637 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9638 fn clone(&self) -> Self {
9640 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9641 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9644 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9645 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9651 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
9652 /// but with all dynamically-allocated buffers duplicated in new buffers.
9653 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
9655 /// The contents of CResult_PaymentSecretNoneZ
9656 pub union CResult_PaymentSecretNoneZPtr {
9657 /// A pointer to the contents in the success state.
9658 /// Reading from this pointer when `result_ok` is not set is undefined.
9659 pub result: *mut crate::c_types::ThirtyTwoBytes,
9660 /// Note that this value is always NULL, as there are no contents in the Err variant
9661 pub err: *mut core::ffi::c_void,
9664 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
9665 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
9666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9667 pub struct CResult_PaymentSecretNoneZ {
9668 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
9669 /// `err` or `result` depending on the state of `result_ok`.
9670 pub contents: CResult_PaymentSecretNoneZPtr,
9671 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
9672 pub result_ok: bool,
9675 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
9676 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
9677 CResult_PaymentSecretNoneZ {
9678 contents: CResult_PaymentSecretNoneZPtr {
9679 result: Box::into_raw(Box::new(o)),
9685 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
9686 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
9687 CResult_PaymentSecretNoneZ {
9688 contents: CResult_PaymentSecretNoneZPtr {
9689 err: core::ptr::null_mut(),
9694 /// Checks if the given object is currently in the success state
9696 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
9700 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
9701 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
9702 impl Drop for CResult_PaymentSecretNoneZ {
9703 fn drop(&mut self) {
9705 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9706 let _ = unsafe { Box::from_raw(self.contents.result) };
9712 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
9713 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
9714 let contents = if o.result_ok {
9715 let result = unsafe { o.contents.result };
9716 unsafe { o.contents.result = core::ptr::null_mut() };
9717 CResult_PaymentSecretNoneZPtr { result }
9719 let _ = unsafe { Box::from_raw(o.contents.err) };
9720 o.contents.err = core::ptr::null_mut();
9721 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
9725 result_ok: o.result_ok,
9729 impl Clone for CResult_PaymentSecretNoneZ {
9730 fn clone(&self) -> Self {
9732 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
9733 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9736 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
9737 err: core::ptr::null_mut()
9743 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
9744 /// but with all dynamically-allocated buffers duplicated in new buffers.
9745 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
9747 /// The contents of CResult_PaymentSecretAPIErrorZ
9748 pub union CResult_PaymentSecretAPIErrorZPtr {
9749 /// A pointer to the contents in the success state.
9750 /// Reading from this pointer when `result_ok` is not set is undefined.
9751 pub result: *mut crate::c_types::ThirtyTwoBytes,
9752 /// A pointer to the contents in the error state.
9753 /// Reading from this pointer when `result_ok` is set is undefined.
9754 pub err: *mut crate::lightning::util::errors::APIError,
9757 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9758 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9760 pub struct CResult_PaymentSecretAPIErrorZ {
9761 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9762 /// `err` or `result` depending on the state of `result_ok`.
9763 pub contents: CResult_PaymentSecretAPIErrorZPtr,
9764 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9765 pub result_ok: bool,
9768 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9769 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9770 CResult_PaymentSecretAPIErrorZ {
9771 contents: CResult_PaymentSecretAPIErrorZPtr {
9772 result: Box::into_raw(Box::new(o)),
9778 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9779 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9780 CResult_PaymentSecretAPIErrorZ {
9781 contents: CResult_PaymentSecretAPIErrorZPtr {
9782 err: Box::into_raw(Box::new(e)),
9787 /// Checks if the given object is currently in the success state
9789 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
9793 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9794 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9795 impl Drop for CResult_PaymentSecretAPIErrorZ {
9796 fn drop(&mut self) {
9798 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9799 let _ = unsafe { Box::from_raw(self.contents.result) };
9802 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9803 let _ = unsafe { Box::from_raw(self.contents.err) };
9808 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9809 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9810 let contents = if o.result_ok {
9811 let result = unsafe { o.contents.result };
9812 unsafe { o.contents.result = core::ptr::null_mut() };
9813 CResult_PaymentSecretAPIErrorZPtr { result }
9815 let err = unsafe { o.contents.err };
9816 unsafe { o.contents.err = core::ptr::null_mut(); }
9817 CResult_PaymentSecretAPIErrorZPtr { err }
9821 result_ok: o.result_ok,
9825 impl Clone for CResult_PaymentSecretAPIErrorZ {
9826 fn clone(&self) -> Self {
9828 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
9829 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9832 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
9833 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9839 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9840 /// but with all dynamically-allocated buffers duplicated in new buffers.
9841 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
9843 /// The contents of CResult_PaymentPreimageAPIErrorZ
9844 pub union CResult_PaymentPreimageAPIErrorZPtr {
9845 /// A pointer to the contents in the success state.
9846 /// Reading from this pointer when `result_ok` is not set is undefined.
9847 pub result: *mut crate::c_types::ThirtyTwoBytes,
9848 /// A pointer to the contents in the error state.
9849 /// Reading from this pointer when `result_ok` is set is undefined.
9850 pub err: *mut crate::lightning::util::errors::APIError,
9853 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
9854 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9856 pub struct CResult_PaymentPreimageAPIErrorZ {
9857 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
9858 /// `err` or `result` depending on the state of `result_ok`.
9859 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
9860 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9861 pub result_ok: bool,
9864 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
9865 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
9866 CResult_PaymentPreimageAPIErrorZ {
9867 contents: CResult_PaymentPreimageAPIErrorZPtr {
9868 result: Box::into_raw(Box::new(o)),
9874 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
9875 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
9876 CResult_PaymentPreimageAPIErrorZ {
9877 contents: CResult_PaymentPreimageAPIErrorZPtr {
9878 err: Box::into_raw(Box::new(e)),
9883 /// Checks if the given object is currently in the success state
9885 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
9889 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
9890 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
9891 impl Drop for CResult_PaymentPreimageAPIErrorZ {
9892 fn drop(&mut self) {
9894 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9895 let _ = unsafe { Box::from_raw(self.contents.result) };
9898 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9899 let _ = unsafe { Box::from_raw(self.contents.err) };
9904 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
9905 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9906 let contents = if o.result_ok {
9907 let result = unsafe { o.contents.result };
9908 unsafe { o.contents.result = core::ptr::null_mut() };
9909 CResult_PaymentPreimageAPIErrorZPtr { result }
9911 let err = unsafe { o.contents.err };
9912 unsafe { o.contents.err = core::ptr::null_mut(); }
9913 CResult_PaymentPreimageAPIErrorZPtr { err }
9917 result_ok: o.result_ok,
9921 impl Clone for CResult_PaymentPreimageAPIErrorZ {
9922 fn clone(&self) -> Self {
9924 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
9925 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9928 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
9929 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9935 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
9936 /// but with all dynamically-allocated buffers duplicated in new buffers.
9937 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
9939 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9940 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9941 /// A pointer to the contents in the success state.
9942 /// Reading from this pointer when `result_ok` is not set is undefined.
9943 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9944 /// A pointer to the contents in the error state.
9945 /// Reading from this pointer when `result_ok` is set is undefined.
9946 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9949 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9950 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9952 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9953 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9954 /// `err` or `result` depending on the state of `result_ok`.
9955 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9956 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9957 pub result_ok: bool,
9960 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9961 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9962 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9963 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9964 result: Box::into_raw(Box::new(o)),
9970 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9971 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9972 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9973 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9974 err: Box::into_raw(Box::new(e)),
9979 /// Checks if the given object is currently in the success state
9981 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9985 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9986 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9987 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9988 fn drop(&mut self) {
9990 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9991 let _ = unsafe { Box::from_raw(self.contents.result) };
9994 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9995 let _ = unsafe { Box::from_raw(self.contents.err) };
10000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10001 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10002 let contents = if o.result_ok {
10003 let result = unsafe { o.contents.result };
10004 unsafe { o.contents.result = core::ptr::null_mut() };
10005 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
10007 let err = unsafe { o.contents.err };
10008 unsafe { o.contents.err = core::ptr::null_mut(); }
10009 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
10013 result_ok: o.result_ok,
10017 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10018 fn clone(&self) -> Self {
10019 if self.result_ok {
10020 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10021 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
10024 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10025 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10031 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
10032 /// but with all dynamically-allocated buffers duplicated in new buffers.
10033 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
10035 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
10036 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
10037 /// A pointer to the contents in the success state.
10038 /// Reading from this pointer when `result_ok` is not set is undefined.
10039 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
10040 /// A pointer to the contents in the error state.
10041 /// Reading from this pointer when `result_ok` is set is undefined.
10042 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10045 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
10046 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
10047 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10048 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
10049 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
10050 /// `err` or `result` depending on the state of `result_ok`.
10051 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
10052 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
10053 pub result_ok: bool,
10056 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
10057 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
10058 CResult_ChannelCounterpartyDecodeErrorZ {
10059 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10060 result: Box::into_raw(Box::new(o)),
10066 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
10067 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
10068 CResult_ChannelCounterpartyDecodeErrorZ {
10069 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10070 err: Box::into_raw(Box::new(e)),
10075 /// Checks if the given object is currently in the success state
10077 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
10081 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
10082 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
10083 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
10084 fn drop(&mut self) {
10085 if self.result_ok {
10086 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10087 let _ = unsafe { Box::from_raw(self.contents.result) };
10090 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10091 let _ = unsafe { Box::from_raw(self.contents.err) };
10096 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
10097 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
10098 let contents = if o.result_ok {
10099 let result = unsafe { o.contents.result };
10100 unsafe { o.contents.result = core::ptr::null_mut() };
10101 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
10103 let err = unsafe { o.contents.err };
10104 unsafe { o.contents.err = core::ptr::null_mut(); }
10105 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
10109 result_ok: o.result_ok,
10113 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
10114 fn clone(&self) -> Self {
10115 if self.result_ok {
10116 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10117 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
10120 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10121 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10127 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
10128 /// but with all dynamically-allocated buffers duplicated in new buffers.
10129 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
10131 /// The contents of CResult_ChannelDetailsDecodeErrorZ
10132 pub union CResult_ChannelDetailsDecodeErrorZPtr {
10133 /// A pointer to the contents in the success state.
10134 /// Reading from this pointer when `result_ok` is not set is undefined.
10135 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
10136 /// A pointer to the contents in the error state.
10137 /// Reading from this pointer when `result_ok` is set is undefined.
10138 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10141 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
10142 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
10143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10144 pub struct CResult_ChannelDetailsDecodeErrorZ {
10145 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
10146 /// `err` or `result` depending on the state of `result_ok`.
10147 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
10148 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
10149 pub result_ok: bool,
10152 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
10153 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
10154 CResult_ChannelDetailsDecodeErrorZ {
10155 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10156 result: Box::into_raw(Box::new(o)),
10162 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
10163 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
10164 CResult_ChannelDetailsDecodeErrorZ {
10165 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10166 err: Box::into_raw(Box::new(e)),
10171 /// Checks if the given object is currently in the success state
10173 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
10177 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
10178 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
10179 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
10180 fn drop(&mut self) {
10181 if self.result_ok {
10182 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10183 let _ = unsafe { Box::from_raw(self.contents.result) };
10186 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10187 let _ = unsafe { Box::from_raw(self.contents.err) };
10192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
10193 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
10194 let contents = if o.result_ok {
10195 let result = unsafe { o.contents.result };
10196 unsafe { o.contents.result = core::ptr::null_mut() };
10197 CResult_ChannelDetailsDecodeErrorZPtr { result }
10199 let err = unsafe { o.contents.err };
10200 unsafe { o.contents.err = core::ptr::null_mut(); }
10201 CResult_ChannelDetailsDecodeErrorZPtr { err }
10205 result_ok: o.result_ok,
10209 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
10210 fn clone(&self) -> Self {
10211 if self.result_ok {
10212 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10213 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
10216 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10217 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10223 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
10224 /// but with all dynamically-allocated buffers duplicated in new buffers.
10225 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
10227 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
10228 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
10229 /// A pointer to the contents in the success state.
10230 /// Reading from this pointer when `result_ok` is not set is undefined.
10231 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
10232 /// A pointer to the contents in the error state.
10233 /// Reading from this pointer when `result_ok` is set is undefined.
10234 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10237 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
10238 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
10239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10240 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
10241 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
10242 /// `err` or `result` depending on the state of `result_ok`.
10243 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
10244 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
10245 pub result_ok: bool,
10248 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
10249 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
10250 CResult_PhantomRouteHintsDecodeErrorZ {
10251 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10252 result: Box::into_raw(Box::new(o)),
10258 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
10259 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
10260 CResult_PhantomRouteHintsDecodeErrorZ {
10261 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10262 err: Box::into_raw(Box::new(e)),
10267 /// Checks if the given object is currently in the success state
10269 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
10273 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
10274 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
10275 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
10276 fn drop(&mut self) {
10277 if self.result_ok {
10278 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10279 let _ = unsafe { Box::from_raw(self.contents.result) };
10282 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10283 let _ = unsafe { Box::from_raw(self.contents.err) };
10288 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
10289 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
10290 let contents = if o.result_ok {
10291 let result = unsafe { o.contents.result };
10292 unsafe { o.contents.result = core::ptr::null_mut() };
10293 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
10295 let err = unsafe { o.contents.err };
10296 unsafe { o.contents.err = core::ptr::null_mut(); }
10297 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
10301 result_ok: o.result_ok,
10305 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
10306 fn clone(&self) -> Self {
10307 if self.result_ok {
10308 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10309 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
10312 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10313 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10319 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
10320 /// but with all dynamically-allocated buffers duplicated in new buffers.
10321 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
10323 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
10324 /// This corresponds to std::vector in C++
10325 pub struct CVec_ChannelMonitorZ {
10326 /// The elements in the array.
10327 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10328 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
10329 /// The number of elements pointed to by `data`.
10332 impl CVec_ChannelMonitorZ {
10333 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
10334 if self.datalen == 0 { return Vec::new(); }
10335 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10336 self.data = core::ptr::null_mut();
10340 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
10341 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10344 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
10345 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
10346 let datalen = v.len();
10347 let data = Box::into_raw(v.into_boxed_slice());
10348 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10352 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10353 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10354 impl Drop for CVec_ChannelMonitorZ {
10355 fn drop(&mut self) {
10356 if self.datalen == 0 { return; }
10357 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10361 /// A tuple of 2 elements. See the individual fields for the types contained.
10362 pub struct C2Tuple_BlockHashChannelManagerZ {
10363 /// The element at position 0
10364 pub a: crate::c_types::ThirtyTwoBytes,
10365 /// The element at position 1
10366 pub b: crate::lightning::ln::channelmanager::ChannelManager,
10368 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
10369 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10376 impl C2Tuple_BlockHashChannelManagerZ {
10377 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10381 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10383 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
10384 C2Tuple_BlockHashChannelManagerZ { a, b, }
10388 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10389 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
10391 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
10392 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10393 /// A pointer to the contents in the success state.
10394 /// Reading from this pointer when `result_ok` is not set is undefined.
10395 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
10396 /// A pointer to the contents in the error state.
10397 /// Reading from this pointer when `result_ok` is set is undefined.
10398 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10401 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10402 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10403 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10404 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10405 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
10406 /// `err` or `result` depending on the state of `result_ok`.
10407 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
10408 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
10409 pub result_ok: bool,
10412 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10413 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10414 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10415 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10416 result: Box::into_raw(Box::new(o)),
10422 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10423 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10424 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10425 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10426 err: Box::into_raw(Box::new(e)),
10431 /// Checks if the given object is currently in the success state
10433 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
10437 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10438 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
10439 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10440 fn drop(&mut self) {
10441 if self.result_ok {
10442 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10443 let _ = unsafe { Box::from_raw(self.contents.result) };
10446 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10447 let _ = unsafe { Box::from_raw(self.contents.err) };
10452 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10453 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10454 let contents = if o.result_ok {
10455 let result = unsafe { o.contents.result };
10456 unsafe { o.contents.result = core::ptr::null_mut() };
10457 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
10459 let err = unsafe { o.contents.err };
10460 unsafe { o.contents.err = core::ptr::null_mut(); }
10461 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
10465 result_ok: o.result_ok,
10470 /// The contents of CResult_ChannelConfigDecodeErrorZ
10471 pub union CResult_ChannelConfigDecodeErrorZPtr {
10472 /// A pointer to the contents in the success state.
10473 /// Reading from this pointer when `result_ok` is not set is undefined.
10474 pub result: *mut crate::lightning::util::config::ChannelConfig,
10475 /// A pointer to the contents in the error state.
10476 /// Reading from this pointer when `result_ok` is set is undefined.
10477 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10480 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
10481 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
10482 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10483 pub struct CResult_ChannelConfigDecodeErrorZ {
10484 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
10485 /// `err` or `result` depending on the state of `result_ok`.
10486 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
10487 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
10488 pub result_ok: bool,
10491 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10492 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
10493 CResult_ChannelConfigDecodeErrorZ {
10494 contents: CResult_ChannelConfigDecodeErrorZPtr {
10495 result: Box::into_raw(Box::new(o)),
10501 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10502 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
10503 CResult_ChannelConfigDecodeErrorZ {
10504 contents: CResult_ChannelConfigDecodeErrorZPtr {
10505 err: Box::into_raw(Box::new(e)),
10510 /// Checks if the given object is currently in the success state
10512 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
10516 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10517 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
10518 impl Drop for CResult_ChannelConfigDecodeErrorZ {
10519 fn drop(&mut self) {
10520 if self.result_ok {
10521 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10522 let _ = unsafe { Box::from_raw(self.contents.result) };
10525 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10526 let _ = unsafe { Box::from_raw(self.contents.err) };
10531 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
10532 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
10533 let contents = if o.result_ok {
10534 let result = unsafe { o.contents.result };
10535 unsafe { o.contents.result = core::ptr::null_mut() };
10536 CResult_ChannelConfigDecodeErrorZPtr { result }
10538 let err = unsafe { o.contents.err };
10539 unsafe { o.contents.err = core::ptr::null_mut(); }
10540 CResult_ChannelConfigDecodeErrorZPtr { err }
10544 result_ok: o.result_ok,
10548 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10549 fn clone(&self) -> Self {
10550 if self.result_ok {
10551 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10552 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10555 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
10556 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10562 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10563 /// but with all dynamically-allocated buffers duplicated in new buffers.
10564 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
10567 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
10568 pub enum COption_APIErrorZ {
10569 /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
10570 Some(crate::lightning::util::errors::APIError),
10571 /// When we're in this state, this COption_APIErrorZ contains nothing
10574 impl COption_APIErrorZ {
10575 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10576 if let Self::None = self { false } else { true }
10578 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10581 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
10582 if let Self::Some(v) = self { v } else { unreachable!() }
10586 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
10587 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
10588 COption_APIErrorZ::Some(o)
10591 /// Constructs a new COption_APIErrorZ containing nothing
10592 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
10593 COption_APIErrorZ::None
10596 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
10597 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
10599 /// Creates a new COption_APIErrorZ which has the same data as `orig`
10600 /// but with all dynamically-allocated buffers duplicated in new buffers.
10601 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
10603 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
10604 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
10605 /// A pointer to the contents in the success state.
10606 /// Reading from this pointer when `result_ok` is not set is undefined.
10607 pub result: *mut crate::c_types::derived::COption_APIErrorZ,
10608 /// A pointer to the contents in the error state.
10609 /// Reading from this pointer when `result_ok` is set is undefined.
10610 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10613 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
10614 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10616 pub struct CResult_COption_APIErrorZDecodeErrorZ {
10617 /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
10618 /// `err` or `result` depending on the state of `result_ok`.
10619 pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
10620 /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
10621 pub result_ok: bool,
10624 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
10625 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
10626 CResult_COption_APIErrorZDecodeErrorZ {
10627 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10628 result: Box::into_raw(Box::new(o)),
10634 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
10635 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
10636 CResult_COption_APIErrorZDecodeErrorZ {
10637 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10638 err: Box::into_raw(Box::new(e)),
10643 /// Checks if the given object is currently in the success state
10645 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
10649 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
10650 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
10651 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
10652 fn drop(&mut self) {
10653 if self.result_ok {
10654 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10655 let _ = unsafe { Box::from_raw(self.contents.result) };
10658 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10659 let _ = unsafe { Box::from_raw(self.contents.err) };
10664 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
10665 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10666 let contents = if o.result_ok {
10667 let result = unsafe { o.contents.result };
10668 unsafe { o.contents.result = core::ptr::null_mut() };
10669 CResult_COption_APIErrorZDecodeErrorZPtr { result }
10671 let err = unsafe { o.contents.err };
10672 unsafe { o.contents.err = core::ptr::null_mut(); }
10673 CResult_COption_APIErrorZDecodeErrorZPtr { err }
10677 result_ok: o.result_ok,
10681 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
10682 fn clone(&self) -> Self {
10683 if self.result_ok {
10684 Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10685 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
10688 Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10689 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10695 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
10696 /// but with all dynamically-allocated buffers duplicated in new buffers.
10697 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
10699 /// The contents of CResult_UntrustedStringDecodeErrorZ
10700 pub union CResult_UntrustedStringDecodeErrorZPtr {
10701 /// A pointer to the contents in the success state.
10702 /// Reading from this pointer when `result_ok` is not set is undefined.
10703 pub result: *mut crate::lightning::util::string::UntrustedString,
10704 /// A pointer to the contents in the error state.
10705 /// Reading from this pointer when `result_ok` is set is undefined.
10706 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10709 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
10710 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
10711 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10712 pub struct CResult_UntrustedStringDecodeErrorZ {
10713 /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
10714 /// `err` or `result` depending on the state of `result_ok`.
10715 pub contents: CResult_UntrustedStringDecodeErrorZPtr,
10716 /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
10717 pub result_ok: bool,
10720 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
10721 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
10722 CResult_UntrustedStringDecodeErrorZ {
10723 contents: CResult_UntrustedStringDecodeErrorZPtr {
10724 result: Box::into_raw(Box::new(o)),
10730 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
10731 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
10732 CResult_UntrustedStringDecodeErrorZ {
10733 contents: CResult_UntrustedStringDecodeErrorZPtr {
10734 err: Box::into_raw(Box::new(e)),
10739 /// Checks if the given object is currently in the success state
10741 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
10745 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
10746 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
10747 impl Drop for CResult_UntrustedStringDecodeErrorZ {
10748 fn drop(&mut self) {
10749 if self.result_ok {
10750 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10751 let _ = unsafe { Box::from_raw(self.contents.result) };
10754 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10755 let _ = unsafe { Box::from_raw(self.contents.err) };
10760 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
10761 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
10762 let contents = if o.result_ok {
10763 let result = unsafe { o.contents.result };
10764 unsafe { o.contents.result = core::ptr::null_mut() };
10765 CResult_UntrustedStringDecodeErrorZPtr { result }
10767 let err = unsafe { o.contents.err };
10768 unsafe { o.contents.err = core::ptr::null_mut(); }
10769 CResult_UntrustedStringDecodeErrorZPtr { err }
10773 result_ok: o.result_ok,
10777 impl Clone for CResult_UntrustedStringDecodeErrorZ {
10778 fn clone(&self) -> Self {
10779 if self.result_ok {
10780 Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
10781 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
10784 Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
10785 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10791 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
10792 /// but with all dynamically-allocated buffers duplicated in new buffers.
10793 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
10795 /// The contents of CResult_OutPointDecodeErrorZ
10796 pub union CResult_OutPointDecodeErrorZPtr {
10797 /// A pointer to the contents in the success state.
10798 /// Reading from this pointer when `result_ok` is not set is undefined.
10799 pub result: *mut crate::lightning::chain::transaction::OutPoint,
10800 /// A pointer to the contents in the error state.
10801 /// Reading from this pointer when `result_ok` is set is undefined.
10802 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10805 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
10806 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
10807 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10808 pub struct CResult_OutPointDecodeErrorZ {
10809 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
10810 /// `err` or `result` depending on the state of `result_ok`.
10811 pub contents: CResult_OutPointDecodeErrorZPtr,
10812 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
10813 pub result_ok: bool,
10816 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
10817 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
10818 CResult_OutPointDecodeErrorZ {
10819 contents: CResult_OutPointDecodeErrorZPtr {
10820 result: Box::into_raw(Box::new(o)),
10826 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
10827 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
10828 CResult_OutPointDecodeErrorZ {
10829 contents: CResult_OutPointDecodeErrorZPtr {
10830 err: Box::into_raw(Box::new(e)),
10835 /// Checks if the given object is currently in the success state
10837 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
10841 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
10842 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
10843 impl Drop for CResult_OutPointDecodeErrorZ {
10844 fn drop(&mut self) {
10845 if self.result_ok {
10846 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10847 let _ = unsafe { Box::from_raw(self.contents.result) };
10850 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10851 let _ = unsafe { Box::from_raw(self.contents.err) };
10856 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
10857 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
10858 let contents = if o.result_ok {
10859 let result = unsafe { o.contents.result };
10860 unsafe { o.contents.result = core::ptr::null_mut() };
10861 CResult_OutPointDecodeErrorZPtr { result }
10863 let err = unsafe { o.contents.err };
10864 unsafe { o.contents.err = core::ptr::null_mut(); }
10865 CResult_OutPointDecodeErrorZPtr { err }
10869 result_ok: o.result_ok,
10873 impl Clone for CResult_OutPointDecodeErrorZ {
10874 fn clone(&self) -> Self {
10875 if self.result_ok {
10876 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
10877 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
10880 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
10881 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10887 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10888 /// but with all dynamically-allocated buffers duplicated in new buffers.
10889 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
10891 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
10892 pub enum COption_TypeZ {
10893 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10894 Some(crate::lightning::ln::wire::Type),
10895 /// When we're in this state, this COption_TypeZ contains nothing
10898 impl COption_TypeZ {
10899 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10900 if let Self::None = self { false } else { true }
10902 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10905 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
10906 if let Self::Some(v) = self { v } else { unreachable!() }
10910 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
10911 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
10912 COption_TypeZ::Some(o)
10915 /// Constructs a new COption_TypeZ containing nothing
10916 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
10917 COption_TypeZ::None
10920 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
10921 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
10923 /// The contents of CResult_COption_TypeZDecodeErrorZ
10924 pub union CResult_COption_TypeZDecodeErrorZPtr {
10925 /// A pointer to the contents in the success state.
10926 /// Reading from this pointer when `result_ok` is not set is undefined.
10927 pub result: *mut crate::c_types::derived::COption_TypeZ,
10928 /// A pointer to the contents in the error state.
10929 /// Reading from this pointer when `result_ok` is set is undefined.
10930 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10933 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10934 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10935 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10936 pub struct CResult_COption_TypeZDecodeErrorZ {
10937 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10938 /// `err` or `result` depending on the state of `result_ok`.
10939 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
10940 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10941 pub result_ok: bool,
10944 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
10945 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
10946 CResult_COption_TypeZDecodeErrorZ {
10947 contents: CResult_COption_TypeZDecodeErrorZPtr {
10948 result: Box::into_raw(Box::new(o)),
10954 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
10955 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
10956 CResult_COption_TypeZDecodeErrorZ {
10957 contents: CResult_COption_TypeZDecodeErrorZPtr {
10958 err: Box::into_raw(Box::new(e)),
10963 /// Checks if the given object is currently in the success state
10965 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
10969 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
10970 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
10971 impl Drop for CResult_COption_TypeZDecodeErrorZ {
10972 fn drop(&mut self) {
10973 if self.result_ok {
10974 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10975 let _ = unsafe { Box::from_raw(self.contents.result) };
10978 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10979 let _ = unsafe { Box::from_raw(self.contents.err) };
10984 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
10985 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10986 let contents = if o.result_ok {
10987 let result = unsafe { o.contents.result };
10988 unsafe { o.contents.result = core::ptr::null_mut() };
10989 CResult_COption_TypeZDecodeErrorZPtr { result }
10991 let err = unsafe { o.contents.err };
10992 unsafe { o.contents.err = core::ptr::null_mut(); }
10993 CResult_COption_TypeZDecodeErrorZPtr { err }
10997 result_ok: o.result_ok,
11002 /// The contents of CResult_PaymentIdPaymentErrorZ
11003 pub union CResult_PaymentIdPaymentErrorZPtr {
11004 /// A pointer to the contents in the success state.
11005 /// Reading from this pointer when `result_ok` is not set is undefined.
11006 pub result: *mut crate::c_types::ThirtyTwoBytes,
11007 /// A pointer to the contents in the error state.
11008 /// Reading from this pointer when `result_ok` is set is undefined.
11009 pub err: *mut crate::lightning_invoice::payment::PaymentError,
11012 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
11013 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
11014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11015 pub struct CResult_PaymentIdPaymentErrorZ {
11016 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
11017 /// `err` or `result` depending on the state of `result_ok`.
11018 pub contents: CResult_PaymentIdPaymentErrorZPtr,
11019 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
11020 pub result_ok: bool,
11023 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
11024 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
11025 CResult_PaymentIdPaymentErrorZ {
11026 contents: CResult_PaymentIdPaymentErrorZPtr {
11027 result: Box::into_raw(Box::new(o)),
11033 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
11034 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
11035 CResult_PaymentIdPaymentErrorZ {
11036 contents: CResult_PaymentIdPaymentErrorZPtr {
11037 err: Box::into_raw(Box::new(e)),
11042 /// Checks if the given object is currently in the success state
11044 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
11048 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
11049 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
11050 impl Drop for CResult_PaymentIdPaymentErrorZ {
11051 fn drop(&mut self) {
11052 if self.result_ok {
11053 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11054 let _ = unsafe { Box::from_raw(self.contents.result) };
11057 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11058 let _ = unsafe { Box::from_raw(self.contents.err) };
11063 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
11064 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
11065 let contents = if o.result_ok {
11066 let result = unsafe { o.contents.result };
11067 unsafe { o.contents.result = core::ptr::null_mut() };
11068 CResult_PaymentIdPaymentErrorZPtr { result }
11070 let err = unsafe { o.contents.err };
11071 unsafe { o.contents.err = core::ptr::null_mut(); }
11072 CResult_PaymentIdPaymentErrorZPtr { err }
11076 result_ok: o.result_ok,
11080 impl Clone for CResult_PaymentIdPaymentErrorZ {
11081 fn clone(&self) -> Self {
11082 if self.result_ok {
11083 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
11084 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
11087 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
11088 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
11094 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
11095 /// but with all dynamically-allocated buffers duplicated in new buffers.
11096 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
11098 /// The contents of CResult_NonePaymentErrorZ
11099 pub union CResult_NonePaymentErrorZPtr {
11100 /// Note that this value is always NULL, as there are no contents in the OK variant
11101 pub result: *mut core::ffi::c_void,
11102 /// A pointer to the contents in the error state.
11103 /// Reading from this pointer when `result_ok` is set is undefined.
11104 pub err: *mut crate::lightning_invoice::payment::PaymentError,
11107 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
11108 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
11109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11110 pub struct CResult_NonePaymentErrorZ {
11111 /// The contents of this CResult_NonePaymentErrorZ, accessible via either
11112 /// `err` or `result` depending on the state of `result_ok`.
11113 pub contents: CResult_NonePaymentErrorZPtr,
11114 /// Whether this CResult_NonePaymentErrorZ represents a success state.
11115 pub result_ok: bool,
11118 /// Creates a new CResult_NonePaymentErrorZ in the success state.
11119 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
11120 CResult_NonePaymentErrorZ {
11121 contents: CResult_NonePaymentErrorZPtr {
11122 result: core::ptr::null_mut(),
11128 /// Creates a new CResult_NonePaymentErrorZ in the error state.
11129 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
11130 CResult_NonePaymentErrorZ {
11131 contents: CResult_NonePaymentErrorZPtr {
11132 err: Box::into_raw(Box::new(e)),
11137 /// Checks if the given object is currently in the success state
11139 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
11143 /// Frees any resources used by the CResult_NonePaymentErrorZ.
11144 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
11145 impl Drop for CResult_NonePaymentErrorZ {
11146 fn drop(&mut self) {
11147 if self.result_ok {
11149 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11150 let _ = unsafe { Box::from_raw(self.contents.err) };
11155 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
11156 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
11157 let contents = if o.result_ok {
11158 let _ = unsafe { Box::from_raw(o.contents.result) };
11159 o.contents.result = core::ptr::null_mut();
11160 CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
11162 let err = unsafe { o.contents.err };
11163 unsafe { o.contents.err = core::ptr::null_mut(); }
11164 CResult_NonePaymentErrorZPtr { err }
11168 result_ok: o.result_ok,
11172 impl Clone for CResult_NonePaymentErrorZ {
11173 fn clone(&self) -> Self {
11174 if self.result_ok {
11175 Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
11176 result: core::ptr::null_mut()
11179 Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
11180 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
11186 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
11187 /// but with all dynamically-allocated buffers duplicated in new buffers.
11188 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
11190 /// The contents of CResult_StringErrorZ
11191 pub union CResult_StringErrorZPtr {
11192 /// A pointer to the contents in the success state.
11193 /// Reading from this pointer when `result_ok` is not set is undefined.
11194 pub result: *mut crate::c_types::Str,
11195 /// A pointer to the contents in the error state.
11196 /// Reading from this pointer when `result_ok` is set is undefined.
11197 pub err: *mut crate::c_types::Secp256k1Error,
11200 /// A CResult_StringErrorZ represents the result of a fallible operation,
11201 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
11202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11203 pub struct CResult_StringErrorZ {
11204 /// The contents of this CResult_StringErrorZ, accessible via either
11205 /// `err` or `result` depending on the state of `result_ok`.
11206 pub contents: CResult_StringErrorZPtr,
11207 /// Whether this CResult_StringErrorZ represents a success state.
11208 pub result_ok: bool,
11211 /// Creates a new CResult_StringErrorZ in the success state.
11212 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
11213 CResult_StringErrorZ {
11214 contents: CResult_StringErrorZPtr {
11215 result: Box::into_raw(Box::new(o)),
11221 /// Creates a new CResult_StringErrorZ in the error state.
11222 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
11223 CResult_StringErrorZ {
11224 contents: CResult_StringErrorZPtr {
11225 err: Box::into_raw(Box::new(e)),
11230 /// Checks if the given object is currently in the success state
11232 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
11236 /// Frees any resources used by the CResult_StringErrorZ.
11237 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
11238 impl Drop for CResult_StringErrorZ {
11239 fn drop(&mut self) {
11240 if self.result_ok {
11241 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11242 let _ = unsafe { Box::from_raw(self.contents.result) };
11245 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11246 let _ = unsafe { Box::from_raw(self.contents.err) };
11251 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
11252 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
11253 let contents = if o.result_ok {
11254 let result = unsafe { o.contents.result };
11255 unsafe { o.contents.result = core::ptr::null_mut() };
11256 CResult_StringErrorZPtr { result }
11258 let err = unsafe { o.contents.err };
11259 unsafe { o.contents.err = core::ptr::null_mut(); }
11260 CResult_StringErrorZPtr { err }
11264 result_ok: o.result_ok,
11268 impl Clone for CResult_StringErrorZ {
11269 fn clone(&self) -> Self {
11270 if self.result_ok {
11271 Self { result_ok: true, contents: CResult_StringErrorZPtr {
11272 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
11275 Self { result_ok: false, contents: CResult_StringErrorZPtr {
11276 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
11282 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
11283 /// but with all dynamically-allocated buffers duplicated in new buffers.
11284 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
11286 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
11287 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11288 /// A pointer to the contents in the success state.
11289 /// Reading from this pointer when `result_ok` is not set is undefined.
11290 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
11291 /// A pointer to the contents in the error state.
11292 /// Reading from this pointer when `result_ok` is set is undefined.
11293 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11296 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
11297 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11299 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
11300 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
11301 /// `err` or `result` depending on the state of `result_ok`.
11302 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
11303 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
11304 pub result_ok: bool,
11307 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
11308 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11309 CResult_ChannelMonitorUpdateDecodeErrorZ {
11310 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11311 result: Box::into_raw(Box::new(o)),
11317 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
11318 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11319 CResult_ChannelMonitorUpdateDecodeErrorZ {
11320 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11321 err: Box::into_raw(Box::new(e)),
11326 /// Checks if the given object is currently in the success state
11328 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
11332 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
11333 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
11334 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
11335 fn drop(&mut self) {
11336 if self.result_ok {
11337 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11338 let _ = unsafe { Box::from_raw(self.contents.result) };
11341 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11342 let _ = unsafe { Box::from_raw(self.contents.err) };
11347 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
11348 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11349 let contents = if o.result_ok {
11350 let result = unsafe { o.contents.result };
11351 unsafe { o.contents.result = core::ptr::null_mut() };
11352 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
11354 let err = unsafe { o.contents.err };
11355 unsafe { o.contents.err = core::ptr::null_mut(); }
11356 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
11360 result_ok: o.result_ok,
11364 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
11365 fn clone(&self) -> Self {
11366 if self.result_ok {
11367 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11368 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
11371 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11372 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11378 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
11379 /// but with all dynamically-allocated buffers duplicated in new buffers.
11380 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
11383 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
11384 pub enum COption_MonitorEventZ {
11385 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
11386 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
11387 /// When we're in this state, this COption_MonitorEventZ contains nothing
11390 impl COption_MonitorEventZ {
11391 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11392 if let Self::None = self { false } else { true }
11394 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11397 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
11398 if let Self::Some(v) = self { v } else { unreachable!() }
11402 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
11403 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
11404 COption_MonitorEventZ::Some(o)
11407 /// Constructs a new COption_MonitorEventZ containing nothing
11408 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
11409 COption_MonitorEventZ::None
11412 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
11413 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
11415 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
11416 /// but with all dynamically-allocated buffers duplicated in new buffers.
11417 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
11419 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
11420 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
11421 /// A pointer to the contents in the success state.
11422 /// Reading from this pointer when `result_ok` is not set is undefined.
11423 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
11424 /// A pointer to the contents in the error state.
11425 /// Reading from this pointer when `result_ok` is set is undefined.
11426 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11429 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
11430 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11432 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
11433 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
11434 /// `err` or `result` depending on the state of `result_ok`.
11435 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
11436 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
11437 pub result_ok: bool,
11440 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
11441 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
11442 CResult_COption_MonitorEventZDecodeErrorZ {
11443 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11444 result: Box::into_raw(Box::new(o)),
11450 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
11451 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
11452 CResult_COption_MonitorEventZDecodeErrorZ {
11453 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11454 err: Box::into_raw(Box::new(e)),
11459 /// Checks if the given object is currently in the success state
11461 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
11465 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
11466 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
11467 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
11468 fn drop(&mut self) {
11469 if self.result_ok {
11470 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11471 let _ = unsafe { Box::from_raw(self.contents.result) };
11474 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11475 let _ = unsafe { Box::from_raw(self.contents.err) };
11480 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
11481 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11482 let contents = if o.result_ok {
11483 let result = unsafe { o.contents.result };
11484 unsafe { o.contents.result = core::ptr::null_mut() };
11485 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
11487 let err = unsafe { o.contents.err };
11488 unsafe { o.contents.err = core::ptr::null_mut(); }
11489 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
11493 result_ok: o.result_ok,
11497 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
11498 fn clone(&self) -> Self {
11499 if self.result_ok {
11500 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11501 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
11504 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11505 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11511 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
11512 /// but with all dynamically-allocated buffers duplicated in new buffers.
11513 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
11515 /// The contents of CResult_HTLCUpdateDecodeErrorZ
11516 pub union CResult_HTLCUpdateDecodeErrorZPtr {
11517 /// A pointer to the contents in the success state.
11518 /// Reading from this pointer when `result_ok` is not set is undefined.
11519 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
11520 /// A pointer to the contents in the error state.
11521 /// Reading from this pointer when `result_ok` is set is undefined.
11522 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11525 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
11526 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11527 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11528 pub struct CResult_HTLCUpdateDecodeErrorZ {
11529 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
11530 /// `err` or `result` depending on the state of `result_ok`.
11531 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
11532 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
11533 pub result_ok: bool,
11536 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11537 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11538 CResult_HTLCUpdateDecodeErrorZ {
11539 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11540 result: Box::into_raw(Box::new(o)),
11546 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11547 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11548 CResult_HTLCUpdateDecodeErrorZ {
11549 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11550 err: Box::into_raw(Box::new(e)),
11555 /// Checks if the given object is currently in the success state
11557 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11561 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11562 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11563 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11564 fn drop(&mut self) {
11565 if self.result_ok {
11566 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11567 let _ = unsafe { Box::from_raw(self.contents.result) };
11570 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11571 let _ = unsafe { Box::from_raw(self.contents.err) };
11576 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11577 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11578 let contents = if o.result_ok {
11579 let result = unsafe { o.contents.result };
11580 unsafe { o.contents.result = core::ptr::null_mut() };
11581 CResult_HTLCUpdateDecodeErrorZPtr { result }
11583 let err = unsafe { o.contents.err };
11584 unsafe { o.contents.err = core::ptr::null_mut(); }
11585 CResult_HTLCUpdateDecodeErrorZPtr { err }
11589 result_ok: o.result_ok,
11593 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11594 fn clone(&self) -> Self {
11595 if self.result_ok {
11596 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11597 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11600 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11601 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11607 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11608 /// but with all dynamically-allocated buffers duplicated in new buffers.
11609 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11611 /// A tuple of 2 elements. See the individual fields for the types contained.
11612 pub struct C2Tuple_OutPointScriptZ {
11613 /// The element at position 0
11614 pub a: crate::lightning::chain::transaction::OutPoint,
11615 /// The element at position 1
11616 pub b: crate::c_types::derived::CVec_u8Z,
11618 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11619 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11626 impl C2Tuple_OutPointScriptZ {
11627 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11631 impl Clone for C2Tuple_OutPointScriptZ {
11632 fn clone(&self) -> Self {
11634 a: Clone::clone(&self.a),
11635 b: Clone::clone(&self.b),
11640 /// Creates a new tuple which has the same data as `orig`
11641 /// but with all dynamically-allocated buffers duplicated in new buffers.
11642 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11643 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11645 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11646 C2Tuple_OutPointScriptZ { a, b, }
11650 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11651 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11653 /// A tuple of 2 elements. See the individual fields for the types contained.
11654 pub struct C2Tuple_u32ScriptZ {
11655 /// The element at position 0
11657 /// The element at position 1
11658 pub b: crate::c_types::derived::CVec_u8Z,
11660 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11661 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11668 impl C2Tuple_u32ScriptZ {
11669 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11673 impl Clone for C2Tuple_u32ScriptZ {
11674 fn clone(&self) -> Self {
11676 a: Clone::clone(&self.a),
11677 b: Clone::clone(&self.b),
11682 /// Creates a new tuple which has the same data as `orig`
11683 /// but with all dynamically-allocated buffers duplicated in new buffers.
11684 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11685 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11687 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11688 C2Tuple_u32ScriptZ { a, b, }
11692 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11693 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11695 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11696 /// This corresponds to std::vector in C++
11697 pub struct CVec_C2Tuple_u32ScriptZZ {
11698 /// The elements in the array.
11699 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11700 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11701 /// The number of elements pointed to by `data`.
11704 impl CVec_C2Tuple_u32ScriptZZ {
11705 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11706 if self.datalen == 0 { return Vec::new(); }
11707 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11708 self.data = core::ptr::null_mut();
11712 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11713 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11716 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11717 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11718 let datalen = v.len();
11719 let data = Box::into_raw(v.into_boxed_slice());
11720 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11724 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11725 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11726 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11727 fn drop(&mut self) {
11728 if self.datalen == 0 { return; }
11729 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11732 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11733 fn clone(&self) -> Self {
11734 let mut res = Vec::new();
11735 if self.datalen == 0 { return Self::from(res); }
11736 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11741 /// A tuple of 2 elements. See the individual fields for the types contained.
11742 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11743 /// The element at position 0
11744 pub a: crate::c_types::ThirtyTwoBytes,
11745 /// The element at position 1
11746 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11748 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11749 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11756 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11757 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11761 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11762 fn clone(&self) -> Self {
11764 a: Clone::clone(&self.a),
11765 b: Clone::clone(&self.b),
11770 /// Creates a new tuple which has the same data as `orig`
11771 /// but with all dynamically-allocated buffers duplicated in new buffers.
11772 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11773 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11775 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 {
11776 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11780 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11781 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11783 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11784 /// This corresponds to std::vector in C++
11785 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11786 /// The elements in the array.
11787 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11788 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11789 /// The number of elements pointed to by `data`.
11792 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11793 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11794 if self.datalen == 0 { return Vec::new(); }
11795 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11796 self.data = core::ptr::null_mut();
11800 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11801 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11804 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11805 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11806 let datalen = v.len();
11807 let data = Box::into_raw(v.into_boxed_slice());
11808 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11812 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11813 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11814 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11815 fn drop(&mut self) {
11816 if self.datalen == 0 { return; }
11817 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11820 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11821 fn clone(&self) -> Self {
11822 let mut res = Vec::new();
11823 if self.datalen == 0 { return Self::from(res); }
11824 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11829 /// A dynamically-allocated array of crate::lightning::events::Events of arbitrary size.
11830 /// This corresponds to std::vector in C++
11831 pub struct CVec_EventZ {
11832 /// The elements in the array.
11833 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11834 pub data: *mut crate::lightning::events::Event,
11835 /// The number of elements pointed to by `data`.
11839 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::Event> {
11840 if self.datalen == 0 { return Vec::new(); }
11841 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11842 self.data = core::ptr::null_mut();
11846 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::Event] {
11847 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11850 impl From<Vec<crate::lightning::events::Event>> for CVec_EventZ {
11851 fn from(v: Vec<crate::lightning::events::Event>) -> Self {
11852 let datalen = v.len();
11853 let data = Box::into_raw(v.into_boxed_slice());
11854 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11858 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11859 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11860 impl Drop for CVec_EventZ {
11861 fn drop(&mut self) {
11862 if self.datalen == 0 { return; }
11863 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11866 impl Clone for CVec_EventZ {
11867 fn clone(&self) -> Self {
11868 let mut res = Vec::new();
11869 if self.datalen == 0 { return Self::from(res); }
11870 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11875 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11876 /// This corresponds to std::vector in C++
11877 pub struct CVec_TransactionZ {
11878 /// The elements in the array.
11879 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11880 pub data: *mut crate::c_types::Transaction,
11881 /// The number of elements pointed to by `data`.
11884 impl CVec_TransactionZ {
11885 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11886 if self.datalen == 0 { return Vec::new(); }
11887 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11888 self.data = core::ptr::null_mut();
11892 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11893 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11896 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11897 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11898 let datalen = v.len();
11899 let data = Box::into_raw(v.into_boxed_slice());
11900 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11904 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11905 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11906 impl Drop for CVec_TransactionZ {
11907 fn drop(&mut self) {
11908 if self.datalen == 0 { return; }
11909 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11912 impl Clone for CVec_TransactionZ {
11913 fn clone(&self) -> Self {
11914 let mut res = Vec::new();
11915 if self.datalen == 0 { return Self::from(res); }
11916 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11921 /// A tuple of 2 elements. See the individual fields for the types contained.
11922 pub struct C2Tuple_u32TxOutZ {
11923 /// The element at position 0
11925 /// The element at position 1
11926 pub b: crate::c_types::TxOut,
11928 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11929 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11936 impl C2Tuple_u32TxOutZ {
11937 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11941 impl Clone for C2Tuple_u32TxOutZ {
11942 fn clone(&self) -> Self {
11944 a: Clone::clone(&self.a),
11945 b: Clone::clone(&self.b),
11950 /// Creates a new tuple which has the same data as `orig`
11951 /// but with all dynamically-allocated buffers duplicated in new buffers.
11952 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11953 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11955 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11956 C2Tuple_u32TxOutZ { a, b, }
11960 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11961 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11963 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11964 /// This corresponds to std::vector in C++
11965 pub struct CVec_C2Tuple_u32TxOutZZ {
11966 /// The elements in the array.
11967 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11968 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11969 /// The number of elements pointed to by `data`.
11972 impl CVec_C2Tuple_u32TxOutZZ {
11973 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11974 if self.datalen == 0 { return Vec::new(); }
11975 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11976 self.data = core::ptr::null_mut();
11980 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11981 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11984 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11985 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11986 let datalen = v.len();
11987 let data = Box::into_raw(v.into_boxed_slice());
11988 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11992 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11993 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11994 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11995 fn drop(&mut self) {
11996 if self.datalen == 0 { return; }
11997 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12000 impl Clone for CVec_C2Tuple_u32TxOutZZ {
12001 fn clone(&self) -> Self {
12002 let mut res = Vec::new();
12003 if self.datalen == 0 { return Self::from(res); }
12004 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12009 /// A tuple of 2 elements. See the individual fields for the types contained.
12010 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12011 /// The element at position 0
12012 pub a: crate::c_types::ThirtyTwoBytes,
12013 /// The element at position 1
12014 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
12016 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12017 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
12024 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12025 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
12029 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12030 fn clone(&self) -> Self {
12032 a: Clone::clone(&self.a),
12033 b: Clone::clone(&self.b),
12038 /// Creates a new tuple which has the same data as `orig`
12039 /// but with all dynamically-allocated buffers duplicated in new buffers.
12040 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
12041 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12043 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 {
12044 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
12048 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
12049 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
12051 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12052 /// This corresponds to std::vector in C++
12053 pub struct CVec_TransactionOutputsZ {
12054 /// The elements in the array.
12055 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12056 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
12057 /// The number of elements pointed to by `data`.
12060 impl CVec_TransactionOutputsZ {
12061 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
12062 if self.datalen == 0 { return Vec::new(); }
12063 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12064 self.data = core::ptr::null_mut();
12068 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
12069 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12072 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
12073 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
12074 let datalen = v.len();
12075 let data = Box::into_raw(v.into_boxed_slice());
12076 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12080 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12081 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
12082 impl Drop for CVec_TransactionOutputsZ {
12083 fn drop(&mut self) {
12084 if self.datalen == 0 { return; }
12085 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12088 impl Clone for CVec_TransactionOutputsZ {
12089 fn clone(&self) -> Self {
12090 let mut res = Vec::new();
12091 if self.datalen == 0 { return Self::from(res); }
12092 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12097 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
12098 /// This corresponds to std::vector in C++
12099 pub struct CVec_BalanceZ {
12100 /// The elements in the array.
12101 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12102 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
12103 /// The number of elements pointed to by `data`.
12106 impl CVec_BalanceZ {
12107 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12108 if self.datalen == 0 { return Vec::new(); }
12109 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12110 self.data = core::ptr::null_mut();
12114 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
12115 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12118 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
12119 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
12120 let datalen = v.len();
12121 let data = Box::into_raw(v.into_boxed_slice());
12122 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12126 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12127 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
12128 impl Drop for CVec_BalanceZ {
12129 fn drop(&mut self) {
12130 if self.datalen == 0 { return; }
12131 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12134 impl Clone for CVec_BalanceZ {
12135 fn clone(&self) -> Self {
12136 let mut res = Vec::new();
12137 if self.datalen == 0 { return Self::from(res); }
12138 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12143 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
12144 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12145 /// A pointer to the contents in the success state.
12146 /// Reading from this pointer when `result_ok` is not set is undefined.
12147 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
12148 /// A pointer to the contents in the error state.
12149 /// Reading from this pointer when `result_ok` is set is undefined.
12150 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12153 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
12154 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12156 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12157 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
12158 /// `err` or `result` depending on the state of `result_ok`.
12159 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
12160 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
12161 pub result_ok: bool,
12164 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
12165 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12166 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12167 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12168 result: Box::into_raw(Box::new(o)),
12174 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
12175 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12176 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12177 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12178 err: Box::into_raw(Box::new(e)),
12183 /// Checks if the given object is currently in the success state
12185 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
12189 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
12190 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
12191 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12192 fn drop(&mut self) {
12193 if self.result_ok {
12194 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12195 let _ = unsafe { Box::from_raw(self.contents.result) };
12198 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12199 let _ = unsafe { Box::from_raw(self.contents.err) };
12204 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12205 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12206 let contents = if o.result_ok {
12207 let result = unsafe { o.contents.result };
12208 unsafe { o.contents.result = core::ptr::null_mut() };
12209 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
12211 let err = unsafe { o.contents.err };
12212 unsafe { o.contents.err = core::ptr::null_mut(); }
12213 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
12217 result_ok: o.result_ok,
12222 /// A tuple of 2 elements. See the individual fields for the types contained.
12223 pub struct C2Tuple_PublicKeyTypeZ {
12224 /// The element at position 0
12225 pub a: crate::c_types::PublicKey,
12226 /// The element at position 1
12227 pub b: crate::lightning::ln::wire::Type,
12229 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
12230 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
12237 impl C2Tuple_PublicKeyTypeZ {
12238 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
12242 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12244 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
12245 C2Tuple_PublicKeyTypeZ { a, b, }
12249 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12250 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
12252 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
12253 /// This corresponds to std::vector in C++
12254 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
12255 /// The elements in the array.
12256 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12257 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
12258 /// The number of elements pointed to by `data`.
12261 impl CVec_C2Tuple_PublicKeyTypeZZ {
12262 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
12263 if self.datalen == 0 { return Vec::new(); }
12264 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12265 self.data = core::ptr::null_mut();
12269 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
12270 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12273 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
12274 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
12275 let datalen = v.len();
12276 let data = Box::into_raw(v.into_boxed_slice());
12277 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12281 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12282 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
12283 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
12284 fn drop(&mut self) {
12285 if self.datalen == 0 { return; }
12286 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12290 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
12291 pub enum COption_CustomOnionMessageContentsZ {
12292 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
12293 Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
12294 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
12297 impl COption_CustomOnionMessageContentsZ {
12298 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12299 if let Self::None = self { false } else { true }
12301 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12304 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
12305 if let Self::Some(v) = self { v } else { unreachable!() }
12309 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
12310 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
12311 COption_CustomOnionMessageContentsZ::Some(o)
12314 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
12315 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
12316 COption_CustomOnionMessageContentsZ::None
12319 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
12320 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
12322 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
12323 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12324 /// A pointer to the contents in the success state.
12325 /// Reading from this pointer when `result_ok` is not set is undefined.
12326 pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
12327 /// A pointer to the contents in the error state.
12328 /// Reading from this pointer when `result_ok` is set is undefined.
12329 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12332 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
12333 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12335 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12336 /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
12337 /// `err` or `result` depending on the state of `result_ok`.
12338 pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
12339 /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
12340 pub result_ok: bool,
12343 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
12344 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12345 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12346 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12347 result: Box::into_raw(Box::new(o)),
12353 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
12354 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12355 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12356 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12357 err: Box::into_raw(Box::new(e)),
12362 /// Checks if the given object is currently in the success state
12364 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
12368 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
12369 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
12370 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12371 fn drop(&mut self) {
12372 if self.result_ok {
12373 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12374 let _ = unsafe { Box::from_raw(self.contents.result) };
12377 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12378 let _ = unsafe { Box::from_raw(self.contents.err) };
12383 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12384 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12385 let contents = if o.result_ok {
12386 let result = unsafe { o.contents.result };
12387 unsafe { o.contents.result = core::ptr::null_mut() };
12388 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
12390 let err = unsafe { o.contents.err };
12391 unsafe { o.contents.err = core::ptr::null_mut(); }
12392 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
12396 result_ok: o.result_ok,
12402 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
12403 pub enum COption_NetAddressZ {
12404 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
12405 Some(crate::lightning::ln::msgs::NetAddress),
12406 /// When we're in this state, this COption_NetAddressZ contains nothing
12409 impl COption_NetAddressZ {
12410 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12411 if let Self::None = self { false } else { true }
12413 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12416 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
12417 if let Self::Some(v) = self { v } else { unreachable!() }
12421 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
12422 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
12423 COption_NetAddressZ::Some(o)
12426 /// Constructs a new COption_NetAddressZ containing nothing
12427 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
12428 COption_NetAddressZ::None
12431 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
12432 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
12434 /// Creates a new COption_NetAddressZ which has the same data as `orig`
12435 /// but with all dynamically-allocated buffers duplicated in new buffers.
12436 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
12438 /// A tuple of 2 elements. See the individual fields for the types contained.
12439 pub struct C2Tuple_PublicKeyCOption_NetAddressZZ {
12440 /// The element at position 0
12441 pub a: crate::c_types::PublicKey,
12442 /// The element at position 1
12443 pub b: crate::c_types::derived::COption_NetAddressZ,
12445 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)> for C2Tuple_PublicKeyCOption_NetAddressZZ {
12446 fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)) -> Self {
12453 impl C2Tuple_PublicKeyCOption_NetAddressZZ {
12454 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ) {
12458 impl Clone for C2Tuple_PublicKeyCOption_NetAddressZZ {
12459 fn clone(&self) -> Self {
12461 a: Clone::clone(&self.a),
12462 b: Clone::clone(&self.b),
12467 /// Creates a new tuple which has the same data as `orig`
12468 /// but with all dynamically-allocated buffers duplicated in new buffers.
12469 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_NetAddressZZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ { Clone::clone(&orig) }
12470 /// Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
12472 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_NetAddressZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ {
12473 C2Tuple_PublicKeyCOption_NetAddressZZ { a, b, }
12477 /// Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
12478 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res: C2Tuple_PublicKeyCOption_NetAddressZZ) { }
12480 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
12481 /// This corresponds to std::vector in C++
12482 pub struct CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12483 /// The elements in the array.
12484 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12485 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ,
12486 /// The number of elements pointed to by `data`.
12489 impl CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12490 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ> {
12491 if self.datalen == 0 { return Vec::new(); }
12492 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12493 self.data = core::ptr::null_mut();
12497 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ] {
12498 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12501 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12502 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>) -> Self {
12503 let datalen = v.len();
12504 let data = Box::into_raw(v.into_boxed_slice());
12505 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12509 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12510 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ) { }
12511 impl Drop for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12512 fn drop(&mut self) {
12513 if self.datalen == 0 { return; }
12514 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12517 impl Clone for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12518 fn clone(&self) -> Self {
12519 let mut res = Vec::new();
12520 if self.datalen == 0 { return Self::from(res); }
12521 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12526 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12527 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12528 /// A pointer to the contents in the success state.
12529 /// Reading from this pointer when `result_ok` is not set is undefined.
12530 pub result: *mut crate::c_types::derived::CVec_u8Z,
12531 /// A pointer to the contents in the error state.
12532 /// Reading from this pointer when `result_ok` is set is undefined.
12533 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12536 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12537 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12538 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12539 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12540 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12541 /// `err` or `result` depending on the state of `result_ok`.
12542 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12543 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12544 pub result_ok: bool,
12547 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12548 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12549 CResult_CVec_u8ZPeerHandleErrorZ {
12550 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12551 result: Box::into_raw(Box::new(o)),
12557 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12558 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12559 CResult_CVec_u8ZPeerHandleErrorZ {
12560 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12561 err: Box::into_raw(Box::new(e)),
12566 /// Checks if the given object is currently in the success state
12568 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12572 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12573 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12574 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12575 fn drop(&mut self) {
12576 if self.result_ok {
12577 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12578 let _ = unsafe { Box::from_raw(self.contents.result) };
12581 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12582 let _ = unsafe { Box::from_raw(self.contents.err) };
12587 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12588 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12589 let contents = if o.result_ok {
12590 let result = unsafe { o.contents.result };
12591 unsafe { o.contents.result = core::ptr::null_mut() };
12592 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12594 let err = unsafe { o.contents.err };
12595 unsafe { o.contents.err = core::ptr::null_mut(); }
12596 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12600 result_ok: o.result_ok,
12604 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12605 fn clone(&self) -> Self {
12606 if self.result_ok {
12607 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12608 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12611 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12612 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12618 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12619 /// but with all dynamically-allocated buffers duplicated in new buffers.
12620 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12622 /// The contents of CResult_NonePeerHandleErrorZ
12623 pub union CResult_NonePeerHandleErrorZPtr {
12624 /// Note that this value is always NULL, as there are no contents in the OK variant
12625 pub result: *mut core::ffi::c_void,
12626 /// A pointer to the contents in the error state.
12627 /// Reading from this pointer when `result_ok` is set is undefined.
12628 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12631 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12632 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12633 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12634 pub struct CResult_NonePeerHandleErrorZ {
12635 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12636 /// `err` or `result` depending on the state of `result_ok`.
12637 pub contents: CResult_NonePeerHandleErrorZPtr,
12638 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12639 pub result_ok: bool,
12642 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12643 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12644 CResult_NonePeerHandleErrorZ {
12645 contents: CResult_NonePeerHandleErrorZPtr {
12646 result: core::ptr::null_mut(),
12652 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12653 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12654 CResult_NonePeerHandleErrorZ {
12655 contents: CResult_NonePeerHandleErrorZPtr {
12656 err: Box::into_raw(Box::new(e)),
12661 /// Checks if the given object is currently in the success state
12663 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12667 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12668 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12669 impl Drop for CResult_NonePeerHandleErrorZ {
12670 fn drop(&mut self) {
12671 if self.result_ok {
12673 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12674 let _ = unsafe { Box::from_raw(self.contents.err) };
12679 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12680 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12681 let contents = if o.result_ok {
12682 let _ = unsafe { Box::from_raw(o.contents.result) };
12683 o.contents.result = core::ptr::null_mut();
12684 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12686 let err = unsafe { o.contents.err };
12687 unsafe { o.contents.err = core::ptr::null_mut(); }
12688 CResult_NonePeerHandleErrorZPtr { err }
12692 result_ok: o.result_ok,
12696 impl Clone for CResult_NonePeerHandleErrorZ {
12697 fn clone(&self) -> Self {
12698 if self.result_ok {
12699 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12700 result: core::ptr::null_mut()
12703 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12704 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12710 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12711 /// but with all dynamically-allocated buffers duplicated in new buffers.
12712 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12714 /// The contents of CResult_boolPeerHandleErrorZ
12715 pub union CResult_boolPeerHandleErrorZPtr {
12716 /// A pointer to the contents in the success state.
12717 /// Reading from this pointer when `result_ok` is not set is undefined.
12718 pub result: *mut bool,
12719 /// A pointer to the contents in the error state.
12720 /// Reading from this pointer when `result_ok` is set is undefined.
12721 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12724 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12725 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12727 pub struct CResult_boolPeerHandleErrorZ {
12728 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12729 /// `err` or `result` depending on the state of `result_ok`.
12730 pub contents: CResult_boolPeerHandleErrorZPtr,
12731 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12732 pub result_ok: bool,
12735 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12736 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12737 CResult_boolPeerHandleErrorZ {
12738 contents: CResult_boolPeerHandleErrorZPtr {
12739 result: Box::into_raw(Box::new(o)),
12745 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12746 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12747 CResult_boolPeerHandleErrorZ {
12748 contents: CResult_boolPeerHandleErrorZPtr {
12749 err: Box::into_raw(Box::new(e)),
12754 /// Checks if the given object is currently in the success state
12756 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12760 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12761 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12762 impl Drop for CResult_boolPeerHandleErrorZ {
12763 fn drop(&mut self) {
12764 if self.result_ok {
12765 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12766 let _ = unsafe { Box::from_raw(self.contents.result) };
12769 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12770 let _ = unsafe { Box::from_raw(self.contents.err) };
12775 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12776 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12777 let contents = if o.result_ok {
12778 let result = unsafe { o.contents.result };
12779 unsafe { o.contents.result = core::ptr::null_mut() };
12780 CResult_boolPeerHandleErrorZPtr { result }
12782 let err = unsafe { o.contents.err };
12783 unsafe { o.contents.err = core::ptr::null_mut(); }
12784 CResult_boolPeerHandleErrorZPtr { err }
12788 result_ok: o.result_ok,
12792 impl Clone for CResult_boolPeerHandleErrorZ {
12793 fn clone(&self) -> Self {
12794 if self.result_ok {
12795 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12796 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12799 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12800 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12806 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12807 /// but with all dynamically-allocated buffers duplicated in new buffers.
12808 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12810 /// The contents of CResult_TxOutUtxoLookupErrorZ
12811 pub union CResult_TxOutUtxoLookupErrorZPtr {
12812 /// A pointer to the contents in the success state.
12813 /// Reading from this pointer when `result_ok` is not set is undefined.
12814 pub result: *mut crate::c_types::TxOut,
12815 /// A pointer to the contents in the error state.
12816 /// Reading from this pointer when `result_ok` is set is undefined.
12817 pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
12820 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
12821 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
12822 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12823 pub struct CResult_TxOutUtxoLookupErrorZ {
12824 /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
12825 /// `err` or `result` depending on the state of `result_ok`.
12826 pub contents: CResult_TxOutUtxoLookupErrorZPtr,
12827 /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
12828 pub result_ok: bool,
12831 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
12832 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
12833 CResult_TxOutUtxoLookupErrorZ {
12834 contents: CResult_TxOutUtxoLookupErrorZPtr {
12835 result: Box::into_raw(Box::new(o)),
12841 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
12842 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
12843 CResult_TxOutUtxoLookupErrorZ {
12844 contents: CResult_TxOutUtxoLookupErrorZPtr {
12845 err: Box::into_raw(Box::new(e)),
12850 /// Checks if the given object is currently in the success state
12852 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
12856 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
12857 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
12858 impl Drop for CResult_TxOutUtxoLookupErrorZ {
12859 fn drop(&mut self) {
12860 if self.result_ok {
12861 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12862 let _ = unsafe { Box::from_raw(self.contents.result) };
12865 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12866 let _ = unsafe { Box::from_raw(self.contents.err) };
12871 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
12872 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
12873 let contents = if o.result_ok {
12874 let result = unsafe { o.contents.result };
12875 unsafe { o.contents.result = core::ptr::null_mut() };
12876 CResult_TxOutUtxoLookupErrorZPtr { result }
12878 let err = unsafe { o.contents.err };
12879 unsafe { o.contents.err = core::ptr::null_mut(); }
12880 CResult_TxOutUtxoLookupErrorZPtr { err }
12884 result_ok: o.result_ok,
12888 impl Clone for CResult_TxOutUtxoLookupErrorZ {
12889 fn clone(&self) -> Self {
12890 if self.result_ok {
12891 Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
12892 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
12895 Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
12896 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
12902 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
12903 /// but with all dynamically-allocated buffers duplicated in new buffers.
12904 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
12906 /// The contents of CResult_NoneSendErrorZ
12907 pub union CResult_NoneSendErrorZPtr {
12908 /// Note that this value is always NULL, as there are no contents in the OK variant
12909 pub result: *mut core::ffi::c_void,
12910 /// A pointer to the contents in the error state.
12911 /// Reading from this pointer when `result_ok` is set is undefined.
12912 pub err: *mut crate::lightning::onion_message::messenger::SendError,
12915 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
12916 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12918 pub struct CResult_NoneSendErrorZ {
12919 /// The contents of this CResult_NoneSendErrorZ, accessible via either
12920 /// `err` or `result` depending on the state of `result_ok`.
12921 pub contents: CResult_NoneSendErrorZPtr,
12922 /// Whether this CResult_NoneSendErrorZ represents a success state.
12923 pub result_ok: bool,
12926 /// Creates a new CResult_NoneSendErrorZ in the success state.
12927 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12928 CResult_NoneSendErrorZ {
12929 contents: CResult_NoneSendErrorZPtr {
12930 result: core::ptr::null_mut(),
12936 /// Creates a new CResult_NoneSendErrorZ in the error state.
12937 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12938 CResult_NoneSendErrorZ {
12939 contents: CResult_NoneSendErrorZPtr {
12940 err: Box::into_raw(Box::new(e)),
12945 /// Checks if the given object is currently in the success state
12947 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12951 /// Frees any resources used by the CResult_NoneSendErrorZ.
12952 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12953 impl Drop for CResult_NoneSendErrorZ {
12954 fn drop(&mut self) {
12955 if self.result_ok {
12957 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12958 let _ = unsafe { Box::from_raw(self.contents.err) };
12963 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12964 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12965 let contents = if o.result_ok {
12966 let _ = unsafe { Box::from_raw(o.contents.result) };
12967 o.contents.result = core::ptr::null_mut();
12968 CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12970 let err = unsafe { o.contents.err };
12971 unsafe { o.contents.err = core::ptr::null_mut(); }
12972 CResult_NoneSendErrorZPtr { err }
12976 result_ok: o.result_ok,
12981 /// The contents of CResult_BlindedPathNoneZ
12982 pub union CResult_BlindedPathNoneZPtr {
12983 /// A pointer to the contents in the success state.
12984 /// Reading from this pointer when `result_ok` is not set is undefined.
12985 pub result: *mut crate::lightning::blinded_path::BlindedPath,
12986 /// Note that this value is always NULL, as there are no contents in the Err variant
12987 pub err: *mut core::ffi::c_void,
12990 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
12991 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
12992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12993 pub struct CResult_BlindedPathNoneZ {
12994 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
12995 /// `err` or `result` depending on the state of `result_ok`.
12996 pub contents: CResult_BlindedPathNoneZPtr,
12997 /// Whether this CResult_BlindedPathNoneZ represents a success state.
12998 pub result_ok: bool,
13001 /// Creates a new CResult_BlindedPathNoneZ in the success state.
13002 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
13003 CResult_BlindedPathNoneZ {
13004 contents: CResult_BlindedPathNoneZPtr {
13005 result: Box::into_raw(Box::new(o)),
13011 /// Creates a new CResult_BlindedPathNoneZ in the error state.
13012 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
13013 CResult_BlindedPathNoneZ {
13014 contents: CResult_BlindedPathNoneZPtr {
13015 err: core::ptr::null_mut(),
13020 /// Checks if the given object is currently in the success state
13022 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
13026 /// Frees any resources used by the CResult_BlindedPathNoneZ.
13027 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
13028 impl Drop for CResult_BlindedPathNoneZ {
13029 fn drop(&mut self) {
13030 if self.result_ok {
13031 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13032 let _ = unsafe { Box::from_raw(self.contents.result) };
13038 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
13039 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
13040 let contents = if o.result_ok {
13041 let result = unsafe { o.contents.result };
13042 unsafe { o.contents.result = core::ptr::null_mut() };
13043 CResult_BlindedPathNoneZPtr { result }
13045 let _ = unsafe { Box::from_raw(o.contents.err) };
13046 o.contents.err = core::ptr::null_mut();
13047 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
13051 result_ok: o.result_ok,
13055 impl Clone for CResult_BlindedPathNoneZ {
13056 fn clone(&self) -> Self {
13057 if self.result_ok {
13058 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
13059 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
13062 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
13063 err: core::ptr::null_mut()
13069 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
13070 /// but with all dynamically-allocated buffers duplicated in new buffers.
13071 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
13073 /// The contents of CResult_BlindedPathDecodeErrorZ
13074 pub union CResult_BlindedPathDecodeErrorZPtr {
13075 /// A pointer to the contents in the success state.
13076 /// Reading from this pointer when `result_ok` is not set is undefined.
13077 pub result: *mut crate::lightning::blinded_path::BlindedPath,
13078 /// A pointer to the contents in the error state.
13079 /// Reading from this pointer when `result_ok` is set is undefined.
13080 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13083 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
13084 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
13085 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13086 pub struct CResult_BlindedPathDecodeErrorZ {
13087 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
13088 /// `err` or `result` depending on the state of `result_ok`.
13089 pub contents: CResult_BlindedPathDecodeErrorZPtr,
13090 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
13091 pub result_ok: bool,
13094 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
13095 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
13096 CResult_BlindedPathDecodeErrorZ {
13097 contents: CResult_BlindedPathDecodeErrorZPtr {
13098 result: Box::into_raw(Box::new(o)),
13104 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
13105 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
13106 CResult_BlindedPathDecodeErrorZ {
13107 contents: CResult_BlindedPathDecodeErrorZPtr {
13108 err: Box::into_raw(Box::new(e)),
13113 /// Checks if the given object is currently in the success state
13115 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
13119 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
13120 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
13121 impl Drop for CResult_BlindedPathDecodeErrorZ {
13122 fn drop(&mut self) {
13123 if self.result_ok {
13124 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13125 let _ = unsafe { Box::from_raw(self.contents.result) };
13128 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13129 let _ = unsafe { Box::from_raw(self.contents.err) };
13134 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
13135 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
13136 let contents = if o.result_ok {
13137 let result = unsafe { o.contents.result };
13138 unsafe { o.contents.result = core::ptr::null_mut() };
13139 CResult_BlindedPathDecodeErrorZPtr { result }
13141 let err = unsafe { o.contents.err };
13142 unsafe { o.contents.err = core::ptr::null_mut(); }
13143 CResult_BlindedPathDecodeErrorZPtr { err }
13147 result_ok: o.result_ok,
13151 impl Clone for CResult_BlindedPathDecodeErrorZ {
13152 fn clone(&self) -> Self {
13153 if self.result_ok {
13154 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
13155 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
13158 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
13159 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13165 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
13166 /// but with all dynamically-allocated buffers duplicated in new buffers.
13167 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
13169 /// The contents of CResult_BlindedHopDecodeErrorZ
13170 pub union CResult_BlindedHopDecodeErrorZPtr {
13171 /// A pointer to the contents in the success state.
13172 /// Reading from this pointer when `result_ok` is not set is undefined.
13173 pub result: *mut crate::lightning::blinded_path::BlindedHop,
13174 /// A pointer to the contents in the error state.
13175 /// Reading from this pointer when `result_ok` is set is undefined.
13176 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13179 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
13180 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
13181 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13182 pub struct CResult_BlindedHopDecodeErrorZ {
13183 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
13184 /// `err` or `result` depending on the state of `result_ok`.
13185 pub contents: CResult_BlindedHopDecodeErrorZPtr,
13186 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
13187 pub result_ok: bool,
13190 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
13191 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
13192 CResult_BlindedHopDecodeErrorZ {
13193 contents: CResult_BlindedHopDecodeErrorZPtr {
13194 result: Box::into_raw(Box::new(o)),
13200 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
13201 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
13202 CResult_BlindedHopDecodeErrorZ {
13203 contents: CResult_BlindedHopDecodeErrorZPtr {
13204 err: Box::into_raw(Box::new(e)),
13209 /// Checks if the given object is currently in the success state
13211 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
13215 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
13216 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
13217 impl Drop for CResult_BlindedHopDecodeErrorZ {
13218 fn drop(&mut self) {
13219 if self.result_ok {
13220 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13221 let _ = unsafe { Box::from_raw(self.contents.result) };
13224 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13225 let _ = unsafe { Box::from_raw(self.contents.err) };
13230 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
13231 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
13232 let contents = if o.result_ok {
13233 let result = unsafe { o.contents.result };
13234 unsafe { o.contents.result = core::ptr::null_mut() };
13235 CResult_BlindedHopDecodeErrorZPtr { result }
13237 let err = unsafe { o.contents.err };
13238 unsafe { o.contents.err = core::ptr::null_mut(); }
13239 CResult_BlindedHopDecodeErrorZPtr { err }
13243 result_ok: o.result_ok,
13247 impl Clone for CResult_BlindedHopDecodeErrorZ {
13248 fn clone(&self) -> Self {
13249 if self.result_ok {
13250 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
13251 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
13254 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
13255 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13261 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
13262 /// but with all dynamically-allocated buffers duplicated in new buffers.
13263 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
13265 /// The contents of CResult_SiPrefixParseErrorZ
13266 pub union CResult_SiPrefixParseErrorZPtr {
13267 /// A pointer to the contents in the success state.
13268 /// Reading from this pointer when `result_ok` is not set is undefined.
13269 pub result: *mut crate::lightning_invoice::SiPrefix,
13270 /// A pointer to the contents in the error state.
13271 /// Reading from this pointer when `result_ok` is set is undefined.
13272 pub err: *mut crate::lightning_invoice::ParseError,
13275 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
13276 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
13277 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13278 pub struct CResult_SiPrefixParseErrorZ {
13279 /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
13280 /// `err` or `result` depending on the state of `result_ok`.
13281 pub contents: CResult_SiPrefixParseErrorZPtr,
13282 /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
13283 pub result_ok: bool,
13286 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
13287 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
13288 CResult_SiPrefixParseErrorZ {
13289 contents: CResult_SiPrefixParseErrorZPtr {
13290 result: Box::into_raw(Box::new(o)),
13296 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
13297 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
13298 CResult_SiPrefixParseErrorZ {
13299 contents: CResult_SiPrefixParseErrorZPtr {
13300 err: Box::into_raw(Box::new(e)),
13305 /// Checks if the given object is currently in the success state
13307 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
13311 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
13312 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
13313 impl Drop for CResult_SiPrefixParseErrorZ {
13314 fn drop(&mut self) {
13315 if self.result_ok {
13316 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13317 let _ = unsafe { Box::from_raw(self.contents.result) };
13320 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13321 let _ = unsafe { Box::from_raw(self.contents.err) };
13326 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
13327 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
13328 let contents = if o.result_ok {
13329 let result = unsafe { o.contents.result };
13330 unsafe { o.contents.result = core::ptr::null_mut() };
13331 CResult_SiPrefixParseErrorZPtr { result }
13333 let err = unsafe { o.contents.err };
13334 unsafe { o.contents.err = core::ptr::null_mut(); }
13335 CResult_SiPrefixParseErrorZPtr { err }
13339 result_ok: o.result_ok,
13343 impl Clone for CResult_SiPrefixParseErrorZ {
13344 fn clone(&self) -> Self {
13345 if self.result_ok {
13346 Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
13347 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
13350 Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
13351 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
13357 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
13358 /// but with all dynamically-allocated buffers duplicated in new buffers.
13359 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
13361 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
13362 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
13363 /// A pointer to the contents in the success state.
13364 /// Reading from this pointer when `result_ok` is not set is undefined.
13365 pub result: *mut crate::lightning_invoice::Invoice,
13366 /// A pointer to the contents in the error state.
13367 /// Reading from this pointer when `result_ok` is set is undefined.
13368 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
13371 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
13372 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
13373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13374 pub struct CResult_InvoiceParseOrSemanticErrorZ {
13375 /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
13376 /// `err` or `result` depending on the state of `result_ok`.
13377 pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
13378 /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
13379 pub result_ok: bool,
13382 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
13383 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
13384 CResult_InvoiceParseOrSemanticErrorZ {
13385 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13386 result: Box::into_raw(Box::new(o)),
13392 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
13393 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
13394 CResult_InvoiceParseOrSemanticErrorZ {
13395 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13396 err: Box::into_raw(Box::new(e)),
13401 /// Checks if the given object is currently in the success state
13403 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
13407 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
13408 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
13409 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
13410 fn drop(&mut self) {
13411 if self.result_ok {
13412 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13413 let _ = unsafe { Box::from_raw(self.contents.result) };
13416 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13417 let _ = unsafe { Box::from_raw(self.contents.err) };
13422 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
13423 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
13424 let contents = if o.result_ok {
13425 let result = unsafe { o.contents.result };
13426 unsafe { o.contents.result = core::ptr::null_mut() };
13427 CResult_InvoiceParseOrSemanticErrorZPtr { result }
13429 let err = unsafe { o.contents.err };
13430 unsafe { o.contents.err = core::ptr::null_mut(); }
13431 CResult_InvoiceParseOrSemanticErrorZPtr { err }
13435 result_ok: o.result_ok,
13439 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
13440 fn clone(&self) -> Self {
13441 if self.result_ok {
13442 Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13443 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
13446 Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13447 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
13453 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
13454 /// but with all dynamically-allocated buffers duplicated in new buffers.
13455 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
13457 /// The contents of CResult_SignedRawInvoiceParseErrorZ
13458 pub union CResult_SignedRawInvoiceParseErrorZPtr {
13459 /// A pointer to the contents in the success state.
13460 /// Reading from this pointer when `result_ok` is not set is undefined.
13461 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
13462 /// A pointer to the contents in the error state.
13463 /// Reading from this pointer when `result_ok` is set is undefined.
13464 pub err: *mut crate::lightning_invoice::ParseError,
13467 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
13468 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
13469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13470 pub struct CResult_SignedRawInvoiceParseErrorZ {
13471 /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
13472 /// `err` or `result` depending on the state of `result_ok`.
13473 pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
13474 /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
13475 pub result_ok: bool,
13478 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
13479 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
13480 CResult_SignedRawInvoiceParseErrorZ {
13481 contents: CResult_SignedRawInvoiceParseErrorZPtr {
13482 result: Box::into_raw(Box::new(o)),
13488 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
13489 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
13490 CResult_SignedRawInvoiceParseErrorZ {
13491 contents: CResult_SignedRawInvoiceParseErrorZPtr {
13492 err: Box::into_raw(Box::new(e)),
13497 /// Checks if the given object is currently in the success state
13499 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
13503 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
13504 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
13505 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
13506 fn drop(&mut self) {
13507 if self.result_ok {
13508 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13509 let _ = unsafe { Box::from_raw(self.contents.result) };
13512 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13513 let _ = unsafe { Box::from_raw(self.contents.err) };
13518 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
13519 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
13520 let contents = if o.result_ok {
13521 let result = unsafe { o.contents.result };
13522 unsafe { o.contents.result = core::ptr::null_mut() };
13523 CResult_SignedRawInvoiceParseErrorZPtr { result }
13525 let err = unsafe { o.contents.err };
13526 unsafe { o.contents.err = core::ptr::null_mut(); }
13527 CResult_SignedRawInvoiceParseErrorZPtr { err }
13531 result_ok: o.result_ok,
13535 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
13536 fn clone(&self) -> Self {
13537 if self.result_ok {
13538 Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
13539 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
13542 Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
13543 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
13549 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
13550 /// but with all dynamically-allocated buffers duplicated in new buffers.
13551 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
13553 /// A tuple of 3 elements. See the individual fields for the types contained.
13554 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13555 /// The element at position 0
13556 pub a: crate::lightning_invoice::RawInvoice,
13557 /// The element at position 1
13558 pub b: crate::c_types::ThirtyTwoBytes,
13559 /// The element at position 2
13560 pub c: crate::lightning_invoice::InvoiceSignature,
13562 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13563 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
13571 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13572 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
13573 (self.a, self.b, self.c)
13576 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13577 fn clone(&self) -> Self {
13579 a: Clone::clone(&self.a),
13580 b: Clone::clone(&self.b),
13581 c: Clone::clone(&self.c),
13586 /// Creates a new tuple which has the same data as `orig`
13587 /// but with all dynamically-allocated buffers duplicated in new buffers.
13588 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
13589 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
13591 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 {
13592 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
13596 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
13597 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
13599 /// The contents of CResult_PayeePubKeyErrorZ
13600 pub union CResult_PayeePubKeyErrorZPtr {
13601 /// A pointer to the contents in the success state.
13602 /// Reading from this pointer when `result_ok` is not set is undefined.
13603 pub result: *mut crate::lightning_invoice::PayeePubKey,
13604 /// A pointer to the contents in the error state.
13605 /// Reading from this pointer when `result_ok` is set is undefined.
13606 pub err: *mut crate::c_types::Secp256k1Error,
13609 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
13610 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
13611 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13612 pub struct CResult_PayeePubKeyErrorZ {
13613 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
13614 /// `err` or `result` depending on the state of `result_ok`.
13615 pub contents: CResult_PayeePubKeyErrorZPtr,
13616 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
13617 pub result_ok: bool,
13620 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
13621 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
13622 CResult_PayeePubKeyErrorZ {
13623 contents: CResult_PayeePubKeyErrorZPtr {
13624 result: Box::into_raw(Box::new(o)),
13630 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
13631 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
13632 CResult_PayeePubKeyErrorZ {
13633 contents: CResult_PayeePubKeyErrorZPtr {
13634 err: Box::into_raw(Box::new(e)),
13639 /// Checks if the given object is currently in the success state
13641 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
13645 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
13646 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
13647 impl Drop for CResult_PayeePubKeyErrorZ {
13648 fn drop(&mut self) {
13649 if self.result_ok {
13650 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13651 let _ = unsafe { Box::from_raw(self.contents.result) };
13654 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13655 let _ = unsafe { Box::from_raw(self.contents.err) };
13660 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
13661 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
13662 let contents = if o.result_ok {
13663 let result = unsafe { o.contents.result };
13664 unsafe { o.contents.result = core::ptr::null_mut() };
13665 CResult_PayeePubKeyErrorZPtr { result }
13667 let err = unsafe { o.contents.err };
13668 unsafe { o.contents.err = core::ptr::null_mut(); }
13669 CResult_PayeePubKeyErrorZPtr { err }
13673 result_ok: o.result_ok,
13677 impl Clone for CResult_PayeePubKeyErrorZ {
13678 fn clone(&self) -> Self {
13679 if self.result_ok {
13680 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
13681 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
13684 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
13685 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
13691 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
13692 /// but with all dynamically-allocated buffers duplicated in new buffers.
13693 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
13695 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
13696 /// This corresponds to std::vector in C++
13697 pub struct CVec_PrivateRouteZ {
13698 /// The elements in the array.
13699 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13700 pub data: *mut crate::lightning_invoice::PrivateRoute,
13701 /// The number of elements pointed to by `data`.
13704 impl CVec_PrivateRouteZ {
13705 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
13706 if self.datalen == 0 { return Vec::new(); }
13707 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13708 self.data = core::ptr::null_mut();
13712 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
13713 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13716 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
13717 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
13718 let datalen = v.len();
13719 let data = Box::into_raw(v.into_boxed_slice());
13720 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13724 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13725 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
13726 impl Drop for CVec_PrivateRouteZ {
13727 fn drop(&mut self) {
13728 if self.datalen == 0 { return; }
13729 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13732 impl Clone for CVec_PrivateRouteZ {
13733 fn clone(&self) -> Self {
13734 let mut res = Vec::new();
13735 if self.datalen == 0 { return Self::from(res); }
13736 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13741 /// The contents of CResult_PositiveTimestampCreationErrorZ
13742 pub union CResult_PositiveTimestampCreationErrorZPtr {
13743 /// A pointer to the contents in the success state.
13744 /// Reading from this pointer when `result_ok` is not set is undefined.
13745 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
13746 /// A pointer to the contents in the error state.
13747 /// Reading from this pointer when `result_ok` is set is undefined.
13748 pub err: *mut crate::lightning_invoice::CreationError,
13751 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
13752 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
13753 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13754 pub struct CResult_PositiveTimestampCreationErrorZ {
13755 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
13756 /// `err` or `result` depending on the state of `result_ok`.
13757 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
13758 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
13759 pub result_ok: bool,
13762 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
13763 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
13764 CResult_PositiveTimestampCreationErrorZ {
13765 contents: CResult_PositiveTimestampCreationErrorZPtr {
13766 result: Box::into_raw(Box::new(o)),
13772 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
13773 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
13774 CResult_PositiveTimestampCreationErrorZ {
13775 contents: CResult_PositiveTimestampCreationErrorZPtr {
13776 err: Box::into_raw(Box::new(e)),
13781 /// Checks if the given object is currently in the success state
13783 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
13787 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
13788 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
13789 impl Drop for CResult_PositiveTimestampCreationErrorZ {
13790 fn drop(&mut self) {
13791 if self.result_ok {
13792 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13793 let _ = unsafe { Box::from_raw(self.contents.result) };
13796 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13797 let _ = unsafe { Box::from_raw(self.contents.err) };
13802 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
13803 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
13804 let contents = if o.result_ok {
13805 let result = unsafe { o.contents.result };
13806 unsafe { o.contents.result = core::ptr::null_mut() };
13807 CResult_PositiveTimestampCreationErrorZPtr { result }
13809 let err = unsafe { o.contents.err };
13810 unsafe { o.contents.err = core::ptr::null_mut(); }
13811 CResult_PositiveTimestampCreationErrorZPtr { err }
13815 result_ok: o.result_ok,
13819 impl Clone for CResult_PositiveTimestampCreationErrorZ {
13820 fn clone(&self) -> Self {
13821 if self.result_ok {
13822 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
13823 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
13826 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
13827 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13833 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
13834 /// but with all dynamically-allocated buffers duplicated in new buffers.
13835 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
13837 /// The contents of CResult_NoneSemanticErrorZ
13838 pub union CResult_NoneSemanticErrorZPtr {
13839 /// Note that this value is always NULL, as there are no contents in the OK variant
13840 pub result: *mut core::ffi::c_void,
13841 /// A pointer to the contents in the error state.
13842 /// Reading from this pointer when `result_ok` is set is undefined.
13843 pub err: *mut crate::lightning_invoice::SemanticError,
13846 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
13847 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
13848 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13849 pub struct CResult_NoneSemanticErrorZ {
13850 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
13851 /// `err` or `result` depending on the state of `result_ok`.
13852 pub contents: CResult_NoneSemanticErrorZPtr,
13853 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
13854 pub result_ok: bool,
13857 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
13858 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
13859 CResult_NoneSemanticErrorZ {
13860 contents: CResult_NoneSemanticErrorZPtr {
13861 result: core::ptr::null_mut(),
13867 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
13868 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
13869 CResult_NoneSemanticErrorZ {
13870 contents: CResult_NoneSemanticErrorZPtr {
13871 err: Box::into_raw(Box::new(e)),
13876 /// Checks if the given object is currently in the success state
13878 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
13882 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
13883 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
13884 impl Drop for CResult_NoneSemanticErrorZ {
13885 fn drop(&mut self) {
13886 if self.result_ok {
13888 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13889 let _ = unsafe { Box::from_raw(self.contents.err) };
13894 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
13895 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
13896 let contents = if o.result_ok {
13897 let _ = unsafe { Box::from_raw(o.contents.result) };
13898 o.contents.result = core::ptr::null_mut();
13899 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
13901 let err = unsafe { o.contents.err };
13902 unsafe { o.contents.err = core::ptr::null_mut(); }
13903 CResult_NoneSemanticErrorZPtr { err }
13907 result_ok: o.result_ok,
13911 impl Clone for CResult_NoneSemanticErrorZ {
13912 fn clone(&self) -> Self {
13913 if self.result_ok {
13914 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
13915 result: core::ptr::null_mut()
13918 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
13919 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
13925 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
13926 /// but with all dynamically-allocated buffers duplicated in new buffers.
13927 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
13929 /// The contents of CResult_InvoiceSemanticErrorZ
13930 pub union CResult_InvoiceSemanticErrorZPtr {
13931 /// A pointer to the contents in the success state.
13932 /// Reading from this pointer when `result_ok` is not set is undefined.
13933 pub result: *mut crate::lightning_invoice::Invoice,
13934 /// A pointer to the contents in the error state.
13935 /// Reading from this pointer when `result_ok` is set is undefined.
13936 pub err: *mut crate::lightning_invoice::SemanticError,
13939 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
13940 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
13941 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13942 pub struct CResult_InvoiceSemanticErrorZ {
13943 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
13944 /// `err` or `result` depending on the state of `result_ok`.
13945 pub contents: CResult_InvoiceSemanticErrorZPtr,
13946 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
13947 pub result_ok: bool,
13950 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
13951 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
13952 CResult_InvoiceSemanticErrorZ {
13953 contents: CResult_InvoiceSemanticErrorZPtr {
13954 result: Box::into_raw(Box::new(o)),
13960 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
13961 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
13962 CResult_InvoiceSemanticErrorZ {
13963 contents: CResult_InvoiceSemanticErrorZPtr {
13964 err: Box::into_raw(Box::new(e)),
13969 /// Checks if the given object is currently in the success state
13971 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
13975 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
13976 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
13977 impl Drop for CResult_InvoiceSemanticErrorZ {
13978 fn drop(&mut self) {
13979 if self.result_ok {
13980 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13981 let _ = unsafe { Box::from_raw(self.contents.result) };
13984 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13985 let _ = unsafe { Box::from_raw(self.contents.err) };
13990 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
13991 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
13992 let contents = if o.result_ok {
13993 let result = unsafe { o.contents.result };
13994 unsafe { o.contents.result = core::ptr::null_mut() };
13995 CResult_InvoiceSemanticErrorZPtr { result }
13997 let err = unsafe { o.contents.err };
13998 unsafe { o.contents.err = core::ptr::null_mut(); }
13999 CResult_InvoiceSemanticErrorZPtr { err }
14003 result_ok: o.result_ok,
14007 impl Clone for CResult_InvoiceSemanticErrorZ {
14008 fn clone(&self) -> Self {
14009 if self.result_ok {
14010 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
14011 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
14014 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
14015 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
14021 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
14022 /// but with all dynamically-allocated buffers duplicated in new buffers.
14023 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
14025 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
14026 /// This corresponds to std::vector in C++
14027 pub struct CVec_AddressZ {
14028 /// The elements in the array.
14029 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14030 pub data: *mut crate::c_types::Str,
14031 /// The number of elements pointed to by `data`.
14034 impl CVec_AddressZ {
14035 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
14036 if self.datalen == 0 { return Vec::new(); }
14037 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14038 self.data = core::ptr::null_mut();
14042 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
14043 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14046 impl From<Vec<crate::c_types::Str>> for CVec_AddressZ {
14047 fn from(v: Vec<crate::c_types::Str>) -> Self {
14048 let datalen = v.len();
14049 let data = Box::into_raw(v.into_boxed_slice());
14050 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14054 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14055 pub extern "C" fn CVec_AddressZ_free(_res: CVec_AddressZ) { }
14056 impl Drop for CVec_AddressZ {
14057 fn drop(&mut self) {
14058 if self.datalen == 0 { return; }
14059 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14062 impl Clone for CVec_AddressZ {
14063 fn clone(&self) -> Self {
14064 let mut res = Vec::new();
14065 if self.datalen == 0 { return Self::from(res); }
14066 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14071 /// The contents of CResult_DescriptionCreationErrorZ
14072 pub union CResult_DescriptionCreationErrorZPtr {
14073 /// A pointer to the contents in the success state.
14074 /// Reading from this pointer when `result_ok` is not set is undefined.
14075 pub result: *mut crate::lightning_invoice::Description,
14076 /// A pointer to the contents in the error state.
14077 /// Reading from this pointer when `result_ok` is set is undefined.
14078 pub err: *mut crate::lightning_invoice::CreationError,
14081 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
14082 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
14083 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14084 pub struct CResult_DescriptionCreationErrorZ {
14085 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
14086 /// `err` or `result` depending on the state of `result_ok`.
14087 pub contents: CResult_DescriptionCreationErrorZPtr,
14088 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
14089 pub result_ok: bool,
14092 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
14093 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
14094 CResult_DescriptionCreationErrorZ {
14095 contents: CResult_DescriptionCreationErrorZPtr {
14096 result: Box::into_raw(Box::new(o)),
14102 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
14103 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
14104 CResult_DescriptionCreationErrorZ {
14105 contents: CResult_DescriptionCreationErrorZPtr {
14106 err: Box::into_raw(Box::new(e)),
14111 /// Checks if the given object is currently in the success state
14113 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
14117 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
14118 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
14119 impl Drop for CResult_DescriptionCreationErrorZ {
14120 fn drop(&mut self) {
14121 if self.result_ok {
14122 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14123 let _ = unsafe { Box::from_raw(self.contents.result) };
14126 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14127 let _ = unsafe { Box::from_raw(self.contents.err) };
14132 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
14133 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
14134 let contents = if o.result_ok {
14135 let result = unsafe { o.contents.result };
14136 unsafe { o.contents.result = core::ptr::null_mut() };
14137 CResult_DescriptionCreationErrorZPtr { result }
14139 let err = unsafe { o.contents.err };
14140 unsafe { o.contents.err = core::ptr::null_mut(); }
14141 CResult_DescriptionCreationErrorZPtr { err }
14145 result_ok: o.result_ok,
14149 impl Clone for CResult_DescriptionCreationErrorZ {
14150 fn clone(&self) -> Self {
14151 if self.result_ok {
14152 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
14153 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
14156 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
14157 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
14163 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
14164 /// but with all dynamically-allocated buffers duplicated in new buffers.
14165 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
14167 /// The contents of CResult_PrivateRouteCreationErrorZ
14168 pub union CResult_PrivateRouteCreationErrorZPtr {
14169 /// A pointer to the contents in the success state.
14170 /// Reading from this pointer when `result_ok` is not set is undefined.
14171 pub result: *mut crate::lightning_invoice::PrivateRoute,
14172 /// A pointer to the contents in the error state.
14173 /// Reading from this pointer when `result_ok` is set is undefined.
14174 pub err: *mut crate::lightning_invoice::CreationError,
14177 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
14178 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
14179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14180 pub struct CResult_PrivateRouteCreationErrorZ {
14181 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
14182 /// `err` or `result` depending on the state of `result_ok`.
14183 pub contents: CResult_PrivateRouteCreationErrorZPtr,
14184 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
14185 pub result_ok: bool,
14188 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
14189 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
14190 CResult_PrivateRouteCreationErrorZ {
14191 contents: CResult_PrivateRouteCreationErrorZPtr {
14192 result: Box::into_raw(Box::new(o)),
14198 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
14199 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
14200 CResult_PrivateRouteCreationErrorZ {
14201 contents: CResult_PrivateRouteCreationErrorZPtr {
14202 err: Box::into_raw(Box::new(e)),
14207 /// Checks if the given object is currently in the success state
14209 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
14213 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
14214 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
14215 impl Drop for CResult_PrivateRouteCreationErrorZ {
14216 fn drop(&mut self) {
14217 if self.result_ok {
14218 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14219 let _ = unsafe { Box::from_raw(self.contents.result) };
14222 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14223 let _ = unsafe { Box::from_raw(self.contents.err) };
14228 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
14229 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
14230 let contents = if o.result_ok {
14231 let result = unsafe { o.contents.result };
14232 unsafe { o.contents.result = core::ptr::null_mut() };
14233 CResult_PrivateRouteCreationErrorZPtr { result }
14235 let err = unsafe { o.contents.err };
14236 unsafe { o.contents.err = core::ptr::null_mut(); }
14237 CResult_PrivateRouteCreationErrorZPtr { err }
14241 result_ok: o.result_ok,
14245 impl Clone for CResult_PrivateRouteCreationErrorZ {
14246 fn clone(&self) -> Self {
14247 if self.result_ok {
14248 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
14249 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
14252 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
14253 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
14259 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
14260 /// but with all dynamically-allocated buffers duplicated in new buffers.
14261 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
14263 /// The contents of CResult_NetAddressDecodeErrorZ
14264 pub union CResult_NetAddressDecodeErrorZPtr {
14265 /// A pointer to the contents in the success state.
14266 /// Reading from this pointer when `result_ok` is not set is undefined.
14267 pub result: *mut crate::lightning::ln::msgs::NetAddress,
14268 /// A pointer to the contents in the error state.
14269 /// Reading from this pointer when `result_ok` is set is undefined.
14270 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14273 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
14274 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
14275 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14276 pub struct CResult_NetAddressDecodeErrorZ {
14277 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
14278 /// `err` or `result` depending on the state of `result_ok`.
14279 pub contents: CResult_NetAddressDecodeErrorZPtr,
14280 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
14281 pub result_ok: bool,
14284 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
14285 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
14286 CResult_NetAddressDecodeErrorZ {
14287 contents: CResult_NetAddressDecodeErrorZPtr {
14288 result: Box::into_raw(Box::new(o)),
14294 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
14295 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
14296 CResult_NetAddressDecodeErrorZ {
14297 contents: CResult_NetAddressDecodeErrorZPtr {
14298 err: Box::into_raw(Box::new(e)),
14303 /// Checks if the given object is currently in the success state
14305 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
14309 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
14310 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
14311 impl Drop for CResult_NetAddressDecodeErrorZ {
14312 fn drop(&mut self) {
14313 if self.result_ok {
14314 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14315 let _ = unsafe { Box::from_raw(self.contents.result) };
14318 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14319 let _ = unsafe { Box::from_raw(self.contents.err) };
14324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
14325 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
14326 let contents = if o.result_ok {
14327 let result = unsafe { o.contents.result };
14328 unsafe { o.contents.result = core::ptr::null_mut() };
14329 CResult_NetAddressDecodeErrorZPtr { result }
14331 let err = unsafe { o.contents.err };
14332 unsafe { o.contents.err = core::ptr::null_mut(); }
14333 CResult_NetAddressDecodeErrorZPtr { err }
14337 result_ok: o.result_ok,
14341 impl Clone for CResult_NetAddressDecodeErrorZ {
14342 fn clone(&self) -> Self {
14343 if self.result_ok {
14344 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
14345 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
14348 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
14349 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14355 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
14356 /// but with all dynamically-allocated buffers duplicated in new buffers.
14357 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
14359 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
14360 /// This corresponds to std::vector in C++
14361 pub struct CVec_UpdateAddHTLCZ {
14362 /// The elements in the array.
14363 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14364 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14365 /// The number of elements pointed to by `data`.
14368 impl CVec_UpdateAddHTLCZ {
14369 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
14370 if self.datalen == 0 { return Vec::new(); }
14371 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14372 self.data = core::ptr::null_mut();
14376 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
14377 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14380 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
14381 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
14382 let datalen = v.len();
14383 let data = Box::into_raw(v.into_boxed_slice());
14384 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14388 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14389 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
14390 impl Drop for CVec_UpdateAddHTLCZ {
14391 fn drop(&mut self) {
14392 if self.datalen == 0 { return; }
14393 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14396 impl Clone for CVec_UpdateAddHTLCZ {
14397 fn clone(&self) -> Self {
14398 let mut res = Vec::new();
14399 if self.datalen == 0 { return Self::from(res); }
14400 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14405 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
14406 /// This corresponds to std::vector in C++
14407 pub struct CVec_UpdateFulfillHTLCZ {
14408 /// The elements in the array.
14409 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14410 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14411 /// The number of elements pointed to by `data`.
14414 impl CVec_UpdateFulfillHTLCZ {
14415 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
14416 if self.datalen == 0 { return Vec::new(); }
14417 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14418 self.data = core::ptr::null_mut();
14422 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
14423 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14426 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
14427 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
14428 let datalen = v.len();
14429 let data = Box::into_raw(v.into_boxed_slice());
14430 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14434 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14435 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
14436 impl Drop for CVec_UpdateFulfillHTLCZ {
14437 fn drop(&mut self) {
14438 if self.datalen == 0 { return; }
14439 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14442 impl Clone for CVec_UpdateFulfillHTLCZ {
14443 fn clone(&self) -> Self {
14444 let mut res = Vec::new();
14445 if self.datalen == 0 { return Self::from(res); }
14446 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14451 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
14452 /// This corresponds to std::vector in C++
14453 pub struct CVec_UpdateFailHTLCZ {
14454 /// The elements in the array.
14455 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14456 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14457 /// The number of elements pointed to by `data`.
14460 impl CVec_UpdateFailHTLCZ {
14461 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
14462 if self.datalen == 0 { return Vec::new(); }
14463 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14464 self.data = core::ptr::null_mut();
14468 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
14469 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14472 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
14473 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
14474 let datalen = v.len();
14475 let data = Box::into_raw(v.into_boxed_slice());
14476 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14480 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14481 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
14482 impl Drop for CVec_UpdateFailHTLCZ {
14483 fn drop(&mut self) {
14484 if self.datalen == 0 { return; }
14485 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14488 impl Clone for CVec_UpdateFailHTLCZ {
14489 fn clone(&self) -> Self {
14490 let mut res = Vec::new();
14491 if self.datalen == 0 { return Self::from(res); }
14492 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14497 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
14498 /// This corresponds to std::vector in C++
14499 pub struct CVec_UpdateFailMalformedHTLCZ {
14500 /// The elements in the array.
14501 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14502 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14503 /// The number of elements pointed to by `data`.
14506 impl CVec_UpdateFailMalformedHTLCZ {
14507 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
14508 if self.datalen == 0 { return Vec::new(); }
14509 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14510 self.data = core::ptr::null_mut();
14514 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
14515 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14518 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
14519 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
14520 let datalen = v.len();
14521 let data = Box::into_raw(v.into_boxed_slice());
14522 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14526 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14527 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
14528 impl Drop for CVec_UpdateFailMalformedHTLCZ {
14529 fn drop(&mut self) {
14530 if self.datalen == 0 { return; }
14531 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14534 impl Clone for CVec_UpdateFailMalformedHTLCZ {
14535 fn clone(&self) -> Self {
14536 let mut res = Vec::new();
14537 if self.datalen == 0 { return Self::from(res); }
14538 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14543 /// The contents of CResult_AcceptChannelDecodeErrorZ
14544 pub union CResult_AcceptChannelDecodeErrorZPtr {
14545 /// A pointer to the contents in the success state.
14546 /// Reading from this pointer when `result_ok` is not set is undefined.
14547 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
14548 /// A pointer to the contents in the error state.
14549 /// Reading from this pointer when `result_ok` is set is undefined.
14550 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14553 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
14554 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14556 pub struct CResult_AcceptChannelDecodeErrorZ {
14557 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
14558 /// `err` or `result` depending on the state of `result_ok`.
14559 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
14560 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
14561 pub result_ok: bool,
14564 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
14565 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
14566 CResult_AcceptChannelDecodeErrorZ {
14567 contents: CResult_AcceptChannelDecodeErrorZPtr {
14568 result: Box::into_raw(Box::new(o)),
14574 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
14575 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
14576 CResult_AcceptChannelDecodeErrorZ {
14577 contents: CResult_AcceptChannelDecodeErrorZPtr {
14578 err: Box::into_raw(Box::new(e)),
14583 /// Checks if the given object is currently in the success state
14585 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
14589 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
14590 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
14591 impl Drop for CResult_AcceptChannelDecodeErrorZ {
14592 fn drop(&mut self) {
14593 if self.result_ok {
14594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14595 let _ = unsafe { Box::from_raw(self.contents.result) };
14598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14599 let _ = unsafe { Box::from_raw(self.contents.err) };
14604 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
14605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14606 let contents = if o.result_ok {
14607 let result = unsafe { o.contents.result };
14608 unsafe { o.contents.result = core::ptr::null_mut() };
14609 CResult_AcceptChannelDecodeErrorZPtr { result }
14611 let err = unsafe { o.contents.err };
14612 unsafe { o.contents.err = core::ptr::null_mut(); }
14613 CResult_AcceptChannelDecodeErrorZPtr { err }
14617 result_ok: o.result_ok,
14621 impl Clone for CResult_AcceptChannelDecodeErrorZ {
14622 fn clone(&self) -> Self {
14623 if self.result_ok {
14624 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
14625 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
14628 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
14629 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14635 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
14636 /// but with all dynamically-allocated buffers duplicated in new buffers.
14637 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
14639 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
14640 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
14641 /// A pointer to the contents in the success state.
14642 /// Reading from this pointer when `result_ok` is not set is undefined.
14643 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
14644 /// A pointer to the contents in the error state.
14645 /// Reading from this pointer when `result_ok` is set is undefined.
14646 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14649 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
14650 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14652 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
14653 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
14654 /// `err` or `result` depending on the state of `result_ok`.
14655 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
14656 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
14657 pub result_ok: bool,
14660 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
14661 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14662 CResult_AnnouncementSignaturesDecodeErrorZ {
14663 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14664 result: Box::into_raw(Box::new(o)),
14670 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
14671 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14672 CResult_AnnouncementSignaturesDecodeErrorZ {
14673 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14674 err: Box::into_raw(Box::new(e)),
14679 /// Checks if the given object is currently in the success state
14681 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
14685 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
14686 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
14687 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
14688 fn drop(&mut self) {
14689 if self.result_ok {
14690 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14691 let _ = unsafe { Box::from_raw(self.contents.result) };
14694 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14695 let _ = unsafe { Box::from_raw(self.contents.err) };
14700 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
14701 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
14702 let contents = if o.result_ok {
14703 let result = unsafe { o.contents.result };
14704 unsafe { o.contents.result = core::ptr::null_mut() };
14705 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
14707 let err = unsafe { o.contents.err };
14708 unsafe { o.contents.err = core::ptr::null_mut(); }
14709 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
14713 result_ok: o.result_ok,
14717 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
14718 fn clone(&self) -> Self {
14719 if self.result_ok {
14720 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14721 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
14724 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14725 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14731 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
14732 /// but with all dynamically-allocated buffers duplicated in new buffers.
14733 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
14735 /// The contents of CResult_ChannelReestablishDecodeErrorZ
14736 pub union CResult_ChannelReestablishDecodeErrorZPtr {
14737 /// A pointer to the contents in the success state.
14738 /// Reading from this pointer when `result_ok` is not set is undefined.
14739 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
14740 /// A pointer to the contents in the error state.
14741 /// Reading from this pointer when `result_ok` is set is undefined.
14742 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14745 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
14746 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
14747 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14748 pub struct CResult_ChannelReestablishDecodeErrorZ {
14749 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
14750 /// `err` or `result` depending on the state of `result_ok`.
14751 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
14752 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
14753 pub result_ok: bool,
14756 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
14757 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
14758 CResult_ChannelReestablishDecodeErrorZ {
14759 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14760 result: Box::into_raw(Box::new(o)),
14766 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
14767 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
14768 CResult_ChannelReestablishDecodeErrorZ {
14769 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14770 err: Box::into_raw(Box::new(e)),
14775 /// Checks if the given object is currently in the success state
14777 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
14781 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
14782 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
14783 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
14784 fn drop(&mut self) {
14785 if self.result_ok {
14786 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14787 let _ = unsafe { Box::from_raw(self.contents.result) };
14790 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14791 let _ = unsafe { Box::from_raw(self.contents.err) };
14796 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
14797 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
14798 let contents = if o.result_ok {
14799 let result = unsafe { o.contents.result };
14800 unsafe { o.contents.result = core::ptr::null_mut() };
14801 CResult_ChannelReestablishDecodeErrorZPtr { result }
14803 let err = unsafe { o.contents.err };
14804 unsafe { o.contents.err = core::ptr::null_mut(); }
14805 CResult_ChannelReestablishDecodeErrorZPtr { err }
14809 result_ok: o.result_ok,
14813 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
14814 fn clone(&self) -> Self {
14815 if self.result_ok {
14816 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14817 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
14820 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14821 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14827 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14828 /// but with all dynamically-allocated buffers duplicated in new buffers.
14829 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
14831 /// The contents of CResult_ClosingSignedDecodeErrorZ
14832 pub union CResult_ClosingSignedDecodeErrorZPtr {
14833 /// A pointer to the contents in the success state.
14834 /// Reading from this pointer when `result_ok` is not set is undefined.
14835 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
14836 /// A pointer to the contents in the error state.
14837 /// Reading from this pointer when `result_ok` is set is undefined.
14838 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14841 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
14842 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14843 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14844 pub struct CResult_ClosingSignedDecodeErrorZ {
14845 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
14846 /// `err` or `result` depending on the state of `result_ok`.
14847 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
14848 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
14849 pub result_ok: bool,
14852 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14853 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
14854 CResult_ClosingSignedDecodeErrorZ {
14855 contents: CResult_ClosingSignedDecodeErrorZPtr {
14856 result: Box::into_raw(Box::new(o)),
14862 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14863 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
14864 CResult_ClosingSignedDecodeErrorZ {
14865 contents: CResult_ClosingSignedDecodeErrorZPtr {
14866 err: Box::into_raw(Box::new(e)),
14871 /// Checks if the given object is currently in the success state
14873 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
14877 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14878 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
14879 impl Drop for CResult_ClosingSignedDecodeErrorZ {
14880 fn drop(&mut self) {
14881 if self.result_ok {
14882 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14883 let _ = unsafe { Box::from_raw(self.contents.result) };
14886 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14887 let _ = unsafe { Box::from_raw(self.contents.err) };
14892 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
14893 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14894 let contents = if o.result_ok {
14895 let result = unsafe { o.contents.result };
14896 unsafe { o.contents.result = core::ptr::null_mut() };
14897 CResult_ClosingSignedDecodeErrorZPtr { result }
14899 let err = unsafe { o.contents.err };
14900 unsafe { o.contents.err = core::ptr::null_mut(); }
14901 CResult_ClosingSignedDecodeErrorZPtr { err }
14905 result_ok: o.result_ok,
14909 impl Clone for CResult_ClosingSignedDecodeErrorZ {
14910 fn clone(&self) -> Self {
14911 if self.result_ok {
14912 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
14913 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
14916 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
14917 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14923 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14924 /// but with all dynamically-allocated buffers duplicated in new buffers.
14925 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
14927 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
14928 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14929 /// A pointer to the contents in the success state.
14930 /// Reading from this pointer when `result_ok` is not set is undefined.
14931 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
14932 /// A pointer to the contents in the error state.
14933 /// Reading from this pointer when `result_ok` is set is undefined.
14934 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14937 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
14938 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14940 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
14941 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
14942 /// `err` or `result` depending on the state of `result_ok`.
14943 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
14944 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
14945 pub result_ok: bool,
14948 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14949 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14950 CResult_ClosingSignedFeeRangeDecodeErrorZ {
14951 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14952 result: Box::into_raw(Box::new(o)),
14958 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14959 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14960 CResult_ClosingSignedFeeRangeDecodeErrorZ {
14961 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14962 err: Box::into_raw(Box::new(e)),
14967 /// Checks if the given object is currently in the success state
14969 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
14973 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14974 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
14975 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14976 fn drop(&mut self) {
14977 if self.result_ok {
14978 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14979 let _ = unsafe { Box::from_raw(self.contents.result) };
14982 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14983 let _ = unsafe { Box::from_raw(self.contents.err) };
14988 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14989 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14990 let contents = if o.result_ok {
14991 let result = unsafe { o.contents.result };
14992 unsafe { o.contents.result = core::ptr::null_mut() };
14993 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
14995 let err = unsafe { o.contents.err };
14996 unsafe { o.contents.err = core::ptr::null_mut(); }
14997 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
15001 result_ok: o.result_ok,
15005 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
15006 fn clone(&self) -> Self {
15007 if self.result_ok {
15008 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
15009 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
15012 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
15013 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15019 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
15020 /// but with all dynamically-allocated buffers duplicated in new buffers.
15021 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
15023 /// The contents of CResult_CommitmentSignedDecodeErrorZ
15024 pub union CResult_CommitmentSignedDecodeErrorZPtr {
15025 /// A pointer to the contents in the success state.
15026 /// Reading from this pointer when `result_ok` is not set is undefined.
15027 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
15028 /// A pointer to the contents in the error state.
15029 /// Reading from this pointer when `result_ok` is set is undefined.
15030 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15033 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
15034 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15035 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15036 pub struct CResult_CommitmentSignedDecodeErrorZ {
15037 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
15038 /// `err` or `result` depending on the state of `result_ok`.
15039 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
15040 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
15041 pub result_ok: bool,
15044 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
15045 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
15046 CResult_CommitmentSignedDecodeErrorZ {
15047 contents: CResult_CommitmentSignedDecodeErrorZPtr {
15048 result: Box::into_raw(Box::new(o)),
15054 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
15055 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
15056 CResult_CommitmentSignedDecodeErrorZ {
15057 contents: CResult_CommitmentSignedDecodeErrorZPtr {
15058 err: Box::into_raw(Box::new(e)),
15063 /// Checks if the given object is currently in the success state
15065 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
15069 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
15070 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
15071 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
15072 fn drop(&mut self) {
15073 if self.result_ok {
15074 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15075 let _ = unsafe { Box::from_raw(self.contents.result) };
15078 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15079 let _ = unsafe { Box::from_raw(self.contents.err) };
15084 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
15085 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15086 let contents = if o.result_ok {
15087 let result = unsafe { o.contents.result };
15088 unsafe { o.contents.result = core::ptr::null_mut() };
15089 CResult_CommitmentSignedDecodeErrorZPtr { result }
15091 let err = unsafe { o.contents.err };
15092 unsafe { o.contents.err = core::ptr::null_mut(); }
15093 CResult_CommitmentSignedDecodeErrorZPtr { err }
15097 result_ok: o.result_ok,
15101 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
15102 fn clone(&self) -> Self {
15103 if self.result_ok {
15104 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15105 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
15108 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15109 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15115 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
15116 /// but with all dynamically-allocated buffers duplicated in new buffers.
15117 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
15119 /// The contents of CResult_FundingCreatedDecodeErrorZ
15120 pub union CResult_FundingCreatedDecodeErrorZPtr {
15121 /// A pointer to the contents in the success state.
15122 /// Reading from this pointer when `result_ok` is not set is undefined.
15123 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
15124 /// A pointer to the contents in the error state.
15125 /// Reading from this pointer when `result_ok` is set is undefined.
15126 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15129 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
15130 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
15131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15132 pub struct CResult_FundingCreatedDecodeErrorZ {
15133 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
15134 /// `err` or `result` depending on the state of `result_ok`.
15135 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
15136 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
15137 pub result_ok: bool,
15140 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
15141 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
15142 CResult_FundingCreatedDecodeErrorZ {
15143 contents: CResult_FundingCreatedDecodeErrorZPtr {
15144 result: Box::into_raw(Box::new(o)),
15150 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
15151 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
15152 CResult_FundingCreatedDecodeErrorZ {
15153 contents: CResult_FundingCreatedDecodeErrorZPtr {
15154 err: Box::into_raw(Box::new(e)),
15159 /// Checks if the given object is currently in the success state
15161 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
15165 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
15166 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
15167 impl Drop for CResult_FundingCreatedDecodeErrorZ {
15168 fn drop(&mut self) {
15169 if self.result_ok {
15170 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15171 let _ = unsafe { Box::from_raw(self.contents.result) };
15174 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15175 let _ = unsafe { Box::from_raw(self.contents.err) };
15180 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
15181 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
15182 let contents = if o.result_ok {
15183 let result = unsafe { o.contents.result };
15184 unsafe { o.contents.result = core::ptr::null_mut() };
15185 CResult_FundingCreatedDecodeErrorZPtr { result }
15187 let err = unsafe { o.contents.err };
15188 unsafe { o.contents.err = core::ptr::null_mut(); }
15189 CResult_FundingCreatedDecodeErrorZPtr { err }
15193 result_ok: o.result_ok,
15197 impl Clone for CResult_FundingCreatedDecodeErrorZ {
15198 fn clone(&self) -> Self {
15199 if self.result_ok {
15200 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
15201 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
15204 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
15205 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15211 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
15212 /// but with all dynamically-allocated buffers duplicated in new buffers.
15213 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
15215 /// The contents of CResult_FundingSignedDecodeErrorZ
15216 pub union CResult_FundingSignedDecodeErrorZPtr {
15217 /// A pointer to the contents in the success state.
15218 /// Reading from this pointer when `result_ok` is not set is undefined.
15219 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
15220 /// A pointer to the contents in the error state.
15221 /// Reading from this pointer when `result_ok` is set is undefined.
15222 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15225 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
15226 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15228 pub struct CResult_FundingSignedDecodeErrorZ {
15229 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
15230 /// `err` or `result` depending on the state of `result_ok`.
15231 pub contents: CResult_FundingSignedDecodeErrorZPtr,
15232 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
15233 pub result_ok: bool,
15236 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
15237 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
15238 CResult_FundingSignedDecodeErrorZ {
15239 contents: CResult_FundingSignedDecodeErrorZPtr {
15240 result: Box::into_raw(Box::new(o)),
15246 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
15247 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
15248 CResult_FundingSignedDecodeErrorZ {
15249 contents: CResult_FundingSignedDecodeErrorZPtr {
15250 err: Box::into_raw(Box::new(e)),
15255 /// Checks if the given object is currently in the success state
15257 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
15261 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
15262 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
15263 impl Drop for CResult_FundingSignedDecodeErrorZ {
15264 fn drop(&mut self) {
15265 if self.result_ok {
15266 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15267 let _ = unsafe { Box::from_raw(self.contents.result) };
15270 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15271 let _ = unsafe { Box::from_raw(self.contents.err) };
15276 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
15277 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15278 let contents = if o.result_ok {
15279 let result = unsafe { o.contents.result };
15280 unsafe { o.contents.result = core::ptr::null_mut() };
15281 CResult_FundingSignedDecodeErrorZPtr { result }
15283 let err = unsafe { o.contents.err };
15284 unsafe { o.contents.err = core::ptr::null_mut(); }
15285 CResult_FundingSignedDecodeErrorZPtr { err }
15289 result_ok: o.result_ok,
15293 impl Clone for CResult_FundingSignedDecodeErrorZ {
15294 fn clone(&self) -> Self {
15295 if self.result_ok {
15296 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
15297 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
15300 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
15301 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15307 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
15308 /// but with all dynamically-allocated buffers duplicated in new buffers.
15309 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
15311 /// The contents of CResult_ChannelReadyDecodeErrorZ
15312 pub union CResult_ChannelReadyDecodeErrorZPtr {
15313 /// A pointer to the contents in the success state.
15314 /// Reading from this pointer when `result_ok` is not set is undefined.
15315 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
15316 /// A pointer to the contents in the error state.
15317 /// Reading from this pointer when `result_ok` is set is undefined.
15318 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15321 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
15322 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
15323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15324 pub struct CResult_ChannelReadyDecodeErrorZ {
15325 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
15326 /// `err` or `result` depending on the state of `result_ok`.
15327 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
15328 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
15329 pub result_ok: bool,
15332 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
15333 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
15334 CResult_ChannelReadyDecodeErrorZ {
15335 contents: CResult_ChannelReadyDecodeErrorZPtr {
15336 result: Box::into_raw(Box::new(o)),
15342 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
15343 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
15344 CResult_ChannelReadyDecodeErrorZ {
15345 contents: CResult_ChannelReadyDecodeErrorZPtr {
15346 err: Box::into_raw(Box::new(e)),
15351 /// Checks if the given object is currently in the success state
15353 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
15357 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
15358 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
15359 impl Drop for CResult_ChannelReadyDecodeErrorZ {
15360 fn drop(&mut self) {
15361 if self.result_ok {
15362 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15363 let _ = unsafe { Box::from_raw(self.contents.result) };
15366 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15367 let _ = unsafe { Box::from_raw(self.contents.err) };
15372 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
15373 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
15374 let contents = if o.result_ok {
15375 let result = unsafe { o.contents.result };
15376 unsafe { o.contents.result = core::ptr::null_mut() };
15377 CResult_ChannelReadyDecodeErrorZPtr { result }
15379 let err = unsafe { o.contents.err };
15380 unsafe { o.contents.err = core::ptr::null_mut(); }
15381 CResult_ChannelReadyDecodeErrorZPtr { err }
15385 result_ok: o.result_ok,
15389 impl Clone for CResult_ChannelReadyDecodeErrorZ {
15390 fn clone(&self) -> Self {
15391 if self.result_ok {
15392 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
15393 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
15396 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
15397 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15403 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
15404 /// but with all dynamically-allocated buffers duplicated in new buffers.
15405 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
15407 /// The contents of CResult_InitDecodeErrorZ
15408 pub union CResult_InitDecodeErrorZPtr {
15409 /// A pointer to the contents in the success state.
15410 /// Reading from this pointer when `result_ok` is not set is undefined.
15411 pub result: *mut crate::lightning::ln::msgs::Init,
15412 /// A pointer to the contents in the error state.
15413 /// Reading from this pointer when `result_ok` is set is undefined.
15414 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15417 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
15418 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
15419 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15420 pub struct CResult_InitDecodeErrorZ {
15421 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
15422 /// `err` or `result` depending on the state of `result_ok`.
15423 pub contents: CResult_InitDecodeErrorZPtr,
15424 /// Whether this CResult_InitDecodeErrorZ represents a success state.
15425 pub result_ok: bool,
15428 /// Creates a new CResult_InitDecodeErrorZ in the success state.
15429 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
15430 CResult_InitDecodeErrorZ {
15431 contents: CResult_InitDecodeErrorZPtr {
15432 result: Box::into_raw(Box::new(o)),
15438 /// Creates a new CResult_InitDecodeErrorZ in the error state.
15439 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
15440 CResult_InitDecodeErrorZ {
15441 contents: CResult_InitDecodeErrorZPtr {
15442 err: Box::into_raw(Box::new(e)),
15447 /// Checks if the given object is currently in the success state
15449 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
15453 /// Frees any resources used by the CResult_InitDecodeErrorZ.
15454 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
15455 impl Drop for CResult_InitDecodeErrorZ {
15456 fn drop(&mut self) {
15457 if self.result_ok {
15458 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15459 let _ = unsafe { Box::from_raw(self.contents.result) };
15462 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15463 let _ = unsafe { Box::from_raw(self.contents.err) };
15468 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
15469 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
15470 let contents = if o.result_ok {
15471 let result = unsafe { o.contents.result };
15472 unsafe { o.contents.result = core::ptr::null_mut() };
15473 CResult_InitDecodeErrorZPtr { result }
15475 let err = unsafe { o.contents.err };
15476 unsafe { o.contents.err = core::ptr::null_mut(); }
15477 CResult_InitDecodeErrorZPtr { err }
15481 result_ok: o.result_ok,
15485 impl Clone for CResult_InitDecodeErrorZ {
15486 fn clone(&self) -> Self {
15487 if self.result_ok {
15488 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
15489 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
15492 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
15493 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15499 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15500 /// but with all dynamically-allocated buffers duplicated in new buffers.
15501 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
15503 /// The contents of CResult_OpenChannelDecodeErrorZ
15504 pub union CResult_OpenChannelDecodeErrorZPtr {
15505 /// A pointer to the contents in the success state.
15506 /// Reading from this pointer when `result_ok` is not set is undefined.
15507 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
15508 /// A pointer to the contents in the error state.
15509 /// Reading from this pointer when `result_ok` is set is undefined.
15510 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15513 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
15514 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15515 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15516 pub struct CResult_OpenChannelDecodeErrorZ {
15517 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
15518 /// `err` or `result` depending on the state of `result_ok`.
15519 pub contents: CResult_OpenChannelDecodeErrorZPtr,
15520 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
15521 pub result_ok: bool,
15524 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15525 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
15526 CResult_OpenChannelDecodeErrorZ {
15527 contents: CResult_OpenChannelDecodeErrorZPtr {
15528 result: Box::into_raw(Box::new(o)),
15534 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15535 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
15536 CResult_OpenChannelDecodeErrorZ {
15537 contents: CResult_OpenChannelDecodeErrorZPtr {
15538 err: Box::into_raw(Box::new(e)),
15543 /// Checks if the given object is currently in the success state
15545 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
15549 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15550 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
15551 impl Drop for CResult_OpenChannelDecodeErrorZ {
15552 fn drop(&mut self) {
15553 if self.result_ok {
15554 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15555 let _ = unsafe { Box::from_raw(self.contents.result) };
15558 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15559 let _ = unsafe { Box::from_raw(self.contents.err) };
15564 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
15565 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15566 let contents = if o.result_ok {
15567 let result = unsafe { o.contents.result };
15568 unsafe { o.contents.result = core::ptr::null_mut() };
15569 CResult_OpenChannelDecodeErrorZPtr { result }
15571 let err = unsafe { o.contents.err };
15572 unsafe { o.contents.err = core::ptr::null_mut(); }
15573 CResult_OpenChannelDecodeErrorZPtr { err }
15577 result_ok: o.result_ok,
15581 impl Clone for CResult_OpenChannelDecodeErrorZ {
15582 fn clone(&self) -> Self {
15583 if self.result_ok {
15584 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
15585 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
15588 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
15589 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15595 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15596 /// but with all dynamically-allocated buffers duplicated in new buffers.
15597 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
15599 /// The contents of CResult_RevokeAndACKDecodeErrorZ
15600 pub union CResult_RevokeAndACKDecodeErrorZPtr {
15601 /// A pointer to the contents in the success state.
15602 /// Reading from this pointer when `result_ok` is not set is undefined.
15603 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
15604 /// A pointer to the contents in the error state.
15605 /// Reading from this pointer when `result_ok` is set is undefined.
15606 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15609 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
15610 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
15611 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15612 pub struct CResult_RevokeAndACKDecodeErrorZ {
15613 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
15614 /// `err` or `result` depending on the state of `result_ok`.
15615 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
15616 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
15617 pub result_ok: bool,
15620 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15621 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
15622 CResult_RevokeAndACKDecodeErrorZ {
15623 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15624 result: Box::into_raw(Box::new(o)),
15630 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15631 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
15632 CResult_RevokeAndACKDecodeErrorZ {
15633 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15634 err: Box::into_raw(Box::new(e)),
15639 /// Checks if the given object is currently in the success state
15641 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
15645 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15646 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
15647 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
15648 fn drop(&mut self) {
15649 if self.result_ok {
15650 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15651 let _ = unsafe { Box::from_raw(self.contents.result) };
15654 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15655 let _ = unsafe { Box::from_raw(self.contents.err) };
15660 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
15661 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
15662 let contents = if o.result_ok {
15663 let result = unsafe { o.contents.result };
15664 unsafe { o.contents.result = core::ptr::null_mut() };
15665 CResult_RevokeAndACKDecodeErrorZPtr { result }
15667 let err = unsafe { o.contents.err };
15668 unsafe { o.contents.err = core::ptr::null_mut(); }
15669 CResult_RevokeAndACKDecodeErrorZPtr { err }
15673 result_ok: o.result_ok,
15677 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
15678 fn clone(&self) -> Self {
15679 if self.result_ok {
15680 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15681 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
15684 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15685 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15691 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15692 /// but with all dynamically-allocated buffers duplicated in new buffers.
15693 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
15695 /// The contents of CResult_ShutdownDecodeErrorZ
15696 pub union CResult_ShutdownDecodeErrorZPtr {
15697 /// A pointer to the contents in the success state.
15698 /// Reading from this pointer when `result_ok` is not set is undefined.
15699 pub result: *mut crate::lightning::ln::msgs::Shutdown,
15700 /// A pointer to the contents in the error state.
15701 /// Reading from this pointer when `result_ok` is set is undefined.
15702 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15705 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
15706 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
15707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15708 pub struct CResult_ShutdownDecodeErrorZ {
15709 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
15710 /// `err` or `result` depending on the state of `result_ok`.
15711 pub contents: CResult_ShutdownDecodeErrorZPtr,
15712 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
15713 pub result_ok: bool,
15716 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15717 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
15718 CResult_ShutdownDecodeErrorZ {
15719 contents: CResult_ShutdownDecodeErrorZPtr {
15720 result: Box::into_raw(Box::new(o)),
15726 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15727 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
15728 CResult_ShutdownDecodeErrorZ {
15729 contents: CResult_ShutdownDecodeErrorZPtr {
15730 err: Box::into_raw(Box::new(e)),
15735 /// Checks if the given object is currently in the success state
15737 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
15741 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15742 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
15743 impl Drop for CResult_ShutdownDecodeErrorZ {
15744 fn drop(&mut self) {
15745 if self.result_ok {
15746 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15747 let _ = unsafe { Box::from_raw(self.contents.result) };
15750 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15751 let _ = unsafe { Box::from_raw(self.contents.err) };
15756 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
15757 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
15758 let contents = if o.result_ok {
15759 let result = unsafe { o.contents.result };
15760 unsafe { o.contents.result = core::ptr::null_mut() };
15761 CResult_ShutdownDecodeErrorZPtr { result }
15763 let err = unsafe { o.contents.err };
15764 unsafe { o.contents.err = core::ptr::null_mut(); }
15765 CResult_ShutdownDecodeErrorZPtr { err }
15769 result_ok: o.result_ok,
15773 impl Clone for CResult_ShutdownDecodeErrorZ {
15774 fn clone(&self) -> Self {
15775 if self.result_ok {
15776 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
15777 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
15780 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
15781 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15787 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15788 /// but with all dynamically-allocated buffers duplicated in new buffers.
15789 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
15791 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
15792 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
15793 /// A pointer to the contents in the success state.
15794 /// Reading from this pointer when `result_ok` is not set is undefined.
15795 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15796 /// A pointer to the contents in the error state.
15797 /// Reading from this pointer when `result_ok` is set is undefined.
15798 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15801 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15802 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15804 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
15805 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15806 /// `err` or `result` depending on the state of `result_ok`.
15807 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
15808 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15809 pub result_ok: bool,
15812 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15813 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
15814 CResult_UpdateFailHTLCDecodeErrorZ {
15815 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15816 result: Box::into_raw(Box::new(o)),
15822 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15823 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
15824 CResult_UpdateFailHTLCDecodeErrorZ {
15825 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15826 err: Box::into_raw(Box::new(e)),
15831 /// Checks if the given object is currently in the success state
15833 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
15837 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15838 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
15839 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
15840 fn drop(&mut self) {
15841 if self.result_ok {
15842 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15843 let _ = unsafe { Box::from_raw(self.contents.result) };
15846 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15847 let _ = unsafe { Box::from_raw(self.contents.err) };
15852 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
15853 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15854 let contents = if o.result_ok {
15855 let result = unsafe { o.contents.result };
15856 unsafe { o.contents.result = core::ptr::null_mut() };
15857 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
15859 let err = unsafe { o.contents.err };
15860 unsafe { o.contents.err = core::ptr::null_mut(); }
15861 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
15865 result_ok: o.result_ok,
15869 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
15870 fn clone(&self) -> Self {
15871 if self.result_ok {
15872 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15873 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
15876 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15877 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15883 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15884 /// but with all dynamically-allocated buffers duplicated in new buffers.
15885 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
15887 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15888 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15889 /// A pointer to the contents in the success state.
15890 /// Reading from this pointer when `result_ok` is not set is undefined.
15891 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15892 /// A pointer to the contents in the error state.
15893 /// Reading from this pointer when `result_ok` is set is undefined.
15894 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15897 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15898 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15900 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15901 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15902 /// `err` or `result` depending on the state of `result_ok`.
15903 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
15904 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15905 pub result_ok: bool,
15908 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15909 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15910 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15911 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15912 result: Box::into_raw(Box::new(o)),
15918 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15919 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15920 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15921 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15922 err: Box::into_raw(Box::new(e)),
15927 /// Checks if the given object is currently in the success state
15929 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
15933 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15934 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
15935 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15936 fn drop(&mut self) {
15937 if self.result_ok {
15938 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15939 let _ = unsafe { Box::from_raw(self.contents.result) };
15942 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15943 let _ = unsafe { Box::from_raw(self.contents.err) };
15948 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15949 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15950 let contents = if o.result_ok {
15951 let result = unsafe { o.contents.result };
15952 unsafe { o.contents.result = core::ptr::null_mut() };
15953 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
15955 let err = unsafe { o.contents.err };
15956 unsafe { o.contents.err = core::ptr::null_mut(); }
15957 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
15961 result_ok: o.result_ok,
15965 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15966 fn clone(&self) -> Self {
15967 if self.result_ok {
15968 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15969 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
15972 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15973 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15979 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15980 /// but with all dynamically-allocated buffers duplicated in new buffers.
15981 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
15983 /// The contents of CResult_UpdateFeeDecodeErrorZ
15984 pub union CResult_UpdateFeeDecodeErrorZPtr {
15985 /// A pointer to the contents in the success state.
15986 /// Reading from this pointer when `result_ok` is not set is undefined.
15987 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
15988 /// A pointer to the contents in the error state.
15989 /// Reading from this pointer when `result_ok` is set is undefined.
15990 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15993 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
15994 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
15995 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15996 pub struct CResult_UpdateFeeDecodeErrorZ {
15997 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
15998 /// `err` or `result` depending on the state of `result_ok`.
15999 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
16000 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
16001 pub result_ok: bool,
16004 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16005 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
16006 CResult_UpdateFeeDecodeErrorZ {
16007 contents: CResult_UpdateFeeDecodeErrorZPtr {
16008 result: Box::into_raw(Box::new(o)),
16014 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16015 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
16016 CResult_UpdateFeeDecodeErrorZ {
16017 contents: CResult_UpdateFeeDecodeErrorZPtr {
16018 err: Box::into_raw(Box::new(e)),
16023 /// Checks if the given object is currently in the success state
16025 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
16029 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16030 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
16031 impl Drop for CResult_UpdateFeeDecodeErrorZ {
16032 fn drop(&mut self) {
16033 if self.result_ok {
16034 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16035 let _ = unsafe { Box::from_raw(self.contents.result) };
16038 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16039 let _ = unsafe { Box::from_raw(self.contents.err) };
16044 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
16045 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
16046 let contents = if o.result_ok {
16047 let result = unsafe { o.contents.result };
16048 unsafe { o.contents.result = core::ptr::null_mut() };
16049 CResult_UpdateFeeDecodeErrorZPtr { result }
16051 let err = unsafe { o.contents.err };
16052 unsafe { o.contents.err = core::ptr::null_mut(); }
16053 CResult_UpdateFeeDecodeErrorZPtr { err }
16057 result_ok: o.result_ok,
16061 impl Clone for CResult_UpdateFeeDecodeErrorZ {
16062 fn clone(&self) -> Self {
16063 if self.result_ok {
16064 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
16065 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
16068 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
16069 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16075 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16076 /// but with all dynamically-allocated buffers duplicated in new buffers.
16077 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
16079 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
16080 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16081 /// A pointer to the contents in the success state.
16082 /// Reading from this pointer when `result_ok` is not set is undefined.
16083 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
16084 /// A pointer to the contents in the error state.
16085 /// Reading from this pointer when `result_ok` is set is undefined.
16086 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16089 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
16090 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16091 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16092 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
16093 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
16094 /// `err` or `result` depending on the state of `result_ok`.
16095 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
16096 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
16097 pub result_ok: bool,
16100 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16101 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16102 CResult_UpdateFulfillHTLCDecodeErrorZ {
16103 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16104 result: Box::into_raw(Box::new(o)),
16110 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16111 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16112 CResult_UpdateFulfillHTLCDecodeErrorZ {
16113 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16114 err: Box::into_raw(Box::new(e)),
16119 /// Checks if the given object is currently in the success state
16121 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
16125 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16126 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
16127 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
16128 fn drop(&mut self) {
16129 if self.result_ok {
16130 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16131 let _ = unsafe { Box::from_raw(self.contents.result) };
16134 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16135 let _ = unsafe { Box::from_raw(self.contents.err) };
16140 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
16141 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16142 let contents = if o.result_ok {
16143 let result = unsafe { o.contents.result };
16144 unsafe { o.contents.result = core::ptr::null_mut() };
16145 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
16147 let err = unsafe { o.contents.err };
16148 unsafe { o.contents.err = core::ptr::null_mut(); }
16149 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
16153 result_ok: o.result_ok,
16157 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
16158 fn clone(&self) -> Self {
16159 if self.result_ok {
16160 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16161 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
16164 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16165 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16171 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16172 /// but with all dynamically-allocated buffers duplicated in new buffers.
16173 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
16175 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
16176 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
16177 /// A pointer to the contents in the success state.
16178 /// Reading from this pointer when `result_ok` is not set is undefined.
16179 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
16180 /// A pointer to the contents in the error state.
16181 /// Reading from this pointer when `result_ok` is set is undefined.
16182 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16185 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
16186 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16188 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
16189 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
16190 /// `err` or `result` depending on the state of `result_ok`.
16191 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
16192 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
16193 pub result_ok: bool,
16196 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16197 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
16198 CResult_UpdateAddHTLCDecodeErrorZ {
16199 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16200 result: Box::into_raw(Box::new(o)),
16206 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16207 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
16208 CResult_UpdateAddHTLCDecodeErrorZ {
16209 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16210 err: Box::into_raw(Box::new(e)),
16215 /// Checks if the given object is currently in the success state
16217 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
16221 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16222 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
16223 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
16224 fn drop(&mut self) {
16225 if self.result_ok {
16226 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16227 let _ = unsafe { Box::from_raw(self.contents.result) };
16230 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16231 let _ = unsafe { Box::from_raw(self.contents.err) };
16236 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
16237 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16238 let contents = if o.result_ok {
16239 let result = unsafe { o.contents.result };
16240 unsafe { o.contents.result = core::ptr::null_mut() };
16241 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
16243 let err = unsafe { o.contents.err };
16244 unsafe { o.contents.err = core::ptr::null_mut(); }
16245 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
16249 result_ok: o.result_ok,
16253 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
16254 fn clone(&self) -> Self {
16255 if self.result_ok {
16256 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16257 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
16260 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16261 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16267 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16268 /// but with all dynamically-allocated buffers duplicated in new buffers.
16269 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
16271 /// The contents of CResult_OnionMessageDecodeErrorZ
16272 pub union CResult_OnionMessageDecodeErrorZPtr {
16273 /// A pointer to the contents in the success state.
16274 /// Reading from this pointer when `result_ok` is not set is undefined.
16275 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
16276 /// A pointer to the contents in the error state.
16277 /// Reading from this pointer when `result_ok` is set is undefined.
16278 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16281 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
16282 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16284 pub struct CResult_OnionMessageDecodeErrorZ {
16285 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
16286 /// `err` or `result` depending on the state of `result_ok`.
16287 pub contents: CResult_OnionMessageDecodeErrorZPtr,
16288 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
16289 pub result_ok: bool,
16292 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
16293 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
16294 CResult_OnionMessageDecodeErrorZ {
16295 contents: CResult_OnionMessageDecodeErrorZPtr {
16296 result: Box::into_raw(Box::new(o)),
16302 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
16303 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
16304 CResult_OnionMessageDecodeErrorZ {
16305 contents: CResult_OnionMessageDecodeErrorZPtr {
16306 err: Box::into_raw(Box::new(e)),
16311 /// Checks if the given object is currently in the success state
16313 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
16317 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
16318 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
16319 impl Drop for CResult_OnionMessageDecodeErrorZ {
16320 fn drop(&mut self) {
16321 if self.result_ok {
16322 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16323 let _ = unsafe { Box::from_raw(self.contents.result) };
16326 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16327 let _ = unsafe { Box::from_raw(self.contents.err) };
16332 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
16333 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16334 let contents = if o.result_ok {
16335 let result = unsafe { o.contents.result };
16336 unsafe { o.contents.result = core::ptr::null_mut() };
16337 CResult_OnionMessageDecodeErrorZPtr { result }
16339 let err = unsafe { o.contents.err };
16340 unsafe { o.contents.err = core::ptr::null_mut(); }
16341 CResult_OnionMessageDecodeErrorZPtr { err }
16345 result_ok: o.result_ok,
16349 impl Clone for CResult_OnionMessageDecodeErrorZ {
16350 fn clone(&self) -> Self {
16351 if self.result_ok {
16352 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
16353 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
16356 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
16357 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16363 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
16364 /// but with all dynamically-allocated buffers duplicated in new buffers.
16365 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
16367 /// The contents of CResult_PingDecodeErrorZ
16368 pub union CResult_PingDecodeErrorZPtr {
16369 /// A pointer to the contents in the success state.
16370 /// Reading from this pointer when `result_ok` is not set is undefined.
16371 pub result: *mut crate::lightning::ln::msgs::Ping,
16372 /// A pointer to the contents in the error state.
16373 /// Reading from this pointer when `result_ok` is set is undefined.
16374 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16377 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
16378 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
16379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16380 pub struct CResult_PingDecodeErrorZ {
16381 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
16382 /// `err` or `result` depending on the state of `result_ok`.
16383 pub contents: CResult_PingDecodeErrorZPtr,
16384 /// Whether this CResult_PingDecodeErrorZ represents a success state.
16385 pub result_ok: bool,
16388 /// Creates a new CResult_PingDecodeErrorZ in the success state.
16389 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
16390 CResult_PingDecodeErrorZ {
16391 contents: CResult_PingDecodeErrorZPtr {
16392 result: Box::into_raw(Box::new(o)),
16398 /// Creates a new CResult_PingDecodeErrorZ in the error state.
16399 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
16400 CResult_PingDecodeErrorZ {
16401 contents: CResult_PingDecodeErrorZPtr {
16402 err: Box::into_raw(Box::new(e)),
16407 /// Checks if the given object is currently in the success state
16409 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
16413 /// Frees any resources used by the CResult_PingDecodeErrorZ.
16414 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
16415 impl Drop for CResult_PingDecodeErrorZ {
16416 fn drop(&mut self) {
16417 if self.result_ok {
16418 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16419 let _ = unsafe { Box::from_raw(self.contents.result) };
16422 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16423 let _ = unsafe { Box::from_raw(self.contents.err) };
16428 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
16429 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
16430 let contents = if o.result_ok {
16431 let result = unsafe { o.contents.result };
16432 unsafe { o.contents.result = core::ptr::null_mut() };
16433 CResult_PingDecodeErrorZPtr { result }
16435 let err = unsafe { o.contents.err };
16436 unsafe { o.contents.err = core::ptr::null_mut(); }
16437 CResult_PingDecodeErrorZPtr { err }
16441 result_ok: o.result_ok,
16445 impl Clone for CResult_PingDecodeErrorZ {
16446 fn clone(&self) -> Self {
16447 if self.result_ok {
16448 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
16449 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
16452 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
16453 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16459 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16460 /// but with all dynamically-allocated buffers duplicated in new buffers.
16461 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
16463 /// The contents of CResult_PongDecodeErrorZ
16464 pub union CResult_PongDecodeErrorZPtr {
16465 /// A pointer to the contents in the success state.
16466 /// Reading from this pointer when `result_ok` is not set is undefined.
16467 pub result: *mut crate::lightning::ln::msgs::Pong,
16468 /// A pointer to the contents in the error state.
16469 /// Reading from this pointer when `result_ok` is set is undefined.
16470 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16473 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
16474 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
16475 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16476 pub struct CResult_PongDecodeErrorZ {
16477 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
16478 /// `err` or `result` depending on the state of `result_ok`.
16479 pub contents: CResult_PongDecodeErrorZPtr,
16480 /// Whether this CResult_PongDecodeErrorZ represents a success state.
16481 pub result_ok: bool,
16484 /// Creates a new CResult_PongDecodeErrorZ in the success state.
16485 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
16486 CResult_PongDecodeErrorZ {
16487 contents: CResult_PongDecodeErrorZPtr {
16488 result: Box::into_raw(Box::new(o)),
16494 /// Creates a new CResult_PongDecodeErrorZ in the error state.
16495 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
16496 CResult_PongDecodeErrorZ {
16497 contents: CResult_PongDecodeErrorZPtr {
16498 err: Box::into_raw(Box::new(e)),
16503 /// Checks if the given object is currently in the success state
16505 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
16509 /// Frees any resources used by the CResult_PongDecodeErrorZ.
16510 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
16511 impl Drop for CResult_PongDecodeErrorZ {
16512 fn drop(&mut self) {
16513 if self.result_ok {
16514 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16515 let _ = unsafe { Box::from_raw(self.contents.result) };
16518 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16519 let _ = unsafe { Box::from_raw(self.contents.err) };
16524 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
16525 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
16526 let contents = if o.result_ok {
16527 let result = unsafe { o.contents.result };
16528 unsafe { o.contents.result = core::ptr::null_mut() };
16529 CResult_PongDecodeErrorZPtr { result }
16531 let err = unsafe { o.contents.err };
16532 unsafe { o.contents.err = core::ptr::null_mut(); }
16533 CResult_PongDecodeErrorZPtr { err }
16537 result_ok: o.result_ok,
16541 impl Clone for CResult_PongDecodeErrorZ {
16542 fn clone(&self) -> Self {
16543 if self.result_ok {
16544 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
16545 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
16548 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
16549 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16555 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16556 /// but with all dynamically-allocated buffers duplicated in new buffers.
16557 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
16559 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
16560 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16561 /// A pointer to the contents in the success state.
16562 /// Reading from this pointer when `result_ok` is not set is undefined.
16563 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
16564 /// A pointer to the contents in the error state.
16565 /// Reading from this pointer when `result_ok` is set is undefined.
16566 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16569 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16570 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16571 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16572 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16573 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
16574 /// `err` or `result` depending on the state of `result_ok`.
16575 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
16576 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
16577 pub result_ok: bool,
16580 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16581 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16582 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16583 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16584 result: Box::into_raw(Box::new(o)),
16590 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16591 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16592 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16593 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16594 err: Box::into_raw(Box::new(e)),
16599 /// Checks if the given object is currently in the success state
16601 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
16605 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16606 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
16607 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16608 fn drop(&mut self) {
16609 if self.result_ok {
16610 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16611 let _ = unsafe { Box::from_raw(self.contents.result) };
16614 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16615 let _ = unsafe { Box::from_raw(self.contents.err) };
16620 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16621 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16622 let contents = if o.result_ok {
16623 let result = unsafe { o.contents.result };
16624 unsafe { o.contents.result = core::ptr::null_mut() };
16625 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
16627 let err = unsafe { o.contents.err };
16628 unsafe { o.contents.err = core::ptr::null_mut(); }
16629 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
16633 result_ok: o.result_ok,
16637 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16638 fn clone(&self) -> Self {
16639 if self.result_ok {
16640 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16641 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16644 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16645 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16651 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16652 /// but with all dynamically-allocated buffers duplicated in new buffers.
16653 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16655 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
16656 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
16657 /// A pointer to the contents in the success state.
16658 /// Reading from this pointer when `result_ok` is not set is undefined.
16659 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
16660 /// A pointer to the contents in the error state.
16661 /// Reading from this pointer when `result_ok` is set is undefined.
16662 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16665 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16666 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16667 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16668 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
16669 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
16670 /// `err` or `result` depending on the state of `result_ok`.
16671 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
16672 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
16673 pub result_ok: bool,
16676 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16677 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
16678 CResult_ChannelAnnouncementDecodeErrorZ {
16679 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16680 result: Box::into_raw(Box::new(o)),
16686 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16687 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
16688 CResult_ChannelAnnouncementDecodeErrorZ {
16689 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16690 err: Box::into_raw(Box::new(e)),
16695 /// Checks if the given object is currently in the success state
16697 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
16701 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16702 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
16703 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
16704 fn drop(&mut self) {
16705 if self.result_ok {
16706 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16707 let _ = unsafe { Box::from_raw(self.contents.result) };
16710 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16711 let _ = unsafe { Box::from_raw(self.contents.err) };
16716 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
16717 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16718 let contents = if o.result_ok {
16719 let result = unsafe { o.contents.result };
16720 unsafe { o.contents.result = core::ptr::null_mut() };
16721 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
16723 let err = unsafe { o.contents.err };
16724 unsafe { o.contents.err = core::ptr::null_mut(); }
16725 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
16729 result_ok: o.result_ok,
16733 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
16734 fn clone(&self) -> Self {
16735 if self.result_ok {
16736 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16737 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16740 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16741 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16747 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16748 /// but with all dynamically-allocated buffers duplicated in new buffers.
16749 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16751 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
16752 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16753 /// A pointer to the contents in the success state.
16754 /// Reading from this pointer when `result_ok` is not set is undefined.
16755 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
16756 /// A pointer to the contents in the error state.
16757 /// Reading from this pointer when `result_ok` is set is undefined.
16758 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16761 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16762 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16764 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
16765 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
16766 /// `err` or `result` depending on the state of `result_ok`.
16767 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
16768 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
16769 pub result_ok: bool,
16772 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16773 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16774 CResult_UnsignedChannelUpdateDecodeErrorZ {
16775 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16776 result: Box::into_raw(Box::new(o)),
16782 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16783 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16784 CResult_UnsignedChannelUpdateDecodeErrorZ {
16785 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16786 err: Box::into_raw(Box::new(e)),
16791 /// Checks if the given object is currently in the success state
16793 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
16797 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16798 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
16799 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
16800 fn drop(&mut self) {
16801 if self.result_ok {
16802 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16803 let _ = unsafe { Box::from_raw(self.contents.result) };
16806 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16807 let _ = unsafe { Box::from_raw(self.contents.err) };
16812 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
16813 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16814 let contents = if o.result_ok {
16815 let result = unsafe { o.contents.result };
16816 unsafe { o.contents.result = core::ptr::null_mut() };
16817 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
16819 let err = unsafe { o.contents.err };
16820 unsafe { o.contents.err = core::ptr::null_mut(); }
16821 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
16825 result_ok: o.result_ok,
16829 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
16830 fn clone(&self) -> Self {
16831 if self.result_ok {
16832 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16833 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
16836 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16837 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16843 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16844 /// but with all dynamically-allocated buffers duplicated in new buffers.
16845 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16847 /// The contents of CResult_ChannelUpdateDecodeErrorZ
16848 pub union CResult_ChannelUpdateDecodeErrorZPtr {
16849 /// A pointer to the contents in the success state.
16850 /// Reading from this pointer when `result_ok` is not set is undefined.
16851 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
16852 /// A pointer to the contents in the error state.
16853 /// Reading from this pointer when `result_ok` is set is undefined.
16854 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16857 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16858 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16860 pub struct CResult_ChannelUpdateDecodeErrorZ {
16861 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16862 /// `err` or `result` depending on the state of `result_ok`.
16863 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
16864 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16865 pub result_ok: bool,
16868 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16869 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
16870 CResult_ChannelUpdateDecodeErrorZ {
16871 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16872 result: Box::into_raw(Box::new(o)),
16878 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16879 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
16880 CResult_ChannelUpdateDecodeErrorZ {
16881 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16882 err: Box::into_raw(Box::new(e)),
16887 /// Checks if the given object is currently in the success state
16889 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
16893 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16894 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
16895 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
16896 fn drop(&mut self) {
16897 if self.result_ok {
16898 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16899 let _ = unsafe { Box::from_raw(self.contents.result) };
16902 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16903 let _ = unsafe { Box::from_raw(self.contents.err) };
16908 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
16909 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16910 let contents = if o.result_ok {
16911 let result = unsafe { o.contents.result };
16912 unsafe { o.contents.result = core::ptr::null_mut() };
16913 CResult_ChannelUpdateDecodeErrorZPtr { result }
16915 let err = unsafe { o.contents.err };
16916 unsafe { o.contents.err = core::ptr::null_mut(); }
16917 CResult_ChannelUpdateDecodeErrorZPtr { err }
16921 result_ok: o.result_ok,
16925 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
16926 fn clone(&self) -> Self {
16927 if self.result_ok {
16928 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16929 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
16932 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16933 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16939 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16940 /// but with all dynamically-allocated buffers duplicated in new buffers.
16941 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16943 /// The contents of CResult_ErrorMessageDecodeErrorZ
16944 pub union CResult_ErrorMessageDecodeErrorZPtr {
16945 /// A pointer to the contents in the success state.
16946 /// Reading from this pointer when `result_ok` is not set is undefined.
16947 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
16948 /// A pointer to the contents in the error state.
16949 /// Reading from this pointer when `result_ok` is set is undefined.
16950 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16953 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16954 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16956 pub struct CResult_ErrorMessageDecodeErrorZ {
16957 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16958 /// `err` or `result` depending on the state of `result_ok`.
16959 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
16960 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16961 pub result_ok: bool,
16964 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16965 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
16966 CResult_ErrorMessageDecodeErrorZ {
16967 contents: CResult_ErrorMessageDecodeErrorZPtr {
16968 result: Box::into_raw(Box::new(o)),
16974 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16975 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
16976 CResult_ErrorMessageDecodeErrorZ {
16977 contents: CResult_ErrorMessageDecodeErrorZPtr {
16978 err: Box::into_raw(Box::new(e)),
16983 /// Checks if the given object is currently in the success state
16985 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
16989 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16990 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
16991 impl Drop for CResult_ErrorMessageDecodeErrorZ {
16992 fn drop(&mut self) {
16993 if self.result_ok {
16994 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16995 let _ = unsafe { Box::from_raw(self.contents.result) };
16998 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16999 let _ = unsafe { Box::from_raw(self.contents.err) };
17004 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
17005 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17006 let contents = if o.result_ok {
17007 let result = unsafe { o.contents.result };
17008 unsafe { o.contents.result = core::ptr::null_mut() };
17009 CResult_ErrorMessageDecodeErrorZPtr { result }
17011 let err = unsafe { o.contents.err };
17012 unsafe { o.contents.err = core::ptr::null_mut(); }
17013 CResult_ErrorMessageDecodeErrorZPtr { err }
17017 result_ok: o.result_ok,
17021 impl Clone for CResult_ErrorMessageDecodeErrorZ {
17022 fn clone(&self) -> Self {
17023 if self.result_ok {
17024 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
17025 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
17028 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
17029 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17035 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
17036 /// but with all dynamically-allocated buffers duplicated in new buffers.
17037 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
17039 /// The contents of CResult_WarningMessageDecodeErrorZ
17040 pub union CResult_WarningMessageDecodeErrorZPtr {
17041 /// A pointer to the contents in the success state.
17042 /// Reading from this pointer when `result_ok` is not set is undefined.
17043 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
17044 /// A pointer to the contents in the error state.
17045 /// Reading from this pointer when `result_ok` is set is undefined.
17046 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17049 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
17050 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
17051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17052 pub struct CResult_WarningMessageDecodeErrorZ {
17053 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
17054 /// `err` or `result` depending on the state of `result_ok`.
17055 pub contents: CResult_WarningMessageDecodeErrorZPtr,
17056 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
17057 pub result_ok: bool,
17060 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
17061 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
17062 CResult_WarningMessageDecodeErrorZ {
17063 contents: CResult_WarningMessageDecodeErrorZPtr {
17064 result: Box::into_raw(Box::new(o)),
17070 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
17071 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
17072 CResult_WarningMessageDecodeErrorZ {
17073 contents: CResult_WarningMessageDecodeErrorZPtr {
17074 err: Box::into_raw(Box::new(e)),
17079 /// Checks if the given object is currently in the success state
17081 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
17085 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
17086 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
17087 impl Drop for CResult_WarningMessageDecodeErrorZ {
17088 fn drop(&mut self) {
17089 if self.result_ok {
17090 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17091 let _ = unsafe { Box::from_raw(self.contents.result) };
17094 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17095 let _ = unsafe { Box::from_raw(self.contents.err) };
17100 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
17101 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17102 let contents = if o.result_ok {
17103 let result = unsafe { o.contents.result };
17104 unsafe { o.contents.result = core::ptr::null_mut() };
17105 CResult_WarningMessageDecodeErrorZPtr { result }
17107 let err = unsafe { o.contents.err };
17108 unsafe { o.contents.err = core::ptr::null_mut(); }
17109 CResult_WarningMessageDecodeErrorZPtr { err }
17113 result_ok: o.result_ok,
17117 impl Clone for CResult_WarningMessageDecodeErrorZ {
17118 fn clone(&self) -> Self {
17119 if self.result_ok {
17120 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
17121 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
17124 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
17125 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17131 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
17132 /// but with all dynamically-allocated buffers duplicated in new buffers.
17133 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
17135 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
17136 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17137 /// A pointer to the contents in the success state.
17138 /// Reading from this pointer when `result_ok` is not set is undefined.
17139 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
17140 /// A pointer to the contents in the error state.
17141 /// Reading from this pointer when `result_ok` is set is undefined.
17142 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17145 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17146 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17148 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17149 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
17150 /// `err` or `result` depending on the state of `result_ok`.
17151 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
17152 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
17153 pub result_ok: bool,
17156 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
17157 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17158 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17159 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17160 result: Box::into_raw(Box::new(o)),
17166 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
17167 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17168 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17169 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17170 err: Box::into_raw(Box::new(e)),
17175 /// Checks if the given object is currently in the success state
17177 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
17181 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
17182 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
17183 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17184 fn drop(&mut self) {
17185 if self.result_ok {
17186 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17187 let _ = unsafe { Box::from_raw(self.contents.result) };
17190 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17191 let _ = unsafe { Box::from_raw(self.contents.err) };
17196 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17197 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17198 let contents = if o.result_ok {
17199 let result = unsafe { o.contents.result };
17200 unsafe { o.contents.result = core::ptr::null_mut() };
17201 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
17203 let err = unsafe { o.contents.err };
17204 unsafe { o.contents.err = core::ptr::null_mut(); }
17205 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
17209 result_ok: o.result_ok,
17213 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17214 fn clone(&self) -> Self {
17215 if self.result_ok {
17216 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17217 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17220 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17221 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17227 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
17228 /// but with all dynamically-allocated buffers duplicated in new buffers.
17229 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17231 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
17232 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
17233 /// A pointer to the contents in the success state.
17234 /// Reading from this pointer when `result_ok` is not set is undefined.
17235 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
17236 /// A pointer to the contents in the error state.
17237 /// Reading from this pointer when `result_ok` is set is undefined.
17238 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17241 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17242 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17244 pub struct CResult_NodeAnnouncementDecodeErrorZ {
17245 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
17246 /// `err` or `result` depending on the state of `result_ok`.
17247 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
17248 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
17249 pub result_ok: bool,
17252 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
17253 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
17254 CResult_NodeAnnouncementDecodeErrorZ {
17255 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17256 result: Box::into_raw(Box::new(o)),
17262 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
17263 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
17264 CResult_NodeAnnouncementDecodeErrorZ {
17265 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17266 err: Box::into_raw(Box::new(e)),
17271 /// Checks if the given object is currently in the success state
17273 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
17277 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
17278 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
17279 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
17280 fn drop(&mut self) {
17281 if self.result_ok {
17282 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17283 let _ = unsafe { Box::from_raw(self.contents.result) };
17286 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17287 let _ = unsafe { Box::from_raw(self.contents.err) };
17292 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
17293 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17294 let contents = if o.result_ok {
17295 let result = unsafe { o.contents.result };
17296 unsafe { o.contents.result = core::ptr::null_mut() };
17297 CResult_NodeAnnouncementDecodeErrorZPtr { result }
17299 let err = unsafe { o.contents.err };
17300 unsafe { o.contents.err = core::ptr::null_mut(); }
17301 CResult_NodeAnnouncementDecodeErrorZPtr { err }
17305 result_ok: o.result_ok,
17309 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
17310 fn clone(&self) -> Self {
17311 if self.result_ok {
17312 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17313 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17316 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17317 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17323 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
17324 /// but with all dynamically-allocated buffers duplicated in new buffers.
17325 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17327 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
17328 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
17329 /// A pointer to the contents in the success state.
17330 /// Reading from this pointer when `result_ok` is not set is undefined.
17331 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
17332 /// A pointer to the contents in the error state.
17333 /// Reading from this pointer when `result_ok` is set is undefined.
17334 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17337 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
17338 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
17339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17340 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
17341 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
17342 /// `err` or `result` depending on the state of `result_ok`.
17343 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
17344 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
17345 pub result_ok: bool,
17348 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
17349 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17350 CResult_QueryShortChannelIdsDecodeErrorZ {
17351 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17352 result: Box::into_raw(Box::new(o)),
17358 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
17359 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17360 CResult_QueryShortChannelIdsDecodeErrorZ {
17361 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17362 err: Box::into_raw(Box::new(e)),
17367 /// Checks if the given object is currently in the success state
17369 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
17373 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
17374 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
17375 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
17376 fn drop(&mut self) {
17377 if self.result_ok {
17378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17379 let _ = unsafe { Box::from_raw(self.contents.result) };
17382 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17383 let _ = unsafe { Box::from_raw(self.contents.err) };
17388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
17389 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
17390 let contents = if o.result_ok {
17391 let result = unsafe { o.contents.result };
17392 unsafe { o.contents.result = core::ptr::null_mut() };
17393 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
17395 let err = unsafe { o.contents.err };
17396 unsafe { o.contents.err = core::ptr::null_mut(); }
17397 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
17401 result_ok: o.result_ok,
17405 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
17406 fn clone(&self) -> Self {
17407 if self.result_ok {
17408 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17409 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
17412 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17413 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17419 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
17420 /// but with all dynamically-allocated buffers duplicated in new buffers.
17421 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
17423 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
17424 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17425 /// A pointer to the contents in the success state.
17426 /// Reading from this pointer when `result_ok` is not set is undefined.
17427 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
17428 /// A pointer to the contents in the error state.
17429 /// Reading from this pointer when `result_ok` is set is undefined.
17430 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17433 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
17434 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
17435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17436 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17437 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
17438 /// `err` or `result` depending on the state of `result_ok`.
17439 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
17440 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
17441 pub result_ok: bool,
17444 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
17445 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17446 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17447 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17448 result: Box::into_raw(Box::new(o)),
17454 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
17455 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17456 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17457 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17458 err: Box::into_raw(Box::new(e)),
17463 /// Checks if the given object is currently in the success state
17465 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
17469 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
17470 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
17471 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17472 fn drop(&mut self) {
17473 if self.result_ok {
17474 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17475 let _ = unsafe { Box::from_raw(self.contents.result) };
17478 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17479 let _ = unsafe { Box::from_raw(self.contents.err) };
17484 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17485 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
17486 let contents = if o.result_ok {
17487 let result = unsafe { o.contents.result };
17488 unsafe { o.contents.result = core::ptr::null_mut() };
17489 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
17491 let err = unsafe { o.contents.err };
17492 unsafe { o.contents.err = core::ptr::null_mut(); }
17493 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
17497 result_ok: o.result_ok,
17501 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17502 fn clone(&self) -> Self {
17503 if self.result_ok {
17504 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17505 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
17508 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17509 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17515 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
17516 /// but with all dynamically-allocated buffers duplicated in new buffers.
17517 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
17519 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
17520 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
17521 /// A pointer to the contents in the success state.
17522 /// Reading from this pointer when `result_ok` is not set is undefined.
17523 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
17524 /// A pointer to the contents in the error state.
17525 /// Reading from this pointer when `result_ok` is set is undefined.
17526 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17529 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
17530 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17532 pub struct CResult_QueryChannelRangeDecodeErrorZ {
17533 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
17534 /// `err` or `result` depending on the state of `result_ok`.
17535 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
17536 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
17537 pub result_ok: bool,
17540 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
17541 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
17542 CResult_QueryChannelRangeDecodeErrorZ {
17543 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17544 result: Box::into_raw(Box::new(o)),
17550 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
17551 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
17552 CResult_QueryChannelRangeDecodeErrorZ {
17553 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17554 err: Box::into_raw(Box::new(e)),
17559 /// Checks if the given object is currently in the success state
17561 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
17565 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
17566 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
17567 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
17568 fn drop(&mut self) {
17569 if self.result_ok {
17570 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17571 let _ = unsafe { Box::from_raw(self.contents.result) };
17574 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17575 let _ = unsafe { Box::from_raw(self.contents.err) };
17580 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
17581 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17582 let contents = if o.result_ok {
17583 let result = unsafe { o.contents.result };
17584 unsafe { o.contents.result = core::ptr::null_mut() };
17585 CResult_QueryChannelRangeDecodeErrorZPtr { result }
17587 let err = unsafe { o.contents.err };
17588 unsafe { o.contents.err = core::ptr::null_mut(); }
17589 CResult_QueryChannelRangeDecodeErrorZPtr { err }
17593 result_ok: o.result_ok,
17597 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
17598 fn clone(&self) -> Self {
17599 if self.result_ok {
17600 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17601 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
17604 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17605 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17611 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
17612 /// but with all dynamically-allocated buffers duplicated in new buffers.
17613 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17615 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
17616 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
17617 /// A pointer to the contents in the success state.
17618 /// Reading from this pointer when `result_ok` is not set is undefined.
17619 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
17620 /// A pointer to the contents in the error state.
17621 /// Reading from this pointer when `result_ok` is set is undefined.
17622 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17625 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
17626 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17628 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
17629 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
17630 /// `err` or `result` depending on the state of `result_ok`.
17631 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
17632 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
17633 pub result_ok: bool,
17636 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
17637 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
17638 CResult_ReplyChannelRangeDecodeErrorZ {
17639 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17640 result: Box::into_raw(Box::new(o)),
17646 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
17647 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
17648 CResult_ReplyChannelRangeDecodeErrorZ {
17649 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17650 err: Box::into_raw(Box::new(e)),
17655 /// Checks if the given object is currently in the success state
17657 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
17661 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
17662 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
17663 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
17664 fn drop(&mut self) {
17665 if self.result_ok {
17666 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17667 let _ = unsafe { Box::from_raw(self.contents.result) };
17670 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17671 let _ = unsafe { Box::from_raw(self.contents.err) };
17676 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
17677 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17678 let contents = if o.result_ok {
17679 let result = unsafe { o.contents.result };
17680 unsafe { o.contents.result = core::ptr::null_mut() };
17681 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
17683 let err = unsafe { o.contents.err };
17684 unsafe { o.contents.err = core::ptr::null_mut(); }
17685 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
17689 result_ok: o.result_ok,
17693 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
17694 fn clone(&self) -> Self {
17695 if self.result_ok {
17696 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17697 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
17700 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17701 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17707 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
17708 /// but with all dynamically-allocated buffers duplicated in new buffers.
17709 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17711 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
17712 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
17713 /// A pointer to the contents in the success state.
17714 /// Reading from this pointer when `result_ok` is not set is undefined.
17715 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
17716 /// A pointer to the contents in the error state.
17717 /// Reading from this pointer when `result_ok` is set is undefined.
17718 pub err: *mut crate::lightning::ln::msgs::DecodeError,
17721 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
17722 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
17723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17724 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
17725 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
17726 /// `err` or `result` depending on the state of `result_ok`.
17727 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
17728 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
17729 pub result_ok: bool,
17732 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
17733 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
17734 CResult_GossipTimestampFilterDecodeErrorZ {
17735 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17736 result: Box::into_raw(Box::new(o)),
17742 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
17743 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
17744 CResult_GossipTimestampFilterDecodeErrorZ {
17745 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17746 err: Box::into_raw(Box::new(e)),
17751 /// Checks if the given object is currently in the success state
17753 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
17757 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
17758 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
17759 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
17760 fn drop(&mut self) {
17761 if self.result_ok {
17762 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17763 let _ = unsafe { Box::from_raw(self.contents.result) };
17766 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17767 let _ = unsafe { Box::from_raw(self.contents.err) };
17772 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
17773 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
17774 let contents = if o.result_ok {
17775 let result = unsafe { o.contents.result };
17776 unsafe { o.contents.result = core::ptr::null_mut() };
17777 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
17779 let err = unsafe { o.contents.err };
17780 unsafe { o.contents.err = core::ptr::null_mut(); }
17781 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
17785 result_ok: o.result_ok,
17789 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
17790 fn clone(&self) -> Self {
17791 if self.result_ok {
17792 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17793 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
17796 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17797 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17803 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17804 /// but with all dynamically-allocated buffers duplicated in new buffers.
17805 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
17807 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
17808 /// This corresponds to std::vector in C++
17809 pub struct CVec_PhantomRouteHintsZ {
17810 /// The elements in the array.
17811 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17812 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
17813 /// The number of elements pointed to by `data`.
17816 impl CVec_PhantomRouteHintsZ {
17817 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
17818 if self.datalen == 0 { return Vec::new(); }
17819 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17820 self.data = core::ptr::null_mut();
17824 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
17825 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17828 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
17829 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
17830 let datalen = v.len();
17831 let data = Box::into_raw(v.into_boxed_slice());
17832 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17836 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17837 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
17838 impl Drop for CVec_PhantomRouteHintsZ {
17839 fn drop(&mut self) {
17840 if self.datalen == 0 { return; }
17841 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17844 impl Clone for CVec_PhantomRouteHintsZ {
17845 fn clone(&self) -> Self {
17846 let mut res = Vec::new();
17847 if self.datalen == 0 { return Self::from(res); }
17848 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17853 /// The contents of CResult_InvoiceSignOrCreationErrorZ
17854 pub union CResult_InvoiceSignOrCreationErrorZPtr {
17855 /// A pointer to the contents in the success state.
17856 /// Reading from this pointer when `result_ok` is not set is undefined.
17857 pub result: *mut crate::lightning_invoice::Invoice,
17858 /// A pointer to the contents in the error state.
17859 /// Reading from this pointer when `result_ok` is set is undefined.
17860 pub err: *mut crate::lightning_invoice::SignOrCreationError,
17863 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
17864 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
17865 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17866 pub struct CResult_InvoiceSignOrCreationErrorZ {
17867 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
17868 /// `err` or `result` depending on the state of `result_ok`.
17869 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
17870 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
17871 pub result_ok: bool,
17874 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
17875 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
17876 CResult_InvoiceSignOrCreationErrorZ {
17877 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17878 result: Box::into_raw(Box::new(o)),
17884 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
17885 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
17886 CResult_InvoiceSignOrCreationErrorZ {
17887 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17888 err: Box::into_raw(Box::new(e)),
17893 /// Checks if the given object is currently in the success state
17895 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
17899 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
17900 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
17901 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
17902 fn drop(&mut self) {
17903 if self.result_ok {
17904 if unsafe { !(self.contents.result as *mut ()).is_null() } {
17905 let _ = unsafe { Box::from_raw(self.contents.result) };
17908 if unsafe { !(self.contents.err as *mut ()).is_null() } {
17909 let _ = unsafe { Box::from_raw(self.contents.err) };
17914 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
17915 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
17916 let contents = if o.result_ok {
17917 let result = unsafe { o.contents.result };
17918 unsafe { o.contents.result = core::ptr::null_mut() };
17919 CResult_InvoiceSignOrCreationErrorZPtr { result }
17921 let err = unsafe { o.contents.err };
17922 unsafe { o.contents.err = core::ptr::null_mut(); }
17923 CResult_InvoiceSignOrCreationErrorZPtr { err }
17927 result_ok: o.result_ok,
17931 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
17932 fn clone(&self) -> Self {
17933 if self.result_ok {
17934 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17935 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
17938 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17939 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
17945 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
17946 /// but with all dynamically-allocated buffers duplicated in new buffers.
17947 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
17949 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
17950 /// This corresponds to std::vector in C++
17951 pub struct CVec_FutureZ {
17952 /// The elements in the array.
17953 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17954 pub data: *mut crate::lightning::util::wakers::Future,
17955 /// The number of elements pointed to by `data`.
17958 impl CVec_FutureZ {
17959 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
17960 if self.datalen == 0 { return Vec::new(); }
17961 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17962 self.data = core::ptr::null_mut();
17966 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
17967 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17970 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
17971 fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
17972 let datalen = v.len();
17973 let data = Box::into_raw(v.into_boxed_slice());
17974 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17978 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17979 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
17980 impl Drop for CVec_FutureZ {
17981 fn drop(&mut self) {
17982 if self.datalen == 0 { return; }
17983 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17986 impl Clone for CVec_FutureZ {
17987 fn clone(&self) -> Self {
17988 let mut res = Vec::new();
17989 if self.datalen == 0 { return Self::from(res); }
17990 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17995 /// An enum which can either contain a crate::lightning::chain::Filter or not
17996 pub enum COption_FilterZ {
17997 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
17998 Some(crate::lightning::chain::Filter),
17999 /// When we're in this state, this COption_FilterZ contains nothing
18002 impl COption_FilterZ {
18003 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
18004 if let Self::None = self { false } else { true }
18006 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18009 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
18010 if let Self::Some(v) = self { v } else { unreachable!() }
18014 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
18015 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
18016 COption_FilterZ::Some(o)
18019 /// Constructs a new COption_FilterZ containing nothing
18020 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
18021 COption_FilterZ::None
18024 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
18025 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
18027 /// The contents of CResult_LockedChannelMonitorNoneZ
18028 pub union CResult_LockedChannelMonitorNoneZPtr {
18029 /// A pointer to the contents in the success state.
18030 /// Reading from this pointer when `result_ok` is not set is undefined.
18031 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
18032 /// Note that this value is always NULL, as there are no contents in the Err variant
18033 pub err: *mut core::ffi::c_void,
18036 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
18037 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
18038 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18039 pub struct CResult_LockedChannelMonitorNoneZ {
18040 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
18041 /// `err` or `result` depending on the state of `result_ok`.
18042 pub contents: CResult_LockedChannelMonitorNoneZPtr,
18043 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
18044 pub result_ok: bool,
18047 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
18048 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
18049 CResult_LockedChannelMonitorNoneZ {
18050 contents: CResult_LockedChannelMonitorNoneZPtr {
18051 result: Box::into_raw(Box::new(o)),
18057 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
18058 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
18059 CResult_LockedChannelMonitorNoneZ {
18060 contents: CResult_LockedChannelMonitorNoneZPtr {
18061 err: core::ptr::null_mut(),
18066 /// Checks if the given object is currently in the success state
18068 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
18072 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
18073 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
18074 impl Drop for CResult_LockedChannelMonitorNoneZ {
18075 fn drop(&mut self) {
18076 if self.result_ok {
18077 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18078 let _ = unsafe { Box::from_raw(self.contents.result) };
18084 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
18085 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
18086 let contents = if o.result_ok {
18087 let result = unsafe { o.contents.result };
18088 unsafe { o.contents.result = core::ptr::null_mut() };
18089 CResult_LockedChannelMonitorNoneZPtr { result }
18091 let _ = unsafe { Box::from_raw(o.contents.err) };
18092 o.contents.err = core::ptr::null_mut();
18093 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
18097 result_ok: o.result_ok,
18102 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
18103 /// This corresponds to std::vector in C++
18104 pub struct CVec_OutPointZ {
18105 /// The elements in the array.
18106 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18107 pub data: *mut crate::lightning::chain::transaction::OutPoint,
18108 /// The number of elements pointed to by `data`.
18111 impl CVec_OutPointZ {
18112 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
18113 if self.datalen == 0 { return Vec::new(); }
18114 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18115 self.data = core::ptr::null_mut();
18119 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
18120 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18123 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
18124 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
18125 let datalen = v.len();
18126 let data = Box::into_raw(v.into_boxed_slice());
18127 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18131 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18132 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
18133 impl Drop for CVec_OutPointZ {
18134 fn drop(&mut self) {
18135 if self.datalen == 0 { return; }
18136 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18139 impl Clone for CVec_OutPointZ {
18140 fn clone(&self) -> Self {
18141 let mut res = Vec::new();
18142 if self.datalen == 0 { return Self::from(res); }
18143 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18148 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
18149 /// This corresponds to std::vector in C++
18150 pub struct CVec_MonitorUpdateIdZ {
18151 /// The elements in the array.
18152 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18153 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
18154 /// The number of elements pointed to by `data`.
18157 impl CVec_MonitorUpdateIdZ {
18158 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
18159 if self.datalen == 0 { return Vec::new(); }
18160 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18161 self.data = core::ptr::null_mut();
18165 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
18166 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18169 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
18170 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
18171 let datalen = v.len();
18172 let data = Box::into_raw(v.into_boxed_slice());
18173 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18177 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18178 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
18179 impl Drop for CVec_MonitorUpdateIdZ {
18180 fn drop(&mut self) {
18181 if self.datalen == 0 { return; }
18182 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18185 impl Clone for CVec_MonitorUpdateIdZ {
18186 fn clone(&self) -> Self {
18187 let mut res = Vec::new();
18188 if self.datalen == 0 { return Self::from(res); }
18189 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18194 /// A tuple of 2 elements. See the individual fields for the types contained.
18195 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18196 /// The element at position 0
18197 pub a: crate::lightning::chain::transaction::OutPoint,
18198 /// The element at position 1
18199 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
18201 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18202 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
18209 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18210 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
18214 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18215 fn clone(&self) -> Self {
18217 a: Clone::clone(&self.a),
18218 b: Clone::clone(&self.b),
18223 /// Creates a new tuple which has the same data as `orig`
18224 /// but with all dynamically-allocated buffers duplicated in new buffers.
18225 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
18226 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
18228 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18229 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
18233 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
18234 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
18236 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
18237 /// This corresponds to std::vector in C++
18238 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18239 /// The elements in the array.
18240 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18241 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
18242 /// The number of elements pointed to by `data`.
18245 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18246 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
18247 if self.datalen == 0 { return Vec::new(); }
18248 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18249 self.data = core::ptr::null_mut();
18253 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
18254 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18257 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18258 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
18259 let datalen = v.len();
18260 let data = Box::into_raw(v.into_boxed_slice());
18261 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18265 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18266 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
18267 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18268 fn drop(&mut self) {
18269 if self.datalen == 0 { return; }
18270 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18273 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18274 fn clone(&self) -> Self {
18275 let mut res = Vec::new();
18276 if self.datalen == 0 { return Self::from(res); }
18277 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18282 /// The contents of CResult_u32GraphSyncErrorZ
18283 pub union CResult_u32GraphSyncErrorZPtr {
18284 /// A pointer to the contents in the success state.
18285 /// Reading from this pointer when `result_ok` is not set is undefined.
18286 pub result: *mut u32,
18287 /// A pointer to the contents in the error state.
18288 /// Reading from this pointer when `result_ok` is set is undefined.
18289 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
18292 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
18293 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
18294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18295 pub struct CResult_u32GraphSyncErrorZ {
18296 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
18297 /// `err` or `result` depending on the state of `result_ok`.
18298 pub contents: CResult_u32GraphSyncErrorZPtr,
18299 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
18300 pub result_ok: bool,
18303 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
18304 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
18305 CResult_u32GraphSyncErrorZ {
18306 contents: CResult_u32GraphSyncErrorZPtr {
18307 result: Box::into_raw(Box::new(o)),
18313 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
18314 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
18315 CResult_u32GraphSyncErrorZ {
18316 contents: CResult_u32GraphSyncErrorZPtr {
18317 err: Box::into_raw(Box::new(e)),
18322 /// Checks if the given object is currently in the success state
18324 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
18328 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
18329 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
18330 impl Drop for CResult_u32GraphSyncErrorZ {
18331 fn drop(&mut self) {
18332 if self.result_ok {
18333 if unsafe { !(self.contents.result as *mut ()).is_null() } {
18334 let _ = unsafe { Box::from_raw(self.contents.result) };
18337 if unsafe { !(self.contents.err as *mut ()).is_null() } {
18338 let _ = unsafe { Box::from_raw(self.contents.err) };
18343 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
18344 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
18345 let contents = if o.result_ok {
18346 let result = unsafe { o.contents.result };
18347 unsafe { o.contents.result = core::ptr::null_mut() };
18348 CResult_u32GraphSyncErrorZPtr { result }
18350 let err = unsafe { o.contents.err };
18351 unsafe { o.contents.err = core::ptr::null_mut(); }
18352 CResult_u32GraphSyncErrorZPtr { err }
18356 result_ok: o.result_ok,