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};
11 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
12 pub enum COption_HTLCClaimZ {
13 /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
14 Some(crate::lightning::ln::chan_utils::HTLCClaim),
15 /// When we're in this state, this COption_HTLCClaimZ contains nothing
18 impl COption_HTLCClaimZ {
19 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20 if let Self::None = self { false } else { true }
22 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
25 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
26 if let Self::Some(v) = self { v } else { unreachable!() }
30 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
31 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
32 COption_HTLCClaimZ::Some(o)
35 /// Constructs a new COption_HTLCClaimZ containing nothing
36 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
37 COption_HTLCClaimZ::None
40 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
41 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
43 /// The contents of CResult_NoneNoneZ
44 pub union CResult_NoneNoneZPtr {
45 /// Note that this value is always NULL, as there are no contents in the OK variant
46 pub result: *mut core::ffi::c_void,
47 /// Note that this value is always NULL, as there are no contents in the Err variant
48 pub err: *mut core::ffi::c_void,
51 /// A CResult_NoneNoneZ represents the result of a fallible operation,
52 /// containing a () on success and a () on failure.
53 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
54 pub struct CResult_NoneNoneZ {
55 /// The contents of this CResult_NoneNoneZ, accessible via either
56 /// `err` or `result` depending on the state of `result_ok`.
57 pub contents: CResult_NoneNoneZPtr,
58 /// Whether this CResult_NoneNoneZ represents a success state.
62 /// Creates a new CResult_NoneNoneZ in the success state.
63 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
65 contents: CResult_NoneNoneZPtr {
66 result: core::ptr::null_mut(),
72 /// Creates a new CResult_NoneNoneZ in the error state.
73 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
75 contents: CResult_NoneNoneZPtr {
76 err: core::ptr::null_mut(),
81 /// Checks if the given object is currently in the success state
83 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
87 /// Frees any resources used by the CResult_NoneNoneZ.
88 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
89 impl Drop for CResult_NoneNoneZ {
96 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
97 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
98 let contents = if o.result_ok {
99 let _ = unsafe { Box::from_raw(o.contents.result) };
100 o.contents.result = core::ptr::null_mut();
101 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
103 let _ = unsafe { Box::from_raw(o.contents.err) };
104 o.contents.err = core::ptr::null_mut();
105 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
109 result_ok: o.result_ok,
113 impl Clone for CResult_NoneNoneZ {
114 fn clone(&self) -> Self {
116 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
117 result: core::ptr::null_mut()
120 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
121 err: core::ptr::null_mut()
127 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
128 /// but with all dynamically-allocated buffers duplicated in new buffers.
129 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
131 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
132 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
133 /// A pointer to the contents in the success state.
134 /// Reading from this pointer when `result_ok` is not set is undefined.
135 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
136 /// A pointer to the contents in the error state.
137 /// Reading from this pointer when `result_ok` is set is undefined.
138 pub err: *mut crate::lightning::ln::msgs::DecodeError,
141 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
142 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
144 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
145 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
146 /// `err` or `result` depending on the state of `result_ok`.
147 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
148 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
152 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
153 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
154 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
155 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
156 result: Box::into_raw(Box::new(o)),
162 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
163 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
164 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
165 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
166 err: Box::into_raw(Box::new(e)),
171 /// Checks if the given object is currently in the success state
173 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
177 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
178 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
179 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
182 if unsafe { !(self.contents.result as *mut ()).is_null() } {
183 let _ = unsafe { Box::from_raw(self.contents.result) };
186 if unsafe { !(self.contents.err as *mut ()).is_null() } {
187 let _ = unsafe { Box::from_raw(self.contents.err) };
192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
193 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
194 let contents = if o.result_ok {
195 let result = unsafe { o.contents.result };
196 unsafe { o.contents.result = core::ptr::null_mut() };
197 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
199 let err = unsafe { o.contents.err };
200 unsafe { o.contents.err = core::ptr::null_mut(); }
201 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
205 result_ok: o.result_ok,
209 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
210 fn clone(&self) -> Self {
212 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
213 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
216 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
217 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
223 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
224 /// but with all dynamically-allocated buffers duplicated in new buffers.
225 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
227 /// The contents of CResult_TxCreationKeysDecodeErrorZ
228 pub union CResult_TxCreationKeysDecodeErrorZPtr {
229 /// A pointer to the contents in the success state.
230 /// Reading from this pointer when `result_ok` is not set is undefined.
231 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
232 /// A pointer to the contents in the error state.
233 /// Reading from this pointer when `result_ok` is set is undefined.
234 pub err: *mut crate::lightning::ln::msgs::DecodeError,
237 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
238 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
240 pub struct CResult_TxCreationKeysDecodeErrorZ {
241 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
242 /// `err` or `result` depending on the state of `result_ok`.
243 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
244 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
248 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
249 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
250 CResult_TxCreationKeysDecodeErrorZ {
251 contents: CResult_TxCreationKeysDecodeErrorZPtr {
252 result: Box::into_raw(Box::new(o)),
258 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
259 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
260 CResult_TxCreationKeysDecodeErrorZ {
261 contents: CResult_TxCreationKeysDecodeErrorZPtr {
262 err: Box::into_raw(Box::new(e)),
267 /// Checks if the given object is currently in the success state
269 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
273 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
274 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
275 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
278 if unsafe { !(self.contents.result as *mut ()).is_null() } {
279 let _ = unsafe { Box::from_raw(self.contents.result) };
282 if unsafe { !(self.contents.err as *mut ()).is_null() } {
283 let _ = unsafe { Box::from_raw(self.contents.err) };
288 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
289 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
290 let contents = if o.result_ok {
291 let result = unsafe { o.contents.result };
292 unsafe { o.contents.result = core::ptr::null_mut() };
293 CResult_TxCreationKeysDecodeErrorZPtr { result }
295 let err = unsafe { o.contents.err };
296 unsafe { o.contents.err = core::ptr::null_mut(); }
297 CResult_TxCreationKeysDecodeErrorZPtr { err }
301 result_ok: o.result_ok,
305 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
306 fn clone(&self) -> Self {
308 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
309 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
312 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
313 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
319 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
320 /// but with all dynamically-allocated buffers duplicated in new buffers.
321 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
323 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
324 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
325 /// A pointer to the contents in the success state.
326 /// Reading from this pointer when `result_ok` is not set is undefined.
327 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
328 /// A pointer to the contents in the error state.
329 /// Reading from this pointer when `result_ok` is set is undefined.
330 pub err: *mut crate::lightning::ln::msgs::DecodeError,
333 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
334 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
336 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
337 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
338 /// `err` or `result` depending on the state of `result_ok`.
339 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
340 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
344 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
345 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
346 CResult_ChannelPublicKeysDecodeErrorZ {
347 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
348 result: Box::into_raw(Box::new(o)),
354 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
355 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
356 CResult_ChannelPublicKeysDecodeErrorZ {
357 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
358 err: Box::into_raw(Box::new(e)),
363 /// Checks if the given object is currently in the success state
365 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
369 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
370 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
371 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
374 if unsafe { !(self.contents.result as *mut ()).is_null() } {
375 let _ = unsafe { Box::from_raw(self.contents.result) };
378 if unsafe { !(self.contents.err as *mut ()).is_null() } {
379 let _ = unsafe { Box::from_raw(self.contents.err) };
384 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
385 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
386 let contents = if o.result_ok {
387 let result = unsafe { o.contents.result };
388 unsafe { o.contents.result = core::ptr::null_mut() };
389 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
391 let err = unsafe { o.contents.err };
392 unsafe { o.contents.err = core::ptr::null_mut(); }
393 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
397 result_ok: o.result_ok,
401 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
402 fn clone(&self) -> Self {
404 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
405 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
408 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
409 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
415 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
416 /// but with all dynamically-allocated buffers duplicated in new buffers.
417 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
420 /// An enum which can either contain a u32 or not
421 pub enum COption_u32Z {
422 /// When we're in this state, this COption_u32Z contains a u32
424 /// When we're in this state, this COption_u32Z contains nothing
428 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
429 if let Self::None = self { false } else { true }
431 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
434 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
435 if let Self::Some(v) = self { v } else { unreachable!() }
439 /// Constructs a new COption_u32Z containing a u32
440 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
441 COption_u32Z::Some(o)
444 /// Constructs a new COption_u32Z containing nothing
445 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
449 /// Frees any resources associated with the u32, if we are in the Some state
450 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
452 /// Creates a new COption_u32Z which has the same data as `orig`
453 /// but with all dynamically-allocated buffers duplicated in new buffers.
454 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
456 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
457 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
458 /// A pointer to the contents in the success state.
459 /// Reading from this pointer when `result_ok` is not set is undefined.
460 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
461 /// A pointer to the contents in the error state.
462 /// Reading from this pointer when `result_ok` is set is undefined.
463 pub err: *mut crate::lightning::ln::msgs::DecodeError,
466 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
467 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
469 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
470 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
471 /// `err` or `result` depending on the state of `result_ok`.
472 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
473 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
477 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
478 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
479 CResult_HTLCOutputInCommitmentDecodeErrorZ {
480 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
481 result: Box::into_raw(Box::new(o)),
487 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
488 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
489 CResult_HTLCOutputInCommitmentDecodeErrorZ {
490 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
491 err: Box::into_raw(Box::new(e)),
496 /// Checks if the given object is currently in the success state
498 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
502 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
503 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
504 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
507 if unsafe { !(self.contents.result as *mut ()).is_null() } {
508 let _ = unsafe { Box::from_raw(self.contents.result) };
511 if unsafe { !(self.contents.err as *mut ()).is_null() } {
512 let _ = unsafe { Box::from_raw(self.contents.err) };
517 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
518 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
519 let contents = if o.result_ok {
520 let result = unsafe { o.contents.result };
521 unsafe { o.contents.result = core::ptr::null_mut() };
522 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
524 let err = unsafe { o.contents.err };
525 unsafe { o.contents.err = core::ptr::null_mut(); }
526 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
530 result_ok: o.result_ok,
534 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
535 fn clone(&self) -> Self {
537 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
538 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
541 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
542 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
548 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
549 /// but with all dynamically-allocated buffers duplicated in new buffers.
550 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
552 /// An enum which can either contain a or not
553 pub enum COption_NoneZ {
554 /// When we're in this state, this COption_NoneZ contains a
556 /// When we're in this state, this COption_NoneZ contains nothing
560 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
561 if let Self::None = self { false } else { true }
563 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
568 /// Constructs a new COption_NoneZ containing a
569 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
573 /// Constructs a new COption_NoneZ containing nothing
574 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
578 /// Frees any resources associated with the , if we are in the Some state
579 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
581 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
582 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
583 /// A pointer to the contents in the success state.
584 /// Reading from this pointer when `result_ok` is not set is undefined.
585 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
586 /// A pointer to the contents in the error state.
587 /// Reading from this pointer when `result_ok` is set is undefined.
588 pub err: *mut crate::lightning::ln::msgs::DecodeError,
591 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
592 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
593 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
594 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
595 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
596 /// `err` or `result` depending on the state of `result_ok`.
597 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
598 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
602 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
603 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
604 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
605 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
606 result: Box::into_raw(Box::new(o)),
612 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
613 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
614 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
615 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
616 err: Box::into_raw(Box::new(e)),
621 /// Checks if the given object is currently in the success state
623 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
627 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
628 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
629 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
632 if unsafe { !(self.contents.result as *mut ()).is_null() } {
633 let _ = unsafe { Box::from_raw(self.contents.result) };
636 if unsafe { !(self.contents.err as *mut ()).is_null() } {
637 let _ = unsafe { Box::from_raw(self.contents.err) };
642 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
643 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
644 let contents = if o.result_ok {
645 let result = unsafe { o.contents.result };
646 unsafe { o.contents.result = core::ptr::null_mut() };
647 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
649 let err = unsafe { o.contents.err };
650 unsafe { o.contents.err = core::ptr::null_mut(); }
651 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
655 result_ok: o.result_ok,
659 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
660 fn clone(&self) -> Self {
662 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
663 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
666 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
667 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
673 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
674 /// but with all dynamically-allocated buffers duplicated in new buffers.
675 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
677 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
678 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
679 /// A pointer to the contents in the success state.
680 /// Reading from this pointer when `result_ok` is not set is undefined.
681 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
682 /// A pointer to the contents in the error state.
683 /// Reading from this pointer when `result_ok` is set is undefined.
684 pub err: *mut crate::lightning::ln::msgs::DecodeError,
687 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
688 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
689 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
690 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
691 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
692 /// `err` or `result` depending on the state of `result_ok`.
693 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
694 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
698 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
699 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
700 CResult_ChannelTransactionParametersDecodeErrorZ {
701 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
702 result: Box::into_raw(Box::new(o)),
708 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
709 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
710 CResult_ChannelTransactionParametersDecodeErrorZ {
711 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
712 err: Box::into_raw(Box::new(e)),
717 /// Checks if the given object is currently in the success state
719 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
723 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
724 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
725 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
728 if unsafe { !(self.contents.result as *mut ()).is_null() } {
729 let _ = unsafe { Box::from_raw(self.contents.result) };
732 if unsafe { !(self.contents.err as *mut ()).is_null() } {
733 let _ = unsafe { Box::from_raw(self.contents.err) };
738 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
739 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
740 let contents = if o.result_ok {
741 let result = unsafe { o.contents.result };
742 unsafe { o.contents.result = core::ptr::null_mut() };
743 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
745 let err = unsafe { o.contents.err };
746 unsafe { o.contents.err = core::ptr::null_mut(); }
747 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
751 result_ok: o.result_ok,
755 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
756 fn clone(&self) -> Self {
758 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
759 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
762 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
763 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
769 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
770 /// but with all dynamically-allocated buffers duplicated in new buffers.
771 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
773 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
774 /// This corresponds to std::vector in C++
775 pub struct CVec_SignatureZ {
776 /// The elements in the array.
777 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
778 pub data: *mut crate::c_types::Signature,
779 /// The number of elements pointed to by `data`.
782 impl CVec_SignatureZ {
783 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
784 if self.datalen == 0 { return Vec::new(); }
785 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
786 self.data = core::ptr::null_mut();
790 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
791 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
794 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
795 fn from(v: Vec<crate::c_types::Signature>) -> Self {
796 let datalen = v.len();
797 let data = Box::into_raw(v.into_boxed_slice());
798 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
802 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
803 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
804 impl Drop for CVec_SignatureZ {
806 if self.datalen == 0 { return; }
807 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
810 impl Clone for CVec_SignatureZ {
811 fn clone(&self) -> Self {
812 let mut res = Vec::new();
813 if self.datalen == 0 { return Self::from(res); }
814 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
819 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
820 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
821 /// A pointer to the contents in the success state.
822 /// Reading from this pointer when `result_ok` is not set is undefined.
823 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
824 /// A pointer to the contents in the error state.
825 /// Reading from this pointer when `result_ok` is set is undefined.
826 pub err: *mut crate::lightning::ln::msgs::DecodeError,
829 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
830 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
832 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
833 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
834 /// `err` or `result` depending on the state of `result_ok`.
835 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
836 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
840 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
841 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
842 CResult_HolderCommitmentTransactionDecodeErrorZ {
843 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
844 result: Box::into_raw(Box::new(o)),
850 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
851 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
852 CResult_HolderCommitmentTransactionDecodeErrorZ {
853 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
854 err: Box::into_raw(Box::new(e)),
859 /// Checks if the given object is currently in the success state
861 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
865 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
866 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
867 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
870 if unsafe { !(self.contents.result as *mut ()).is_null() } {
871 let _ = unsafe { Box::from_raw(self.contents.result) };
874 if unsafe { !(self.contents.err as *mut ()).is_null() } {
875 let _ = unsafe { Box::from_raw(self.contents.err) };
880 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
881 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
882 let contents = if o.result_ok {
883 let result = unsafe { o.contents.result };
884 unsafe { o.contents.result = core::ptr::null_mut() };
885 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
887 let err = unsafe { o.contents.err };
888 unsafe { o.contents.err = core::ptr::null_mut(); }
889 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
893 result_ok: o.result_ok,
897 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
898 fn clone(&self) -> Self {
900 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
901 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
904 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
905 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
911 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
912 /// but with all dynamically-allocated buffers duplicated in new buffers.
913 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
915 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
916 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
917 /// A pointer to the contents in the success state.
918 /// Reading from this pointer when `result_ok` is not set is undefined.
919 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
920 /// A pointer to the contents in the error state.
921 /// Reading from this pointer when `result_ok` is set is undefined.
922 pub err: *mut crate::lightning::ln::msgs::DecodeError,
925 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
926 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
928 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
929 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
930 /// `err` or `result` depending on the state of `result_ok`.
931 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
932 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
936 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
937 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
938 CResult_BuiltCommitmentTransactionDecodeErrorZ {
939 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
940 result: Box::into_raw(Box::new(o)),
946 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
947 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
948 CResult_BuiltCommitmentTransactionDecodeErrorZ {
949 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
950 err: Box::into_raw(Box::new(e)),
955 /// Checks if the given object is currently in the success state
957 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
961 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
962 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
963 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
966 if unsafe { !(self.contents.result as *mut ()).is_null() } {
967 let _ = unsafe { Box::from_raw(self.contents.result) };
970 if unsafe { !(self.contents.err as *mut ()).is_null() } {
971 let _ = unsafe { Box::from_raw(self.contents.err) };
976 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
977 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
978 let contents = if o.result_ok {
979 let result = unsafe { o.contents.result };
980 unsafe { o.contents.result = core::ptr::null_mut() };
981 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
983 let err = unsafe { o.contents.err };
984 unsafe { o.contents.err = core::ptr::null_mut(); }
985 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
989 result_ok: o.result_ok,
993 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
994 fn clone(&self) -> Self {
996 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
997 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1000 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1001 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1007 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1008 /// but with all dynamically-allocated buffers duplicated in new buffers.
1009 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1011 /// The contents of CResult_TrustedClosingTransactionNoneZ
1012 pub union CResult_TrustedClosingTransactionNoneZPtr {
1013 /// A pointer to the contents in the success state.
1014 /// Reading from this pointer when `result_ok` is not set is undefined.
1015 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1016 /// Note that this value is always NULL, as there are no contents in the Err variant
1017 pub err: *mut core::ffi::c_void,
1020 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1021 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1023 pub struct CResult_TrustedClosingTransactionNoneZ {
1024 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1025 /// `err` or `result` depending on the state of `result_ok`.
1026 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1027 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1028 pub result_ok: bool,
1031 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1032 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1033 CResult_TrustedClosingTransactionNoneZ {
1034 contents: CResult_TrustedClosingTransactionNoneZPtr {
1035 result: Box::into_raw(Box::new(o)),
1041 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1042 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1043 CResult_TrustedClosingTransactionNoneZ {
1044 contents: CResult_TrustedClosingTransactionNoneZPtr {
1045 err: core::ptr::null_mut(),
1050 /// Checks if the given object is currently in the success state
1052 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1056 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1057 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1058 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1059 fn drop(&mut self) {
1061 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1062 let _ = unsafe { Box::from_raw(self.contents.result) };
1068 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1069 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1070 let contents = if o.result_ok {
1071 let result = unsafe { o.contents.result };
1072 unsafe { o.contents.result = core::ptr::null_mut() };
1073 CResult_TrustedClosingTransactionNoneZPtr { result }
1075 let _ = unsafe { Box::from_raw(o.contents.err) };
1076 o.contents.err = core::ptr::null_mut();
1077 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1081 result_ok: o.result_ok,
1086 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1087 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1088 /// A pointer to the contents in the success state.
1089 /// Reading from this pointer when `result_ok` is not set is undefined.
1090 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1091 /// A pointer to the contents in the error state.
1092 /// Reading from this pointer when `result_ok` is set is undefined.
1093 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1096 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1097 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1099 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1100 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1101 /// `err` or `result` depending on the state of `result_ok`.
1102 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1103 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1104 pub result_ok: bool,
1107 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1108 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1109 CResult_CommitmentTransactionDecodeErrorZ {
1110 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1111 result: Box::into_raw(Box::new(o)),
1117 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1118 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1119 CResult_CommitmentTransactionDecodeErrorZ {
1120 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1121 err: Box::into_raw(Box::new(e)),
1126 /// Checks if the given object is currently in the success state
1128 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1132 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1133 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1134 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1135 fn drop(&mut self) {
1137 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1138 let _ = unsafe { Box::from_raw(self.contents.result) };
1141 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1142 let _ = unsafe { Box::from_raw(self.contents.err) };
1147 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1148 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1149 let contents = if o.result_ok {
1150 let result = unsafe { o.contents.result };
1151 unsafe { o.contents.result = core::ptr::null_mut() };
1152 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1154 let err = unsafe { o.contents.err };
1155 unsafe { o.contents.err = core::ptr::null_mut(); }
1156 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1160 result_ok: o.result_ok,
1164 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1165 fn clone(&self) -> Self {
1167 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1168 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1171 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1172 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1178 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1179 /// but with all dynamically-allocated buffers duplicated in new buffers.
1180 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1182 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1183 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1184 /// A pointer to the contents in the success state.
1185 /// Reading from this pointer when `result_ok` is not set is undefined.
1186 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1187 /// Note that this value is always NULL, as there are no contents in the Err variant
1188 pub err: *mut core::ffi::c_void,
1191 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1192 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1193 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1194 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1195 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1196 /// `err` or `result` depending on the state of `result_ok`.
1197 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1198 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1199 pub result_ok: bool,
1202 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1203 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1204 CResult_TrustedCommitmentTransactionNoneZ {
1205 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1206 result: Box::into_raw(Box::new(o)),
1212 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1213 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1214 CResult_TrustedCommitmentTransactionNoneZ {
1215 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1216 err: core::ptr::null_mut(),
1221 /// Checks if the given object is currently in the success state
1223 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1227 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1228 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1229 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1230 fn drop(&mut self) {
1232 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1233 let _ = unsafe { Box::from_raw(self.contents.result) };
1239 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1240 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1241 let contents = if o.result_ok {
1242 let result = unsafe { o.contents.result };
1243 unsafe { o.contents.result = core::ptr::null_mut() };
1244 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1246 let _ = unsafe { Box::from_raw(o.contents.err) };
1247 o.contents.err = core::ptr::null_mut();
1248 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1252 result_ok: o.result_ok,
1257 /// The contents of CResult_CVec_SignatureZNoneZ
1258 pub union CResult_CVec_SignatureZNoneZPtr {
1259 /// A pointer to the contents in the success state.
1260 /// Reading from this pointer when `result_ok` is not set is undefined.
1261 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1262 /// Note that this value is always NULL, as there are no contents in the Err variant
1263 pub err: *mut core::ffi::c_void,
1266 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1267 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1268 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1269 pub struct CResult_CVec_SignatureZNoneZ {
1270 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1271 /// `err` or `result` depending on the state of `result_ok`.
1272 pub contents: CResult_CVec_SignatureZNoneZPtr,
1273 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1274 pub result_ok: bool,
1277 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1278 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1279 CResult_CVec_SignatureZNoneZ {
1280 contents: CResult_CVec_SignatureZNoneZPtr {
1281 result: Box::into_raw(Box::new(o)),
1287 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1288 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1289 CResult_CVec_SignatureZNoneZ {
1290 contents: CResult_CVec_SignatureZNoneZPtr {
1291 err: core::ptr::null_mut(),
1296 /// Checks if the given object is currently in the success state
1298 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1302 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1303 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1304 impl Drop for CResult_CVec_SignatureZNoneZ {
1305 fn drop(&mut self) {
1307 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1308 let _ = unsafe { Box::from_raw(self.contents.result) };
1314 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1315 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1316 let contents = if o.result_ok {
1317 let result = unsafe { o.contents.result };
1318 unsafe { o.contents.result = core::ptr::null_mut() };
1319 CResult_CVec_SignatureZNoneZPtr { result }
1321 let _ = unsafe { Box::from_raw(o.contents.err) };
1322 o.contents.err = core::ptr::null_mut();
1323 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1327 result_ok: o.result_ok,
1331 impl Clone for CResult_CVec_SignatureZNoneZ {
1332 fn clone(&self) -> Self {
1334 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1335 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1338 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1339 err: core::ptr::null_mut()
1345 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1346 /// but with all dynamically-allocated buffers duplicated in new buffers.
1347 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1349 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1350 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1351 /// A pointer to the contents in the success state.
1352 /// Reading from this pointer when `result_ok` is not set is undefined.
1353 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1354 /// A pointer to the contents in the error state.
1355 /// Reading from this pointer when `result_ok` is set is undefined.
1356 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1359 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1360 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1362 pub struct CResult_ShutdownScriptDecodeErrorZ {
1363 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1364 /// `err` or `result` depending on the state of `result_ok`.
1365 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1366 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1367 pub result_ok: bool,
1370 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1371 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1372 CResult_ShutdownScriptDecodeErrorZ {
1373 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1374 result: Box::into_raw(Box::new(o)),
1380 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1381 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1382 CResult_ShutdownScriptDecodeErrorZ {
1383 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1384 err: Box::into_raw(Box::new(e)),
1389 /// Checks if the given object is currently in the success state
1391 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1395 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1396 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1397 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1398 fn drop(&mut self) {
1400 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1401 let _ = unsafe { Box::from_raw(self.contents.result) };
1404 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1405 let _ = unsafe { Box::from_raw(self.contents.err) };
1410 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1411 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1412 let contents = if o.result_ok {
1413 let result = unsafe { o.contents.result };
1414 unsafe { o.contents.result = core::ptr::null_mut() };
1415 CResult_ShutdownScriptDecodeErrorZPtr { result }
1417 let err = unsafe { o.contents.err };
1418 unsafe { o.contents.err = core::ptr::null_mut(); }
1419 CResult_ShutdownScriptDecodeErrorZPtr { err }
1423 result_ok: o.result_ok,
1427 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1428 fn clone(&self) -> Self {
1430 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1431 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1434 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1435 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1441 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1442 /// but with all dynamically-allocated buffers duplicated in new buffers.
1443 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1445 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1446 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1447 /// A pointer to the contents in the success state.
1448 /// Reading from this pointer when `result_ok` is not set is undefined.
1449 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1450 /// A pointer to the contents in the error state.
1451 /// Reading from this pointer when `result_ok` is set is undefined.
1452 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1455 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1456 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1457 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1458 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1459 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1460 /// `err` or `result` depending on the state of `result_ok`.
1461 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1462 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1463 pub result_ok: bool,
1466 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1467 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1468 CResult_ShutdownScriptInvalidShutdownScriptZ {
1469 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1470 result: Box::into_raw(Box::new(o)),
1476 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1477 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1478 CResult_ShutdownScriptInvalidShutdownScriptZ {
1479 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1480 err: Box::into_raw(Box::new(e)),
1485 /// Checks if the given object is currently in the success state
1487 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1491 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1492 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1493 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1494 fn drop(&mut self) {
1496 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1497 let _ = unsafe { Box::from_raw(self.contents.result) };
1500 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1501 let _ = unsafe { Box::from_raw(self.contents.err) };
1506 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1507 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1508 let contents = if o.result_ok {
1509 let result = unsafe { o.contents.result };
1510 unsafe { o.contents.result = core::ptr::null_mut() };
1511 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1513 let err = unsafe { o.contents.err };
1514 unsafe { o.contents.err = core::ptr::null_mut(); }
1515 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1519 result_ok: o.result_ok,
1523 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1524 fn clone(&self) -> Self {
1526 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1527 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1530 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1531 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1537 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1538 /// but with all dynamically-allocated buffers duplicated in new buffers.
1539 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1541 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
1542 /// This corresponds to std::vector in C++
1543 pub struct CVec_PublicKeyZ {
1544 /// The elements in the array.
1545 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1546 pub data: *mut crate::c_types::PublicKey,
1547 /// The number of elements pointed to by `data`.
1550 impl CVec_PublicKeyZ {
1551 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
1552 if self.datalen == 0 { return Vec::new(); }
1553 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1554 self.data = core::ptr::null_mut();
1558 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
1559 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1562 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
1563 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
1564 let datalen = v.len();
1565 let data = Box::into_raw(v.into_boxed_slice());
1566 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1570 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1571 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
1572 impl Drop for CVec_PublicKeyZ {
1573 fn drop(&mut self) {
1574 if self.datalen == 0 { return; }
1575 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1578 impl Clone for CVec_PublicKeyZ {
1579 fn clone(&self) -> Self {
1580 let mut res = Vec::new();
1581 if self.datalen == 0 { return Self::from(res); }
1582 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1587 /// The contents of CResult_BlindedPathNoneZ
1588 pub union CResult_BlindedPathNoneZPtr {
1589 /// A pointer to the contents in the success state.
1590 /// Reading from this pointer when `result_ok` is not set is undefined.
1591 pub result: *mut crate::lightning::onion_message::blinded_path::BlindedPath,
1592 /// Note that this value is always NULL, as there are no contents in the Err variant
1593 pub err: *mut core::ffi::c_void,
1596 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
1597 /// containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a () on failure.
1598 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1599 pub struct CResult_BlindedPathNoneZ {
1600 /// The contents of this CResult_BlindedPathNoneZ, accessible via either
1601 /// `err` or `result` depending on the state of `result_ok`.
1602 pub contents: CResult_BlindedPathNoneZPtr,
1603 /// Whether this CResult_BlindedPathNoneZ represents a success state.
1604 pub result_ok: bool,
1607 /// Creates a new CResult_BlindedPathNoneZ in the success state.
1608 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
1609 CResult_BlindedPathNoneZ {
1610 contents: CResult_BlindedPathNoneZPtr {
1611 result: Box::into_raw(Box::new(o)),
1617 /// Creates a new CResult_BlindedPathNoneZ in the error state.
1618 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
1619 CResult_BlindedPathNoneZ {
1620 contents: CResult_BlindedPathNoneZPtr {
1621 err: core::ptr::null_mut(),
1626 /// Checks if the given object is currently in the success state
1628 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
1632 /// Frees any resources used by the CResult_BlindedPathNoneZ.
1633 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
1634 impl Drop for CResult_BlindedPathNoneZ {
1635 fn drop(&mut self) {
1637 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1638 let _ = unsafe { Box::from_raw(self.contents.result) };
1644 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
1645 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, ()>) -> Self {
1646 let contents = if o.result_ok {
1647 let result = unsafe { o.contents.result };
1648 unsafe { o.contents.result = core::ptr::null_mut() };
1649 CResult_BlindedPathNoneZPtr { result }
1651 let _ = unsafe { Box::from_raw(o.contents.err) };
1652 o.contents.err = core::ptr::null_mut();
1653 CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
1657 result_ok: o.result_ok,
1661 impl Clone for CResult_BlindedPathNoneZ {
1662 fn clone(&self) -> Self {
1664 Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
1665 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
1668 Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
1669 err: core::ptr::null_mut()
1675 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
1676 /// but with all dynamically-allocated buffers duplicated in new buffers.
1677 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
1679 /// The contents of CResult_BlindedPathDecodeErrorZ
1680 pub union CResult_BlindedPathDecodeErrorZPtr {
1681 /// A pointer to the contents in the success state.
1682 /// Reading from this pointer when `result_ok` is not set is undefined.
1683 pub result: *mut crate::lightning::onion_message::blinded_path::BlindedPath,
1684 /// A pointer to the contents in the error state.
1685 /// Reading from this pointer when `result_ok` is set is undefined.
1686 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1689 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
1690 /// containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
1691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1692 pub struct CResult_BlindedPathDecodeErrorZ {
1693 /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
1694 /// `err` or `result` depending on the state of `result_ok`.
1695 pub contents: CResult_BlindedPathDecodeErrorZPtr,
1696 /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
1697 pub result_ok: bool,
1700 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
1701 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
1702 CResult_BlindedPathDecodeErrorZ {
1703 contents: CResult_BlindedPathDecodeErrorZPtr {
1704 result: Box::into_raw(Box::new(o)),
1710 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
1711 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
1712 CResult_BlindedPathDecodeErrorZ {
1713 contents: CResult_BlindedPathDecodeErrorZPtr {
1714 err: Box::into_raw(Box::new(e)),
1719 /// Checks if the given object is currently in the success state
1721 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
1725 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
1726 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
1727 impl Drop for CResult_BlindedPathDecodeErrorZ {
1728 fn drop(&mut self) {
1730 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1731 let _ = unsafe { Box::from_raw(self.contents.result) };
1734 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1735 let _ = unsafe { Box::from_raw(self.contents.err) };
1740 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
1741 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
1742 let contents = if o.result_ok {
1743 let result = unsafe { o.contents.result };
1744 unsafe { o.contents.result = core::ptr::null_mut() };
1745 CResult_BlindedPathDecodeErrorZPtr { result }
1747 let err = unsafe { o.contents.err };
1748 unsafe { o.contents.err = core::ptr::null_mut(); }
1749 CResult_BlindedPathDecodeErrorZPtr { err }
1753 result_ok: o.result_ok,
1757 impl Clone for CResult_BlindedPathDecodeErrorZ {
1758 fn clone(&self) -> Self {
1760 Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
1761 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
1764 Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
1765 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1771 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
1772 /// but with all dynamically-allocated buffers duplicated in new buffers.
1773 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
1775 /// The contents of CResult_BlindedHopDecodeErrorZ
1776 pub union CResult_BlindedHopDecodeErrorZPtr {
1777 /// A pointer to the contents in the success state.
1778 /// Reading from this pointer when `result_ok` is not set is undefined.
1779 pub result: *mut crate::lightning::onion_message::blinded_path::BlindedHop,
1780 /// A pointer to the contents in the error state.
1781 /// Reading from this pointer when `result_ok` is set is undefined.
1782 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1785 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
1786 /// containing a crate::lightning::onion_message::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1787 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1788 pub struct CResult_BlindedHopDecodeErrorZ {
1789 /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
1790 /// `err` or `result` depending on the state of `result_ok`.
1791 pub contents: CResult_BlindedHopDecodeErrorZPtr,
1792 /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
1793 pub result_ok: bool,
1796 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
1797 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
1798 CResult_BlindedHopDecodeErrorZ {
1799 contents: CResult_BlindedHopDecodeErrorZPtr {
1800 result: Box::into_raw(Box::new(o)),
1806 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
1807 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
1808 CResult_BlindedHopDecodeErrorZ {
1809 contents: CResult_BlindedHopDecodeErrorZPtr {
1810 err: Box::into_raw(Box::new(e)),
1815 /// Checks if the given object is currently in the success state
1817 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
1821 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
1822 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
1823 impl Drop for CResult_BlindedHopDecodeErrorZ {
1824 fn drop(&mut self) {
1826 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1827 let _ = unsafe { Box::from_raw(self.contents.result) };
1830 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1831 let _ = unsafe { Box::from_raw(self.contents.err) };
1836 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
1837 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1838 let contents = if o.result_ok {
1839 let result = unsafe { o.contents.result };
1840 unsafe { o.contents.result = core::ptr::null_mut() };
1841 CResult_BlindedHopDecodeErrorZPtr { result }
1843 let err = unsafe { o.contents.err };
1844 unsafe { o.contents.err = core::ptr::null_mut(); }
1845 CResult_BlindedHopDecodeErrorZPtr { err }
1849 result_ok: o.result_ok,
1853 impl Clone for CResult_BlindedHopDecodeErrorZ {
1854 fn clone(&self) -> Self {
1856 Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
1857 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
1860 Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
1861 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1867 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
1868 /// but with all dynamically-allocated buffers duplicated in new buffers.
1869 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
1871 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
1872 pub enum COption_WriteableScoreZ {
1873 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
1874 Some(crate::lightning::routing::scoring::WriteableScore),
1875 /// When we're in this state, this COption_WriteableScoreZ contains nothing
1878 impl COption_WriteableScoreZ {
1879 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1880 if let Self::None = self { false } else { true }
1882 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1885 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
1886 if let Self::Some(v) = self { v } else { unreachable!() }
1890 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
1891 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
1892 COption_WriteableScoreZ::Some(o)
1895 /// Constructs a new COption_WriteableScoreZ containing nothing
1896 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
1897 COption_WriteableScoreZ::None
1900 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
1901 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
1903 /// The contents of CResult_NoneErrorZ
1904 pub union CResult_NoneErrorZPtr {
1905 /// Note that this value is always NULL, as there are no contents in the OK variant
1906 pub result: *mut core::ffi::c_void,
1907 /// A pointer to the contents in the error state.
1908 /// Reading from this pointer when `result_ok` is set is undefined.
1909 pub err: *mut crate::c_types::IOError,
1912 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1913 /// containing a () on success and a crate::c_types::IOError on failure.
1914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1915 pub struct CResult_NoneErrorZ {
1916 /// The contents of this CResult_NoneErrorZ, accessible via either
1917 /// `err` or `result` depending on the state of `result_ok`.
1918 pub contents: CResult_NoneErrorZPtr,
1919 /// Whether this CResult_NoneErrorZ represents a success state.
1920 pub result_ok: bool,
1923 /// Creates a new CResult_NoneErrorZ in the success state.
1924 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1925 CResult_NoneErrorZ {
1926 contents: CResult_NoneErrorZPtr {
1927 result: core::ptr::null_mut(),
1933 /// Creates a new CResult_NoneErrorZ in the error state.
1934 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1935 CResult_NoneErrorZ {
1936 contents: CResult_NoneErrorZPtr {
1937 err: Box::into_raw(Box::new(e)),
1942 /// Checks if the given object is currently in the success state
1944 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1948 /// Frees any resources used by the CResult_NoneErrorZ.
1949 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1950 impl Drop for CResult_NoneErrorZ {
1951 fn drop(&mut self) {
1954 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1955 let _ = unsafe { Box::from_raw(self.contents.err) };
1960 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1961 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1962 let contents = if o.result_ok {
1963 let _ = unsafe { Box::from_raw(o.contents.result) };
1964 o.contents.result = core::ptr::null_mut();
1965 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1967 let err = unsafe { o.contents.err };
1968 unsafe { o.contents.err = core::ptr::null_mut(); }
1969 CResult_NoneErrorZPtr { err }
1973 result_ok: o.result_ok,
1977 impl Clone for CResult_NoneErrorZ {
1978 fn clone(&self) -> Self {
1980 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1981 result: core::ptr::null_mut()
1984 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1985 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1991 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1992 /// but with all dynamically-allocated buffers duplicated in new buffers.
1993 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1995 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1996 /// This corresponds to std::vector in C++
1997 pub struct CVec_ChannelDetailsZ {
1998 /// The elements in the array.
1999 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2000 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2001 /// The number of elements pointed to by `data`.
2004 impl CVec_ChannelDetailsZ {
2005 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2006 if self.datalen == 0 { return Vec::new(); }
2007 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2008 self.data = core::ptr::null_mut();
2012 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2013 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2016 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2017 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2018 let datalen = v.len();
2019 let data = Box::into_raw(v.into_boxed_slice());
2020 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2024 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2025 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2026 impl Drop for CVec_ChannelDetailsZ {
2027 fn drop(&mut self) {
2028 if self.datalen == 0 { return; }
2029 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2032 impl Clone for CVec_ChannelDetailsZ {
2033 fn clone(&self) -> Self {
2034 let mut res = Vec::new();
2035 if self.datalen == 0 { return Self::from(res); }
2036 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2041 /// The contents of CResult_RouteLightningErrorZ
2042 pub union CResult_RouteLightningErrorZPtr {
2043 /// A pointer to the contents in the success state.
2044 /// Reading from this pointer when `result_ok` is not set is undefined.
2045 pub result: *mut crate::lightning::routing::router::Route,
2046 /// A pointer to the contents in the error state.
2047 /// Reading from this pointer when `result_ok` is set is undefined.
2048 pub err: *mut crate::lightning::ln::msgs::LightningError,
2051 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2052 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2053 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2054 pub struct CResult_RouteLightningErrorZ {
2055 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2056 /// `err` or `result` depending on the state of `result_ok`.
2057 pub contents: CResult_RouteLightningErrorZPtr,
2058 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2059 pub result_ok: bool,
2062 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2063 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2064 CResult_RouteLightningErrorZ {
2065 contents: CResult_RouteLightningErrorZPtr {
2066 result: Box::into_raw(Box::new(o)),
2072 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2073 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2074 CResult_RouteLightningErrorZ {
2075 contents: CResult_RouteLightningErrorZPtr {
2076 err: Box::into_raw(Box::new(e)),
2081 /// Checks if the given object is currently in the success state
2083 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2087 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2088 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2089 impl Drop for CResult_RouteLightningErrorZ {
2090 fn drop(&mut self) {
2092 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2093 let _ = unsafe { Box::from_raw(self.contents.result) };
2096 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2097 let _ = unsafe { Box::from_raw(self.contents.err) };
2102 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2103 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2104 let contents = if o.result_ok {
2105 let result = unsafe { o.contents.result };
2106 unsafe { o.contents.result = core::ptr::null_mut() };
2107 CResult_RouteLightningErrorZPtr { result }
2109 let err = unsafe { o.contents.err };
2110 unsafe { o.contents.err = core::ptr::null_mut(); }
2111 CResult_RouteLightningErrorZPtr { err }
2115 result_ok: o.result_ok,
2119 impl Clone for CResult_RouteLightningErrorZ {
2120 fn clone(&self) -> Self {
2122 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2123 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2126 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2127 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2133 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2134 /// but with all dynamically-allocated buffers duplicated in new buffers.
2135 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2137 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2138 /// This corresponds to std::vector in C++
2139 pub struct CVec_RouteHopZ {
2140 /// The elements in the array.
2141 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2142 pub data: *mut crate::lightning::routing::router::RouteHop,
2143 /// The number of elements pointed to by `data`.
2146 impl CVec_RouteHopZ {
2147 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2148 if self.datalen == 0 { return Vec::new(); }
2149 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2150 self.data = core::ptr::null_mut();
2154 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2155 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2158 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2159 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2160 let datalen = v.len();
2161 let data = Box::into_raw(v.into_boxed_slice());
2162 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2166 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2167 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2168 impl Drop for CVec_RouteHopZ {
2169 fn drop(&mut self) {
2170 if self.datalen == 0 { return; }
2171 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2174 impl Clone for CVec_RouteHopZ {
2175 fn clone(&self) -> Self {
2176 let mut res = Vec::new();
2177 if self.datalen == 0 { return Self::from(res); }
2178 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2184 /// An enum which can either contain a u64 or not
2185 pub enum COption_u64Z {
2186 /// When we're in this state, this COption_u64Z contains a u64
2188 /// When we're in this state, this COption_u64Z contains nothing
2192 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2193 if let Self::None = self { false } else { true }
2195 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2198 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2199 if let Self::Some(v) = self { v } else { unreachable!() }
2203 /// Constructs a new COption_u64Z containing a u64
2204 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2205 COption_u64Z::Some(o)
2208 /// Constructs a new COption_u64Z containing nothing
2209 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2213 /// Frees any resources associated with the u64, if we are in the Some state
2214 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2216 /// Creates a new COption_u64Z which has the same data as `orig`
2217 /// but with all dynamically-allocated buffers duplicated in new buffers.
2218 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2220 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
2221 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
2222 /// A pointer to the contents in the success state.
2223 /// Reading from this pointer when `result_ok` is not set is undefined.
2224 pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
2225 /// A pointer to the contents in the error state.
2226 /// Reading from this pointer when `result_ok` is set is undefined.
2227 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2230 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2231 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2233 pub struct CResult_InFlightHtlcsDecodeErrorZ {
2234 /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
2235 /// `err` or `result` depending on the state of `result_ok`.
2236 pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
2237 /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
2238 pub result_ok: bool,
2241 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
2242 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
2243 CResult_InFlightHtlcsDecodeErrorZ {
2244 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2245 result: Box::into_raw(Box::new(o)),
2251 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
2252 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
2253 CResult_InFlightHtlcsDecodeErrorZ {
2254 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2255 err: Box::into_raw(Box::new(e)),
2260 /// Checks if the given object is currently in the success state
2262 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
2266 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
2267 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
2268 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
2269 fn drop(&mut self) {
2271 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2272 let _ = unsafe { Box::from_raw(self.contents.result) };
2275 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2276 let _ = unsafe { Box::from_raw(self.contents.err) };
2281 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
2282 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
2283 let contents = if o.result_ok {
2284 let result = unsafe { o.contents.result };
2285 unsafe { o.contents.result = core::ptr::null_mut() };
2286 CResult_InFlightHtlcsDecodeErrorZPtr { result }
2288 let err = unsafe { o.contents.err };
2289 unsafe { o.contents.err = core::ptr::null_mut(); }
2290 CResult_InFlightHtlcsDecodeErrorZPtr { err }
2294 result_ok: o.result_ok,
2298 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
2299 fn clone(&self) -> Self {
2301 Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2302 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
2305 Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2306 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2312 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
2313 /// but with all dynamically-allocated buffers duplicated in new buffers.
2314 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
2316 /// The contents of CResult_RouteHopDecodeErrorZ
2317 pub union CResult_RouteHopDecodeErrorZPtr {
2318 /// A pointer to the contents in the success state.
2319 /// Reading from this pointer when `result_ok` is not set is undefined.
2320 pub result: *mut crate::lightning::routing::router::RouteHop,
2321 /// A pointer to the contents in the error state.
2322 /// Reading from this pointer when `result_ok` is set is undefined.
2323 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2326 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2327 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2328 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2329 pub struct CResult_RouteHopDecodeErrorZ {
2330 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2331 /// `err` or `result` depending on the state of `result_ok`.
2332 pub contents: CResult_RouteHopDecodeErrorZPtr,
2333 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2334 pub result_ok: bool,
2337 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
2338 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
2339 CResult_RouteHopDecodeErrorZ {
2340 contents: CResult_RouteHopDecodeErrorZPtr {
2341 result: Box::into_raw(Box::new(o)),
2347 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
2348 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
2349 CResult_RouteHopDecodeErrorZ {
2350 contents: CResult_RouteHopDecodeErrorZPtr {
2351 err: Box::into_raw(Box::new(e)),
2356 /// Checks if the given object is currently in the success state
2358 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
2362 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
2363 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
2364 impl Drop for CResult_RouteHopDecodeErrorZ {
2365 fn drop(&mut self) {
2367 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2368 let _ = unsafe { Box::from_raw(self.contents.result) };
2371 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2372 let _ = unsafe { Box::from_raw(self.contents.err) };
2377 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
2378 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2379 let contents = if o.result_ok {
2380 let result = unsafe { o.contents.result };
2381 unsafe { o.contents.result = core::ptr::null_mut() };
2382 CResult_RouteHopDecodeErrorZPtr { result }
2384 let err = unsafe { o.contents.err };
2385 unsafe { o.contents.err = core::ptr::null_mut(); }
2386 CResult_RouteHopDecodeErrorZPtr { err }
2390 result_ok: o.result_ok,
2394 impl Clone for CResult_RouteHopDecodeErrorZ {
2395 fn clone(&self) -> Self {
2397 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2398 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2401 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2402 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2408 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2409 /// but with all dynamically-allocated buffers duplicated in new buffers.
2410 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2412 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2413 /// This corresponds to std::vector in C++
2414 pub struct CVec_CVec_RouteHopZZ {
2415 /// The elements in the array.
2416 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2417 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2418 /// The number of elements pointed to by `data`.
2421 impl CVec_CVec_RouteHopZZ {
2422 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2423 if self.datalen == 0 { return Vec::new(); }
2424 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2425 self.data = core::ptr::null_mut();
2429 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2430 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2433 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2434 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2435 let datalen = v.len();
2436 let data = Box::into_raw(v.into_boxed_slice());
2437 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2441 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2442 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2443 impl Drop for CVec_CVec_RouteHopZZ {
2444 fn drop(&mut self) {
2445 if self.datalen == 0 { return; }
2446 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2449 impl Clone for CVec_CVec_RouteHopZZ {
2450 fn clone(&self) -> Self {
2451 let mut res = Vec::new();
2452 if self.datalen == 0 { return Self::from(res); }
2453 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2458 /// The contents of CResult_RouteDecodeErrorZ
2459 pub union CResult_RouteDecodeErrorZPtr {
2460 /// A pointer to the contents in the success state.
2461 /// Reading from this pointer when `result_ok` is not set is undefined.
2462 pub result: *mut crate::lightning::routing::router::Route,
2463 /// A pointer to the contents in the error state.
2464 /// Reading from this pointer when `result_ok` is set is undefined.
2465 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2468 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2469 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2471 pub struct CResult_RouteDecodeErrorZ {
2472 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2473 /// `err` or `result` depending on the state of `result_ok`.
2474 pub contents: CResult_RouteDecodeErrorZPtr,
2475 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2476 pub result_ok: bool,
2479 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2480 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2481 CResult_RouteDecodeErrorZ {
2482 contents: CResult_RouteDecodeErrorZPtr {
2483 result: Box::into_raw(Box::new(o)),
2489 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2490 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2491 CResult_RouteDecodeErrorZ {
2492 contents: CResult_RouteDecodeErrorZPtr {
2493 err: Box::into_raw(Box::new(e)),
2498 /// Checks if the given object is currently in the success state
2500 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2504 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2505 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2506 impl Drop for CResult_RouteDecodeErrorZ {
2507 fn drop(&mut self) {
2509 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2510 let _ = unsafe { Box::from_raw(self.contents.result) };
2513 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2514 let _ = unsafe { Box::from_raw(self.contents.err) };
2519 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2520 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2521 let contents = if o.result_ok {
2522 let result = unsafe { o.contents.result };
2523 unsafe { o.contents.result = core::ptr::null_mut() };
2524 CResult_RouteDecodeErrorZPtr { result }
2526 let err = unsafe { o.contents.err };
2527 unsafe { o.contents.err = core::ptr::null_mut(); }
2528 CResult_RouteDecodeErrorZPtr { err }
2532 result_ok: o.result_ok,
2536 impl Clone for CResult_RouteDecodeErrorZ {
2537 fn clone(&self) -> Self {
2539 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2540 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2543 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2544 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2550 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2551 /// but with all dynamically-allocated buffers duplicated in new buffers.
2552 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2554 /// The contents of CResult_RouteParametersDecodeErrorZ
2555 pub union CResult_RouteParametersDecodeErrorZPtr {
2556 /// A pointer to the contents in the success state.
2557 /// Reading from this pointer when `result_ok` is not set is undefined.
2558 pub result: *mut crate::lightning::routing::router::RouteParameters,
2559 /// A pointer to the contents in the error state.
2560 /// Reading from this pointer when `result_ok` is set is undefined.
2561 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2564 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2565 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2567 pub struct CResult_RouteParametersDecodeErrorZ {
2568 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2569 /// `err` or `result` depending on the state of `result_ok`.
2570 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2571 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2572 pub result_ok: bool,
2575 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2576 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2577 CResult_RouteParametersDecodeErrorZ {
2578 contents: CResult_RouteParametersDecodeErrorZPtr {
2579 result: Box::into_raw(Box::new(o)),
2585 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2586 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2587 CResult_RouteParametersDecodeErrorZ {
2588 contents: CResult_RouteParametersDecodeErrorZPtr {
2589 err: Box::into_raw(Box::new(e)),
2594 /// Checks if the given object is currently in the success state
2596 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2600 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2601 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2602 impl Drop for CResult_RouteParametersDecodeErrorZ {
2603 fn drop(&mut self) {
2605 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2606 let _ = unsafe { Box::from_raw(self.contents.result) };
2609 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2610 let _ = unsafe { Box::from_raw(self.contents.err) };
2615 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2616 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2617 let contents = if o.result_ok {
2618 let result = unsafe { o.contents.result };
2619 unsafe { o.contents.result = core::ptr::null_mut() };
2620 CResult_RouteParametersDecodeErrorZPtr { result }
2622 let err = unsafe { o.contents.err };
2623 unsafe { o.contents.err = core::ptr::null_mut(); }
2624 CResult_RouteParametersDecodeErrorZPtr { err }
2628 result_ok: o.result_ok,
2632 impl Clone for CResult_RouteParametersDecodeErrorZ {
2633 fn clone(&self) -> Self {
2635 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2636 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2639 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2640 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2646 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2647 /// but with all dynamically-allocated buffers duplicated in new buffers.
2648 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2650 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2651 /// This corresponds to std::vector in C++
2652 pub struct CVec_RouteHintZ {
2653 /// The elements in the array.
2654 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2655 pub data: *mut crate::lightning::routing::router::RouteHint,
2656 /// The number of elements pointed to by `data`.
2659 impl CVec_RouteHintZ {
2660 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2661 if self.datalen == 0 { return Vec::new(); }
2662 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2663 self.data = core::ptr::null_mut();
2667 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2668 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2671 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2672 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2673 let datalen = v.len();
2674 let data = Box::into_raw(v.into_boxed_slice());
2675 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2679 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2680 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2681 impl Drop for CVec_RouteHintZ {
2682 fn drop(&mut self) {
2683 if self.datalen == 0 { return; }
2684 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2687 impl Clone for CVec_RouteHintZ {
2688 fn clone(&self) -> Self {
2689 let mut res = Vec::new();
2690 if self.datalen == 0 { return Self::from(res); }
2691 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2696 /// A dynamically-allocated array of u64s of arbitrary size.
2697 /// This corresponds to std::vector in C++
2698 pub struct CVec_u64Z {
2699 /// The elements in the array.
2700 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2702 /// The number of elements pointed to by `data`.
2706 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2707 if self.datalen == 0 { return Vec::new(); }
2708 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2709 self.data = core::ptr::null_mut();
2713 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2714 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2717 impl From<Vec<u64>> for CVec_u64Z {
2718 fn from(v: Vec<u64>) -> Self {
2719 let datalen = v.len();
2720 let data = Box::into_raw(v.into_boxed_slice());
2721 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2725 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2726 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2727 impl Drop for CVec_u64Z {
2728 fn drop(&mut self) {
2729 if self.datalen == 0 { return; }
2730 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2733 impl Clone for CVec_u64Z {
2734 fn clone(&self) -> Self {
2735 let mut res = Vec::new();
2736 if self.datalen == 0 { return Self::from(res); }
2737 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2742 /// The contents of CResult_PaymentParametersDecodeErrorZ
2743 pub union CResult_PaymentParametersDecodeErrorZPtr {
2744 /// A pointer to the contents in the success state.
2745 /// Reading from this pointer when `result_ok` is not set is undefined.
2746 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2747 /// A pointer to the contents in the error state.
2748 /// Reading from this pointer when `result_ok` is set is undefined.
2749 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2752 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2753 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2754 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2755 pub struct CResult_PaymentParametersDecodeErrorZ {
2756 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2757 /// `err` or `result` depending on the state of `result_ok`.
2758 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2759 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2760 pub result_ok: bool,
2763 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2764 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2765 CResult_PaymentParametersDecodeErrorZ {
2766 contents: CResult_PaymentParametersDecodeErrorZPtr {
2767 result: Box::into_raw(Box::new(o)),
2773 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2774 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2775 CResult_PaymentParametersDecodeErrorZ {
2776 contents: CResult_PaymentParametersDecodeErrorZPtr {
2777 err: Box::into_raw(Box::new(e)),
2782 /// Checks if the given object is currently in the success state
2784 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2788 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2789 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2790 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2791 fn drop(&mut self) {
2793 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2794 let _ = unsafe { Box::from_raw(self.contents.result) };
2797 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2798 let _ = unsafe { Box::from_raw(self.contents.err) };
2803 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2804 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2805 let contents = if o.result_ok {
2806 let result = unsafe { o.contents.result };
2807 unsafe { o.contents.result = core::ptr::null_mut() };
2808 CResult_PaymentParametersDecodeErrorZPtr { result }
2810 let err = unsafe { o.contents.err };
2811 unsafe { o.contents.err = core::ptr::null_mut(); }
2812 CResult_PaymentParametersDecodeErrorZPtr { err }
2816 result_ok: o.result_ok,
2820 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2821 fn clone(&self) -> Self {
2823 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2824 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2827 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2828 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2834 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2835 /// but with all dynamically-allocated buffers duplicated in new buffers.
2836 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2838 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2839 /// This corresponds to std::vector in C++
2840 pub struct CVec_RouteHintHopZ {
2841 /// The elements in the array.
2842 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2843 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2844 /// The number of elements pointed to by `data`.
2847 impl CVec_RouteHintHopZ {
2848 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2849 if self.datalen == 0 { return Vec::new(); }
2850 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2851 self.data = core::ptr::null_mut();
2855 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2856 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2859 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2860 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2861 let datalen = v.len();
2862 let data = Box::into_raw(v.into_boxed_slice());
2863 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2867 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2868 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2869 impl Drop for CVec_RouteHintHopZ {
2870 fn drop(&mut self) {
2871 if self.datalen == 0 { return; }
2872 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2875 impl Clone for CVec_RouteHintHopZ {
2876 fn clone(&self) -> Self {
2877 let mut res = Vec::new();
2878 if self.datalen == 0 { return Self::from(res); }
2879 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2884 /// The contents of CResult_RouteHintDecodeErrorZ
2885 pub union CResult_RouteHintDecodeErrorZPtr {
2886 /// A pointer to the contents in the success state.
2887 /// Reading from this pointer when `result_ok` is not set is undefined.
2888 pub result: *mut crate::lightning::routing::router::RouteHint,
2889 /// A pointer to the contents in the error state.
2890 /// Reading from this pointer when `result_ok` is set is undefined.
2891 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2894 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2895 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2897 pub struct CResult_RouteHintDecodeErrorZ {
2898 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2899 /// `err` or `result` depending on the state of `result_ok`.
2900 pub contents: CResult_RouteHintDecodeErrorZPtr,
2901 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2902 pub result_ok: bool,
2905 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2906 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2907 CResult_RouteHintDecodeErrorZ {
2908 contents: CResult_RouteHintDecodeErrorZPtr {
2909 result: Box::into_raw(Box::new(o)),
2915 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2916 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2917 CResult_RouteHintDecodeErrorZ {
2918 contents: CResult_RouteHintDecodeErrorZPtr {
2919 err: Box::into_raw(Box::new(e)),
2924 /// Checks if the given object is currently in the success state
2926 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2930 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2931 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2932 impl Drop for CResult_RouteHintDecodeErrorZ {
2933 fn drop(&mut self) {
2935 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2936 let _ = unsafe { Box::from_raw(self.contents.result) };
2939 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2940 let _ = unsafe { Box::from_raw(self.contents.err) };
2945 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2946 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2947 let contents = if o.result_ok {
2948 let result = unsafe { o.contents.result };
2949 unsafe { o.contents.result = core::ptr::null_mut() };
2950 CResult_RouteHintDecodeErrorZPtr { result }
2952 let err = unsafe { o.contents.err };
2953 unsafe { o.contents.err = core::ptr::null_mut(); }
2954 CResult_RouteHintDecodeErrorZPtr { err }
2958 result_ok: o.result_ok,
2962 impl Clone for CResult_RouteHintDecodeErrorZ {
2963 fn clone(&self) -> Self {
2965 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2966 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2969 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2970 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2976 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2977 /// but with all dynamically-allocated buffers duplicated in new buffers.
2978 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2980 /// The contents of CResult_RouteHintHopDecodeErrorZ
2981 pub union CResult_RouteHintHopDecodeErrorZPtr {
2982 /// A pointer to the contents in the success state.
2983 /// Reading from this pointer when `result_ok` is not set is undefined.
2984 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2985 /// A pointer to the contents in the error state.
2986 /// Reading from this pointer when `result_ok` is set is undefined.
2987 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2990 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2991 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2993 pub struct CResult_RouteHintHopDecodeErrorZ {
2994 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2995 /// `err` or `result` depending on the state of `result_ok`.
2996 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2997 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2998 pub result_ok: bool,
3001 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
3002 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
3003 CResult_RouteHintHopDecodeErrorZ {
3004 contents: CResult_RouteHintHopDecodeErrorZPtr {
3005 result: Box::into_raw(Box::new(o)),
3011 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
3012 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
3013 CResult_RouteHintHopDecodeErrorZ {
3014 contents: CResult_RouteHintHopDecodeErrorZPtr {
3015 err: Box::into_raw(Box::new(e)),
3020 /// Checks if the given object is currently in the success state
3022 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
3026 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
3027 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
3028 impl Drop for CResult_RouteHintHopDecodeErrorZ {
3029 fn drop(&mut self) {
3031 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3032 let _ = unsafe { Box::from_raw(self.contents.result) };
3035 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3036 let _ = unsafe { Box::from_raw(self.contents.err) };
3041 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
3042 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3043 let contents = if o.result_ok {
3044 let result = unsafe { o.contents.result };
3045 unsafe { o.contents.result = core::ptr::null_mut() };
3046 CResult_RouteHintHopDecodeErrorZPtr { result }
3048 let err = unsafe { o.contents.err };
3049 unsafe { o.contents.err = core::ptr::null_mut(); }
3050 CResult_RouteHintHopDecodeErrorZPtr { err }
3054 result_ok: o.result_ok,
3058 impl Clone for CResult_RouteHintHopDecodeErrorZ {
3059 fn clone(&self) -> Self {
3061 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
3062 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
3065 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
3066 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3072 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
3073 /// but with all dynamically-allocated buffers duplicated in new buffers.
3074 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
3076 /// The contents of CResult_PaymentPurposeDecodeErrorZ
3077 pub union CResult_PaymentPurposeDecodeErrorZPtr {
3078 /// A pointer to the contents in the success state.
3079 /// Reading from this pointer when `result_ok` is not set is undefined.
3080 pub result: *mut crate::lightning::util::events::PaymentPurpose,
3081 /// A pointer to the contents in the error state.
3082 /// Reading from this pointer when `result_ok` is set is undefined.
3083 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3086 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
3087 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
3088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3089 pub struct CResult_PaymentPurposeDecodeErrorZ {
3090 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
3091 /// `err` or `result` depending on the state of `result_ok`.
3092 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
3093 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
3094 pub result_ok: bool,
3097 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
3098 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
3099 CResult_PaymentPurposeDecodeErrorZ {
3100 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3101 result: Box::into_raw(Box::new(o)),
3107 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
3108 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
3109 CResult_PaymentPurposeDecodeErrorZ {
3110 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3111 err: Box::into_raw(Box::new(e)),
3116 /// Checks if the given object is currently in the success state
3118 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
3122 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
3123 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
3124 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
3125 fn drop(&mut self) {
3127 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3128 let _ = unsafe { Box::from_raw(self.contents.result) };
3131 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3132 let _ = unsafe { Box::from_raw(self.contents.err) };
3137 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
3138 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
3139 let contents = if o.result_ok {
3140 let result = unsafe { o.contents.result };
3141 unsafe { o.contents.result = core::ptr::null_mut() };
3142 CResult_PaymentPurposeDecodeErrorZPtr { result }
3144 let err = unsafe { o.contents.err };
3145 unsafe { o.contents.err = core::ptr::null_mut(); }
3146 CResult_PaymentPurposeDecodeErrorZPtr { err }
3150 result_ok: o.result_ok,
3154 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
3155 fn clone(&self) -> Self {
3157 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3158 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
3161 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3162 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3168 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
3169 /// but with all dynamically-allocated buffers duplicated in new buffers.
3170 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
3173 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3174 pub enum COption_ClosureReasonZ {
3175 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3176 Some(crate::lightning::util::events::ClosureReason),
3177 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3180 impl COption_ClosureReasonZ {
3181 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3182 if let Self::None = self { false } else { true }
3184 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3187 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3188 if let Self::Some(v) = self { v } else { unreachable!() }
3192 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3193 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3194 COption_ClosureReasonZ::Some(o)
3197 /// Constructs a new COption_ClosureReasonZ containing nothing
3198 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3199 COption_ClosureReasonZ::None
3202 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3203 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3205 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3206 /// but with all dynamically-allocated buffers duplicated in new buffers.
3207 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3209 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3210 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3211 /// A pointer to the contents in the success state.
3212 /// Reading from this pointer when `result_ok` is not set is undefined.
3213 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3214 /// A pointer to the contents in the error state.
3215 /// Reading from this pointer when `result_ok` is set is undefined.
3216 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3219 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3220 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3221 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3222 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3223 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3224 /// `err` or `result` depending on the state of `result_ok`.
3225 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3226 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3227 pub result_ok: bool,
3230 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3231 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3232 CResult_COption_ClosureReasonZDecodeErrorZ {
3233 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3234 result: Box::into_raw(Box::new(o)),
3240 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3241 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3242 CResult_COption_ClosureReasonZDecodeErrorZ {
3243 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3244 err: Box::into_raw(Box::new(e)),
3249 /// Checks if the given object is currently in the success state
3251 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3255 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3256 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3257 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3258 fn drop(&mut self) {
3260 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3261 let _ = unsafe { Box::from_raw(self.contents.result) };
3264 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3265 let _ = unsafe { Box::from_raw(self.contents.err) };
3270 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3271 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3272 let contents = if o.result_ok {
3273 let result = unsafe { o.contents.result };
3274 unsafe { o.contents.result = core::ptr::null_mut() };
3275 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3277 let err = unsafe { o.contents.err };
3278 unsafe { o.contents.err = core::ptr::null_mut(); }
3279 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3283 result_ok: o.result_ok,
3287 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3288 fn clone(&self) -> Self {
3290 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3291 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3294 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3302 /// but with all dynamically-allocated buffers duplicated in new buffers.
3303 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3306 /// An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
3307 pub enum COption_HTLCDestinationZ {
3308 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
3309 Some(crate::lightning::util::events::HTLCDestination),
3310 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
3313 impl COption_HTLCDestinationZ {
3314 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3315 if let Self::None = self { false } else { true }
3317 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3320 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::HTLCDestination {
3321 if let Self::Some(v) = self { v } else { unreachable!() }
3325 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
3326 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::util::events::HTLCDestination) -> COption_HTLCDestinationZ {
3327 COption_HTLCDestinationZ::Some(o)
3330 /// Constructs a new COption_HTLCDestinationZ containing nothing
3331 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
3332 COption_HTLCDestinationZ::None
3335 /// Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
3336 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
3338 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
3339 /// but with all dynamically-allocated buffers duplicated in new buffers.
3340 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
3342 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
3343 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3344 /// A pointer to the contents in the success state.
3345 /// Reading from this pointer when `result_ok` is not set is undefined.
3346 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
3347 /// A pointer to the contents in the error state.
3348 /// Reading from this pointer when `result_ok` is set is undefined.
3349 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3352 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
3353 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3355 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
3356 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
3357 /// `err` or `result` depending on the state of `result_ok`.
3358 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
3359 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
3360 pub result_ok: bool,
3363 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
3364 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3365 CResult_COption_HTLCDestinationZDecodeErrorZ {
3366 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3367 result: Box::into_raw(Box::new(o)),
3373 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
3374 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3375 CResult_COption_HTLCDestinationZDecodeErrorZ {
3376 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3377 err: Box::into_raw(Box::new(e)),
3382 /// Checks if the given object is currently in the success state
3384 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
3388 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
3389 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
3390 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
3391 fn drop(&mut self) {
3393 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3394 let _ = unsafe { Box::from_raw(self.contents.result) };
3397 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3398 let _ = unsafe { Box::from_raw(self.contents.err) };
3403 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
3404 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3405 let contents = if o.result_ok {
3406 let result = unsafe { o.contents.result };
3407 unsafe { o.contents.result = core::ptr::null_mut() };
3408 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
3410 let err = unsafe { o.contents.err };
3411 unsafe { o.contents.err = core::ptr::null_mut(); }
3412 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
3416 result_ok: o.result_ok,
3420 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
3421 fn clone(&self) -> Self {
3423 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3424 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
3427 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3428 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3434 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
3435 /// but with all dynamically-allocated buffers duplicated in new buffers.
3436 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
3439 /// An enum which can either contain a crate::c_types::U128 or not
3440 pub enum COption_u128Z {
3441 /// When we're in this state, this COption_u128Z contains a crate::c_types::U128
3442 Some(crate::c_types::U128),
3443 /// When we're in this state, this COption_u128Z contains nothing
3446 impl COption_u128Z {
3447 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3448 if let Self::None = self { false } else { true }
3450 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3453 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
3454 if let Self::Some(v) = self { v } else { unreachable!() }
3458 /// Constructs a new COption_u128Z containing a crate::c_types::U128
3459 pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z {
3460 COption_u128Z::Some(o)
3463 /// Constructs a new COption_u128Z containing nothing
3464 pub extern "C" fn COption_u128Z_none() -> COption_u128Z {
3468 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
3469 pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { }
3471 /// Creates a new COption_u128Z which has the same data as `orig`
3472 /// but with all dynamically-allocated buffers duplicated in new buffers.
3473 pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) }
3476 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3477 pub enum COption_NetworkUpdateZ {
3478 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3479 Some(crate::lightning::routing::gossip::NetworkUpdate),
3480 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3483 impl COption_NetworkUpdateZ {
3484 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3485 if let Self::None = self { false } else { true }
3487 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3490 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3491 if let Self::Some(v) = self { v } else { unreachable!() }
3495 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3496 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3497 COption_NetworkUpdateZ::Some(o)
3500 /// Constructs a new COption_NetworkUpdateZ containing nothing
3501 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3502 COption_NetworkUpdateZ::None
3505 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3506 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3508 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3509 /// but with all dynamically-allocated buffers duplicated in new buffers.
3510 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3512 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3513 /// This corresponds to std::vector in C++
3514 pub struct CVec_SpendableOutputDescriptorZ {
3515 /// The elements in the array.
3516 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3517 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3518 /// The number of elements pointed to by `data`.
3521 impl CVec_SpendableOutputDescriptorZ {
3522 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3523 if self.datalen == 0 { return Vec::new(); }
3524 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3525 self.data = core::ptr::null_mut();
3529 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3530 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3533 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3534 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3535 let datalen = v.len();
3536 let data = Box::into_raw(v.into_boxed_slice());
3537 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3541 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3542 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3543 impl Drop for CVec_SpendableOutputDescriptorZ {
3544 fn drop(&mut self) {
3545 if self.datalen == 0 { return; }
3546 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3549 impl Clone for CVec_SpendableOutputDescriptorZ {
3550 fn clone(&self) -> Self {
3551 let mut res = Vec::new();
3552 if self.datalen == 0 { return Self::from(res); }
3553 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3559 /// An enum which can either contain a crate::lightning::util::events::Event or not
3560 pub enum COption_EventZ {
3561 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3562 Some(crate::lightning::util::events::Event),
3563 /// When we're in this state, this COption_EventZ contains nothing
3566 impl COption_EventZ {
3567 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3568 if let Self::None = self { false } else { true }
3570 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3573 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3574 if let Self::Some(v) = self { v } else { unreachable!() }
3578 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3579 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3580 COption_EventZ::Some(o)
3583 /// Constructs a new COption_EventZ containing nothing
3584 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3585 COption_EventZ::None
3588 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3589 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3591 /// Creates a new COption_EventZ which has the same data as `orig`
3592 /// but with all dynamically-allocated buffers duplicated in new buffers.
3593 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3595 /// The contents of CResult_COption_EventZDecodeErrorZ
3596 pub union CResult_COption_EventZDecodeErrorZPtr {
3597 /// A pointer to the contents in the success state.
3598 /// Reading from this pointer when `result_ok` is not set is undefined.
3599 pub result: *mut crate::c_types::derived::COption_EventZ,
3600 /// A pointer to the contents in the error state.
3601 /// Reading from this pointer when `result_ok` is set is undefined.
3602 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3605 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3606 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3608 pub struct CResult_COption_EventZDecodeErrorZ {
3609 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3610 /// `err` or `result` depending on the state of `result_ok`.
3611 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3612 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3613 pub result_ok: bool,
3616 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3617 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3618 CResult_COption_EventZDecodeErrorZ {
3619 contents: CResult_COption_EventZDecodeErrorZPtr {
3620 result: Box::into_raw(Box::new(o)),
3626 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3627 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3628 CResult_COption_EventZDecodeErrorZ {
3629 contents: CResult_COption_EventZDecodeErrorZPtr {
3630 err: Box::into_raw(Box::new(e)),
3635 /// Checks if the given object is currently in the success state
3637 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3641 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3642 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3643 impl Drop for CResult_COption_EventZDecodeErrorZ {
3644 fn drop(&mut self) {
3646 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3647 let _ = unsafe { Box::from_raw(self.contents.result) };
3650 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3651 let _ = unsafe { Box::from_raw(self.contents.err) };
3656 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3657 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3658 let contents = if o.result_ok {
3659 let result = unsafe { o.contents.result };
3660 unsafe { o.contents.result = core::ptr::null_mut() };
3661 CResult_COption_EventZDecodeErrorZPtr { result }
3663 let err = unsafe { o.contents.err };
3664 unsafe { o.contents.err = core::ptr::null_mut(); }
3665 CResult_COption_EventZDecodeErrorZPtr { err }
3669 result_ok: o.result_ok,
3673 impl Clone for CResult_COption_EventZDecodeErrorZ {
3674 fn clone(&self) -> Self {
3676 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3677 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3680 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3681 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3687 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3688 /// but with all dynamically-allocated buffers duplicated in new buffers.
3689 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3691 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3692 /// This corresponds to std::vector in C++
3693 pub struct CVec_MessageSendEventZ {
3694 /// The elements in the array.
3695 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3696 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3697 /// The number of elements pointed to by `data`.
3700 impl CVec_MessageSendEventZ {
3701 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3702 if self.datalen == 0 { return Vec::new(); }
3703 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3704 self.data = core::ptr::null_mut();
3708 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3709 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3712 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3713 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3714 let datalen = v.len();
3715 let data = Box::into_raw(v.into_boxed_slice());
3716 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3720 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3721 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3722 impl Drop for CVec_MessageSendEventZ {
3723 fn drop(&mut self) {
3724 if self.datalen == 0 { return; }
3725 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3728 impl Clone for CVec_MessageSendEventZ {
3729 fn clone(&self) -> Self {
3730 let mut res = Vec::new();
3731 if self.datalen == 0 { return Self::from(res); }
3732 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3737 /// The contents of CResult_TxOutAccessErrorZ
3738 pub union CResult_TxOutAccessErrorZPtr {
3739 /// A pointer to the contents in the success state.
3740 /// Reading from this pointer when `result_ok` is not set is undefined.
3741 pub result: *mut crate::c_types::TxOut,
3742 /// A pointer to the contents in the error state.
3743 /// Reading from this pointer when `result_ok` is set is undefined.
3744 pub err: *mut crate::lightning::chain::AccessError,
3747 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3748 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3749 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3750 pub struct CResult_TxOutAccessErrorZ {
3751 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3752 /// `err` or `result` depending on the state of `result_ok`.
3753 pub contents: CResult_TxOutAccessErrorZPtr,
3754 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3755 pub result_ok: bool,
3758 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3759 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3760 CResult_TxOutAccessErrorZ {
3761 contents: CResult_TxOutAccessErrorZPtr {
3762 result: Box::into_raw(Box::new(o)),
3768 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3769 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3770 CResult_TxOutAccessErrorZ {
3771 contents: CResult_TxOutAccessErrorZPtr {
3772 err: Box::into_raw(Box::new(e)),
3777 /// Checks if the given object is currently in the success state
3779 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3783 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3784 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3785 impl Drop for CResult_TxOutAccessErrorZ {
3786 fn drop(&mut self) {
3788 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3789 let _ = unsafe { Box::from_raw(self.contents.result) };
3792 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3793 let _ = unsafe { Box::from_raw(self.contents.err) };
3798 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3799 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3800 let contents = if o.result_ok {
3801 let result = unsafe { o.contents.result };
3802 unsafe { o.contents.result = core::ptr::null_mut() };
3803 CResult_TxOutAccessErrorZPtr { result }
3805 let err = unsafe { o.contents.err };
3806 unsafe { o.contents.err = core::ptr::null_mut(); }
3807 CResult_TxOutAccessErrorZPtr { err }
3811 result_ok: o.result_ok,
3815 impl Clone for CResult_TxOutAccessErrorZ {
3816 fn clone(&self) -> Self {
3818 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3819 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3822 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3823 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3829 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3830 /// but with all dynamically-allocated buffers duplicated in new buffers.
3831 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3833 /// A tuple of 2 elements. See the individual fields for the types contained.
3834 pub struct C2Tuple_usizeTransactionZ {
3835 /// The element at position 0
3837 /// The element at position 1
3838 pub b: crate::c_types::Transaction,
3840 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3841 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3848 impl C2Tuple_usizeTransactionZ {
3849 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3853 impl Clone for C2Tuple_usizeTransactionZ {
3854 fn clone(&self) -> Self {
3856 a: Clone::clone(&self.a),
3857 b: Clone::clone(&self.b),
3862 /// Creates a new tuple which has the same data as `orig`
3863 /// but with all dynamically-allocated buffers duplicated in new buffers.
3864 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3865 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3867 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3868 C2Tuple_usizeTransactionZ { a, b, }
3872 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3873 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3875 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3876 /// This corresponds to std::vector in C++
3877 pub struct CVec_C2Tuple_usizeTransactionZZ {
3878 /// The elements in the array.
3879 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3880 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3881 /// The number of elements pointed to by `data`.
3884 impl CVec_C2Tuple_usizeTransactionZZ {
3885 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3886 if self.datalen == 0 { return Vec::new(); }
3887 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3888 self.data = core::ptr::null_mut();
3892 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3893 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3896 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3897 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3898 let datalen = v.len();
3899 let data = Box::into_raw(v.into_boxed_slice());
3900 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3904 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3905 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3906 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3907 fn drop(&mut self) {
3908 if self.datalen == 0 { return; }
3909 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3912 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3913 fn clone(&self) -> Self {
3914 let mut res = Vec::new();
3915 if self.datalen == 0 { return Self::from(res); }
3916 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3921 /// A tuple of 2 elements. See the individual fields for the types contained.
3922 pub struct C2Tuple_TxidBlockHashZ {
3923 /// The element at position 0
3924 pub a: crate::c_types::ThirtyTwoBytes,
3925 /// The element at position 1
3926 pub b: crate::c_types::ThirtyTwoBytes,
3928 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_TxidBlockHashZ {
3929 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
3936 impl C2Tuple_TxidBlockHashZ {
3937 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
3941 impl Clone for C2Tuple_TxidBlockHashZ {
3942 fn clone(&self) -> Self {
3944 a: Clone::clone(&self.a),
3945 b: Clone::clone(&self.b),
3950 /// Creates a new tuple which has the same data as `orig`
3951 /// but with all dynamically-allocated buffers duplicated in new buffers.
3952 pub extern "C" fn C2Tuple_TxidBlockHashZ_clone(orig: &C2Tuple_TxidBlockHashZ) -> C2Tuple_TxidBlockHashZ { Clone::clone(&orig) }
3953 /// Creates a new C2Tuple_TxidBlockHashZ from the contained elements.
3955 pub extern "C" fn C2Tuple_TxidBlockHashZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_TxidBlockHashZ {
3956 C2Tuple_TxidBlockHashZ { a, b, }
3960 /// Frees any resources used by the C2Tuple_TxidBlockHashZ.
3961 pub extern "C" fn C2Tuple_TxidBlockHashZ_free(_res: C2Tuple_TxidBlockHashZ) { }
3963 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
3964 /// This corresponds to std::vector in C++
3965 pub struct CVec_C2Tuple_TxidBlockHashZZ {
3966 /// The elements in the array.
3967 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3968 pub data: *mut crate::c_types::derived::C2Tuple_TxidBlockHashZ,
3969 /// The number of elements pointed to by `data`.
3972 impl CVec_C2Tuple_TxidBlockHashZZ {
3973 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ> {
3974 if self.datalen == 0 { return Vec::new(); }
3975 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3976 self.data = core::ptr::null_mut();
3980 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidBlockHashZ] {
3981 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3984 impl From<Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>> for CVec_C2Tuple_TxidBlockHashZZ {
3985 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>) -> Self {
3986 let datalen = v.len();
3987 let data = Box::into_raw(v.into_boxed_slice());
3988 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3992 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3993 pub extern "C" fn CVec_C2Tuple_TxidBlockHashZZ_free(_res: CVec_C2Tuple_TxidBlockHashZZ) { }
3994 impl Drop for CVec_C2Tuple_TxidBlockHashZZ {
3995 fn drop(&mut self) {
3996 if self.datalen == 0 { return; }
3997 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4000 impl Clone for CVec_C2Tuple_TxidBlockHashZZ {
4001 fn clone(&self) -> Self {
4002 let mut res = Vec::new();
4003 if self.datalen == 0 { return Self::from(res); }
4004 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4009 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4010 /// This corresponds to std::vector in C++
4011 pub struct CVec_MonitorEventZ {
4012 /// The elements in the array.
4013 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4014 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
4015 /// The number of elements pointed to by `data`.
4018 impl CVec_MonitorEventZ {
4019 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
4020 if self.datalen == 0 { return Vec::new(); }
4021 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4022 self.data = core::ptr::null_mut();
4026 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
4027 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4030 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
4031 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
4032 let datalen = v.len();
4033 let data = Box::into_raw(v.into_boxed_slice());
4034 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4038 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4039 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
4040 impl Drop for CVec_MonitorEventZ {
4041 fn drop(&mut self) {
4042 if self.datalen == 0 { return; }
4043 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4046 impl Clone for CVec_MonitorEventZ {
4047 fn clone(&self) -> Self {
4048 let mut res = Vec::new();
4049 if self.datalen == 0 { return Self::from(res); }
4050 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4055 /// A tuple of 3 elements. See the individual fields for the types contained.
4056 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4057 /// The element at position 0
4058 pub a: crate::lightning::chain::transaction::OutPoint,
4059 /// The element at position 1
4060 pub b: crate::c_types::derived::CVec_MonitorEventZ,
4061 /// The element at position 2
4062 pub c: crate::c_types::PublicKey,
4064 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4065 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
4073 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4074 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
4075 (self.a, self.b, self.c)
4078 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4079 fn clone(&self) -> Self {
4081 a: Clone::clone(&self.a),
4082 b: Clone::clone(&self.b),
4083 c: Clone::clone(&self.c),
4088 /// Creates a new tuple which has the same data as `orig`
4089 /// but with all dynamically-allocated buffers duplicated in new buffers.
4090 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
4091 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
4093 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 {
4094 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
4098 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
4099 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
4101 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4102 /// This corresponds to std::vector in C++
4103 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4104 /// The elements in the array.
4105 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4106 pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
4107 /// The number of elements pointed to by `data`.
4110 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4111 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
4112 if self.datalen == 0 { return Vec::new(); }
4113 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4114 self.data = core::ptr::null_mut();
4118 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
4119 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4122 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4123 fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
4124 let datalen = v.len();
4125 let data = Box::into_raw(v.into_boxed_slice());
4126 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4130 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4131 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
4132 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4133 fn drop(&mut self) {
4134 if self.datalen == 0 { return; }
4135 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4138 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4139 fn clone(&self) -> Self {
4140 let mut res = Vec::new();
4141 if self.datalen == 0 { return Self::from(res); }
4142 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4147 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4148 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4149 /// A pointer to the contents in the success state.
4150 /// Reading from this pointer when `result_ok` is not set is undefined.
4151 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4152 /// A pointer to the contents in the error state.
4153 /// Reading from this pointer when `result_ok` is set is undefined.
4154 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4157 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4158 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4160 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4161 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4162 /// `err` or `result` depending on the state of `result_ok`.
4163 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4164 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4165 pub result_ok: bool,
4168 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4169 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4170 CResult_FixedPenaltyScorerDecodeErrorZ {
4171 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4172 result: Box::into_raw(Box::new(o)),
4178 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4179 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4180 CResult_FixedPenaltyScorerDecodeErrorZ {
4181 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4182 err: Box::into_raw(Box::new(e)),
4187 /// Checks if the given object is currently in the success state
4189 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4193 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4194 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4195 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4196 fn drop(&mut self) {
4198 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4199 let _ = unsafe { Box::from_raw(self.contents.result) };
4202 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4203 let _ = unsafe { Box::from_raw(self.contents.err) };
4208 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4209 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4210 let contents = if o.result_ok {
4211 let result = unsafe { o.contents.result };
4212 unsafe { o.contents.result = core::ptr::null_mut() };
4213 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4215 let err = unsafe { o.contents.err };
4216 unsafe { o.contents.err = core::ptr::null_mut(); }
4217 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4221 result_ok: o.result_ok,
4225 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4226 fn clone(&self) -> Self {
4228 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4229 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4232 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4233 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4239 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4240 /// but with all dynamically-allocated buffers duplicated in new buffers.
4241 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4243 /// A tuple of 2 elements. See the individual fields for the types contained.
4244 pub struct C2Tuple_u64u64Z {
4245 /// The element at position 0
4247 /// The element at position 1
4250 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4251 fn from (tup: (u64, u64)) -> Self {
4258 impl C2Tuple_u64u64Z {
4259 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4263 impl Clone for C2Tuple_u64u64Z {
4264 fn clone(&self) -> Self {
4266 a: Clone::clone(&self.a),
4267 b: Clone::clone(&self.b),
4272 /// Creates a new tuple which has the same data as `orig`
4273 /// but with all dynamically-allocated buffers duplicated in new buffers.
4274 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4275 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4277 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4278 C2Tuple_u64u64Z { a, b, }
4282 /// Frees any resources used by the C2Tuple_u64u64Z.
4283 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4286 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4287 pub enum COption_C2Tuple_u64u64ZZ {
4288 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4289 Some(crate::c_types::derived::C2Tuple_u64u64Z),
4290 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4293 impl COption_C2Tuple_u64u64ZZ {
4294 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4295 if let Self::None = self { false } else { true }
4297 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4300 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4301 if let Self::Some(v) = self { v } else { unreachable!() }
4305 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4306 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4307 COption_C2Tuple_u64u64ZZ::Some(o)
4310 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4311 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4312 COption_C2Tuple_u64u64ZZ::None
4315 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4316 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4318 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4319 /// but with all dynamically-allocated buffers duplicated in new buffers.
4320 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4322 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4323 /// This corresponds to std::vector in C++
4324 pub struct CVec_NodeIdZ {
4325 /// The elements in the array.
4326 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4327 pub data: *mut crate::lightning::routing::gossip::NodeId,
4328 /// The number of elements pointed to by `data`.
4332 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4333 if self.datalen == 0 { return Vec::new(); }
4334 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4335 self.data = core::ptr::null_mut();
4339 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4340 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4343 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4344 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4345 let datalen = v.len();
4346 let data = Box::into_raw(v.into_boxed_slice());
4347 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4351 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4352 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4353 impl Drop for CVec_NodeIdZ {
4354 fn drop(&mut self) {
4355 if self.datalen == 0 { return; }
4356 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4359 impl Clone for CVec_NodeIdZ {
4360 fn clone(&self) -> Self {
4361 let mut res = Vec::new();
4362 if self.datalen == 0 { return Self::from(res); }
4363 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4368 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4369 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4370 /// A pointer to the contents in the success state.
4371 /// Reading from this pointer when `result_ok` is not set is undefined.
4372 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4373 /// A pointer to the contents in the error state.
4374 /// Reading from this pointer when `result_ok` is set is undefined.
4375 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4378 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4379 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4381 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4382 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4383 /// `err` or `result` depending on the state of `result_ok`.
4384 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4385 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4386 pub result_ok: bool,
4389 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4390 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4391 CResult_ProbabilisticScorerDecodeErrorZ {
4392 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4393 result: Box::into_raw(Box::new(o)),
4399 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4400 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4401 CResult_ProbabilisticScorerDecodeErrorZ {
4402 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4403 err: Box::into_raw(Box::new(e)),
4408 /// Checks if the given object is currently in the success state
4410 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4414 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4415 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4416 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4417 fn drop(&mut self) {
4419 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4420 let _ = unsafe { Box::from_raw(self.contents.result) };
4423 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4424 let _ = unsafe { Box::from_raw(self.contents.err) };
4429 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4430 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4431 let contents = if o.result_ok {
4432 let result = unsafe { o.contents.result };
4433 unsafe { o.contents.result = core::ptr::null_mut() };
4434 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4436 let err = unsafe { o.contents.err };
4437 unsafe { o.contents.err = core::ptr::null_mut(); }
4438 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4442 result_ok: o.result_ok,
4447 /// The contents of CResult_InitFeaturesDecodeErrorZ
4448 pub union CResult_InitFeaturesDecodeErrorZPtr {
4449 /// A pointer to the contents in the success state.
4450 /// Reading from this pointer when `result_ok` is not set is undefined.
4451 pub result: *mut crate::lightning::ln::features::InitFeatures,
4452 /// A pointer to the contents in the error state.
4453 /// Reading from this pointer when `result_ok` is set is undefined.
4454 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4457 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4458 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4460 pub struct CResult_InitFeaturesDecodeErrorZ {
4461 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4462 /// `err` or `result` depending on the state of `result_ok`.
4463 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4464 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4465 pub result_ok: bool,
4468 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4469 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4470 CResult_InitFeaturesDecodeErrorZ {
4471 contents: CResult_InitFeaturesDecodeErrorZPtr {
4472 result: Box::into_raw(Box::new(o)),
4478 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4479 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4480 CResult_InitFeaturesDecodeErrorZ {
4481 contents: CResult_InitFeaturesDecodeErrorZPtr {
4482 err: Box::into_raw(Box::new(e)),
4487 /// Checks if the given object is currently in the success state
4489 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4493 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4494 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4495 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4496 fn drop(&mut self) {
4498 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4499 let _ = unsafe { Box::from_raw(self.contents.result) };
4502 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4503 let _ = unsafe { Box::from_raw(self.contents.err) };
4508 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4509 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4510 let contents = if o.result_ok {
4511 let result = unsafe { o.contents.result };
4512 unsafe { o.contents.result = core::ptr::null_mut() };
4513 CResult_InitFeaturesDecodeErrorZPtr { result }
4515 let err = unsafe { o.contents.err };
4516 unsafe { o.contents.err = core::ptr::null_mut(); }
4517 CResult_InitFeaturesDecodeErrorZPtr { err }
4521 result_ok: o.result_ok,
4525 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4526 fn clone(&self) -> Self {
4528 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4529 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4532 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4533 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4539 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4540 /// but with all dynamically-allocated buffers duplicated in new buffers.
4541 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4543 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4544 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4545 /// A pointer to the contents in the success state.
4546 /// Reading from this pointer when `result_ok` is not set is undefined.
4547 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4548 /// A pointer to the contents in the error state.
4549 /// Reading from this pointer when `result_ok` is set is undefined.
4550 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4553 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4554 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4556 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4557 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4558 /// `err` or `result` depending on the state of `result_ok`.
4559 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4560 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4561 pub result_ok: bool,
4564 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4565 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4566 CResult_ChannelFeaturesDecodeErrorZ {
4567 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4568 result: Box::into_raw(Box::new(o)),
4574 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4575 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4576 CResult_ChannelFeaturesDecodeErrorZ {
4577 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4578 err: Box::into_raw(Box::new(e)),
4583 /// Checks if the given object is currently in the success state
4585 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4589 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4590 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4591 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4592 fn drop(&mut self) {
4594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4595 let _ = unsafe { Box::from_raw(self.contents.result) };
4598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4599 let _ = unsafe { Box::from_raw(self.contents.err) };
4604 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4606 let contents = if o.result_ok {
4607 let result = unsafe { o.contents.result };
4608 unsafe { o.contents.result = core::ptr::null_mut() };
4609 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4611 let err = unsafe { o.contents.err };
4612 unsafe { o.contents.err = core::ptr::null_mut(); }
4613 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4617 result_ok: o.result_ok,
4621 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4622 fn clone(&self) -> Self {
4624 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4625 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4628 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4629 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4635 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4636 /// but with all dynamically-allocated buffers duplicated in new buffers.
4637 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4639 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4640 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4641 /// A pointer to the contents in the success state.
4642 /// Reading from this pointer when `result_ok` is not set is undefined.
4643 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4644 /// A pointer to the contents in the error state.
4645 /// Reading from this pointer when `result_ok` is set is undefined.
4646 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4649 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4650 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4652 pub struct CResult_NodeFeaturesDecodeErrorZ {
4653 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4654 /// `err` or `result` depending on the state of `result_ok`.
4655 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4656 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4657 pub result_ok: bool,
4660 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4661 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4662 CResult_NodeFeaturesDecodeErrorZ {
4663 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4664 result: Box::into_raw(Box::new(o)),
4670 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4671 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4672 CResult_NodeFeaturesDecodeErrorZ {
4673 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4674 err: Box::into_raw(Box::new(e)),
4679 /// Checks if the given object is currently in the success state
4681 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4685 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4686 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4687 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4688 fn drop(&mut self) {
4690 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4691 let _ = unsafe { Box::from_raw(self.contents.result) };
4694 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4695 let _ = unsafe { Box::from_raw(self.contents.err) };
4700 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4701 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4702 let contents = if o.result_ok {
4703 let result = unsafe { o.contents.result };
4704 unsafe { o.contents.result = core::ptr::null_mut() };
4705 CResult_NodeFeaturesDecodeErrorZPtr { result }
4707 let err = unsafe { o.contents.err };
4708 unsafe { o.contents.err = core::ptr::null_mut(); }
4709 CResult_NodeFeaturesDecodeErrorZPtr { err }
4713 result_ok: o.result_ok,
4717 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4718 fn clone(&self) -> Self {
4720 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4721 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4724 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4725 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4731 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4732 /// but with all dynamically-allocated buffers duplicated in new buffers.
4733 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4735 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4736 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4737 /// A pointer to the contents in the success state.
4738 /// Reading from this pointer when `result_ok` is not set is undefined.
4739 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4740 /// A pointer to the contents in the error state.
4741 /// Reading from this pointer when `result_ok` is set is undefined.
4742 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4745 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4746 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4747 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4748 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4749 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4750 /// `err` or `result` depending on the state of `result_ok`.
4751 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4752 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4753 pub result_ok: bool,
4756 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4757 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4758 CResult_InvoiceFeaturesDecodeErrorZ {
4759 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4760 result: Box::into_raw(Box::new(o)),
4766 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4767 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4768 CResult_InvoiceFeaturesDecodeErrorZ {
4769 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4770 err: Box::into_raw(Box::new(e)),
4775 /// Checks if the given object is currently in the success state
4777 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4781 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4782 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4783 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4784 fn drop(&mut self) {
4786 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4787 let _ = unsafe { Box::from_raw(self.contents.result) };
4790 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4791 let _ = unsafe { Box::from_raw(self.contents.err) };
4796 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4797 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4798 let contents = if o.result_ok {
4799 let result = unsafe { o.contents.result };
4800 unsafe { o.contents.result = core::ptr::null_mut() };
4801 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4803 let err = unsafe { o.contents.err };
4804 unsafe { o.contents.err = core::ptr::null_mut(); }
4805 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4809 result_ok: o.result_ok,
4813 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4814 fn clone(&self) -> Self {
4816 Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4817 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4820 Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4821 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4827 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4828 /// but with all dynamically-allocated buffers duplicated in new buffers.
4829 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4831 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4832 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4833 /// A pointer to the contents in the success state.
4834 /// Reading from this pointer when `result_ok` is not set is undefined.
4835 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4836 /// A pointer to the contents in the error state.
4837 /// Reading from this pointer when `result_ok` is set is undefined.
4838 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4841 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4842 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4843 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4844 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4845 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4846 /// `err` or `result` depending on the state of `result_ok`.
4847 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4848 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4849 pub result_ok: bool,
4852 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4853 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4854 CResult_ChannelTypeFeaturesDecodeErrorZ {
4855 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4856 result: Box::into_raw(Box::new(o)),
4862 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4863 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4864 CResult_ChannelTypeFeaturesDecodeErrorZ {
4865 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4866 err: Box::into_raw(Box::new(e)),
4871 /// Checks if the given object is currently in the success state
4873 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4877 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4878 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4879 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4880 fn drop(&mut self) {
4882 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4883 let _ = unsafe { Box::from_raw(self.contents.result) };
4886 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4887 let _ = unsafe { Box::from_raw(self.contents.err) };
4892 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4893 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4894 let contents = if o.result_ok {
4895 let result = unsafe { o.contents.result };
4896 unsafe { o.contents.result = core::ptr::null_mut() };
4897 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4899 let err = unsafe { o.contents.err };
4900 unsafe { o.contents.err = core::ptr::null_mut(); }
4901 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4905 result_ok: o.result_ok,
4909 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4910 fn clone(&self) -> Self {
4912 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4913 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4916 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4917 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4923 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4924 /// but with all dynamically-allocated buffers duplicated in new buffers.
4925 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4927 /// The contents of CResult_OfferFeaturesDecodeErrorZ
4928 pub union CResult_OfferFeaturesDecodeErrorZPtr {
4929 /// A pointer to the contents in the success state.
4930 /// Reading from this pointer when `result_ok` is not set is undefined.
4931 pub result: *mut crate::lightning::ln::features::OfferFeatures,
4932 /// A pointer to the contents in the error state.
4933 /// Reading from this pointer when `result_ok` is set is undefined.
4934 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4937 /// A CResult_OfferFeaturesDecodeErrorZ represents the result of a fallible operation,
4938 /// containing a crate::lightning::ln::features::OfferFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4940 pub struct CResult_OfferFeaturesDecodeErrorZ {
4941 /// The contents of this CResult_OfferFeaturesDecodeErrorZ, accessible via either
4942 /// `err` or `result` depending on the state of `result_ok`.
4943 pub contents: CResult_OfferFeaturesDecodeErrorZPtr,
4944 /// Whether this CResult_OfferFeaturesDecodeErrorZ represents a success state.
4945 pub result_ok: bool,
4948 /// Creates a new CResult_OfferFeaturesDecodeErrorZ in the success state.
4949 pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::OfferFeatures) -> CResult_OfferFeaturesDecodeErrorZ {
4950 CResult_OfferFeaturesDecodeErrorZ {
4951 contents: CResult_OfferFeaturesDecodeErrorZPtr {
4952 result: Box::into_raw(Box::new(o)),
4958 /// Creates a new CResult_OfferFeaturesDecodeErrorZ in the error state.
4959 pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferFeaturesDecodeErrorZ {
4960 CResult_OfferFeaturesDecodeErrorZ {
4961 contents: CResult_OfferFeaturesDecodeErrorZPtr {
4962 err: Box::into_raw(Box::new(e)),
4967 /// Checks if the given object is currently in the success state
4969 pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_is_ok(o: &CResult_OfferFeaturesDecodeErrorZ) -> bool {
4973 /// Frees any resources used by the CResult_OfferFeaturesDecodeErrorZ.
4974 pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_free(_res: CResult_OfferFeaturesDecodeErrorZ) { }
4975 impl Drop for CResult_OfferFeaturesDecodeErrorZ {
4976 fn drop(&mut self) {
4978 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4979 let _ = unsafe { Box::from_raw(self.contents.result) };
4982 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4983 let _ = unsafe { Box::from_raw(self.contents.err) };
4988 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::OfferFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_OfferFeaturesDecodeErrorZ {
4989 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::OfferFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4990 let contents = if o.result_ok {
4991 let result = unsafe { o.contents.result };
4992 unsafe { o.contents.result = core::ptr::null_mut() };
4993 CResult_OfferFeaturesDecodeErrorZPtr { result }
4995 let err = unsafe { o.contents.err };
4996 unsafe { o.contents.err = core::ptr::null_mut(); }
4997 CResult_OfferFeaturesDecodeErrorZPtr { err }
5001 result_ok: o.result_ok,
5005 impl Clone for CResult_OfferFeaturesDecodeErrorZ {
5006 fn clone(&self) -> Self {
5008 Self { result_ok: true, contents: CResult_OfferFeaturesDecodeErrorZPtr {
5009 result: Box::into_raw(Box::new(<crate::lightning::ln::features::OfferFeatures>::clone(unsafe { &*self.contents.result })))
5012 Self { result_ok: false, contents: CResult_OfferFeaturesDecodeErrorZPtr {
5013 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5019 /// Creates a new CResult_OfferFeaturesDecodeErrorZ which has the same data as `orig`
5020 /// but with all dynamically-allocated buffers duplicated in new buffers.
5021 pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_clone(orig: &CResult_OfferFeaturesDecodeErrorZ) -> CResult_OfferFeaturesDecodeErrorZ { Clone::clone(&orig) }
5023 /// The contents of CResult_InvoiceRequestFeaturesDecodeErrorZ
5024 pub union CResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5025 /// A pointer to the contents in the success state.
5026 /// Reading from this pointer when `result_ok` is not set is undefined.
5027 pub result: *mut crate::lightning::ln::features::InvoiceRequestFeatures,
5028 /// A pointer to the contents in the error state.
5029 /// Reading from this pointer when `result_ok` is set is undefined.
5030 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5033 /// A CResult_InvoiceRequestFeaturesDecodeErrorZ represents the result of a fallible operation,
5034 /// containing a crate::lightning::ln::features::InvoiceRequestFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5035 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5036 pub struct CResult_InvoiceRequestFeaturesDecodeErrorZ {
5037 /// The contents of this CResult_InvoiceRequestFeaturesDecodeErrorZ, accessible via either
5038 /// `err` or `result` depending on the state of `result_ok`.
5039 pub contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr,
5040 /// Whether this CResult_InvoiceRequestFeaturesDecodeErrorZ represents a success state.
5041 pub result_ok: bool,
5044 /// Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the success state.
5045 pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceRequestFeatures) -> CResult_InvoiceRequestFeaturesDecodeErrorZ {
5046 CResult_InvoiceRequestFeaturesDecodeErrorZ {
5047 contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5048 result: Box::into_raw(Box::new(o)),
5054 /// Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the error state.
5055 pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFeaturesDecodeErrorZ {
5056 CResult_InvoiceRequestFeaturesDecodeErrorZ {
5057 contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5058 err: Box::into_raw(Box::new(e)),
5063 /// Checks if the given object is currently in the success state
5065 pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFeaturesDecodeErrorZ) -> bool {
5069 /// Frees any resources used by the CResult_InvoiceRequestFeaturesDecodeErrorZ.
5070 pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_free(_res: CResult_InvoiceRequestFeaturesDecodeErrorZ) { }
5071 impl Drop for CResult_InvoiceRequestFeaturesDecodeErrorZ {
5072 fn drop(&mut self) {
5074 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5075 let _ = unsafe { Box::from_raw(self.contents.result) };
5078 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5079 let _ = unsafe { Box::from_raw(self.contents.err) };
5084 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceRequestFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceRequestFeaturesDecodeErrorZ {
5085 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceRequestFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5086 let contents = if o.result_ok {
5087 let result = unsafe { o.contents.result };
5088 unsafe { o.contents.result = core::ptr::null_mut() };
5089 CResult_InvoiceRequestFeaturesDecodeErrorZPtr { result }
5091 let err = unsafe { o.contents.err };
5092 unsafe { o.contents.err = core::ptr::null_mut(); }
5093 CResult_InvoiceRequestFeaturesDecodeErrorZPtr { err }
5097 result_ok: o.result_ok,
5101 impl Clone for CResult_InvoiceRequestFeaturesDecodeErrorZ {
5102 fn clone(&self) -> Self {
5104 Self { result_ok: true, contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5105 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceRequestFeatures>::clone(unsafe { &*self.contents.result })))
5108 Self { result_ok: false, contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5109 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5115 /// Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ which has the same data as `orig`
5116 /// but with all dynamically-allocated buffers duplicated in new buffers.
5117 pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFeaturesDecodeErrorZ) -> CResult_InvoiceRequestFeaturesDecodeErrorZ { Clone::clone(&orig) }
5119 /// The contents of CResult_NodeIdDecodeErrorZ
5120 pub union CResult_NodeIdDecodeErrorZPtr {
5121 /// A pointer to the contents in the success state.
5122 /// Reading from this pointer when `result_ok` is not set is undefined.
5123 pub result: *mut crate::lightning::routing::gossip::NodeId,
5124 /// A pointer to the contents in the error state.
5125 /// Reading from this pointer when `result_ok` is set is undefined.
5126 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5129 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5130 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5132 pub struct CResult_NodeIdDecodeErrorZ {
5133 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5134 /// `err` or `result` depending on the state of `result_ok`.
5135 pub contents: CResult_NodeIdDecodeErrorZPtr,
5136 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5137 pub result_ok: bool,
5140 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5141 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5142 CResult_NodeIdDecodeErrorZ {
5143 contents: CResult_NodeIdDecodeErrorZPtr {
5144 result: Box::into_raw(Box::new(o)),
5150 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5151 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5152 CResult_NodeIdDecodeErrorZ {
5153 contents: CResult_NodeIdDecodeErrorZPtr {
5154 err: Box::into_raw(Box::new(e)),
5159 /// Checks if the given object is currently in the success state
5161 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5165 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5166 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5167 impl Drop for CResult_NodeIdDecodeErrorZ {
5168 fn drop(&mut self) {
5170 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5171 let _ = unsafe { Box::from_raw(self.contents.result) };
5174 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5175 let _ = unsafe { Box::from_raw(self.contents.err) };
5180 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
5181 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
5182 let contents = if o.result_ok {
5183 let result = unsafe { o.contents.result };
5184 unsafe { o.contents.result = core::ptr::null_mut() };
5185 CResult_NodeIdDecodeErrorZPtr { result }
5187 let err = unsafe { o.contents.err };
5188 unsafe { o.contents.err = core::ptr::null_mut(); }
5189 CResult_NodeIdDecodeErrorZPtr { err }
5193 result_ok: o.result_ok,
5197 impl Clone for CResult_NodeIdDecodeErrorZ {
5198 fn clone(&self) -> Self {
5200 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
5201 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
5204 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
5205 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5211 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
5212 /// but with all dynamically-allocated buffers duplicated in new buffers.
5213 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
5215 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5216 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5217 /// A pointer to the contents in the success state.
5218 /// Reading from this pointer when `result_ok` is not set is undefined.
5219 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
5220 /// A pointer to the contents in the error state.
5221 /// Reading from this pointer when `result_ok` is set is undefined.
5222 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5225 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5226 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5228 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
5229 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5230 /// `err` or `result` depending on the state of `result_ok`.
5231 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
5232 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5233 pub result_ok: bool,
5236 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
5237 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5238 CResult_COption_NetworkUpdateZDecodeErrorZ {
5239 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5240 result: Box::into_raw(Box::new(o)),
5246 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
5247 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5248 CResult_COption_NetworkUpdateZDecodeErrorZ {
5249 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5250 err: Box::into_raw(Box::new(e)),
5255 /// Checks if the given object is currently in the success state
5257 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
5261 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
5262 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
5263 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
5264 fn drop(&mut self) {
5266 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5267 let _ = unsafe { Box::from_raw(self.contents.result) };
5270 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5271 let _ = unsafe { Box::from_raw(self.contents.err) };
5276 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
5277 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5278 let contents = if o.result_ok {
5279 let result = unsafe { o.contents.result };
5280 unsafe { o.contents.result = core::ptr::null_mut() };
5281 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
5283 let err = unsafe { o.contents.err };
5284 unsafe { o.contents.err = core::ptr::null_mut(); }
5285 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
5289 result_ok: o.result_ok,
5293 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
5294 fn clone(&self) -> Self {
5296 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5297 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
5300 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5301 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5307 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
5308 /// but with all dynamically-allocated buffers duplicated in new buffers.
5309 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
5311 /// An enum which can either contain a crate::lightning::chain::Access or not
5312 pub enum COption_AccessZ {
5313 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5314 Some(crate::lightning::chain::Access),
5315 /// When we're in this state, this COption_AccessZ contains nothing
5318 impl COption_AccessZ {
5319 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5320 if let Self::None = self { false } else { true }
5322 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5325 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
5326 if let Self::Some(v) = self { v } else { unreachable!() }
5330 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
5331 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
5332 COption_AccessZ::Some(o)
5335 /// Constructs a new COption_AccessZ containing nothing
5336 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
5337 COption_AccessZ::None
5340 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
5341 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
5343 /// The contents of CResult_boolLightningErrorZ
5344 pub union CResult_boolLightningErrorZPtr {
5345 /// A pointer to the contents in the success state.
5346 /// Reading from this pointer when `result_ok` is not set is undefined.
5347 pub result: *mut bool,
5348 /// A pointer to the contents in the error state.
5349 /// Reading from this pointer when `result_ok` is set is undefined.
5350 pub err: *mut crate::lightning::ln::msgs::LightningError,
5353 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
5354 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5355 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5356 pub struct CResult_boolLightningErrorZ {
5357 /// The contents of this CResult_boolLightningErrorZ, accessible via either
5358 /// `err` or `result` depending on the state of `result_ok`.
5359 pub contents: CResult_boolLightningErrorZPtr,
5360 /// Whether this CResult_boolLightningErrorZ represents a success state.
5361 pub result_ok: bool,
5364 /// Creates a new CResult_boolLightningErrorZ in the success state.
5365 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
5366 CResult_boolLightningErrorZ {
5367 contents: CResult_boolLightningErrorZPtr {
5368 result: Box::into_raw(Box::new(o)),
5374 /// Creates a new CResult_boolLightningErrorZ in the error state.
5375 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
5376 CResult_boolLightningErrorZ {
5377 contents: CResult_boolLightningErrorZPtr {
5378 err: Box::into_raw(Box::new(e)),
5383 /// Checks if the given object is currently in the success state
5385 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
5389 /// Frees any resources used by the CResult_boolLightningErrorZ.
5390 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
5391 impl Drop for CResult_boolLightningErrorZ {
5392 fn drop(&mut self) {
5394 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5395 let _ = unsafe { Box::from_raw(self.contents.result) };
5398 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5399 let _ = unsafe { Box::from_raw(self.contents.err) };
5404 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
5405 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
5406 let contents = if o.result_ok {
5407 let result = unsafe { o.contents.result };
5408 unsafe { o.contents.result = core::ptr::null_mut() };
5409 CResult_boolLightningErrorZPtr { result }
5411 let err = unsafe { o.contents.err };
5412 unsafe { o.contents.err = core::ptr::null_mut(); }
5413 CResult_boolLightningErrorZPtr { err }
5417 result_ok: o.result_ok,
5421 impl Clone for CResult_boolLightningErrorZ {
5422 fn clone(&self) -> Self {
5424 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
5425 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
5428 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
5429 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5435 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
5436 /// but with all dynamically-allocated buffers duplicated in new buffers.
5437 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
5439 /// A tuple of 3 elements. See the individual fields for the types contained.
5440 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5441 /// The element at position 0
5442 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
5443 /// The element at position 1
5444 pub b: crate::lightning::ln::msgs::ChannelUpdate,
5445 /// The element at position 2
5446 pub c: crate::lightning::ln::msgs::ChannelUpdate,
5448 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5449 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
5457 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5458 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
5459 (self.a, self.b, self.c)
5462 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5463 fn clone(&self) -> Self {
5465 a: Clone::clone(&self.a),
5466 b: Clone::clone(&self.b),
5467 c: Clone::clone(&self.c),
5472 /// Creates a new tuple which has the same data as `orig`
5473 /// but with all dynamically-allocated buffers duplicated in new buffers.
5474 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
5475 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
5477 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 {
5478 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5482 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5483 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5486 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5487 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5488 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5489 Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
5490 /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5493 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5494 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5495 if let Self::None = self { false } else { true }
5497 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5500 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5501 if let Self::Some(v) = self { v } else { unreachable!() }
5505 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5506 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5507 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
5510 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
5511 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5512 COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
5515 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
5516 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5518 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
5519 /// but with all dynamically-allocated buffers duplicated in new buffers.
5520 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
5522 /// The contents of CResult_NoneLightningErrorZ
5523 pub union CResult_NoneLightningErrorZPtr {
5524 /// Note that this value is always NULL, as there are no contents in the OK variant
5525 pub result: *mut core::ffi::c_void,
5526 /// A pointer to the contents in the error state.
5527 /// Reading from this pointer when `result_ok` is set is undefined.
5528 pub err: *mut crate::lightning::ln::msgs::LightningError,
5531 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5532 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5533 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5534 pub struct CResult_NoneLightningErrorZ {
5535 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5536 /// `err` or `result` depending on the state of `result_ok`.
5537 pub contents: CResult_NoneLightningErrorZPtr,
5538 /// Whether this CResult_NoneLightningErrorZ represents a success state.
5539 pub result_ok: bool,
5542 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5543 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5544 CResult_NoneLightningErrorZ {
5545 contents: CResult_NoneLightningErrorZPtr {
5546 result: core::ptr::null_mut(),
5552 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5553 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5554 CResult_NoneLightningErrorZ {
5555 contents: CResult_NoneLightningErrorZPtr {
5556 err: Box::into_raw(Box::new(e)),
5561 /// Checks if the given object is currently in the success state
5563 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5567 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5568 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5569 impl Drop for CResult_NoneLightningErrorZ {
5570 fn drop(&mut self) {
5573 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5574 let _ = unsafe { Box::from_raw(self.contents.err) };
5579 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5580 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5581 let contents = if o.result_ok {
5582 let _ = unsafe { Box::from_raw(o.contents.result) };
5583 o.contents.result = core::ptr::null_mut();
5584 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5586 let err = unsafe { o.contents.err };
5587 unsafe { o.contents.err = core::ptr::null_mut(); }
5588 CResult_NoneLightningErrorZPtr { err }
5592 result_ok: o.result_ok,
5596 impl Clone for CResult_NoneLightningErrorZ {
5597 fn clone(&self) -> Self {
5599 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5600 result: core::ptr::null_mut()
5603 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5604 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5610 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5611 /// but with all dynamically-allocated buffers duplicated in new buffers.
5612 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5614 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5615 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5616 /// A pointer to the contents in the success state.
5617 /// Reading from this pointer when `result_ok` is not set is undefined.
5618 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5619 /// A pointer to the contents in the error state.
5620 /// Reading from this pointer when `result_ok` is set is undefined.
5621 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5624 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5625 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5627 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5628 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5629 /// `err` or `result` depending on the state of `result_ok`.
5630 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5631 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5632 pub result_ok: bool,
5635 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5636 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5637 CResult_ChannelUpdateInfoDecodeErrorZ {
5638 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5639 result: Box::into_raw(Box::new(o)),
5645 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5646 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5647 CResult_ChannelUpdateInfoDecodeErrorZ {
5648 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5649 err: Box::into_raw(Box::new(e)),
5654 /// Checks if the given object is currently in the success state
5656 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5660 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5661 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5662 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5663 fn drop(&mut self) {
5665 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5666 let _ = unsafe { Box::from_raw(self.contents.result) };
5669 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5670 let _ = unsafe { Box::from_raw(self.contents.err) };
5675 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5676 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5677 let contents = if o.result_ok {
5678 let result = unsafe { o.contents.result };
5679 unsafe { o.contents.result = core::ptr::null_mut() };
5680 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5682 let err = unsafe { o.contents.err };
5683 unsafe { o.contents.err = core::ptr::null_mut(); }
5684 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5688 result_ok: o.result_ok,
5692 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5693 fn clone(&self) -> Self {
5695 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5696 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5699 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5700 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5706 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5707 /// but with all dynamically-allocated buffers duplicated in new buffers.
5708 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5710 /// The contents of CResult_ChannelInfoDecodeErrorZ
5711 pub union CResult_ChannelInfoDecodeErrorZPtr {
5712 /// A pointer to the contents in the success state.
5713 /// Reading from this pointer when `result_ok` is not set is undefined.
5714 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5715 /// A pointer to the contents in the error state.
5716 /// Reading from this pointer when `result_ok` is set is undefined.
5717 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5720 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5721 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5723 pub struct CResult_ChannelInfoDecodeErrorZ {
5724 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5725 /// `err` or `result` depending on the state of `result_ok`.
5726 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5727 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5728 pub result_ok: bool,
5731 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5732 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5733 CResult_ChannelInfoDecodeErrorZ {
5734 contents: CResult_ChannelInfoDecodeErrorZPtr {
5735 result: Box::into_raw(Box::new(o)),
5741 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5742 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5743 CResult_ChannelInfoDecodeErrorZ {
5744 contents: CResult_ChannelInfoDecodeErrorZPtr {
5745 err: Box::into_raw(Box::new(e)),
5750 /// Checks if the given object is currently in the success state
5752 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5756 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5757 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5758 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5759 fn drop(&mut self) {
5761 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5762 let _ = unsafe { Box::from_raw(self.contents.result) };
5765 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5766 let _ = unsafe { Box::from_raw(self.contents.err) };
5771 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5772 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5773 let contents = if o.result_ok {
5774 let result = unsafe { o.contents.result };
5775 unsafe { o.contents.result = core::ptr::null_mut() };
5776 CResult_ChannelInfoDecodeErrorZPtr { result }
5778 let err = unsafe { o.contents.err };
5779 unsafe { o.contents.err = core::ptr::null_mut(); }
5780 CResult_ChannelInfoDecodeErrorZPtr { err }
5784 result_ok: o.result_ok,
5788 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5789 fn clone(&self) -> Self {
5791 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5792 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5795 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5796 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5802 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5803 /// but with all dynamically-allocated buffers duplicated in new buffers.
5804 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5806 /// The contents of CResult_RoutingFeesDecodeErrorZ
5807 pub union CResult_RoutingFeesDecodeErrorZPtr {
5808 /// A pointer to the contents in the success state.
5809 /// Reading from this pointer when `result_ok` is not set is undefined.
5810 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5811 /// A pointer to the contents in the error state.
5812 /// Reading from this pointer when `result_ok` is set is undefined.
5813 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5816 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5817 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5819 pub struct CResult_RoutingFeesDecodeErrorZ {
5820 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5821 /// `err` or `result` depending on the state of `result_ok`.
5822 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5823 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5824 pub result_ok: bool,
5827 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5828 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5829 CResult_RoutingFeesDecodeErrorZ {
5830 contents: CResult_RoutingFeesDecodeErrorZPtr {
5831 result: Box::into_raw(Box::new(o)),
5837 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5838 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5839 CResult_RoutingFeesDecodeErrorZ {
5840 contents: CResult_RoutingFeesDecodeErrorZPtr {
5841 err: Box::into_raw(Box::new(e)),
5846 /// Checks if the given object is currently in the success state
5848 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5852 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5853 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5854 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5855 fn drop(&mut self) {
5857 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5858 let _ = unsafe { Box::from_raw(self.contents.result) };
5861 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5862 let _ = unsafe { Box::from_raw(self.contents.err) };
5867 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5868 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5869 let contents = if o.result_ok {
5870 let result = unsafe { o.contents.result };
5871 unsafe { o.contents.result = core::ptr::null_mut() };
5872 CResult_RoutingFeesDecodeErrorZPtr { result }
5874 let err = unsafe { o.contents.err };
5875 unsafe { o.contents.err = core::ptr::null_mut(); }
5876 CResult_RoutingFeesDecodeErrorZPtr { err }
5880 result_ok: o.result_ok,
5884 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5885 fn clone(&self) -> Self {
5887 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5888 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5891 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5892 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5898 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5899 /// but with all dynamically-allocated buffers duplicated in new buffers.
5900 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5902 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5903 /// This corresponds to std::vector in C++
5904 pub struct CVec_NetAddressZ {
5905 /// The elements in the array.
5906 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5907 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5908 /// The number of elements pointed to by `data`.
5911 impl CVec_NetAddressZ {
5912 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5913 if self.datalen == 0 { return Vec::new(); }
5914 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5915 self.data = core::ptr::null_mut();
5919 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5920 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5923 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5924 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5925 let datalen = v.len();
5926 let data = Box::into_raw(v.into_boxed_slice());
5927 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5931 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5932 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5933 impl Drop for CVec_NetAddressZ {
5934 fn drop(&mut self) {
5935 if self.datalen == 0 { return; }
5936 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5939 impl Clone for CVec_NetAddressZ {
5940 fn clone(&self) -> Self {
5941 let mut res = Vec::new();
5942 if self.datalen == 0 { return Self::from(res); }
5943 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5948 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5949 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5950 /// A pointer to the contents in the success state.
5951 /// Reading from this pointer when `result_ok` is not set is undefined.
5952 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5953 /// A pointer to the contents in the error state.
5954 /// Reading from this pointer when `result_ok` is set is undefined.
5955 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5958 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5959 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5960 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5961 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5962 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5963 /// `err` or `result` depending on the state of `result_ok`.
5964 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5965 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5966 pub result_ok: bool,
5969 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5970 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5971 CResult_NodeAnnouncementInfoDecodeErrorZ {
5972 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5973 result: Box::into_raw(Box::new(o)),
5979 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5980 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5981 CResult_NodeAnnouncementInfoDecodeErrorZ {
5982 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5983 err: Box::into_raw(Box::new(e)),
5988 /// Checks if the given object is currently in the success state
5990 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5994 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5995 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5996 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5997 fn drop(&mut self) {
5999 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6000 let _ = unsafe { Box::from_raw(self.contents.result) };
6003 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6004 let _ = unsafe { Box::from_raw(self.contents.err) };
6009 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
6010 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6011 let contents = if o.result_ok {
6012 let result = unsafe { o.contents.result };
6013 unsafe { o.contents.result = core::ptr::null_mut() };
6014 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
6016 let err = unsafe { o.contents.err };
6017 unsafe { o.contents.err = core::ptr::null_mut(); }
6018 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
6022 result_ok: o.result_ok,
6026 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
6027 fn clone(&self) -> Self {
6029 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6030 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
6033 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6034 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6040 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
6041 /// but with all dynamically-allocated buffers duplicated in new buffers.
6042 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
6044 /// The contents of CResult_NodeAliasDecodeErrorZ
6045 pub union CResult_NodeAliasDecodeErrorZPtr {
6046 /// A pointer to the contents in the success state.
6047 /// Reading from this pointer when `result_ok` is not set is undefined.
6048 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
6049 /// A pointer to the contents in the error state.
6050 /// Reading from this pointer when `result_ok` is set is undefined.
6051 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6054 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6055 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6057 pub struct CResult_NodeAliasDecodeErrorZ {
6058 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6059 /// `err` or `result` depending on the state of `result_ok`.
6060 pub contents: CResult_NodeAliasDecodeErrorZPtr,
6061 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6062 pub result_ok: bool,
6065 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
6066 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
6067 CResult_NodeAliasDecodeErrorZ {
6068 contents: CResult_NodeAliasDecodeErrorZPtr {
6069 result: Box::into_raw(Box::new(o)),
6075 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6076 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6077 CResult_NodeAliasDecodeErrorZ {
6078 contents: CResult_NodeAliasDecodeErrorZPtr {
6079 err: Box::into_raw(Box::new(e)),
6084 /// Checks if the given object is currently in the success state
6086 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6090 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6091 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6092 impl Drop for CResult_NodeAliasDecodeErrorZ {
6093 fn drop(&mut self) {
6095 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6096 let _ = unsafe { Box::from_raw(self.contents.result) };
6099 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6100 let _ = unsafe { Box::from_raw(self.contents.err) };
6105 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6106 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6107 let contents = if o.result_ok {
6108 let result = unsafe { o.contents.result };
6109 unsafe { o.contents.result = core::ptr::null_mut() };
6110 CResult_NodeAliasDecodeErrorZPtr { result }
6112 let err = unsafe { o.contents.err };
6113 unsafe { o.contents.err = core::ptr::null_mut(); }
6114 CResult_NodeAliasDecodeErrorZPtr { err }
6118 result_ok: o.result_ok,
6122 impl Clone for CResult_NodeAliasDecodeErrorZ {
6123 fn clone(&self) -> Self {
6125 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6126 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6129 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6130 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6136 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6137 /// but with all dynamically-allocated buffers duplicated in new buffers.
6138 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6140 /// The contents of CResult_NodeInfoDecodeErrorZ
6141 pub union CResult_NodeInfoDecodeErrorZPtr {
6142 /// A pointer to the contents in the success state.
6143 /// Reading from this pointer when `result_ok` is not set is undefined.
6144 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6145 /// A pointer to the contents in the error state.
6146 /// Reading from this pointer when `result_ok` is set is undefined.
6147 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6150 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6151 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6152 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6153 pub struct CResult_NodeInfoDecodeErrorZ {
6154 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6155 /// `err` or `result` depending on the state of `result_ok`.
6156 pub contents: CResult_NodeInfoDecodeErrorZPtr,
6157 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6158 pub result_ok: bool,
6161 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6162 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6163 CResult_NodeInfoDecodeErrorZ {
6164 contents: CResult_NodeInfoDecodeErrorZPtr {
6165 result: Box::into_raw(Box::new(o)),
6171 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6172 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6173 CResult_NodeInfoDecodeErrorZ {
6174 contents: CResult_NodeInfoDecodeErrorZPtr {
6175 err: Box::into_raw(Box::new(e)),
6180 /// Checks if the given object is currently in the success state
6182 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
6186 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
6187 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
6188 impl Drop for CResult_NodeInfoDecodeErrorZ {
6189 fn drop(&mut self) {
6191 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6192 let _ = unsafe { Box::from_raw(self.contents.result) };
6195 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6196 let _ = unsafe { Box::from_raw(self.contents.err) };
6201 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
6202 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6203 let contents = if o.result_ok {
6204 let result = unsafe { o.contents.result };
6205 unsafe { o.contents.result = core::ptr::null_mut() };
6206 CResult_NodeInfoDecodeErrorZPtr { result }
6208 let err = unsafe { o.contents.err };
6209 unsafe { o.contents.err = core::ptr::null_mut(); }
6210 CResult_NodeInfoDecodeErrorZPtr { err }
6214 result_ok: o.result_ok,
6218 impl Clone for CResult_NodeInfoDecodeErrorZ {
6219 fn clone(&self) -> Self {
6221 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
6222 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
6225 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
6226 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6232 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
6233 /// but with all dynamically-allocated buffers duplicated in new buffers.
6234 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
6236 /// The contents of CResult_NetworkGraphDecodeErrorZ
6237 pub union CResult_NetworkGraphDecodeErrorZPtr {
6238 /// A pointer to the contents in the success state.
6239 /// Reading from this pointer when `result_ok` is not set is undefined.
6240 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
6241 /// A pointer to the contents in the error state.
6242 /// Reading from this pointer when `result_ok` is set is undefined.
6243 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6246 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6247 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6249 pub struct CResult_NetworkGraphDecodeErrorZ {
6250 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6251 /// `err` or `result` depending on the state of `result_ok`.
6252 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
6253 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6254 pub result_ok: bool,
6257 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
6258 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
6259 CResult_NetworkGraphDecodeErrorZ {
6260 contents: CResult_NetworkGraphDecodeErrorZPtr {
6261 result: Box::into_raw(Box::new(o)),
6267 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
6268 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
6269 CResult_NetworkGraphDecodeErrorZ {
6270 contents: CResult_NetworkGraphDecodeErrorZPtr {
6271 err: Box::into_raw(Box::new(e)),
6276 /// Checks if the given object is currently in the success state
6278 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
6282 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
6283 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
6284 impl Drop for CResult_NetworkGraphDecodeErrorZ {
6285 fn drop(&mut self) {
6287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6288 let _ = unsafe { Box::from_raw(self.contents.result) };
6291 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6292 let _ = unsafe { Box::from_raw(self.contents.err) };
6297 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
6298 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
6299 let contents = if o.result_ok {
6300 let result = unsafe { o.contents.result };
6301 unsafe { o.contents.result = core::ptr::null_mut() };
6302 CResult_NetworkGraphDecodeErrorZPtr { result }
6304 let err = unsafe { o.contents.err };
6305 unsafe { o.contents.err = core::ptr::null_mut(); }
6306 CResult_NetworkGraphDecodeErrorZPtr { err }
6310 result_ok: o.result_ok,
6316 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6317 pub enum COption_CVec_NetAddressZZ {
6318 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6319 Some(crate::c_types::derived::CVec_NetAddressZ),
6320 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6323 impl COption_CVec_NetAddressZZ {
6324 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6325 if let Self::None = self { false } else { true }
6327 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6330 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
6331 if let Self::Some(v) = self { v } else { unreachable!() }
6335 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
6336 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
6337 COption_CVec_NetAddressZZ::Some(o)
6340 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
6341 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
6342 COption_CVec_NetAddressZZ::None
6345 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
6346 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
6348 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
6349 /// but with all dynamically-allocated buffers duplicated in new buffers.
6350 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
6352 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6353 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6354 /// A pointer to the contents in the success state.
6355 /// Reading from this pointer when `result_ok` is not set is undefined.
6356 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
6357 /// A pointer to the contents in the error state.
6358 /// Reading from this pointer when `result_ok` is set is undefined.
6359 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6362 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6363 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6365 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6366 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6367 /// `err` or `result` depending on the state of `result_ok`.
6368 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
6369 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6370 pub result_ok: bool,
6373 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
6374 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6375 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6376 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6377 result: Box::into_raw(Box::new(o)),
6383 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6384 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6385 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6386 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6387 err: Box::into_raw(Box::new(e)),
6392 /// Checks if the given object is currently in the success state
6394 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6398 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6399 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6400 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6401 fn drop(&mut self) {
6403 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6404 let _ = unsafe { Box::from_raw(self.contents.result) };
6407 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6408 let _ = unsafe { Box::from_raw(self.contents.err) };
6413 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6414 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6415 let contents = if o.result_ok {
6416 let result = unsafe { o.contents.result };
6417 unsafe { o.contents.result = core::ptr::null_mut() };
6418 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6420 let err = unsafe { o.contents.err };
6421 unsafe { o.contents.err = core::ptr::null_mut(); }
6422 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6426 result_ok: o.result_ok,
6430 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6431 fn clone(&self) -> Self {
6433 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6434 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6437 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6438 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6444 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6445 /// but with all dynamically-allocated buffers duplicated in new buffers.
6446 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6448 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6449 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6450 /// A pointer to the contents in the success state.
6451 /// Reading from this pointer when `result_ok` is not set is undefined.
6452 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6453 /// A pointer to the contents in the error state.
6454 /// Reading from this pointer when `result_ok` is set is undefined.
6455 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6458 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6459 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6460 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6461 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6462 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6463 /// `err` or `result` depending on the state of `result_ok`.
6464 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6465 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6466 pub result_ok: bool,
6469 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6470 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6471 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6472 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6473 result: Box::into_raw(Box::new(o)),
6479 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6480 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6481 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6482 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6483 err: Box::into_raw(Box::new(e)),
6488 /// Checks if the given object is currently in the success state
6490 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6494 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6495 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6496 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6497 fn drop(&mut self) {
6499 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6500 let _ = unsafe { Box::from_raw(self.contents.result) };
6503 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6504 let _ = unsafe { Box::from_raw(self.contents.err) };
6509 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6510 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6511 let contents = if o.result_ok {
6512 let result = unsafe { o.contents.result };
6513 unsafe { o.contents.result = core::ptr::null_mut() };
6514 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6516 let err = unsafe { o.contents.err };
6517 unsafe { o.contents.err = core::ptr::null_mut(); }
6518 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6522 result_ok: o.result_ok,
6526 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6527 fn clone(&self) -> Self {
6529 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6530 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6533 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6534 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6540 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6541 /// but with all dynamically-allocated buffers duplicated in new buffers.
6542 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6544 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6545 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6546 /// A pointer to the contents in the success state.
6547 /// Reading from this pointer when `result_ok` is not set is undefined.
6548 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6549 /// A pointer to the contents in the error state.
6550 /// Reading from this pointer when `result_ok` is set is undefined.
6551 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6554 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6555 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6557 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6558 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6559 /// `err` or `result` depending on the state of `result_ok`.
6560 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6561 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6562 pub result_ok: bool,
6565 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6566 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6567 CResult_SpendableOutputDescriptorDecodeErrorZ {
6568 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6569 result: Box::into_raw(Box::new(o)),
6575 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6576 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6577 CResult_SpendableOutputDescriptorDecodeErrorZ {
6578 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6579 err: Box::into_raw(Box::new(e)),
6584 /// Checks if the given object is currently in the success state
6586 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6590 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6591 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6592 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6593 fn drop(&mut self) {
6595 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6596 let _ = unsafe { Box::from_raw(self.contents.result) };
6599 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6600 let _ = unsafe { Box::from_raw(self.contents.err) };
6605 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6606 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6607 let contents = if o.result_ok {
6608 let result = unsafe { o.contents.result };
6609 unsafe { o.contents.result = core::ptr::null_mut() };
6610 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6612 let err = unsafe { o.contents.err };
6613 unsafe { o.contents.err = core::ptr::null_mut(); }
6614 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6618 result_ok: o.result_ok,
6622 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6623 fn clone(&self) -> Self {
6625 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6626 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6629 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6630 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6636 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6637 /// but with all dynamically-allocated buffers duplicated in new buffers.
6638 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6640 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6641 /// This corresponds to std::vector in C++
6642 pub struct CVec_PaymentPreimageZ {
6643 /// The elements in the array.
6644 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6645 pub data: *mut crate::c_types::ThirtyTwoBytes,
6646 /// The number of elements pointed to by `data`.
6649 impl CVec_PaymentPreimageZ {
6650 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6651 if self.datalen == 0 { return Vec::new(); }
6652 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6653 self.data = core::ptr::null_mut();
6657 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6658 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6661 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6662 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6663 let datalen = v.len();
6664 let data = Box::into_raw(v.into_boxed_slice());
6665 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6669 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6670 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6671 impl Drop for CVec_PaymentPreimageZ {
6672 fn drop(&mut self) {
6673 if self.datalen == 0 { return; }
6674 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6677 impl Clone for CVec_PaymentPreimageZ {
6678 fn clone(&self) -> Self {
6679 let mut res = Vec::new();
6680 if self.datalen == 0 { return Self::from(res); }
6681 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6686 /// A tuple of 2 elements. See the individual fields for the types contained.
6687 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6688 /// The element at position 0
6689 pub a: crate::c_types::Signature,
6690 /// The element at position 1
6691 pub b: crate::c_types::derived::CVec_SignatureZ,
6693 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6694 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6701 impl C2Tuple_SignatureCVec_SignatureZZ {
6702 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6706 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6707 fn clone(&self) -> Self {
6709 a: Clone::clone(&self.a),
6710 b: Clone::clone(&self.b),
6715 /// Creates a new tuple which has the same data as `orig`
6716 /// but with all dynamically-allocated buffers duplicated in new buffers.
6717 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6718 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6720 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6721 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6725 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6726 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6728 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6729 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6730 /// A pointer to the contents in the success state.
6731 /// Reading from this pointer when `result_ok` is not set is undefined.
6732 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6733 /// Note that this value is always NULL, as there are no contents in the Err variant
6734 pub err: *mut core::ffi::c_void,
6737 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6738 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6739 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6740 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6741 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6742 /// `err` or `result` depending on the state of `result_ok`.
6743 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6744 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6745 pub result_ok: bool,
6748 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6749 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6750 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6751 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6752 result: Box::into_raw(Box::new(o)),
6758 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6759 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6760 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6761 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6762 err: core::ptr::null_mut(),
6767 /// Checks if the given object is currently in the success state
6769 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6773 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6774 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6775 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6776 fn drop(&mut self) {
6778 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6779 let _ = unsafe { Box::from_raw(self.contents.result) };
6785 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6786 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6787 let contents = if o.result_ok {
6788 let result = unsafe { o.contents.result };
6789 unsafe { o.contents.result = core::ptr::null_mut() };
6790 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6792 let _ = unsafe { Box::from_raw(o.contents.err) };
6793 o.contents.err = core::ptr::null_mut();
6794 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6798 result_ok: o.result_ok,
6802 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6803 fn clone(&self) -> Self {
6805 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6806 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6809 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6810 err: core::ptr::null_mut()
6816 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6817 /// but with all dynamically-allocated buffers duplicated in new buffers.
6818 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6820 /// The contents of CResult_SignatureNoneZ
6821 pub union CResult_SignatureNoneZPtr {
6822 /// A pointer to the contents in the success state.
6823 /// Reading from this pointer when `result_ok` is not set is undefined.
6824 pub result: *mut crate::c_types::Signature,
6825 /// Note that this value is always NULL, as there are no contents in the Err variant
6826 pub err: *mut core::ffi::c_void,
6829 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6830 /// containing a crate::c_types::Signature on success and a () on failure.
6831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6832 pub struct CResult_SignatureNoneZ {
6833 /// The contents of this CResult_SignatureNoneZ, accessible via either
6834 /// `err` or `result` depending on the state of `result_ok`.
6835 pub contents: CResult_SignatureNoneZPtr,
6836 /// Whether this CResult_SignatureNoneZ represents a success state.
6837 pub result_ok: bool,
6840 /// Creates a new CResult_SignatureNoneZ in the success state.
6841 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6842 CResult_SignatureNoneZ {
6843 contents: CResult_SignatureNoneZPtr {
6844 result: Box::into_raw(Box::new(o)),
6850 /// Creates a new CResult_SignatureNoneZ in the error state.
6851 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6852 CResult_SignatureNoneZ {
6853 contents: CResult_SignatureNoneZPtr {
6854 err: core::ptr::null_mut(),
6859 /// Checks if the given object is currently in the success state
6861 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6865 /// Frees any resources used by the CResult_SignatureNoneZ.
6866 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6867 impl Drop for CResult_SignatureNoneZ {
6868 fn drop(&mut self) {
6870 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6871 let _ = unsafe { Box::from_raw(self.contents.result) };
6877 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6878 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6879 let contents = if o.result_ok {
6880 let result = unsafe { o.contents.result };
6881 unsafe { o.contents.result = core::ptr::null_mut() };
6882 CResult_SignatureNoneZPtr { result }
6884 let _ = unsafe { Box::from_raw(o.contents.err) };
6885 o.contents.err = core::ptr::null_mut();
6886 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6890 result_ok: o.result_ok,
6894 impl Clone for CResult_SignatureNoneZ {
6895 fn clone(&self) -> Self {
6897 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6898 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6901 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6902 err: core::ptr::null_mut()
6908 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6909 /// but with all dynamically-allocated buffers duplicated in new buffers.
6910 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6912 /// A tuple of 2 elements. See the individual fields for the types contained.
6913 pub struct C2Tuple_SignatureSignatureZ {
6914 /// The element at position 0
6915 pub a: crate::c_types::Signature,
6916 /// The element at position 1
6917 pub b: crate::c_types::Signature,
6919 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6920 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6927 impl C2Tuple_SignatureSignatureZ {
6928 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6932 impl Clone for C2Tuple_SignatureSignatureZ {
6933 fn clone(&self) -> Self {
6935 a: Clone::clone(&self.a),
6936 b: Clone::clone(&self.b),
6941 /// Creates a new tuple which has the same data as `orig`
6942 /// but with all dynamically-allocated buffers duplicated in new buffers.
6943 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6944 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6946 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6947 C2Tuple_SignatureSignatureZ { a, b, }
6951 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6952 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6954 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6955 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6956 /// A pointer to the contents in the success state.
6957 /// Reading from this pointer when `result_ok` is not set is undefined.
6958 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6959 /// Note that this value is always NULL, as there are no contents in the Err variant
6960 pub err: *mut core::ffi::c_void,
6963 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6964 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6966 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6967 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6968 /// `err` or `result` depending on the state of `result_ok`.
6969 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6970 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6971 pub result_ok: bool,
6974 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6975 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6976 CResult_C2Tuple_SignatureSignatureZNoneZ {
6977 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6978 result: Box::into_raw(Box::new(o)),
6984 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6985 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6986 CResult_C2Tuple_SignatureSignatureZNoneZ {
6987 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6988 err: core::ptr::null_mut(),
6993 /// Checks if the given object is currently in the success state
6995 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6999 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
7000 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
7001 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
7002 fn drop(&mut self) {
7004 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7005 let _ = unsafe { Box::from_raw(self.contents.result) };
7011 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
7012 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
7013 let contents = if o.result_ok {
7014 let result = unsafe { o.contents.result };
7015 unsafe { o.contents.result = core::ptr::null_mut() };
7016 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
7018 let _ = unsafe { Box::from_raw(o.contents.err) };
7019 o.contents.err = core::ptr::null_mut();
7020 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
7024 result_ok: o.result_ok,
7028 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
7029 fn clone(&self) -> Self {
7031 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
7032 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
7035 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
7036 err: core::ptr::null_mut()
7042 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
7043 /// but with all dynamically-allocated buffers duplicated in new buffers.
7044 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
7046 /// The contents of CResult_SecretKeyNoneZ
7047 pub union CResult_SecretKeyNoneZPtr {
7048 /// A pointer to the contents in the success state.
7049 /// Reading from this pointer when `result_ok` is not set is undefined.
7050 pub result: *mut crate::c_types::SecretKey,
7051 /// Note that this value is always NULL, as there are no contents in the Err variant
7052 pub err: *mut core::ffi::c_void,
7055 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
7056 /// containing a crate::c_types::SecretKey on success and a () on failure.
7057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7058 pub struct CResult_SecretKeyNoneZ {
7059 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
7060 /// `err` or `result` depending on the state of `result_ok`.
7061 pub contents: CResult_SecretKeyNoneZPtr,
7062 /// Whether this CResult_SecretKeyNoneZ represents a success state.
7063 pub result_ok: bool,
7066 /// Creates a new CResult_SecretKeyNoneZ in the success state.
7067 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
7068 CResult_SecretKeyNoneZ {
7069 contents: CResult_SecretKeyNoneZPtr {
7070 result: Box::into_raw(Box::new(o)),
7076 /// Creates a new CResult_SecretKeyNoneZ in the error state.
7077 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
7078 CResult_SecretKeyNoneZ {
7079 contents: CResult_SecretKeyNoneZPtr {
7080 err: core::ptr::null_mut(),
7085 /// Checks if the given object is currently in the success state
7087 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
7091 /// Frees any resources used by the CResult_SecretKeyNoneZ.
7092 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
7093 impl Drop for CResult_SecretKeyNoneZ {
7094 fn drop(&mut self) {
7096 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7097 let _ = unsafe { Box::from_raw(self.contents.result) };
7103 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
7104 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
7105 let contents = if o.result_ok {
7106 let result = unsafe { o.contents.result };
7107 unsafe { o.contents.result = core::ptr::null_mut() };
7108 CResult_SecretKeyNoneZPtr { result }
7110 let _ = unsafe { Box::from_raw(o.contents.err) };
7111 o.contents.err = core::ptr::null_mut();
7112 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
7116 result_ok: o.result_ok,
7120 impl Clone for CResult_SecretKeyNoneZ {
7121 fn clone(&self) -> Self {
7123 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
7124 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
7127 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
7128 err: core::ptr::null_mut()
7134 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
7135 /// but with all dynamically-allocated buffers duplicated in new buffers.
7136 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
7138 /// The contents of CResult_PublicKeyNoneZ
7139 pub union CResult_PublicKeyNoneZPtr {
7140 /// A pointer to the contents in the success state.
7141 /// Reading from this pointer when `result_ok` is not set is undefined.
7142 pub result: *mut crate::c_types::PublicKey,
7143 /// Note that this value is always NULL, as there are no contents in the Err variant
7144 pub err: *mut core::ffi::c_void,
7147 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
7148 /// containing a crate::c_types::PublicKey on success and a () on failure.
7149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7150 pub struct CResult_PublicKeyNoneZ {
7151 /// The contents of this CResult_PublicKeyNoneZ, accessible via either
7152 /// `err` or `result` depending on the state of `result_ok`.
7153 pub contents: CResult_PublicKeyNoneZPtr,
7154 /// Whether this CResult_PublicKeyNoneZ represents a success state.
7155 pub result_ok: bool,
7158 /// Creates a new CResult_PublicKeyNoneZ in the success state.
7159 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
7160 CResult_PublicKeyNoneZ {
7161 contents: CResult_PublicKeyNoneZPtr {
7162 result: Box::into_raw(Box::new(o)),
7168 /// Creates a new CResult_PublicKeyNoneZ in the error state.
7169 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
7170 CResult_PublicKeyNoneZ {
7171 contents: CResult_PublicKeyNoneZPtr {
7172 err: core::ptr::null_mut(),
7177 /// Checks if the given object is currently in the success state
7179 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
7183 /// Frees any resources used by the CResult_PublicKeyNoneZ.
7184 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
7185 impl Drop for CResult_PublicKeyNoneZ {
7186 fn drop(&mut self) {
7188 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7189 let _ = unsafe { Box::from_raw(self.contents.result) };
7195 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
7196 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
7197 let contents = if o.result_ok {
7198 let result = unsafe { o.contents.result };
7199 unsafe { o.contents.result = core::ptr::null_mut() };
7200 CResult_PublicKeyNoneZPtr { result }
7202 let _ = unsafe { Box::from_raw(o.contents.err) };
7203 o.contents.err = core::ptr::null_mut();
7204 CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
7208 result_ok: o.result_ok,
7212 impl Clone for CResult_PublicKeyNoneZ {
7213 fn clone(&self) -> Self {
7215 Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
7216 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7219 Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
7220 err: core::ptr::null_mut()
7226 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
7227 /// but with all dynamically-allocated buffers duplicated in new buffers.
7228 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
7230 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
7231 pub enum COption_ScalarZ {
7232 /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7233 Some(crate::c_types::BigEndianScalar),
7234 /// When we're in this state, this COption_ScalarZ contains nothing
7237 impl COption_ScalarZ {
7238 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7239 if let Self::None = self { false } else { true }
7241 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7244 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
7245 if let Self::Some(v) = self { v } else { unreachable!() }
7249 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
7250 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
7251 COption_ScalarZ::Some(o)
7254 /// Constructs a new COption_ScalarZ containing nothing
7255 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
7256 COption_ScalarZ::None
7259 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
7260 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
7262 /// The contents of CResult_SharedSecretNoneZ
7263 pub union CResult_SharedSecretNoneZPtr {
7264 /// A pointer to the contents in the success state.
7265 /// Reading from this pointer when `result_ok` is not set is undefined.
7266 pub result: *mut crate::c_types::ThirtyTwoBytes,
7267 /// Note that this value is always NULL, as there are no contents in the Err variant
7268 pub err: *mut core::ffi::c_void,
7271 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7272 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7274 pub struct CResult_SharedSecretNoneZ {
7275 /// The contents of this CResult_SharedSecretNoneZ, accessible via either
7276 /// `err` or `result` depending on the state of `result_ok`.
7277 pub contents: CResult_SharedSecretNoneZPtr,
7278 /// Whether this CResult_SharedSecretNoneZ represents a success state.
7279 pub result_ok: bool,
7282 /// Creates a new CResult_SharedSecretNoneZ in the success state.
7283 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
7284 CResult_SharedSecretNoneZ {
7285 contents: CResult_SharedSecretNoneZPtr {
7286 result: Box::into_raw(Box::new(o)),
7292 /// Creates a new CResult_SharedSecretNoneZ in the error state.
7293 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
7294 CResult_SharedSecretNoneZ {
7295 contents: CResult_SharedSecretNoneZPtr {
7296 err: core::ptr::null_mut(),
7301 /// Checks if the given object is currently in the success state
7303 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
7307 /// Frees any resources used by the CResult_SharedSecretNoneZ.
7308 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
7309 impl Drop for CResult_SharedSecretNoneZ {
7310 fn drop(&mut self) {
7312 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7313 let _ = unsafe { Box::from_raw(self.contents.result) };
7319 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
7320 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7321 let contents = if o.result_ok {
7322 let result = unsafe { o.contents.result };
7323 unsafe { o.contents.result = core::ptr::null_mut() };
7324 CResult_SharedSecretNoneZPtr { result }
7326 let _ = unsafe { Box::from_raw(o.contents.err) };
7327 o.contents.err = core::ptr::null_mut();
7328 CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
7332 result_ok: o.result_ok,
7336 impl Clone for CResult_SharedSecretNoneZ {
7337 fn clone(&self) -> Self {
7339 Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
7340 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7343 Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
7344 err: core::ptr::null_mut()
7350 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
7351 /// but with all dynamically-allocated buffers duplicated in new buffers.
7352 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
7354 /// The contents of CResult_SignDecodeErrorZ
7355 pub union CResult_SignDecodeErrorZPtr {
7356 /// A pointer to the contents in the success state.
7357 /// Reading from this pointer when `result_ok` is not set is undefined.
7358 pub result: *mut crate::lightning::chain::keysinterface::Sign,
7359 /// A pointer to the contents in the error state.
7360 /// Reading from this pointer when `result_ok` is set is undefined.
7361 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7364 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
7365 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
7366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7367 pub struct CResult_SignDecodeErrorZ {
7368 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
7369 /// `err` or `result` depending on the state of `result_ok`.
7370 pub contents: CResult_SignDecodeErrorZPtr,
7371 /// Whether this CResult_SignDecodeErrorZ represents a success state.
7372 pub result_ok: bool,
7375 /// Creates a new CResult_SignDecodeErrorZ in the success state.
7376 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
7377 CResult_SignDecodeErrorZ {
7378 contents: CResult_SignDecodeErrorZPtr {
7379 result: Box::into_raw(Box::new(o)),
7385 /// Creates a new CResult_SignDecodeErrorZ in the error state.
7386 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
7387 CResult_SignDecodeErrorZ {
7388 contents: CResult_SignDecodeErrorZPtr {
7389 err: Box::into_raw(Box::new(e)),
7394 /// Checks if the given object is currently in the success state
7396 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
7400 /// Frees any resources used by the CResult_SignDecodeErrorZ.
7401 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
7402 impl Drop for CResult_SignDecodeErrorZ {
7403 fn drop(&mut self) {
7405 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7406 let _ = unsafe { Box::from_raw(self.contents.result) };
7409 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7410 let _ = unsafe { Box::from_raw(self.contents.err) };
7415 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
7416 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
7417 let contents = if o.result_ok {
7418 let result = unsafe { o.contents.result };
7419 unsafe { o.contents.result = core::ptr::null_mut() };
7420 CResult_SignDecodeErrorZPtr { result }
7422 let err = unsafe { o.contents.err };
7423 unsafe { o.contents.err = core::ptr::null_mut(); }
7424 CResult_SignDecodeErrorZPtr { err }
7428 result_ok: o.result_ok,
7433 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7434 /// This corresponds to std::vector in C++
7435 pub struct CVec_U5Z {
7436 /// The elements in the array.
7437 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7438 pub data: *mut crate::c_types::U5,
7439 /// The number of elements pointed to by `data`.
7443 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
7444 if self.datalen == 0 { return Vec::new(); }
7445 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7446 self.data = core::ptr::null_mut();
7450 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
7451 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7454 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
7455 fn from(v: Vec<crate::c_types::U5>) -> Self {
7456 let datalen = v.len();
7457 let data = Box::into_raw(v.into_boxed_slice());
7458 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7462 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7463 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
7464 impl Drop for CVec_U5Z {
7465 fn drop(&mut self) {
7466 if self.datalen == 0 { return; }
7467 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7470 impl Clone for CVec_U5Z {
7471 fn clone(&self) -> Self {
7472 let mut res = Vec::new();
7473 if self.datalen == 0 { return Self::from(res); }
7474 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7479 /// The contents of CResult_RecoverableSignatureNoneZ
7480 pub union CResult_RecoverableSignatureNoneZPtr {
7481 /// A pointer to the contents in the success state.
7482 /// Reading from this pointer when `result_ok` is not set is undefined.
7483 pub result: *mut crate::c_types::RecoverableSignature,
7484 /// Note that this value is always NULL, as there are no contents in the Err variant
7485 pub err: *mut core::ffi::c_void,
7488 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7489 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
7490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7491 pub struct CResult_RecoverableSignatureNoneZ {
7492 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7493 /// `err` or `result` depending on the state of `result_ok`.
7494 pub contents: CResult_RecoverableSignatureNoneZPtr,
7495 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7496 pub result_ok: bool,
7499 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
7500 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
7501 CResult_RecoverableSignatureNoneZ {
7502 contents: CResult_RecoverableSignatureNoneZPtr {
7503 result: Box::into_raw(Box::new(o)),
7509 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
7510 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
7511 CResult_RecoverableSignatureNoneZ {
7512 contents: CResult_RecoverableSignatureNoneZPtr {
7513 err: core::ptr::null_mut(),
7518 /// Checks if the given object is currently in the success state
7520 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
7524 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
7525 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
7526 impl Drop for CResult_RecoverableSignatureNoneZ {
7527 fn drop(&mut self) {
7529 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7530 let _ = unsafe { Box::from_raw(self.contents.result) };
7536 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
7537 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
7538 let contents = if o.result_ok {
7539 let result = unsafe { o.contents.result };
7540 unsafe { o.contents.result = core::ptr::null_mut() };
7541 CResult_RecoverableSignatureNoneZPtr { result }
7543 let _ = unsafe { Box::from_raw(o.contents.err) };
7544 o.contents.err = core::ptr::null_mut();
7545 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
7549 result_ok: o.result_ok,
7553 impl Clone for CResult_RecoverableSignatureNoneZ {
7554 fn clone(&self) -> Self {
7556 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
7557 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
7560 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
7561 err: core::ptr::null_mut()
7567 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
7568 /// but with all dynamically-allocated buffers duplicated in new buffers.
7569 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
7571 /// A dynamically-allocated array of u8s of arbitrary size.
7572 /// This corresponds to std::vector in C++
7573 pub struct CVec_u8Z {
7574 /// The elements in the array.
7575 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7577 /// The number of elements pointed to by `data`.
7581 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
7582 if self.datalen == 0 { return Vec::new(); }
7583 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7584 self.data = core::ptr::null_mut();
7588 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
7589 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7592 impl From<Vec<u8>> for CVec_u8Z {
7593 fn from(v: Vec<u8>) -> Self {
7594 let datalen = v.len();
7595 let data = Box::into_raw(v.into_boxed_slice());
7596 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7600 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7601 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
7602 impl Drop for CVec_u8Z {
7603 fn drop(&mut self) {
7604 if self.datalen == 0 { return; }
7605 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7608 impl Clone for CVec_u8Z {
7609 fn clone(&self) -> Self {
7610 let mut res = Vec::new();
7611 if self.datalen == 0 { return Self::from(res); }
7612 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7617 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7618 /// This corresponds to std::vector in C++
7619 pub struct CVec_CVec_u8ZZ {
7620 /// The elements in the array.
7621 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7622 pub data: *mut crate::c_types::derived::CVec_u8Z,
7623 /// The number of elements pointed to by `data`.
7626 impl CVec_CVec_u8ZZ {
7627 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
7628 if self.datalen == 0 { return Vec::new(); }
7629 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7630 self.data = core::ptr::null_mut();
7634 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
7635 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7638 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
7639 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
7640 let datalen = v.len();
7641 let data = Box::into_raw(v.into_boxed_slice());
7642 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7646 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7647 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
7648 impl Drop for CVec_CVec_u8ZZ {
7649 fn drop(&mut self) {
7650 if self.datalen == 0 { return; }
7651 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7654 impl Clone for CVec_CVec_u8ZZ {
7655 fn clone(&self) -> Self {
7656 let mut res = Vec::new();
7657 if self.datalen == 0 { return Self::from(res); }
7658 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7663 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
7664 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
7665 /// A pointer to the contents in the success state.
7666 /// Reading from this pointer when `result_ok` is not set is undefined.
7667 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
7668 /// Note that this value is always NULL, as there are no contents in the Err variant
7669 pub err: *mut core::ffi::c_void,
7672 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7673 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7674 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7675 pub struct CResult_CVec_CVec_u8ZZNoneZ {
7676 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7677 /// `err` or `result` depending on the state of `result_ok`.
7678 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
7679 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7680 pub result_ok: bool,
7683 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
7684 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
7685 CResult_CVec_CVec_u8ZZNoneZ {
7686 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7687 result: Box::into_raw(Box::new(o)),
7693 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
7694 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
7695 CResult_CVec_CVec_u8ZZNoneZ {
7696 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7697 err: core::ptr::null_mut(),
7702 /// Checks if the given object is currently in the success state
7704 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
7708 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
7709 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
7710 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
7711 fn drop(&mut self) {
7713 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7714 let _ = unsafe { Box::from_raw(self.contents.result) };
7720 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
7721 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
7722 let contents = if o.result_ok {
7723 let result = unsafe { o.contents.result };
7724 unsafe { o.contents.result = core::ptr::null_mut() };
7725 CResult_CVec_CVec_u8ZZNoneZPtr { result }
7727 let _ = unsafe { Box::from_raw(o.contents.err) };
7728 o.contents.err = core::ptr::null_mut();
7729 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
7733 result_ok: o.result_ok,
7737 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
7738 fn clone(&self) -> Self {
7740 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7741 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
7744 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7745 err: core::ptr::null_mut()
7751 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
7752 /// but with all dynamically-allocated buffers duplicated in new buffers.
7753 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
7755 /// The contents of CResult_InMemorySignerDecodeErrorZ
7756 pub union CResult_InMemorySignerDecodeErrorZPtr {
7757 /// A pointer to the contents in the success state.
7758 /// Reading from this pointer when `result_ok` is not set is undefined.
7759 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
7760 /// A pointer to the contents in the error state.
7761 /// Reading from this pointer when `result_ok` is set is undefined.
7762 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7765 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7766 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7767 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7768 pub struct CResult_InMemorySignerDecodeErrorZ {
7769 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7770 /// `err` or `result` depending on the state of `result_ok`.
7771 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7772 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7773 pub result_ok: bool,
7776 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7777 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7778 CResult_InMemorySignerDecodeErrorZ {
7779 contents: CResult_InMemorySignerDecodeErrorZPtr {
7780 result: Box::into_raw(Box::new(o)),
7786 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7787 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7788 CResult_InMemorySignerDecodeErrorZ {
7789 contents: CResult_InMemorySignerDecodeErrorZPtr {
7790 err: Box::into_raw(Box::new(e)),
7795 /// Checks if the given object is currently in the success state
7797 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7801 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7802 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7803 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7804 fn drop(&mut self) {
7806 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7807 let _ = unsafe { Box::from_raw(self.contents.result) };
7810 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7811 let _ = unsafe { Box::from_raw(self.contents.err) };
7816 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7817 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7818 let contents = if o.result_ok {
7819 let result = unsafe { o.contents.result };
7820 unsafe { o.contents.result = core::ptr::null_mut() };
7821 CResult_InMemorySignerDecodeErrorZPtr { result }
7823 let err = unsafe { o.contents.err };
7824 unsafe { o.contents.err = core::ptr::null_mut(); }
7825 CResult_InMemorySignerDecodeErrorZPtr { err }
7829 result_ok: o.result_ok,
7833 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7834 fn clone(&self) -> Self {
7836 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7837 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7840 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7841 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7847 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7848 /// but with all dynamically-allocated buffers duplicated in new buffers.
7849 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7851 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7852 /// This corresponds to std::vector in C++
7853 pub struct CVec_TxOutZ {
7854 /// The elements in the array.
7855 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7856 pub data: *mut crate::c_types::TxOut,
7857 /// The number of elements pointed to by `data`.
7861 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7862 if self.datalen == 0 { return Vec::new(); }
7863 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7864 self.data = core::ptr::null_mut();
7868 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7869 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7872 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7873 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7874 let datalen = v.len();
7875 let data = Box::into_raw(v.into_boxed_slice());
7876 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7880 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7881 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7882 impl Drop for CVec_TxOutZ {
7883 fn drop(&mut self) {
7884 if self.datalen == 0 { return; }
7885 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7888 impl Clone for CVec_TxOutZ {
7889 fn clone(&self) -> Self {
7890 let mut res = Vec::new();
7891 if self.datalen == 0 { return Self::from(res); }
7892 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7897 /// The contents of CResult_TransactionNoneZ
7898 pub union CResult_TransactionNoneZPtr {
7899 /// A pointer to the contents in the success state.
7900 /// Reading from this pointer when `result_ok` is not set is undefined.
7901 pub result: *mut crate::c_types::Transaction,
7902 /// Note that this value is always NULL, as there are no contents in the Err variant
7903 pub err: *mut core::ffi::c_void,
7906 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7907 /// containing a crate::c_types::Transaction on success and a () on failure.
7908 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7909 pub struct CResult_TransactionNoneZ {
7910 /// The contents of this CResult_TransactionNoneZ, accessible via either
7911 /// `err` or `result` depending on the state of `result_ok`.
7912 pub contents: CResult_TransactionNoneZPtr,
7913 /// Whether this CResult_TransactionNoneZ represents a success state.
7914 pub result_ok: bool,
7917 /// Creates a new CResult_TransactionNoneZ in the success state.
7918 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7919 CResult_TransactionNoneZ {
7920 contents: CResult_TransactionNoneZPtr {
7921 result: Box::into_raw(Box::new(o)),
7927 /// Creates a new CResult_TransactionNoneZ in the error state.
7928 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7929 CResult_TransactionNoneZ {
7930 contents: CResult_TransactionNoneZPtr {
7931 err: core::ptr::null_mut(),
7936 /// Checks if the given object is currently in the success state
7938 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7942 /// Frees any resources used by the CResult_TransactionNoneZ.
7943 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7944 impl Drop for CResult_TransactionNoneZ {
7945 fn drop(&mut self) {
7947 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7948 let _ = unsafe { Box::from_raw(self.contents.result) };
7954 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7955 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7956 let contents = if o.result_ok {
7957 let result = unsafe { o.contents.result };
7958 unsafe { o.contents.result = core::ptr::null_mut() };
7959 CResult_TransactionNoneZPtr { result }
7961 let _ = unsafe { Box::from_raw(o.contents.err) };
7962 o.contents.err = core::ptr::null_mut();
7963 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7967 result_ok: o.result_ok,
7971 impl Clone for CResult_TransactionNoneZ {
7972 fn clone(&self) -> Self {
7974 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7975 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7978 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7979 err: core::ptr::null_mut()
7985 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7986 /// but with all dynamically-allocated buffers duplicated in new buffers.
7987 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7989 /// A tuple of 2 elements. See the individual fields for the types contained.
7990 pub struct C2Tuple_BlockHashChannelMonitorZ {
7991 /// The element at position 0
7992 pub a: crate::c_types::ThirtyTwoBytes,
7993 /// The element at position 1
7994 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7996 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7997 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
8004 impl C2Tuple_BlockHashChannelMonitorZ {
8005 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
8009 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8011 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
8012 C2Tuple_BlockHashChannelMonitorZ { a, b, }
8016 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8017 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
8019 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8020 /// This corresponds to std::vector in C++
8021 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
8022 /// The elements in the array.
8023 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8024 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8025 /// The number of elements pointed to by `data`.
8028 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
8029 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
8030 if self.datalen == 0 { return Vec::new(); }
8031 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8032 self.data = core::ptr::null_mut();
8036 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
8037 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8040 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8041 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
8042 let datalen = v.len();
8043 let data = Box::into_raw(v.into_boxed_slice());
8044 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8048 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8049 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
8050 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8051 fn drop(&mut self) {
8052 if self.datalen == 0 { return; }
8053 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8057 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8058 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8059 /// A pointer to the contents in the success state.
8060 /// Reading from this pointer when `result_ok` is not set is undefined.
8061 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
8062 /// A pointer to the contents in the error state.
8063 /// Reading from this pointer when `result_ok` is set is undefined.
8064 pub err: *mut crate::c_types::IOError,
8067 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8068 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8070 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8071 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8072 /// `err` or `result` depending on the state of `result_ok`.
8073 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
8074 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8075 pub result_ok: bool,
8078 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
8079 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8080 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8081 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8082 result: Box::into_raw(Box::new(o)),
8088 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
8089 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8090 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8091 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8092 err: Box::into_raw(Box::new(e)),
8097 /// Checks if the given object is currently in the success state
8099 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
8103 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
8104 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
8105 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8106 fn drop(&mut self) {
8108 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8109 let _ = unsafe { Box::from_raw(self.contents.result) };
8112 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8113 let _ = unsafe { Box::from_raw(self.contents.err) };
8118 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8119 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
8120 let contents = if o.result_ok {
8121 let result = unsafe { o.contents.result };
8122 unsafe { o.contents.result = core::ptr::null_mut() };
8123 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
8125 let err = unsafe { o.contents.err };
8126 unsafe { o.contents.err = core::ptr::null_mut(); }
8127 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
8131 result_ok: o.result_ok,
8137 /// An enum which can either contain a u16 or not
8138 pub enum COption_u16Z {
8139 /// When we're in this state, this COption_u16Z contains a u16
8141 /// When we're in this state, this COption_u16Z contains nothing
8145 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8146 if let Self::None = self { false } else { true }
8148 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8151 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
8152 if let Self::Some(v) = self { v } else { unreachable!() }
8156 /// Constructs a new COption_u16Z containing a u16
8157 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
8158 COption_u16Z::Some(o)
8161 /// Constructs a new COption_u16Z containing nothing
8162 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
8166 /// Frees any resources associated with the u16, if we are in the Some state
8167 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
8169 /// Creates a new COption_u16Z which has the same data as `orig`
8170 /// but with all dynamically-allocated buffers duplicated in new buffers.
8171 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
8173 /// The contents of CResult_NoneAPIErrorZ
8174 pub union CResult_NoneAPIErrorZPtr {
8175 /// Note that this value is always NULL, as there are no contents in the OK variant
8176 pub result: *mut core::ffi::c_void,
8177 /// A pointer to the contents in the error state.
8178 /// Reading from this pointer when `result_ok` is set is undefined.
8179 pub err: *mut crate::lightning::util::errors::APIError,
8182 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
8183 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
8184 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8185 pub struct CResult_NoneAPIErrorZ {
8186 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
8187 /// `err` or `result` depending on the state of `result_ok`.
8188 pub contents: CResult_NoneAPIErrorZPtr,
8189 /// Whether this CResult_NoneAPIErrorZ represents a success state.
8190 pub result_ok: bool,
8193 /// Creates a new CResult_NoneAPIErrorZ in the success state.
8194 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
8195 CResult_NoneAPIErrorZ {
8196 contents: CResult_NoneAPIErrorZPtr {
8197 result: core::ptr::null_mut(),
8203 /// Creates a new CResult_NoneAPIErrorZ in the error state.
8204 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
8205 CResult_NoneAPIErrorZ {
8206 contents: CResult_NoneAPIErrorZPtr {
8207 err: Box::into_raw(Box::new(e)),
8212 /// Checks if the given object is currently in the success state
8214 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
8218 /// Frees any resources used by the CResult_NoneAPIErrorZ.
8219 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
8220 impl Drop for CResult_NoneAPIErrorZ {
8221 fn drop(&mut self) {
8224 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8225 let _ = unsafe { Box::from_raw(self.contents.err) };
8230 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
8231 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
8232 let contents = if o.result_ok {
8233 let _ = unsafe { Box::from_raw(o.contents.result) };
8234 o.contents.result = core::ptr::null_mut();
8235 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
8237 let err = unsafe { o.contents.err };
8238 unsafe { o.contents.err = core::ptr::null_mut(); }
8239 CResult_NoneAPIErrorZPtr { err }
8243 result_ok: o.result_ok,
8247 impl Clone for CResult_NoneAPIErrorZ {
8248 fn clone(&self) -> Self {
8250 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
8251 result: core::ptr::null_mut()
8254 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
8255 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8261 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
8262 /// but with all dynamically-allocated buffers duplicated in new buffers.
8263 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
8265 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
8266 /// This corresponds to std::vector in C++
8267 pub struct CVec_CResult_NoneAPIErrorZZ {
8268 /// The elements in the array.
8269 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8270 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
8271 /// The number of elements pointed to by `data`.
8274 impl CVec_CResult_NoneAPIErrorZZ {
8275 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
8276 if self.datalen == 0 { return Vec::new(); }
8277 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8278 self.data = core::ptr::null_mut();
8282 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
8283 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8286 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
8287 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
8288 let datalen = v.len();
8289 let data = Box::into_raw(v.into_boxed_slice());
8290 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8294 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8295 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
8296 impl Drop for CVec_CResult_NoneAPIErrorZZ {
8297 fn drop(&mut self) {
8298 if self.datalen == 0 { return; }
8299 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8302 impl Clone for CVec_CResult_NoneAPIErrorZZ {
8303 fn clone(&self) -> Self {
8304 let mut res = Vec::new();
8305 if self.datalen == 0 { return Self::from(res); }
8306 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8311 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
8312 /// This corresponds to std::vector in C++
8313 pub struct CVec_APIErrorZ {
8314 /// The elements in the array.
8315 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8316 pub data: *mut crate::lightning::util::errors::APIError,
8317 /// The number of elements pointed to by `data`.
8320 impl CVec_APIErrorZ {
8321 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
8322 if self.datalen == 0 { return Vec::new(); }
8323 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8324 self.data = core::ptr::null_mut();
8328 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
8329 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8332 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
8333 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
8334 let datalen = v.len();
8335 let data = Box::into_raw(v.into_boxed_slice());
8336 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8340 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8341 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
8342 impl Drop for CVec_APIErrorZ {
8343 fn drop(&mut self) {
8344 if self.datalen == 0 { return; }
8345 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8348 impl Clone for CVec_APIErrorZ {
8349 fn clone(&self) -> Self {
8350 let mut res = Vec::new();
8351 if self.datalen == 0 { return Self::from(res); }
8352 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8357 /// The contents of CResult__u832APIErrorZ
8358 pub union CResult__u832APIErrorZPtr {
8359 /// A pointer to the contents in the success state.
8360 /// Reading from this pointer when `result_ok` is not set is undefined.
8361 pub result: *mut crate::c_types::ThirtyTwoBytes,
8362 /// A pointer to the contents in the error state.
8363 /// Reading from this pointer when `result_ok` is set is undefined.
8364 pub err: *mut crate::lightning::util::errors::APIError,
8367 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
8368 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8369 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8370 pub struct CResult__u832APIErrorZ {
8371 /// The contents of this CResult__u832APIErrorZ, accessible via either
8372 /// `err` or `result` depending on the state of `result_ok`.
8373 pub contents: CResult__u832APIErrorZPtr,
8374 /// Whether this CResult__u832APIErrorZ represents a success state.
8375 pub result_ok: bool,
8378 /// Creates a new CResult__u832APIErrorZ in the success state.
8379 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
8380 CResult__u832APIErrorZ {
8381 contents: CResult__u832APIErrorZPtr {
8382 result: Box::into_raw(Box::new(o)),
8388 /// Creates a new CResult__u832APIErrorZ in the error state.
8389 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
8390 CResult__u832APIErrorZ {
8391 contents: CResult__u832APIErrorZPtr {
8392 err: Box::into_raw(Box::new(e)),
8397 /// Checks if the given object is currently in the success state
8399 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
8403 /// Frees any resources used by the CResult__u832APIErrorZ.
8404 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
8405 impl Drop for CResult__u832APIErrorZ {
8406 fn drop(&mut self) {
8408 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8409 let _ = unsafe { Box::from_raw(self.contents.result) };
8412 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8413 let _ = unsafe { Box::from_raw(self.contents.err) };
8418 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
8419 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8420 let contents = if o.result_ok {
8421 let result = unsafe { o.contents.result };
8422 unsafe { o.contents.result = core::ptr::null_mut() };
8423 CResult__u832APIErrorZPtr { result }
8425 let err = unsafe { o.contents.err };
8426 unsafe { o.contents.err = core::ptr::null_mut(); }
8427 CResult__u832APIErrorZPtr { err }
8431 result_ok: o.result_ok,
8435 impl Clone for CResult__u832APIErrorZ {
8436 fn clone(&self) -> Self {
8438 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
8439 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8442 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8443 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8449 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8450 /// but with all dynamically-allocated buffers duplicated in new buffers.
8451 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8453 /// The contents of CResult_NonePaymentSendFailureZ
8454 pub union CResult_NonePaymentSendFailureZPtr {
8455 /// Note that this value is always NULL, as there are no contents in the OK variant
8456 pub result: *mut core::ffi::c_void,
8457 /// A pointer to the contents in the error state.
8458 /// Reading from this pointer when `result_ok` is set is undefined.
8459 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8462 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8463 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8465 pub struct CResult_NonePaymentSendFailureZ {
8466 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8467 /// `err` or `result` depending on the state of `result_ok`.
8468 pub contents: CResult_NonePaymentSendFailureZPtr,
8469 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8470 pub result_ok: bool,
8473 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8474 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8475 CResult_NonePaymentSendFailureZ {
8476 contents: CResult_NonePaymentSendFailureZPtr {
8477 result: core::ptr::null_mut(),
8483 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8484 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8485 CResult_NonePaymentSendFailureZ {
8486 contents: CResult_NonePaymentSendFailureZPtr {
8487 err: Box::into_raw(Box::new(e)),
8492 /// Checks if the given object is currently in the success state
8494 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8498 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8499 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8500 impl Drop for CResult_NonePaymentSendFailureZ {
8501 fn drop(&mut self) {
8504 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8505 let _ = unsafe { Box::from_raw(self.contents.err) };
8510 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8511 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8512 let contents = if o.result_ok {
8513 let _ = unsafe { Box::from_raw(o.contents.result) };
8514 o.contents.result = core::ptr::null_mut();
8515 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8517 let err = unsafe { o.contents.err };
8518 unsafe { o.contents.err = core::ptr::null_mut(); }
8519 CResult_NonePaymentSendFailureZPtr { err }
8523 result_ok: o.result_ok,
8527 impl Clone for CResult_NonePaymentSendFailureZ {
8528 fn clone(&self) -> Self {
8530 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8531 result: core::ptr::null_mut()
8534 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8535 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8541 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8542 /// but with all dynamically-allocated buffers duplicated in new buffers.
8543 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8545 /// The contents of CResult_PaymentHashPaymentSendFailureZ
8546 pub union CResult_PaymentHashPaymentSendFailureZPtr {
8547 /// A pointer to the contents in the success state.
8548 /// Reading from this pointer when `result_ok` is not set is undefined.
8549 pub result: *mut crate::c_types::ThirtyTwoBytes,
8550 /// A pointer to the contents in the error state.
8551 /// Reading from this pointer when `result_ok` is set is undefined.
8552 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8555 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
8556 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8558 pub struct CResult_PaymentHashPaymentSendFailureZ {
8559 /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
8560 /// `err` or `result` depending on the state of `result_ok`.
8561 pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
8562 /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
8563 pub result_ok: bool,
8566 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
8567 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
8568 CResult_PaymentHashPaymentSendFailureZ {
8569 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8570 result: Box::into_raw(Box::new(o)),
8576 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
8577 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
8578 CResult_PaymentHashPaymentSendFailureZ {
8579 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8580 err: Box::into_raw(Box::new(e)),
8585 /// Checks if the given object is currently in the success state
8587 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool {
8591 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
8592 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
8593 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
8594 fn drop(&mut self) {
8596 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8597 let _ = unsafe { Box::from_raw(self.contents.result) };
8600 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8601 let _ = unsafe { Box::from_raw(self.contents.err) };
8606 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
8607 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8608 let contents = if o.result_ok {
8609 let result = unsafe { o.contents.result };
8610 unsafe { o.contents.result = core::ptr::null_mut() };
8611 CResult_PaymentHashPaymentSendFailureZPtr { result }
8613 let err = unsafe { o.contents.err };
8614 unsafe { o.contents.err = core::ptr::null_mut(); }
8615 CResult_PaymentHashPaymentSendFailureZPtr { err }
8619 result_ok: o.result_ok,
8623 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
8624 fn clone(&self) -> Self {
8626 Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8627 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8630 Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8631 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8637 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
8638 /// but with all dynamically-allocated buffers duplicated in new buffers.
8639 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
8641 /// A tuple of 2 elements. See the individual fields for the types contained.
8642 pub struct C2Tuple_PaymentHashPaymentIdZ {
8643 /// The element at position 0
8644 pub a: crate::c_types::ThirtyTwoBytes,
8645 /// The element at position 1
8646 pub b: crate::c_types::ThirtyTwoBytes,
8648 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8649 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8656 impl C2Tuple_PaymentHashPaymentIdZ {
8657 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8661 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8662 fn clone(&self) -> Self {
8664 a: Clone::clone(&self.a),
8665 b: Clone::clone(&self.b),
8670 /// Creates a new tuple which has the same data as `orig`
8671 /// but with all dynamically-allocated buffers duplicated in new buffers.
8672 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8673 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8675 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8676 C2Tuple_PaymentHashPaymentIdZ { a, b, }
8680 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8681 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8683 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8684 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8685 /// A pointer to the contents in the success state.
8686 /// Reading from this pointer when `result_ok` is not set is undefined.
8687 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8688 /// A pointer to the contents in the error state.
8689 /// Reading from this pointer when `result_ok` is set is undefined.
8690 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8693 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8694 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8696 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8697 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8698 /// `err` or `result` depending on the state of `result_ok`.
8699 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8700 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8701 pub result_ok: bool,
8704 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8705 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8706 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8707 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8708 result: Box::into_raw(Box::new(o)),
8714 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8715 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8716 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8717 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8718 err: Box::into_raw(Box::new(e)),
8723 /// Checks if the given object is currently in the success state
8725 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8729 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8730 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8731 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8732 fn drop(&mut self) {
8734 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8735 let _ = unsafe { Box::from_raw(self.contents.result) };
8738 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8739 let _ = unsafe { Box::from_raw(self.contents.err) };
8744 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8745 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8746 let contents = if o.result_ok {
8747 let result = unsafe { o.contents.result };
8748 unsafe { o.contents.result = core::ptr::null_mut() };
8749 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8751 let err = unsafe { o.contents.err };
8752 unsafe { o.contents.err = core::ptr::null_mut(); }
8753 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8757 result_ok: o.result_ok,
8761 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8762 fn clone(&self) -> Self {
8764 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8765 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8768 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8769 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8775 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8776 /// but with all dynamically-allocated buffers duplicated in new buffers.
8777 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8779 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8780 /// This corresponds to std::vector in C++
8781 pub struct CVec_ThirtyTwoBytesZ {
8782 /// The elements in the array.
8783 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8784 pub data: *mut crate::c_types::ThirtyTwoBytes,
8785 /// The number of elements pointed to by `data`.
8788 impl CVec_ThirtyTwoBytesZ {
8789 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8790 if self.datalen == 0 { return Vec::new(); }
8791 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8792 self.data = core::ptr::null_mut();
8796 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8797 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8800 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8801 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8802 let datalen = v.len();
8803 let data = Box::into_raw(v.into_boxed_slice());
8804 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8808 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8809 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8810 impl Drop for CVec_ThirtyTwoBytesZ {
8811 fn drop(&mut self) {
8812 if self.datalen == 0 { return; }
8813 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8816 impl Clone for CVec_ThirtyTwoBytesZ {
8817 fn clone(&self) -> Self {
8818 let mut res = Vec::new();
8819 if self.datalen == 0 { return Self::from(res); }
8820 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8825 /// A tuple of 2 elements. See the individual fields for the types contained.
8826 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8827 /// The element at position 0
8828 pub a: crate::c_types::ThirtyTwoBytes,
8829 /// The element at position 1
8830 pub b: crate::c_types::ThirtyTwoBytes,
8832 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8833 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8840 impl C2Tuple_PaymentHashPaymentSecretZ {
8841 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8845 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8846 fn clone(&self) -> Self {
8848 a: Clone::clone(&self.a),
8849 b: Clone::clone(&self.b),
8854 /// Creates a new tuple which has the same data as `orig`
8855 /// but with all dynamically-allocated buffers duplicated in new buffers.
8856 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8857 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8859 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8860 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8864 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8865 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8867 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8868 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8869 /// A pointer to the contents in the success state.
8870 /// Reading from this pointer when `result_ok` is not set is undefined.
8871 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8872 /// Note that this value is always NULL, as there are no contents in the Err variant
8873 pub err: *mut core::ffi::c_void,
8876 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8877 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8879 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8880 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8881 /// `err` or `result` depending on the state of `result_ok`.
8882 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8883 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8884 pub result_ok: bool,
8887 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8888 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8889 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8890 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8891 result: Box::into_raw(Box::new(o)),
8897 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8898 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8899 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8900 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8901 err: core::ptr::null_mut(),
8906 /// Checks if the given object is currently in the success state
8908 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8912 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8913 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8914 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8915 fn drop(&mut self) {
8917 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8918 let _ = unsafe { Box::from_raw(self.contents.result) };
8924 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8925 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8926 let contents = if o.result_ok {
8927 let result = unsafe { o.contents.result };
8928 unsafe { o.contents.result = core::ptr::null_mut() };
8929 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8931 let _ = unsafe { Box::from_raw(o.contents.err) };
8932 o.contents.err = core::ptr::null_mut();
8933 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8937 result_ok: o.result_ok,
8941 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8942 fn clone(&self) -> Self {
8944 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8945 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8948 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8949 err: core::ptr::null_mut()
8955 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8956 /// but with all dynamically-allocated buffers duplicated in new buffers.
8957 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8959 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8960 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8961 /// A pointer to the contents in the success state.
8962 /// Reading from this pointer when `result_ok` is not set is undefined.
8963 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8964 /// A pointer to the contents in the error state.
8965 /// Reading from this pointer when `result_ok` is set is undefined.
8966 pub err: *mut crate::lightning::util::errors::APIError,
8969 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8970 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8972 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8973 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8974 /// `err` or `result` depending on the state of `result_ok`.
8975 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8976 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8977 pub result_ok: bool,
8980 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8981 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8982 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8983 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8984 result: Box::into_raw(Box::new(o)),
8990 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8991 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8992 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8993 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8994 err: Box::into_raw(Box::new(e)),
8999 /// Checks if the given object is currently in the success state
9001 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
9005 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
9006 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
9007 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9008 fn drop(&mut self) {
9010 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9011 let _ = unsafe { Box::from_raw(self.contents.result) };
9014 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9015 let _ = unsafe { Box::from_raw(self.contents.err) };
9020 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9021 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
9022 let contents = if o.result_ok {
9023 let result = unsafe { o.contents.result };
9024 unsafe { o.contents.result = core::ptr::null_mut() };
9025 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
9027 let err = unsafe { o.contents.err };
9028 unsafe { o.contents.err = core::ptr::null_mut(); }
9029 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
9033 result_ok: o.result_ok,
9037 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9038 fn clone(&self) -> Self {
9040 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9041 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9044 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9045 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9051 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
9052 /// but with all dynamically-allocated buffers duplicated in new buffers.
9053 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
9055 /// The contents of CResult_PaymentSecretNoneZ
9056 pub union CResult_PaymentSecretNoneZPtr {
9057 /// A pointer to the contents in the success state.
9058 /// Reading from this pointer when `result_ok` is not set is undefined.
9059 pub result: *mut crate::c_types::ThirtyTwoBytes,
9060 /// Note that this value is always NULL, as there are no contents in the Err variant
9061 pub err: *mut core::ffi::c_void,
9064 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
9065 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
9066 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9067 pub struct CResult_PaymentSecretNoneZ {
9068 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
9069 /// `err` or `result` depending on the state of `result_ok`.
9070 pub contents: CResult_PaymentSecretNoneZPtr,
9071 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
9072 pub result_ok: bool,
9075 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
9076 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
9077 CResult_PaymentSecretNoneZ {
9078 contents: CResult_PaymentSecretNoneZPtr {
9079 result: Box::into_raw(Box::new(o)),
9085 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
9086 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
9087 CResult_PaymentSecretNoneZ {
9088 contents: CResult_PaymentSecretNoneZPtr {
9089 err: core::ptr::null_mut(),
9094 /// Checks if the given object is currently in the success state
9096 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
9100 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
9101 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
9102 impl Drop for CResult_PaymentSecretNoneZ {
9103 fn drop(&mut self) {
9105 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9106 let _ = unsafe { Box::from_raw(self.contents.result) };
9112 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
9113 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
9114 let contents = if o.result_ok {
9115 let result = unsafe { o.contents.result };
9116 unsafe { o.contents.result = core::ptr::null_mut() };
9117 CResult_PaymentSecretNoneZPtr { result }
9119 let _ = unsafe { Box::from_raw(o.contents.err) };
9120 o.contents.err = core::ptr::null_mut();
9121 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
9125 result_ok: o.result_ok,
9129 impl Clone for CResult_PaymentSecretNoneZ {
9130 fn clone(&self) -> Self {
9132 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
9133 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9136 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
9137 err: core::ptr::null_mut()
9143 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
9144 /// but with all dynamically-allocated buffers duplicated in new buffers.
9145 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
9147 /// The contents of CResult_PaymentSecretAPIErrorZ
9148 pub union CResult_PaymentSecretAPIErrorZPtr {
9149 /// A pointer to the contents in the success state.
9150 /// Reading from this pointer when `result_ok` is not set is undefined.
9151 pub result: *mut crate::c_types::ThirtyTwoBytes,
9152 /// A pointer to the contents in the error state.
9153 /// Reading from this pointer when `result_ok` is set is undefined.
9154 pub err: *mut crate::lightning::util::errors::APIError,
9157 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9158 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9160 pub struct CResult_PaymentSecretAPIErrorZ {
9161 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9162 /// `err` or `result` depending on the state of `result_ok`.
9163 pub contents: CResult_PaymentSecretAPIErrorZPtr,
9164 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9165 pub result_ok: bool,
9168 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9169 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9170 CResult_PaymentSecretAPIErrorZ {
9171 contents: CResult_PaymentSecretAPIErrorZPtr {
9172 result: Box::into_raw(Box::new(o)),
9178 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9179 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9180 CResult_PaymentSecretAPIErrorZ {
9181 contents: CResult_PaymentSecretAPIErrorZPtr {
9182 err: Box::into_raw(Box::new(e)),
9187 /// Checks if the given object is currently in the success state
9189 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
9193 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9194 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9195 impl Drop for CResult_PaymentSecretAPIErrorZ {
9196 fn drop(&mut self) {
9198 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9199 let _ = unsafe { Box::from_raw(self.contents.result) };
9202 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9203 let _ = unsafe { Box::from_raw(self.contents.err) };
9208 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9209 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9210 let contents = if o.result_ok {
9211 let result = unsafe { o.contents.result };
9212 unsafe { o.contents.result = core::ptr::null_mut() };
9213 CResult_PaymentSecretAPIErrorZPtr { result }
9215 let err = unsafe { o.contents.err };
9216 unsafe { o.contents.err = core::ptr::null_mut(); }
9217 CResult_PaymentSecretAPIErrorZPtr { err }
9221 result_ok: o.result_ok,
9225 impl Clone for CResult_PaymentSecretAPIErrorZ {
9226 fn clone(&self) -> Self {
9228 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
9229 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9232 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
9233 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9239 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9240 /// but with all dynamically-allocated buffers duplicated in new buffers.
9241 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
9243 /// The contents of CResult_PaymentPreimageAPIErrorZ
9244 pub union CResult_PaymentPreimageAPIErrorZPtr {
9245 /// A pointer to the contents in the success state.
9246 /// Reading from this pointer when `result_ok` is not set is undefined.
9247 pub result: *mut crate::c_types::ThirtyTwoBytes,
9248 /// A pointer to the contents in the error state.
9249 /// Reading from this pointer when `result_ok` is set is undefined.
9250 pub err: *mut crate::lightning::util::errors::APIError,
9253 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
9254 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9256 pub struct CResult_PaymentPreimageAPIErrorZ {
9257 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
9258 /// `err` or `result` depending on the state of `result_ok`.
9259 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
9260 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9261 pub result_ok: bool,
9264 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
9265 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
9266 CResult_PaymentPreimageAPIErrorZ {
9267 contents: CResult_PaymentPreimageAPIErrorZPtr {
9268 result: Box::into_raw(Box::new(o)),
9274 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
9275 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
9276 CResult_PaymentPreimageAPIErrorZ {
9277 contents: CResult_PaymentPreimageAPIErrorZPtr {
9278 err: Box::into_raw(Box::new(e)),
9283 /// Checks if the given object is currently in the success state
9285 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
9289 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
9290 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
9291 impl Drop for CResult_PaymentPreimageAPIErrorZ {
9292 fn drop(&mut self) {
9294 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9295 let _ = unsafe { Box::from_raw(self.contents.result) };
9298 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9299 let _ = unsafe { Box::from_raw(self.contents.err) };
9304 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
9305 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9306 let contents = if o.result_ok {
9307 let result = unsafe { o.contents.result };
9308 unsafe { o.contents.result = core::ptr::null_mut() };
9309 CResult_PaymentPreimageAPIErrorZPtr { result }
9311 let err = unsafe { o.contents.err };
9312 unsafe { o.contents.err = core::ptr::null_mut(); }
9313 CResult_PaymentPreimageAPIErrorZPtr { err }
9317 result_ok: o.result_ok,
9321 impl Clone for CResult_PaymentPreimageAPIErrorZ {
9322 fn clone(&self) -> Self {
9324 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
9325 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9328 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
9329 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9335 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
9336 /// but with all dynamically-allocated buffers duplicated in new buffers.
9337 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
9339 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9340 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9341 /// A pointer to the contents in the success state.
9342 /// Reading from this pointer when `result_ok` is not set is undefined.
9343 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9344 /// A pointer to the contents in the error state.
9345 /// Reading from this pointer when `result_ok` is set is undefined.
9346 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9349 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9350 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9352 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9353 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9354 /// `err` or `result` depending on the state of `result_ok`.
9355 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9356 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9357 pub result_ok: bool,
9360 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9361 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9362 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9363 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9364 result: Box::into_raw(Box::new(o)),
9370 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9371 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9372 CResult_CounterpartyForwardingInfoDecodeErrorZ {
9373 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9374 err: Box::into_raw(Box::new(e)),
9379 /// Checks if the given object is currently in the success state
9381 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9385 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9386 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9387 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9388 fn drop(&mut self) {
9390 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9391 let _ = unsafe { Box::from_raw(self.contents.result) };
9394 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9395 let _ = unsafe { Box::from_raw(self.contents.err) };
9400 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9401 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9402 let contents = if o.result_ok {
9403 let result = unsafe { o.contents.result };
9404 unsafe { o.contents.result = core::ptr::null_mut() };
9405 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9407 let err = unsafe { o.contents.err };
9408 unsafe { o.contents.err = core::ptr::null_mut(); }
9409 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9413 result_ok: o.result_ok,
9417 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9418 fn clone(&self) -> Self {
9420 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9421 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9424 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9425 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9431 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9432 /// but with all dynamically-allocated buffers duplicated in new buffers.
9433 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9435 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9436 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9437 /// A pointer to the contents in the success state.
9438 /// Reading from this pointer when `result_ok` is not set is undefined.
9439 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9440 /// A pointer to the contents in the error state.
9441 /// Reading from this pointer when `result_ok` is set is undefined.
9442 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9445 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9446 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9448 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9449 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9450 /// `err` or `result` depending on the state of `result_ok`.
9451 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9452 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9453 pub result_ok: bool,
9456 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9457 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9458 CResult_ChannelCounterpartyDecodeErrorZ {
9459 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9460 result: Box::into_raw(Box::new(o)),
9466 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9467 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9468 CResult_ChannelCounterpartyDecodeErrorZ {
9469 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9470 err: Box::into_raw(Box::new(e)),
9475 /// Checks if the given object is currently in the success state
9477 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9481 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9482 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9483 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9484 fn drop(&mut self) {
9486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9487 let _ = unsafe { Box::from_raw(self.contents.result) };
9490 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9491 let _ = unsafe { Box::from_raw(self.contents.err) };
9496 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9497 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9498 let contents = if o.result_ok {
9499 let result = unsafe { o.contents.result };
9500 unsafe { o.contents.result = core::ptr::null_mut() };
9501 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9503 let err = unsafe { o.contents.err };
9504 unsafe { o.contents.err = core::ptr::null_mut(); }
9505 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9509 result_ok: o.result_ok,
9513 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9514 fn clone(&self) -> Self {
9516 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9517 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9520 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9521 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9527 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9528 /// but with all dynamically-allocated buffers duplicated in new buffers.
9529 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9531 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9532 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9533 /// A pointer to the contents in the success state.
9534 /// Reading from this pointer when `result_ok` is not set is undefined.
9535 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9536 /// A pointer to the contents in the error state.
9537 /// Reading from this pointer when `result_ok` is set is undefined.
9538 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9541 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9542 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9544 pub struct CResult_ChannelDetailsDecodeErrorZ {
9545 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9546 /// `err` or `result` depending on the state of `result_ok`.
9547 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9548 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9549 pub result_ok: bool,
9552 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9553 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9554 CResult_ChannelDetailsDecodeErrorZ {
9555 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9556 result: Box::into_raw(Box::new(o)),
9562 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9563 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9564 CResult_ChannelDetailsDecodeErrorZ {
9565 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9566 err: Box::into_raw(Box::new(e)),
9571 /// Checks if the given object is currently in the success state
9573 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9577 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9578 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9579 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9580 fn drop(&mut self) {
9582 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9583 let _ = unsafe { Box::from_raw(self.contents.result) };
9586 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9587 let _ = unsafe { Box::from_raw(self.contents.err) };
9592 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9593 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9594 let contents = if o.result_ok {
9595 let result = unsafe { o.contents.result };
9596 unsafe { o.contents.result = core::ptr::null_mut() };
9597 CResult_ChannelDetailsDecodeErrorZPtr { result }
9599 let err = unsafe { o.contents.err };
9600 unsafe { o.contents.err = core::ptr::null_mut(); }
9601 CResult_ChannelDetailsDecodeErrorZPtr { err }
9605 result_ok: o.result_ok,
9609 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9610 fn clone(&self) -> Self {
9612 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9613 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9616 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9617 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9623 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9624 /// but with all dynamically-allocated buffers duplicated in new buffers.
9625 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9627 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9628 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9629 /// A pointer to the contents in the success state.
9630 /// Reading from this pointer when `result_ok` is not set is undefined.
9631 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9632 /// A pointer to the contents in the error state.
9633 /// Reading from this pointer when `result_ok` is set is undefined.
9634 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9637 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9638 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9640 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9641 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9642 /// `err` or `result` depending on the state of `result_ok`.
9643 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9644 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9645 pub result_ok: bool,
9648 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9649 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9650 CResult_PhantomRouteHintsDecodeErrorZ {
9651 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9652 result: Box::into_raw(Box::new(o)),
9658 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9659 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9660 CResult_PhantomRouteHintsDecodeErrorZ {
9661 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9662 err: Box::into_raw(Box::new(e)),
9667 /// Checks if the given object is currently in the success state
9669 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9673 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9674 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9675 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9676 fn drop(&mut self) {
9678 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9679 let _ = unsafe { Box::from_raw(self.contents.result) };
9682 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9683 let _ = unsafe { Box::from_raw(self.contents.err) };
9688 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9689 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9690 let contents = if o.result_ok {
9691 let result = unsafe { o.contents.result };
9692 unsafe { o.contents.result = core::ptr::null_mut() };
9693 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9695 let err = unsafe { o.contents.err };
9696 unsafe { o.contents.err = core::ptr::null_mut(); }
9697 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9701 result_ok: o.result_ok,
9705 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9706 fn clone(&self) -> Self {
9708 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9709 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9712 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9713 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9719 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9720 /// but with all dynamically-allocated buffers duplicated in new buffers.
9721 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9723 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9724 /// This corresponds to std::vector in C++
9725 pub struct CVec_ChannelMonitorZ {
9726 /// The elements in the array.
9727 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9728 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9729 /// The number of elements pointed to by `data`.
9732 impl CVec_ChannelMonitorZ {
9733 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9734 if self.datalen == 0 { return Vec::new(); }
9735 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9736 self.data = core::ptr::null_mut();
9740 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9741 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9744 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9745 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9746 let datalen = v.len();
9747 let data = Box::into_raw(v.into_boxed_slice());
9748 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9752 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9753 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9754 impl Drop for CVec_ChannelMonitorZ {
9755 fn drop(&mut self) {
9756 if self.datalen == 0 { return; }
9757 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9761 /// A tuple of 2 elements. See the individual fields for the types contained.
9762 pub struct C2Tuple_BlockHashChannelManagerZ {
9763 /// The element at position 0
9764 pub a: crate::c_types::ThirtyTwoBytes,
9765 /// The element at position 1
9766 pub b: crate::lightning::ln::channelmanager::ChannelManager,
9768 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9769 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9776 impl C2Tuple_BlockHashChannelManagerZ {
9777 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9781 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9783 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9784 C2Tuple_BlockHashChannelManagerZ { a, b, }
9788 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9789 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9791 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9792 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9793 /// A pointer to the contents in the success state.
9794 /// Reading from this pointer when `result_ok` is not set is undefined.
9795 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9796 /// A pointer to the contents in the error state.
9797 /// Reading from this pointer when `result_ok` is set is undefined.
9798 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9801 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9802 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9804 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9805 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9806 /// `err` or `result` depending on the state of `result_ok`.
9807 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9808 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9809 pub result_ok: bool,
9812 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9813 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9814 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9815 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9816 result: Box::into_raw(Box::new(o)),
9822 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9823 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9824 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9825 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9826 err: Box::into_raw(Box::new(e)),
9831 /// Checks if the given object is currently in the success state
9833 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9837 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9838 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9839 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9840 fn drop(&mut self) {
9842 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9843 let _ = unsafe { Box::from_raw(self.contents.result) };
9846 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9847 let _ = unsafe { Box::from_raw(self.contents.err) };
9852 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9853 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9854 let contents = if o.result_ok {
9855 let result = unsafe { o.contents.result };
9856 unsafe { o.contents.result = core::ptr::null_mut() };
9857 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9859 let err = unsafe { o.contents.err };
9860 unsafe { o.contents.err = core::ptr::null_mut(); }
9861 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9865 result_ok: o.result_ok,
9870 /// The contents of CResult_ChannelConfigDecodeErrorZ
9871 pub union CResult_ChannelConfigDecodeErrorZPtr {
9872 /// A pointer to the contents in the success state.
9873 /// Reading from this pointer when `result_ok` is not set is undefined.
9874 pub result: *mut crate::lightning::util::config::ChannelConfig,
9875 /// A pointer to the contents in the error state.
9876 /// Reading from this pointer when `result_ok` is set is undefined.
9877 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9880 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9881 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9882 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9883 pub struct CResult_ChannelConfigDecodeErrorZ {
9884 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9885 /// `err` or `result` depending on the state of `result_ok`.
9886 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9887 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9888 pub result_ok: bool,
9891 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9892 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9893 CResult_ChannelConfigDecodeErrorZ {
9894 contents: CResult_ChannelConfigDecodeErrorZPtr {
9895 result: Box::into_raw(Box::new(o)),
9901 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9902 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9903 CResult_ChannelConfigDecodeErrorZ {
9904 contents: CResult_ChannelConfigDecodeErrorZPtr {
9905 err: Box::into_raw(Box::new(e)),
9910 /// Checks if the given object is currently in the success state
9912 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9916 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9917 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9918 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9919 fn drop(&mut self) {
9921 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9922 let _ = unsafe { Box::from_raw(self.contents.result) };
9925 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9926 let _ = unsafe { Box::from_raw(self.contents.err) };
9931 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9932 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9933 let contents = if o.result_ok {
9934 let result = unsafe { o.contents.result };
9935 unsafe { o.contents.result = core::ptr::null_mut() };
9936 CResult_ChannelConfigDecodeErrorZPtr { result }
9938 let err = unsafe { o.contents.err };
9939 unsafe { o.contents.err = core::ptr::null_mut(); }
9940 CResult_ChannelConfigDecodeErrorZPtr { err }
9944 result_ok: o.result_ok,
9948 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9949 fn clone(&self) -> Self {
9951 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9952 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9955 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9956 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9962 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9963 /// but with all dynamically-allocated buffers duplicated in new buffers.
9964 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9966 /// The contents of CResult_OutPointDecodeErrorZ
9967 pub union CResult_OutPointDecodeErrorZPtr {
9968 /// A pointer to the contents in the success state.
9969 /// Reading from this pointer when `result_ok` is not set is undefined.
9970 pub result: *mut crate::lightning::chain::transaction::OutPoint,
9971 /// A pointer to the contents in the error state.
9972 /// Reading from this pointer when `result_ok` is set is undefined.
9973 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9976 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9977 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9978 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9979 pub struct CResult_OutPointDecodeErrorZ {
9980 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9981 /// `err` or `result` depending on the state of `result_ok`.
9982 pub contents: CResult_OutPointDecodeErrorZPtr,
9983 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9984 pub result_ok: bool,
9987 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9988 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9989 CResult_OutPointDecodeErrorZ {
9990 contents: CResult_OutPointDecodeErrorZPtr {
9991 result: Box::into_raw(Box::new(o)),
9997 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9998 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9999 CResult_OutPointDecodeErrorZ {
10000 contents: CResult_OutPointDecodeErrorZPtr {
10001 err: Box::into_raw(Box::new(e)),
10006 /// Checks if the given object is currently in the success state
10008 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
10012 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
10013 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
10014 impl Drop for CResult_OutPointDecodeErrorZ {
10015 fn drop(&mut self) {
10016 if self.result_ok {
10017 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10018 let _ = unsafe { Box::from_raw(self.contents.result) };
10021 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10022 let _ = unsafe { Box::from_raw(self.contents.err) };
10027 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
10028 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
10029 let contents = if o.result_ok {
10030 let result = unsafe { o.contents.result };
10031 unsafe { o.contents.result = core::ptr::null_mut() };
10032 CResult_OutPointDecodeErrorZPtr { result }
10034 let err = unsafe { o.contents.err };
10035 unsafe { o.contents.err = core::ptr::null_mut(); }
10036 CResult_OutPointDecodeErrorZPtr { err }
10040 result_ok: o.result_ok,
10044 impl Clone for CResult_OutPointDecodeErrorZ {
10045 fn clone(&self) -> Self {
10046 if self.result_ok {
10047 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
10048 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
10051 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
10052 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10058 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10059 /// but with all dynamically-allocated buffers duplicated in new buffers.
10060 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
10062 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
10063 pub enum COption_TypeZ {
10064 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10065 Some(crate::lightning::ln::wire::Type),
10066 /// When we're in this state, this COption_TypeZ contains nothing
10069 impl COption_TypeZ {
10070 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10071 if let Self::None = self { false } else { true }
10073 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10076 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
10077 if let Self::Some(v) = self { v } else { unreachable!() }
10081 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
10082 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
10083 COption_TypeZ::Some(o)
10086 /// Constructs a new COption_TypeZ containing nothing
10087 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
10088 COption_TypeZ::None
10091 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
10092 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
10094 /// The contents of CResult_COption_TypeZDecodeErrorZ
10095 pub union CResult_COption_TypeZDecodeErrorZPtr {
10096 /// A pointer to the contents in the success state.
10097 /// Reading from this pointer when `result_ok` is not set is undefined.
10098 pub result: *mut crate::c_types::derived::COption_TypeZ,
10099 /// A pointer to the contents in the error state.
10100 /// Reading from this pointer when `result_ok` is set is undefined.
10101 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10104 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10105 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10107 pub struct CResult_COption_TypeZDecodeErrorZ {
10108 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10109 /// `err` or `result` depending on the state of `result_ok`.
10110 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
10111 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10112 pub result_ok: bool,
10115 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
10116 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
10117 CResult_COption_TypeZDecodeErrorZ {
10118 contents: CResult_COption_TypeZDecodeErrorZPtr {
10119 result: Box::into_raw(Box::new(o)),
10125 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
10126 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
10127 CResult_COption_TypeZDecodeErrorZ {
10128 contents: CResult_COption_TypeZDecodeErrorZPtr {
10129 err: Box::into_raw(Box::new(e)),
10134 /// Checks if the given object is currently in the success state
10136 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
10140 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
10141 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
10142 impl Drop for CResult_COption_TypeZDecodeErrorZ {
10143 fn drop(&mut self) {
10144 if self.result_ok {
10145 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10146 let _ = unsafe { Box::from_raw(self.contents.result) };
10149 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10150 let _ = unsafe { Box::from_raw(self.contents.err) };
10155 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
10156 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10157 let contents = if o.result_ok {
10158 let result = unsafe { o.contents.result };
10159 unsafe { o.contents.result = core::ptr::null_mut() };
10160 CResult_COption_TypeZDecodeErrorZPtr { result }
10162 let err = unsafe { o.contents.err };
10163 unsafe { o.contents.err = core::ptr::null_mut(); }
10164 CResult_COption_TypeZDecodeErrorZPtr { err }
10168 result_ok: o.result_ok,
10173 /// The contents of CResult_PaymentIdPaymentErrorZ
10174 pub union CResult_PaymentIdPaymentErrorZPtr {
10175 /// A pointer to the contents in the success state.
10176 /// Reading from this pointer when `result_ok` is not set is undefined.
10177 pub result: *mut crate::c_types::ThirtyTwoBytes,
10178 /// A pointer to the contents in the error state.
10179 /// Reading from this pointer when `result_ok` is set is undefined.
10180 pub err: *mut crate::lightning_invoice::payment::PaymentError,
10183 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
10184 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
10185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10186 pub struct CResult_PaymentIdPaymentErrorZ {
10187 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
10188 /// `err` or `result` depending on the state of `result_ok`.
10189 pub contents: CResult_PaymentIdPaymentErrorZPtr,
10190 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
10191 pub result_ok: bool,
10194 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
10195 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
10196 CResult_PaymentIdPaymentErrorZ {
10197 contents: CResult_PaymentIdPaymentErrorZPtr {
10198 result: Box::into_raw(Box::new(o)),
10204 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
10205 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
10206 CResult_PaymentIdPaymentErrorZ {
10207 contents: CResult_PaymentIdPaymentErrorZPtr {
10208 err: Box::into_raw(Box::new(e)),
10213 /// Checks if the given object is currently in the success state
10215 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
10219 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
10220 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
10221 impl Drop for CResult_PaymentIdPaymentErrorZ {
10222 fn drop(&mut self) {
10223 if self.result_ok {
10224 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10225 let _ = unsafe { Box::from_raw(self.contents.result) };
10228 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10229 let _ = unsafe { Box::from_raw(self.contents.err) };
10234 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
10235 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
10236 let contents = if o.result_ok {
10237 let result = unsafe { o.contents.result };
10238 unsafe { o.contents.result = core::ptr::null_mut() };
10239 CResult_PaymentIdPaymentErrorZPtr { result }
10241 let err = unsafe { o.contents.err };
10242 unsafe { o.contents.err = core::ptr::null_mut(); }
10243 CResult_PaymentIdPaymentErrorZPtr { err }
10247 result_ok: o.result_ok,
10251 impl Clone for CResult_PaymentIdPaymentErrorZ {
10252 fn clone(&self) -> Self {
10253 if self.result_ok {
10254 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
10255 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10258 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
10259 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
10265 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
10266 /// but with all dynamically-allocated buffers duplicated in new buffers.
10267 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
10269 /// The contents of CResult_NonePaymentErrorZ
10270 pub union CResult_NonePaymentErrorZPtr {
10271 /// Note that this value is always NULL, as there are no contents in the OK variant
10272 pub result: *mut core::ffi::c_void,
10273 /// A pointer to the contents in the error state.
10274 /// Reading from this pointer when `result_ok` is set is undefined.
10275 pub err: *mut crate::lightning_invoice::payment::PaymentError,
10278 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
10279 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
10280 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10281 pub struct CResult_NonePaymentErrorZ {
10282 /// The contents of this CResult_NonePaymentErrorZ, accessible via either
10283 /// `err` or `result` depending on the state of `result_ok`.
10284 pub contents: CResult_NonePaymentErrorZPtr,
10285 /// Whether this CResult_NonePaymentErrorZ represents a success state.
10286 pub result_ok: bool,
10289 /// Creates a new CResult_NonePaymentErrorZ in the success state.
10290 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
10291 CResult_NonePaymentErrorZ {
10292 contents: CResult_NonePaymentErrorZPtr {
10293 result: core::ptr::null_mut(),
10299 /// Creates a new CResult_NonePaymentErrorZ in the error state.
10300 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
10301 CResult_NonePaymentErrorZ {
10302 contents: CResult_NonePaymentErrorZPtr {
10303 err: Box::into_raw(Box::new(e)),
10308 /// Checks if the given object is currently in the success state
10310 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
10314 /// Frees any resources used by the CResult_NonePaymentErrorZ.
10315 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
10316 impl Drop for CResult_NonePaymentErrorZ {
10317 fn drop(&mut self) {
10318 if self.result_ok {
10320 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10321 let _ = unsafe { Box::from_raw(self.contents.err) };
10326 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
10327 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
10328 let contents = if o.result_ok {
10329 let _ = unsafe { Box::from_raw(o.contents.result) };
10330 o.contents.result = core::ptr::null_mut();
10331 CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
10333 let err = unsafe { o.contents.err };
10334 unsafe { o.contents.err = core::ptr::null_mut(); }
10335 CResult_NonePaymentErrorZPtr { err }
10339 result_ok: o.result_ok,
10343 impl Clone for CResult_NonePaymentErrorZ {
10344 fn clone(&self) -> Self {
10345 if self.result_ok {
10346 Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
10347 result: core::ptr::null_mut()
10350 Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
10351 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
10357 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
10358 /// but with all dynamically-allocated buffers duplicated in new buffers.
10359 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
10361 /// The contents of CResult_StringErrorZ
10362 pub union CResult_StringErrorZPtr {
10363 /// A pointer to the contents in the success state.
10364 /// Reading from this pointer when `result_ok` is not set is undefined.
10365 pub result: *mut crate::c_types::Str,
10366 /// A pointer to the contents in the error state.
10367 /// Reading from this pointer when `result_ok` is set is undefined.
10368 pub err: *mut crate::c_types::Secp256k1Error,
10371 /// A CResult_StringErrorZ represents the result of a fallible operation,
10372 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10374 pub struct CResult_StringErrorZ {
10375 /// The contents of this CResult_StringErrorZ, accessible via either
10376 /// `err` or `result` depending on the state of `result_ok`.
10377 pub contents: CResult_StringErrorZPtr,
10378 /// Whether this CResult_StringErrorZ represents a success state.
10379 pub result_ok: bool,
10382 /// Creates a new CResult_StringErrorZ in the success state.
10383 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10384 CResult_StringErrorZ {
10385 contents: CResult_StringErrorZPtr {
10386 result: Box::into_raw(Box::new(o)),
10392 /// Creates a new CResult_StringErrorZ in the error state.
10393 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10394 CResult_StringErrorZ {
10395 contents: CResult_StringErrorZPtr {
10396 err: Box::into_raw(Box::new(e)),
10401 /// Checks if the given object is currently in the success state
10403 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10407 /// Frees any resources used by the CResult_StringErrorZ.
10408 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10409 impl Drop for CResult_StringErrorZ {
10410 fn drop(&mut self) {
10411 if self.result_ok {
10412 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10413 let _ = unsafe { Box::from_raw(self.contents.result) };
10416 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10417 let _ = unsafe { Box::from_raw(self.contents.err) };
10422 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10423 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10424 let contents = if o.result_ok {
10425 let result = unsafe { o.contents.result };
10426 unsafe { o.contents.result = core::ptr::null_mut() };
10427 CResult_StringErrorZPtr { result }
10429 let err = unsafe { o.contents.err };
10430 unsafe { o.contents.err = core::ptr::null_mut(); }
10431 CResult_StringErrorZPtr { err }
10435 result_ok: o.result_ok,
10439 impl Clone for CResult_StringErrorZ {
10440 fn clone(&self) -> Self {
10441 if self.result_ok {
10442 Self { result_ok: true, contents: CResult_StringErrorZPtr {
10443 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10446 Self { result_ok: false, contents: CResult_StringErrorZPtr {
10447 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10453 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10454 /// but with all dynamically-allocated buffers duplicated in new buffers.
10455 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10457 /// The contents of CResult_PublicKeyErrorZ
10458 pub union CResult_PublicKeyErrorZPtr {
10459 /// A pointer to the contents in the success state.
10460 /// Reading from this pointer when `result_ok` is not set is undefined.
10461 pub result: *mut crate::c_types::PublicKey,
10462 /// A pointer to the contents in the error state.
10463 /// Reading from this pointer when `result_ok` is set is undefined.
10464 pub err: *mut crate::c_types::Secp256k1Error,
10467 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
10468 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
10469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10470 pub struct CResult_PublicKeyErrorZ {
10471 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
10472 /// `err` or `result` depending on the state of `result_ok`.
10473 pub contents: CResult_PublicKeyErrorZPtr,
10474 /// Whether this CResult_PublicKeyErrorZ represents a success state.
10475 pub result_ok: bool,
10478 /// Creates a new CResult_PublicKeyErrorZ in the success state.
10479 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
10480 CResult_PublicKeyErrorZ {
10481 contents: CResult_PublicKeyErrorZPtr {
10482 result: Box::into_raw(Box::new(o)),
10488 /// Creates a new CResult_PublicKeyErrorZ in the error state.
10489 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
10490 CResult_PublicKeyErrorZ {
10491 contents: CResult_PublicKeyErrorZPtr {
10492 err: Box::into_raw(Box::new(e)),
10497 /// Checks if the given object is currently in the success state
10499 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
10503 /// Frees any resources used by the CResult_PublicKeyErrorZ.
10504 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
10505 impl Drop for CResult_PublicKeyErrorZ {
10506 fn drop(&mut self) {
10507 if self.result_ok {
10508 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10509 let _ = unsafe { Box::from_raw(self.contents.result) };
10512 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10513 let _ = unsafe { Box::from_raw(self.contents.err) };
10518 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
10519 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
10520 let contents = if o.result_ok {
10521 let result = unsafe { o.contents.result };
10522 unsafe { o.contents.result = core::ptr::null_mut() };
10523 CResult_PublicKeyErrorZPtr { result }
10525 let err = unsafe { o.contents.err };
10526 unsafe { o.contents.err = core::ptr::null_mut(); }
10527 CResult_PublicKeyErrorZPtr { err }
10531 result_ok: o.result_ok,
10535 impl Clone for CResult_PublicKeyErrorZ {
10536 fn clone(&self) -> Self {
10537 if self.result_ok {
10538 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
10539 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
10542 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
10543 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10549 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
10550 /// but with all dynamically-allocated buffers duplicated in new buffers.
10551 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
10553 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10554 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10555 /// A pointer to the contents in the success state.
10556 /// Reading from this pointer when `result_ok` is not set is undefined.
10557 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10558 /// A pointer to the contents in the error state.
10559 /// Reading from this pointer when `result_ok` is set is undefined.
10560 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10563 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10564 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10565 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10566 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10567 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10568 /// `err` or `result` depending on the state of `result_ok`.
10569 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10570 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10571 pub result_ok: bool,
10574 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10575 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10576 CResult_ChannelMonitorUpdateDecodeErrorZ {
10577 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10578 result: Box::into_raw(Box::new(o)),
10584 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10585 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10586 CResult_ChannelMonitorUpdateDecodeErrorZ {
10587 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10588 err: Box::into_raw(Box::new(e)),
10593 /// Checks if the given object is currently in the success state
10595 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10599 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10600 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10601 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10602 fn drop(&mut self) {
10603 if self.result_ok {
10604 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10605 let _ = unsafe { Box::from_raw(self.contents.result) };
10608 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10609 let _ = unsafe { Box::from_raw(self.contents.err) };
10614 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10615 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10616 let contents = if o.result_ok {
10617 let result = unsafe { o.contents.result };
10618 unsafe { o.contents.result = core::ptr::null_mut() };
10619 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10621 let err = unsafe { o.contents.err };
10622 unsafe { o.contents.err = core::ptr::null_mut(); }
10623 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10627 result_ok: o.result_ok,
10631 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10632 fn clone(&self) -> Self {
10633 if self.result_ok {
10634 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10635 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10638 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10639 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10645 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10646 /// but with all dynamically-allocated buffers duplicated in new buffers.
10647 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10650 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10651 pub enum COption_MonitorEventZ {
10652 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10653 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10654 /// When we're in this state, this COption_MonitorEventZ contains nothing
10657 impl COption_MonitorEventZ {
10658 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10659 if let Self::None = self { false } else { true }
10661 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10664 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10665 if let Self::Some(v) = self { v } else { unreachable!() }
10669 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10670 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10671 COption_MonitorEventZ::Some(o)
10674 /// Constructs a new COption_MonitorEventZ containing nothing
10675 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10676 COption_MonitorEventZ::None
10679 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10680 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10682 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10683 /// but with all dynamically-allocated buffers duplicated in new buffers.
10684 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10686 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10687 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10688 /// A pointer to the contents in the success state.
10689 /// Reading from this pointer when `result_ok` is not set is undefined.
10690 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10691 /// A pointer to the contents in the error state.
10692 /// Reading from this pointer when `result_ok` is set is undefined.
10693 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10696 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10697 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10698 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10699 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10700 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10701 /// `err` or `result` depending on the state of `result_ok`.
10702 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10703 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10704 pub result_ok: bool,
10707 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10708 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10709 CResult_COption_MonitorEventZDecodeErrorZ {
10710 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10711 result: Box::into_raw(Box::new(o)),
10717 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10718 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10719 CResult_COption_MonitorEventZDecodeErrorZ {
10720 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10721 err: Box::into_raw(Box::new(e)),
10726 /// Checks if the given object is currently in the success state
10728 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10732 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10733 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10734 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10735 fn drop(&mut self) {
10736 if self.result_ok {
10737 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10738 let _ = unsafe { Box::from_raw(self.contents.result) };
10741 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10742 let _ = unsafe { Box::from_raw(self.contents.err) };
10747 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10748 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10749 let contents = if o.result_ok {
10750 let result = unsafe { o.contents.result };
10751 unsafe { o.contents.result = core::ptr::null_mut() };
10752 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10754 let err = unsafe { o.contents.err };
10755 unsafe { o.contents.err = core::ptr::null_mut(); }
10756 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10760 result_ok: o.result_ok,
10764 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10765 fn clone(&self) -> Self {
10766 if self.result_ok {
10767 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10768 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10771 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10772 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10778 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10779 /// but with all dynamically-allocated buffers duplicated in new buffers.
10780 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10782 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10783 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10784 /// A pointer to the contents in the success state.
10785 /// Reading from this pointer when `result_ok` is not set is undefined.
10786 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10787 /// A pointer to the contents in the error state.
10788 /// Reading from this pointer when `result_ok` is set is undefined.
10789 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10792 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10793 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10795 pub struct CResult_HTLCUpdateDecodeErrorZ {
10796 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10797 /// `err` or `result` depending on the state of `result_ok`.
10798 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10799 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10800 pub result_ok: bool,
10803 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10804 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10805 CResult_HTLCUpdateDecodeErrorZ {
10806 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10807 result: Box::into_raw(Box::new(o)),
10813 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10814 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10815 CResult_HTLCUpdateDecodeErrorZ {
10816 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10817 err: Box::into_raw(Box::new(e)),
10822 /// Checks if the given object is currently in the success state
10824 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10828 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10829 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10830 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10831 fn drop(&mut self) {
10832 if self.result_ok {
10833 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10834 let _ = unsafe { Box::from_raw(self.contents.result) };
10837 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10838 let _ = unsafe { Box::from_raw(self.contents.err) };
10843 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10844 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10845 let contents = if o.result_ok {
10846 let result = unsafe { o.contents.result };
10847 unsafe { o.contents.result = core::ptr::null_mut() };
10848 CResult_HTLCUpdateDecodeErrorZPtr { result }
10850 let err = unsafe { o.contents.err };
10851 unsafe { o.contents.err = core::ptr::null_mut(); }
10852 CResult_HTLCUpdateDecodeErrorZPtr { err }
10856 result_ok: o.result_ok,
10860 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10861 fn clone(&self) -> Self {
10862 if self.result_ok {
10863 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10864 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10867 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10868 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10874 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10875 /// but with all dynamically-allocated buffers duplicated in new buffers.
10876 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10878 /// A tuple of 2 elements. See the individual fields for the types contained.
10879 pub struct C2Tuple_OutPointScriptZ {
10880 /// The element at position 0
10881 pub a: crate::lightning::chain::transaction::OutPoint,
10882 /// The element at position 1
10883 pub b: crate::c_types::derived::CVec_u8Z,
10885 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
10886 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10893 impl C2Tuple_OutPointScriptZ {
10894 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10898 impl Clone for C2Tuple_OutPointScriptZ {
10899 fn clone(&self) -> Self {
10901 a: Clone::clone(&self.a),
10902 b: Clone::clone(&self.b),
10907 /// Creates a new tuple which has the same data as `orig`
10908 /// but with all dynamically-allocated buffers duplicated in new buffers.
10909 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
10910 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10912 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
10913 C2Tuple_OutPointScriptZ { a, b, }
10917 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
10918 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
10920 /// A tuple of 2 elements. See the individual fields for the types contained.
10921 pub struct C2Tuple_u32ScriptZ {
10922 /// The element at position 0
10924 /// The element at position 1
10925 pub b: crate::c_types::derived::CVec_u8Z,
10927 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
10928 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10935 impl C2Tuple_u32ScriptZ {
10936 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10940 impl Clone for C2Tuple_u32ScriptZ {
10941 fn clone(&self) -> Self {
10943 a: Clone::clone(&self.a),
10944 b: Clone::clone(&self.b),
10949 /// Creates a new tuple which has the same data as `orig`
10950 /// but with all dynamically-allocated buffers duplicated in new buffers.
10951 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
10952 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
10954 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
10955 C2Tuple_u32ScriptZ { a, b, }
10959 /// Frees any resources used by the C2Tuple_u32ScriptZ.
10960 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
10962 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
10963 /// This corresponds to std::vector in C++
10964 pub struct CVec_C2Tuple_u32ScriptZZ {
10965 /// The elements in the array.
10966 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10967 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
10968 /// The number of elements pointed to by `data`.
10971 impl CVec_C2Tuple_u32ScriptZZ {
10972 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
10973 if self.datalen == 0 { return Vec::new(); }
10974 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10975 self.data = core::ptr::null_mut();
10979 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
10980 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10983 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
10984 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
10985 let datalen = v.len();
10986 let data = Box::into_raw(v.into_boxed_slice());
10987 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10991 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10992 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
10993 impl Drop for CVec_C2Tuple_u32ScriptZZ {
10994 fn drop(&mut self) {
10995 if self.datalen == 0 { return; }
10996 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10999 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11000 fn clone(&self) -> Self {
11001 let mut res = Vec::new();
11002 if self.datalen == 0 { return Self::from(res); }
11003 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11008 /// A tuple of 2 elements. See the individual fields for the types contained.
11009 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11010 /// The element at position 0
11011 pub a: crate::c_types::ThirtyTwoBytes,
11012 /// The element at position 1
11013 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11015 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11016 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11023 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11024 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11028 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11029 fn clone(&self) -> Self {
11031 a: Clone::clone(&self.a),
11032 b: Clone::clone(&self.b),
11037 /// Creates a new tuple which has the same data as `orig`
11038 /// but with all dynamically-allocated buffers duplicated in new buffers.
11039 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11040 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11042 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 {
11043 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11047 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11048 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11050 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11051 /// This corresponds to std::vector in C++
11052 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11053 /// The elements in the array.
11054 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11055 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11056 /// The number of elements pointed to by `data`.
11059 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11060 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11061 if self.datalen == 0 { return Vec::new(); }
11062 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11063 self.data = core::ptr::null_mut();
11067 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11068 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11071 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11072 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11073 let datalen = v.len();
11074 let data = Box::into_raw(v.into_boxed_slice());
11075 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11079 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11080 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11081 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11082 fn drop(&mut self) {
11083 if self.datalen == 0 { return; }
11084 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11087 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11088 fn clone(&self) -> Self {
11089 let mut res = Vec::new();
11090 if self.datalen == 0 { return Self::from(res); }
11091 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11096 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11097 /// This corresponds to std::vector in C++
11098 pub struct CVec_EventZ {
11099 /// The elements in the array.
11100 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11101 pub data: *mut crate::lightning::util::events::Event,
11102 /// The number of elements pointed to by `data`.
11106 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11107 if self.datalen == 0 { return Vec::new(); }
11108 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11109 self.data = core::ptr::null_mut();
11113 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11114 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11117 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11118 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11119 let datalen = v.len();
11120 let data = Box::into_raw(v.into_boxed_slice());
11121 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11125 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11126 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11127 impl Drop for CVec_EventZ {
11128 fn drop(&mut self) {
11129 if self.datalen == 0 { return; }
11130 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11133 impl Clone for CVec_EventZ {
11134 fn clone(&self) -> Self {
11135 let mut res = Vec::new();
11136 if self.datalen == 0 { return Self::from(res); }
11137 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11142 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11143 /// This corresponds to std::vector in C++
11144 pub struct CVec_TransactionZ {
11145 /// The elements in the array.
11146 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11147 pub data: *mut crate::c_types::Transaction,
11148 /// The number of elements pointed to by `data`.
11151 impl CVec_TransactionZ {
11152 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11153 if self.datalen == 0 { return Vec::new(); }
11154 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11155 self.data = core::ptr::null_mut();
11159 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11160 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11163 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11164 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11165 let datalen = v.len();
11166 let data = Box::into_raw(v.into_boxed_slice());
11167 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11171 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11172 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11173 impl Drop for CVec_TransactionZ {
11174 fn drop(&mut self) {
11175 if self.datalen == 0 { return; }
11176 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11179 impl Clone for CVec_TransactionZ {
11180 fn clone(&self) -> Self {
11181 let mut res = Vec::new();
11182 if self.datalen == 0 { return Self::from(res); }
11183 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11188 /// A tuple of 2 elements. See the individual fields for the types contained.
11189 pub struct C2Tuple_u32TxOutZ {
11190 /// The element at position 0
11192 /// The element at position 1
11193 pub b: crate::c_types::TxOut,
11195 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11196 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11203 impl C2Tuple_u32TxOutZ {
11204 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11208 impl Clone for C2Tuple_u32TxOutZ {
11209 fn clone(&self) -> Self {
11211 a: Clone::clone(&self.a),
11212 b: Clone::clone(&self.b),
11217 /// Creates a new tuple which has the same data as `orig`
11218 /// but with all dynamically-allocated buffers duplicated in new buffers.
11219 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11220 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11222 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11223 C2Tuple_u32TxOutZ { a, b, }
11227 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11228 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11230 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11231 /// This corresponds to std::vector in C++
11232 pub struct CVec_C2Tuple_u32TxOutZZ {
11233 /// The elements in the array.
11234 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11235 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11236 /// The number of elements pointed to by `data`.
11239 impl CVec_C2Tuple_u32TxOutZZ {
11240 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11241 if self.datalen == 0 { return Vec::new(); }
11242 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11243 self.data = core::ptr::null_mut();
11247 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11248 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11251 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11252 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11253 let datalen = v.len();
11254 let data = Box::into_raw(v.into_boxed_slice());
11255 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11259 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11260 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11261 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11262 fn drop(&mut self) {
11263 if self.datalen == 0 { return; }
11264 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11267 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11268 fn clone(&self) -> Self {
11269 let mut res = Vec::new();
11270 if self.datalen == 0 { return Self::from(res); }
11271 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11276 /// A tuple of 2 elements. See the individual fields for the types contained.
11277 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11278 /// The element at position 0
11279 pub a: crate::c_types::ThirtyTwoBytes,
11280 /// The element at position 1
11281 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11283 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11284 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11291 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11292 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11296 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11297 fn clone(&self) -> Self {
11299 a: Clone::clone(&self.a),
11300 b: Clone::clone(&self.b),
11305 /// Creates a new tuple which has the same data as `orig`
11306 /// but with all dynamically-allocated buffers duplicated in new buffers.
11307 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11308 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11310 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 {
11311 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11315 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11316 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11318 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11319 /// This corresponds to std::vector in C++
11320 pub struct CVec_TransactionOutputsZ {
11321 /// The elements in the array.
11322 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11323 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11324 /// The number of elements pointed to by `data`.
11327 impl CVec_TransactionOutputsZ {
11328 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11329 if self.datalen == 0 { return Vec::new(); }
11330 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11331 self.data = core::ptr::null_mut();
11335 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11336 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11339 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11340 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11341 let datalen = v.len();
11342 let data = Box::into_raw(v.into_boxed_slice());
11343 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11347 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11348 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11349 impl Drop for CVec_TransactionOutputsZ {
11350 fn drop(&mut self) {
11351 if self.datalen == 0 { return; }
11352 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11355 impl Clone for CVec_TransactionOutputsZ {
11356 fn clone(&self) -> Self {
11357 let mut res = Vec::new();
11358 if self.datalen == 0 { return Self::from(res); }
11359 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11364 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11365 /// This corresponds to std::vector in C++
11366 pub struct CVec_BalanceZ {
11367 /// The elements in the array.
11368 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11369 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11370 /// The number of elements pointed to by `data`.
11373 impl CVec_BalanceZ {
11374 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11375 if self.datalen == 0 { return Vec::new(); }
11376 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11377 self.data = core::ptr::null_mut();
11381 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11382 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11385 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11386 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11387 let datalen = v.len();
11388 let data = Box::into_raw(v.into_boxed_slice());
11389 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11393 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11394 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11395 impl Drop for CVec_BalanceZ {
11396 fn drop(&mut self) {
11397 if self.datalen == 0 { return; }
11398 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11401 impl Clone for CVec_BalanceZ {
11402 fn clone(&self) -> Self {
11403 let mut res = Vec::new();
11404 if self.datalen == 0 { return Self::from(res); }
11405 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11410 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11411 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11412 /// A pointer to the contents in the success state.
11413 /// Reading from this pointer when `result_ok` is not set is undefined.
11414 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11415 /// A pointer to the contents in the error state.
11416 /// Reading from this pointer when `result_ok` is set is undefined.
11417 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11420 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11421 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11423 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11424 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11425 /// `err` or `result` depending on the state of `result_ok`.
11426 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11427 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11428 pub result_ok: bool,
11431 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11432 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11433 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11434 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11435 result: Box::into_raw(Box::new(o)),
11441 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11442 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11443 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11444 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11445 err: Box::into_raw(Box::new(e)),
11450 /// Checks if the given object is currently in the success state
11452 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11456 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11457 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11458 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11459 fn drop(&mut self) {
11460 if self.result_ok {
11461 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11462 let _ = unsafe { Box::from_raw(self.contents.result) };
11465 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11466 let _ = unsafe { Box::from_raw(self.contents.err) };
11471 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11472 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11473 let contents = if o.result_ok {
11474 let result = unsafe { o.contents.result };
11475 unsafe { o.contents.result = core::ptr::null_mut() };
11476 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11478 let err = unsafe { o.contents.err };
11479 unsafe { o.contents.err = core::ptr::null_mut(); }
11480 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11484 result_ok: o.result_ok,
11489 /// A tuple of 2 elements. See the individual fields for the types contained.
11490 pub struct C2Tuple_PublicKeyTypeZ {
11491 /// The element at position 0
11492 pub a: crate::c_types::PublicKey,
11493 /// The element at position 1
11494 pub b: crate::lightning::ln::wire::Type,
11496 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11497 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11504 impl C2Tuple_PublicKeyTypeZ {
11505 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11509 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11511 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11512 C2Tuple_PublicKeyTypeZ { a, b, }
11516 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11517 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11519 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11520 /// This corresponds to std::vector in C++
11521 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11522 /// The elements in the array.
11523 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11524 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11525 /// The number of elements pointed to by `data`.
11528 impl CVec_C2Tuple_PublicKeyTypeZZ {
11529 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11530 if self.datalen == 0 { return Vec::new(); }
11531 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11532 self.data = core::ptr::null_mut();
11536 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11537 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11540 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11541 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11542 let datalen = v.len();
11543 let data = Box::into_raw(v.into_boxed_slice());
11544 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11548 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11549 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11550 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11551 fn drop(&mut self) {
11552 if self.datalen == 0 { return; }
11553 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11557 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
11558 pub enum COption_CustomOnionMessageContentsZ {
11559 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
11560 Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
11561 /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
11564 impl COption_CustomOnionMessageContentsZ {
11565 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11566 if let Self::None = self { false } else { true }
11568 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11571 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
11572 if let Self::Some(v) = self { v } else { unreachable!() }
11576 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
11577 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
11578 COption_CustomOnionMessageContentsZ::Some(o)
11581 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
11582 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
11583 COption_CustomOnionMessageContentsZ::None
11586 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
11587 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
11589 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
11590 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11591 /// A pointer to the contents in the success state.
11592 /// Reading from this pointer when `result_ok` is not set is undefined.
11593 pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
11594 /// A pointer to the contents in the error state.
11595 /// Reading from this pointer when `result_ok` is set is undefined.
11596 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11599 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
11600 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11602 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11603 /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
11604 /// `err` or `result` depending on the state of `result_ok`.
11605 pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
11606 /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
11607 pub result_ok: bool,
11610 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
11611 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11612 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11613 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11614 result: Box::into_raw(Box::new(o)),
11620 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
11621 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11622 CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11623 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11624 err: Box::into_raw(Box::new(e)),
11629 /// Checks if the given object is currently in the success state
11631 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
11635 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
11636 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
11637 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11638 fn drop(&mut self) {
11639 if self.result_ok {
11640 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11641 let _ = unsafe { Box::from_raw(self.contents.result) };
11644 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11645 let _ = unsafe { Box::from_raw(self.contents.err) };
11650 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11651 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11652 let contents = if o.result_ok {
11653 let result = unsafe { o.contents.result };
11654 unsafe { o.contents.result = core::ptr::null_mut() };
11655 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
11657 let err = unsafe { o.contents.err };
11658 unsafe { o.contents.err = core::ptr::null_mut(); }
11659 CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
11663 result_ok: o.result_ok,
11669 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11670 pub enum COption_NetAddressZ {
11671 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11672 Some(crate::lightning::ln::msgs::NetAddress),
11673 /// When we're in this state, this COption_NetAddressZ contains nothing
11676 impl COption_NetAddressZ {
11677 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11678 if let Self::None = self { false } else { true }
11680 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11683 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11684 if let Self::Some(v) = self { v } else { unreachable!() }
11688 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11689 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11690 COption_NetAddressZ::Some(o)
11693 /// Constructs a new COption_NetAddressZ containing nothing
11694 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11695 COption_NetAddressZ::None
11698 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11699 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11701 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11702 /// but with all dynamically-allocated buffers duplicated in new buffers.
11703 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11705 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11706 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11707 /// A pointer to the contents in the success state.
11708 /// Reading from this pointer when `result_ok` is not set is undefined.
11709 pub result: *mut crate::c_types::derived::CVec_u8Z,
11710 /// A pointer to the contents in the error state.
11711 /// Reading from this pointer when `result_ok` is set is undefined.
11712 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11715 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11716 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11718 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11719 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11720 /// `err` or `result` depending on the state of `result_ok`.
11721 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11722 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11723 pub result_ok: bool,
11726 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11727 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11728 CResult_CVec_u8ZPeerHandleErrorZ {
11729 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11730 result: Box::into_raw(Box::new(o)),
11736 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11737 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11738 CResult_CVec_u8ZPeerHandleErrorZ {
11739 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11740 err: Box::into_raw(Box::new(e)),
11745 /// Checks if the given object is currently in the success state
11747 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11751 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11752 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11753 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11754 fn drop(&mut self) {
11755 if self.result_ok {
11756 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11757 let _ = unsafe { Box::from_raw(self.contents.result) };
11760 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11761 let _ = unsafe { Box::from_raw(self.contents.err) };
11766 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11767 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11768 let contents = if o.result_ok {
11769 let result = unsafe { o.contents.result };
11770 unsafe { o.contents.result = core::ptr::null_mut() };
11771 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11773 let err = unsafe { o.contents.err };
11774 unsafe { o.contents.err = core::ptr::null_mut(); }
11775 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11779 result_ok: o.result_ok,
11783 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11784 fn clone(&self) -> Self {
11785 if self.result_ok {
11786 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11787 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11790 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11791 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11797 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11798 /// but with all dynamically-allocated buffers duplicated in new buffers.
11799 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11801 /// The contents of CResult_NonePeerHandleErrorZ
11802 pub union CResult_NonePeerHandleErrorZPtr {
11803 /// Note that this value is always NULL, as there are no contents in the OK variant
11804 pub result: *mut core::ffi::c_void,
11805 /// A pointer to the contents in the error state.
11806 /// Reading from this pointer when `result_ok` is set is undefined.
11807 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11810 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11811 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11812 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11813 pub struct CResult_NonePeerHandleErrorZ {
11814 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11815 /// `err` or `result` depending on the state of `result_ok`.
11816 pub contents: CResult_NonePeerHandleErrorZPtr,
11817 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11818 pub result_ok: bool,
11821 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11822 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11823 CResult_NonePeerHandleErrorZ {
11824 contents: CResult_NonePeerHandleErrorZPtr {
11825 result: core::ptr::null_mut(),
11831 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11832 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11833 CResult_NonePeerHandleErrorZ {
11834 contents: CResult_NonePeerHandleErrorZPtr {
11835 err: Box::into_raw(Box::new(e)),
11840 /// Checks if the given object is currently in the success state
11842 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11846 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11847 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11848 impl Drop for CResult_NonePeerHandleErrorZ {
11849 fn drop(&mut self) {
11850 if self.result_ok {
11852 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11853 let _ = unsafe { Box::from_raw(self.contents.err) };
11858 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11859 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11860 let contents = if o.result_ok {
11861 let _ = unsafe { Box::from_raw(o.contents.result) };
11862 o.contents.result = core::ptr::null_mut();
11863 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11865 let err = unsafe { o.contents.err };
11866 unsafe { o.contents.err = core::ptr::null_mut(); }
11867 CResult_NonePeerHandleErrorZPtr { err }
11871 result_ok: o.result_ok,
11875 impl Clone for CResult_NonePeerHandleErrorZ {
11876 fn clone(&self) -> Self {
11877 if self.result_ok {
11878 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11879 result: core::ptr::null_mut()
11882 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11883 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11889 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11890 /// but with all dynamically-allocated buffers duplicated in new buffers.
11891 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11893 /// The contents of CResult_boolPeerHandleErrorZ
11894 pub union CResult_boolPeerHandleErrorZPtr {
11895 /// A pointer to the contents in the success state.
11896 /// Reading from this pointer when `result_ok` is not set is undefined.
11897 pub result: *mut bool,
11898 /// A pointer to the contents in the error state.
11899 /// Reading from this pointer when `result_ok` is set is undefined.
11900 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11903 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11904 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11905 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11906 pub struct CResult_boolPeerHandleErrorZ {
11907 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11908 /// `err` or `result` depending on the state of `result_ok`.
11909 pub contents: CResult_boolPeerHandleErrorZPtr,
11910 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11911 pub result_ok: bool,
11914 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11915 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11916 CResult_boolPeerHandleErrorZ {
11917 contents: CResult_boolPeerHandleErrorZPtr {
11918 result: Box::into_raw(Box::new(o)),
11924 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11925 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
11926 CResult_boolPeerHandleErrorZ {
11927 contents: CResult_boolPeerHandleErrorZPtr {
11928 err: Box::into_raw(Box::new(e)),
11933 /// Checks if the given object is currently in the success state
11935 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
11939 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
11940 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
11941 impl Drop for CResult_boolPeerHandleErrorZ {
11942 fn drop(&mut self) {
11943 if self.result_ok {
11944 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11945 let _ = unsafe { Box::from_raw(self.contents.result) };
11948 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11949 let _ = unsafe { Box::from_raw(self.contents.err) };
11954 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
11955 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11956 let contents = if o.result_ok {
11957 let result = unsafe { o.contents.result };
11958 unsafe { o.contents.result = core::ptr::null_mut() };
11959 CResult_boolPeerHandleErrorZPtr { result }
11961 let err = unsafe { o.contents.err };
11962 unsafe { o.contents.err = core::ptr::null_mut(); }
11963 CResult_boolPeerHandleErrorZPtr { err }
11967 result_ok: o.result_ok,
11971 impl Clone for CResult_boolPeerHandleErrorZ {
11972 fn clone(&self) -> Self {
11973 if self.result_ok {
11974 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
11975 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
11978 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
11979 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11985 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
11986 /// but with all dynamically-allocated buffers duplicated in new buffers.
11987 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
11989 /// The contents of CResult_NoneSendErrorZ
11990 pub union CResult_NoneSendErrorZPtr {
11991 /// Note that this value is always NULL, as there are no contents in the OK variant
11992 pub result: *mut core::ffi::c_void,
11993 /// A pointer to the contents in the error state.
11994 /// Reading from this pointer when `result_ok` is set is undefined.
11995 pub err: *mut crate::lightning::onion_message::messenger::SendError,
11998 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
11999 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12000 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12001 pub struct CResult_NoneSendErrorZ {
12002 /// The contents of this CResult_NoneSendErrorZ, accessible via either
12003 /// `err` or `result` depending on the state of `result_ok`.
12004 pub contents: CResult_NoneSendErrorZPtr,
12005 /// Whether this CResult_NoneSendErrorZ represents a success state.
12006 pub result_ok: bool,
12009 /// Creates a new CResult_NoneSendErrorZ in the success state.
12010 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12011 CResult_NoneSendErrorZ {
12012 contents: CResult_NoneSendErrorZPtr {
12013 result: core::ptr::null_mut(),
12019 /// Creates a new CResult_NoneSendErrorZ in the error state.
12020 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12021 CResult_NoneSendErrorZ {
12022 contents: CResult_NoneSendErrorZPtr {
12023 err: Box::into_raw(Box::new(e)),
12028 /// Checks if the given object is currently in the success state
12030 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12034 /// Frees any resources used by the CResult_NoneSendErrorZ.
12035 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12036 impl Drop for CResult_NoneSendErrorZ {
12037 fn drop(&mut self) {
12038 if self.result_ok {
12040 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12041 let _ = unsafe { Box::from_raw(self.contents.err) };
12046 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12047 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12048 let contents = if o.result_ok {
12049 let _ = unsafe { Box::from_raw(o.contents.result) };
12050 o.contents.result = core::ptr::null_mut();
12051 CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12053 let err = unsafe { o.contents.err };
12054 unsafe { o.contents.err = core::ptr::null_mut(); }
12055 CResult_NoneSendErrorZPtr { err }
12059 result_ok: o.result_ok,
12064 /// The contents of CResult_SiPrefixParseErrorZ
12065 pub union CResult_SiPrefixParseErrorZPtr {
12066 /// A pointer to the contents in the success state.
12067 /// Reading from this pointer when `result_ok` is not set is undefined.
12068 pub result: *mut crate::lightning_invoice::SiPrefix,
12069 /// A pointer to the contents in the error state.
12070 /// Reading from this pointer when `result_ok` is set is undefined.
12071 pub err: *mut crate::lightning_invoice::ParseError,
12074 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
12075 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
12076 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12077 pub struct CResult_SiPrefixParseErrorZ {
12078 /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
12079 /// `err` or `result` depending on the state of `result_ok`.
12080 pub contents: CResult_SiPrefixParseErrorZPtr,
12081 /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
12082 pub result_ok: bool,
12085 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
12086 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
12087 CResult_SiPrefixParseErrorZ {
12088 contents: CResult_SiPrefixParseErrorZPtr {
12089 result: Box::into_raw(Box::new(o)),
12095 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
12096 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
12097 CResult_SiPrefixParseErrorZ {
12098 contents: CResult_SiPrefixParseErrorZPtr {
12099 err: Box::into_raw(Box::new(e)),
12104 /// Checks if the given object is currently in the success state
12106 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
12110 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
12111 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
12112 impl Drop for CResult_SiPrefixParseErrorZ {
12113 fn drop(&mut self) {
12114 if self.result_ok {
12115 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12116 let _ = unsafe { Box::from_raw(self.contents.result) };
12119 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12120 let _ = unsafe { Box::from_raw(self.contents.err) };
12125 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
12126 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
12127 let contents = if o.result_ok {
12128 let result = unsafe { o.contents.result };
12129 unsafe { o.contents.result = core::ptr::null_mut() };
12130 CResult_SiPrefixParseErrorZPtr { result }
12132 let err = unsafe { o.contents.err };
12133 unsafe { o.contents.err = core::ptr::null_mut(); }
12134 CResult_SiPrefixParseErrorZPtr { err }
12138 result_ok: o.result_ok,
12142 impl Clone for CResult_SiPrefixParseErrorZ {
12143 fn clone(&self) -> Self {
12144 if self.result_ok {
12145 Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
12146 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
12149 Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
12150 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
12156 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
12157 /// but with all dynamically-allocated buffers duplicated in new buffers.
12158 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
12160 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
12161 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
12162 /// A pointer to the contents in the success state.
12163 /// Reading from this pointer when `result_ok` is not set is undefined.
12164 pub result: *mut crate::lightning_invoice::Invoice,
12165 /// A pointer to the contents in the error state.
12166 /// Reading from this pointer when `result_ok` is set is undefined.
12167 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
12170 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
12171 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
12172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12173 pub struct CResult_InvoiceParseOrSemanticErrorZ {
12174 /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
12175 /// `err` or `result` depending on the state of `result_ok`.
12176 pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
12177 /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
12178 pub result_ok: bool,
12181 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
12182 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
12183 CResult_InvoiceParseOrSemanticErrorZ {
12184 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12185 result: Box::into_raw(Box::new(o)),
12191 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
12192 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
12193 CResult_InvoiceParseOrSemanticErrorZ {
12194 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12195 err: Box::into_raw(Box::new(e)),
12200 /// Checks if the given object is currently in the success state
12202 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
12206 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
12207 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
12208 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
12209 fn drop(&mut self) {
12210 if self.result_ok {
12211 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12212 let _ = unsafe { Box::from_raw(self.contents.result) };
12215 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12216 let _ = unsafe { Box::from_raw(self.contents.err) };
12221 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
12222 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
12223 let contents = if o.result_ok {
12224 let result = unsafe { o.contents.result };
12225 unsafe { o.contents.result = core::ptr::null_mut() };
12226 CResult_InvoiceParseOrSemanticErrorZPtr { result }
12228 let err = unsafe { o.contents.err };
12229 unsafe { o.contents.err = core::ptr::null_mut(); }
12230 CResult_InvoiceParseOrSemanticErrorZPtr { err }
12234 result_ok: o.result_ok,
12238 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
12239 fn clone(&self) -> Self {
12240 if self.result_ok {
12241 Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12242 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12245 Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12246 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
12252 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
12253 /// but with all dynamically-allocated buffers duplicated in new buffers.
12254 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
12256 /// The contents of CResult_SignedRawInvoiceParseErrorZ
12257 pub union CResult_SignedRawInvoiceParseErrorZPtr {
12258 /// A pointer to the contents in the success state.
12259 /// Reading from this pointer when `result_ok` is not set is undefined.
12260 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
12261 /// A pointer to the contents in the error state.
12262 /// Reading from this pointer when `result_ok` is set is undefined.
12263 pub err: *mut crate::lightning_invoice::ParseError,
12266 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
12267 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
12268 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12269 pub struct CResult_SignedRawInvoiceParseErrorZ {
12270 /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
12271 /// `err` or `result` depending on the state of `result_ok`.
12272 pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
12273 /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
12274 pub result_ok: bool,
12277 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
12278 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
12279 CResult_SignedRawInvoiceParseErrorZ {
12280 contents: CResult_SignedRawInvoiceParseErrorZPtr {
12281 result: Box::into_raw(Box::new(o)),
12287 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
12288 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
12289 CResult_SignedRawInvoiceParseErrorZ {
12290 contents: CResult_SignedRawInvoiceParseErrorZPtr {
12291 err: Box::into_raw(Box::new(e)),
12296 /// Checks if the given object is currently in the success state
12298 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
12302 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
12303 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
12304 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
12305 fn drop(&mut self) {
12306 if self.result_ok {
12307 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12308 let _ = unsafe { Box::from_raw(self.contents.result) };
12311 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12312 let _ = unsafe { Box::from_raw(self.contents.err) };
12317 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
12318 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
12319 let contents = if o.result_ok {
12320 let result = unsafe { o.contents.result };
12321 unsafe { o.contents.result = core::ptr::null_mut() };
12322 CResult_SignedRawInvoiceParseErrorZPtr { result }
12324 let err = unsafe { o.contents.err };
12325 unsafe { o.contents.err = core::ptr::null_mut(); }
12326 CResult_SignedRawInvoiceParseErrorZPtr { err }
12330 result_ok: o.result_ok,
12334 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
12335 fn clone(&self) -> Self {
12336 if self.result_ok {
12337 Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
12338 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
12341 Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
12342 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
12348 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
12349 /// but with all dynamically-allocated buffers duplicated in new buffers.
12350 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
12352 /// A tuple of 3 elements. See the individual fields for the types contained.
12353 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12354 /// The element at position 0
12355 pub a: crate::lightning_invoice::RawInvoice,
12356 /// The element at position 1
12357 pub b: crate::c_types::ThirtyTwoBytes,
12358 /// The element at position 2
12359 pub c: crate::lightning_invoice::InvoiceSignature,
12361 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12362 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
12370 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12371 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
12372 (self.a, self.b, self.c)
12375 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12376 fn clone(&self) -> Self {
12378 a: Clone::clone(&self.a),
12379 b: Clone::clone(&self.b),
12380 c: Clone::clone(&self.c),
12385 /// Creates a new tuple which has the same data as `orig`
12386 /// but with all dynamically-allocated buffers duplicated in new buffers.
12387 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
12388 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
12390 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 {
12391 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
12395 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
12396 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
12398 /// The contents of CResult_PayeePubKeyErrorZ
12399 pub union CResult_PayeePubKeyErrorZPtr {
12400 /// A pointer to the contents in the success state.
12401 /// Reading from this pointer when `result_ok` is not set is undefined.
12402 pub result: *mut crate::lightning_invoice::PayeePubKey,
12403 /// A pointer to the contents in the error state.
12404 /// Reading from this pointer when `result_ok` is set is undefined.
12405 pub err: *mut crate::c_types::Secp256k1Error,
12408 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
12409 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
12410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12411 pub struct CResult_PayeePubKeyErrorZ {
12412 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
12413 /// `err` or `result` depending on the state of `result_ok`.
12414 pub contents: CResult_PayeePubKeyErrorZPtr,
12415 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
12416 pub result_ok: bool,
12419 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
12420 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
12421 CResult_PayeePubKeyErrorZ {
12422 contents: CResult_PayeePubKeyErrorZPtr {
12423 result: Box::into_raw(Box::new(o)),
12429 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
12430 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
12431 CResult_PayeePubKeyErrorZ {
12432 contents: CResult_PayeePubKeyErrorZPtr {
12433 err: Box::into_raw(Box::new(e)),
12438 /// Checks if the given object is currently in the success state
12440 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
12444 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
12445 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
12446 impl Drop for CResult_PayeePubKeyErrorZ {
12447 fn drop(&mut self) {
12448 if self.result_ok {
12449 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12450 let _ = unsafe { Box::from_raw(self.contents.result) };
12453 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12454 let _ = unsafe { Box::from_raw(self.contents.err) };
12459 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
12460 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
12461 let contents = if o.result_ok {
12462 let result = unsafe { o.contents.result };
12463 unsafe { o.contents.result = core::ptr::null_mut() };
12464 CResult_PayeePubKeyErrorZPtr { result }
12466 let err = unsafe { o.contents.err };
12467 unsafe { o.contents.err = core::ptr::null_mut(); }
12468 CResult_PayeePubKeyErrorZPtr { err }
12472 result_ok: o.result_ok,
12476 impl Clone for CResult_PayeePubKeyErrorZ {
12477 fn clone(&self) -> Self {
12478 if self.result_ok {
12479 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
12480 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
12483 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
12484 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
12490 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
12491 /// but with all dynamically-allocated buffers duplicated in new buffers.
12492 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
12494 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
12495 /// This corresponds to std::vector in C++
12496 pub struct CVec_PrivateRouteZ {
12497 /// The elements in the array.
12498 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12499 pub data: *mut crate::lightning_invoice::PrivateRoute,
12500 /// The number of elements pointed to by `data`.
12503 impl CVec_PrivateRouteZ {
12504 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
12505 if self.datalen == 0 { return Vec::new(); }
12506 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12507 self.data = core::ptr::null_mut();
12511 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
12512 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12515 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
12516 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
12517 let datalen = v.len();
12518 let data = Box::into_raw(v.into_boxed_slice());
12519 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12523 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12524 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
12525 impl Drop for CVec_PrivateRouteZ {
12526 fn drop(&mut self) {
12527 if self.datalen == 0 { return; }
12528 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12531 impl Clone for CVec_PrivateRouteZ {
12532 fn clone(&self) -> Self {
12533 let mut res = Vec::new();
12534 if self.datalen == 0 { return Self::from(res); }
12535 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12540 /// The contents of CResult_PositiveTimestampCreationErrorZ
12541 pub union CResult_PositiveTimestampCreationErrorZPtr {
12542 /// A pointer to the contents in the success state.
12543 /// Reading from this pointer when `result_ok` is not set is undefined.
12544 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
12545 /// A pointer to the contents in the error state.
12546 /// Reading from this pointer when `result_ok` is set is undefined.
12547 pub err: *mut crate::lightning_invoice::CreationError,
12550 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
12551 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
12552 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12553 pub struct CResult_PositiveTimestampCreationErrorZ {
12554 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
12555 /// `err` or `result` depending on the state of `result_ok`.
12556 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
12557 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
12558 pub result_ok: bool,
12561 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
12562 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
12563 CResult_PositiveTimestampCreationErrorZ {
12564 contents: CResult_PositiveTimestampCreationErrorZPtr {
12565 result: Box::into_raw(Box::new(o)),
12571 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
12572 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
12573 CResult_PositiveTimestampCreationErrorZ {
12574 contents: CResult_PositiveTimestampCreationErrorZPtr {
12575 err: Box::into_raw(Box::new(e)),
12580 /// Checks if the given object is currently in the success state
12582 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
12586 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
12587 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
12588 impl Drop for CResult_PositiveTimestampCreationErrorZ {
12589 fn drop(&mut self) {
12590 if self.result_ok {
12591 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12592 let _ = unsafe { Box::from_raw(self.contents.result) };
12595 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12596 let _ = unsafe { Box::from_raw(self.contents.err) };
12601 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
12602 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
12603 let contents = if o.result_ok {
12604 let result = unsafe { o.contents.result };
12605 unsafe { o.contents.result = core::ptr::null_mut() };
12606 CResult_PositiveTimestampCreationErrorZPtr { result }
12608 let err = unsafe { o.contents.err };
12609 unsafe { o.contents.err = core::ptr::null_mut(); }
12610 CResult_PositiveTimestampCreationErrorZPtr { err }
12614 result_ok: o.result_ok,
12618 impl Clone for CResult_PositiveTimestampCreationErrorZ {
12619 fn clone(&self) -> Self {
12620 if self.result_ok {
12621 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
12622 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
12625 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
12626 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
12632 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
12633 /// but with all dynamically-allocated buffers duplicated in new buffers.
12634 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
12636 /// The contents of CResult_NoneSemanticErrorZ
12637 pub union CResult_NoneSemanticErrorZPtr {
12638 /// Note that this value is always NULL, as there are no contents in the OK variant
12639 pub result: *mut core::ffi::c_void,
12640 /// A pointer to the contents in the error state.
12641 /// Reading from this pointer when `result_ok` is set is undefined.
12642 pub err: *mut crate::lightning_invoice::SemanticError,
12645 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
12646 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
12647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12648 pub struct CResult_NoneSemanticErrorZ {
12649 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
12650 /// `err` or `result` depending on the state of `result_ok`.
12651 pub contents: CResult_NoneSemanticErrorZPtr,
12652 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
12653 pub result_ok: bool,
12656 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
12657 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
12658 CResult_NoneSemanticErrorZ {
12659 contents: CResult_NoneSemanticErrorZPtr {
12660 result: core::ptr::null_mut(),
12666 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
12667 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
12668 CResult_NoneSemanticErrorZ {
12669 contents: CResult_NoneSemanticErrorZPtr {
12670 err: Box::into_raw(Box::new(e)),
12675 /// Checks if the given object is currently in the success state
12677 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
12681 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
12682 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
12683 impl Drop for CResult_NoneSemanticErrorZ {
12684 fn drop(&mut self) {
12685 if self.result_ok {
12687 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12688 let _ = unsafe { Box::from_raw(self.contents.err) };
12693 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
12694 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
12695 let contents = if o.result_ok {
12696 let _ = unsafe { Box::from_raw(o.contents.result) };
12697 o.contents.result = core::ptr::null_mut();
12698 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
12700 let err = unsafe { o.contents.err };
12701 unsafe { o.contents.err = core::ptr::null_mut(); }
12702 CResult_NoneSemanticErrorZPtr { err }
12706 result_ok: o.result_ok,
12710 impl Clone for CResult_NoneSemanticErrorZ {
12711 fn clone(&self) -> Self {
12712 if self.result_ok {
12713 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
12714 result: core::ptr::null_mut()
12717 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
12718 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
12724 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
12725 /// but with all dynamically-allocated buffers duplicated in new buffers.
12726 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
12728 /// The contents of CResult_InvoiceSemanticErrorZ
12729 pub union CResult_InvoiceSemanticErrorZPtr {
12730 /// A pointer to the contents in the success state.
12731 /// Reading from this pointer when `result_ok` is not set is undefined.
12732 pub result: *mut crate::lightning_invoice::Invoice,
12733 /// A pointer to the contents in the error state.
12734 /// Reading from this pointer when `result_ok` is set is undefined.
12735 pub err: *mut crate::lightning_invoice::SemanticError,
12738 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
12739 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
12740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12741 pub struct CResult_InvoiceSemanticErrorZ {
12742 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
12743 /// `err` or `result` depending on the state of `result_ok`.
12744 pub contents: CResult_InvoiceSemanticErrorZPtr,
12745 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
12746 pub result_ok: bool,
12749 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
12750 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
12751 CResult_InvoiceSemanticErrorZ {
12752 contents: CResult_InvoiceSemanticErrorZPtr {
12753 result: Box::into_raw(Box::new(o)),
12759 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
12760 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
12761 CResult_InvoiceSemanticErrorZ {
12762 contents: CResult_InvoiceSemanticErrorZPtr {
12763 err: Box::into_raw(Box::new(e)),
12768 /// Checks if the given object is currently in the success state
12770 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
12774 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
12775 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
12776 impl Drop for CResult_InvoiceSemanticErrorZ {
12777 fn drop(&mut self) {
12778 if self.result_ok {
12779 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12780 let _ = unsafe { Box::from_raw(self.contents.result) };
12783 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12784 let _ = unsafe { Box::from_raw(self.contents.err) };
12789 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
12790 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
12791 let contents = if o.result_ok {
12792 let result = unsafe { o.contents.result };
12793 unsafe { o.contents.result = core::ptr::null_mut() };
12794 CResult_InvoiceSemanticErrorZPtr { result }
12796 let err = unsafe { o.contents.err };
12797 unsafe { o.contents.err = core::ptr::null_mut(); }
12798 CResult_InvoiceSemanticErrorZPtr { err }
12802 result_ok: o.result_ok,
12806 impl Clone for CResult_InvoiceSemanticErrorZ {
12807 fn clone(&self) -> Self {
12808 if self.result_ok {
12809 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
12810 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12813 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
12814 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
12820 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
12821 /// but with all dynamically-allocated buffers duplicated in new buffers.
12822 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
12824 /// The contents of CResult_DescriptionCreationErrorZ
12825 pub union CResult_DescriptionCreationErrorZPtr {
12826 /// A pointer to the contents in the success state.
12827 /// Reading from this pointer when `result_ok` is not set is undefined.
12828 pub result: *mut crate::lightning_invoice::Description,
12829 /// A pointer to the contents in the error state.
12830 /// Reading from this pointer when `result_ok` is set is undefined.
12831 pub err: *mut crate::lightning_invoice::CreationError,
12834 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
12835 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
12836 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12837 pub struct CResult_DescriptionCreationErrorZ {
12838 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
12839 /// `err` or `result` depending on the state of `result_ok`.
12840 pub contents: CResult_DescriptionCreationErrorZPtr,
12841 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
12842 pub result_ok: bool,
12845 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
12846 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
12847 CResult_DescriptionCreationErrorZ {
12848 contents: CResult_DescriptionCreationErrorZPtr {
12849 result: Box::into_raw(Box::new(o)),
12855 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
12856 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
12857 CResult_DescriptionCreationErrorZ {
12858 contents: CResult_DescriptionCreationErrorZPtr {
12859 err: Box::into_raw(Box::new(e)),
12864 /// Checks if the given object is currently in the success state
12866 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
12870 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
12871 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
12872 impl Drop for CResult_DescriptionCreationErrorZ {
12873 fn drop(&mut self) {
12874 if self.result_ok {
12875 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12876 let _ = unsafe { Box::from_raw(self.contents.result) };
12879 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12880 let _ = unsafe { Box::from_raw(self.contents.err) };
12885 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
12886 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
12887 let contents = if o.result_ok {
12888 let result = unsafe { o.contents.result };
12889 unsafe { o.contents.result = core::ptr::null_mut() };
12890 CResult_DescriptionCreationErrorZPtr { result }
12892 let err = unsafe { o.contents.err };
12893 unsafe { o.contents.err = core::ptr::null_mut(); }
12894 CResult_DescriptionCreationErrorZPtr { err }
12898 result_ok: o.result_ok,
12902 impl Clone for CResult_DescriptionCreationErrorZ {
12903 fn clone(&self) -> Self {
12904 if self.result_ok {
12905 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
12906 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
12909 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
12910 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
12916 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
12917 /// but with all dynamically-allocated buffers duplicated in new buffers.
12918 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
12920 /// The contents of CResult_PrivateRouteCreationErrorZ
12921 pub union CResult_PrivateRouteCreationErrorZPtr {
12922 /// A pointer to the contents in the success state.
12923 /// Reading from this pointer when `result_ok` is not set is undefined.
12924 pub result: *mut crate::lightning_invoice::PrivateRoute,
12925 /// A pointer to the contents in the error state.
12926 /// Reading from this pointer when `result_ok` is set is undefined.
12927 pub err: *mut crate::lightning_invoice::CreationError,
12930 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
12931 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
12932 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12933 pub struct CResult_PrivateRouteCreationErrorZ {
12934 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
12935 /// `err` or `result` depending on the state of `result_ok`.
12936 pub contents: CResult_PrivateRouteCreationErrorZPtr,
12937 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
12938 pub result_ok: bool,
12941 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
12942 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
12943 CResult_PrivateRouteCreationErrorZ {
12944 contents: CResult_PrivateRouteCreationErrorZPtr {
12945 result: Box::into_raw(Box::new(o)),
12951 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
12952 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
12953 CResult_PrivateRouteCreationErrorZ {
12954 contents: CResult_PrivateRouteCreationErrorZPtr {
12955 err: Box::into_raw(Box::new(e)),
12960 /// Checks if the given object is currently in the success state
12962 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
12966 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
12967 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
12968 impl Drop for CResult_PrivateRouteCreationErrorZ {
12969 fn drop(&mut self) {
12970 if self.result_ok {
12971 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12972 let _ = unsafe { Box::from_raw(self.contents.result) };
12975 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12976 let _ = unsafe { Box::from_raw(self.contents.err) };
12981 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
12982 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
12983 let contents = if o.result_ok {
12984 let result = unsafe { o.contents.result };
12985 unsafe { o.contents.result = core::ptr::null_mut() };
12986 CResult_PrivateRouteCreationErrorZPtr { result }
12988 let err = unsafe { o.contents.err };
12989 unsafe { o.contents.err = core::ptr::null_mut(); }
12990 CResult_PrivateRouteCreationErrorZPtr { err }
12994 result_ok: o.result_ok,
12998 impl Clone for CResult_PrivateRouteCreationErrorZ {
12999 fn clone(&self) -> Self {
13000 if self.result_ok {
13001 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
13002 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
13005 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
13006 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13012 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
13013 /// but with all dynamically-allocated buffers duplicated in new buffers.
13014 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
13016 /// The contents of CResult_u32GraphSyncErrorZ
13017 pub union CResult_u32GraphSyncErrorZPtr {
13018 /// A pointer to the contents in the success state.
13019 /// Reading from this pointer when `result_ok` is not set is undefined.
13020 pub result: *mut u32,
13021 /// A pointer to the contents in the error state.
13022 /// Reading from this pointer when `result_ok` is set is undefined.
13023 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
13026 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
13027 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
13028 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13029 pub struct CResult_u32GraphSyncErrorZ {
13030 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
13031 /// `err` or `result` depending on the state of `result_ok`.
13032 pub contents: CResult_u32GraphSyncErrorZPtr,
13033 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
13034 pub result_ok: bool,
13037 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
13038 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
13039 CResult_u32GraphSyncErrorZ {
13040 contents: CResult_u32GraphSyncErrorZPtr {
13041 result: Box::into_raw(Box::new(o)),
13047 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
13048 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
13049 CResult_u32GraphSyncErrorZ {
13050 contents: CResult_u32GraphSyncErrorZPtr {
13051 err: Box::into_raw(Box::new(e)),
13056 /// Checks if the given object is currently in the success state
13058 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
13062 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
13063 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
13064 impl Drop for CResult_u32GraphSyncErrorZ {
13065 fn drop(&mut self) {
13066 if self.result_ok {
13067 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13068 let _ = unsafe { Box::from_raw(self.contents.result) };
13071 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13072 let _ = unsafe { Box::from_raw(self.contents.err) };
13077 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
13078 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
13079 let contents = if o.result_ok {
13080 let result = unsafe { o.contents.result };
13081 unsafe { o.contents.result = core::ptr::null_mut() };
13082 CResult_u32GraphSyncErrorZPtr { result }
13084 let err = unsafe { o.contents.err };
13085 unsafe { o.contents.err = core::ptr::null_mut(); }
13086 CResult_u32GraphSyncErrorZPtr { err }
13090 result_ok: o.result_ok,
13095 /// The contents of CResult_NetAddressDecodeErrorZ
13096 pub union CResult_NetAddressDecodeErrorZPtr {
13097 /// A pointer to the contents in the success state.
13098 /// Reading from this pointer when `result_ok` is not set is undefined.
13099 pub result: *mut crate::lightning::ln::msgs::NetAddress,
13100 /// A pointer to the contents in the error state.
13101 /// Reading from this pointer when `result_ok` is set is undefined.
13102 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13105 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
13106 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
13107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13108 pub struct CResult_NetAddressDecodeErrorZ {
13109 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
13110 /// `err` or `result` depending on the state of `result_ok`.
13111 pub contents: CResult_NetAddressDecodeErrorZPtr,
13112 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
13113 pub result_ok: bool,
13116 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
13117 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
13118 CResult_NetAddressDecodeErrorZ {
13119 contents: CResult_NetAddressDecodeErrorZPtr {
13120 result: Box::into_raw(Box::new(o)),
13126 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
13127 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
13128 CResult_NetAddressDecodeErrorZ {
13129 contents: CResult_NetAddressDecodeErrorZPtr {
13130 err: Box::into_raw(Box::new(e)),
13135 /// Checks if the given object is currently in the success state
13137 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
13141 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
13142 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
13143 impl Drop for CResult_NetAddressDecodeErrorZ {
13144 fn drop(&mut self) {
13145 if self.result_ok {
13146 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13147 let _ = unsafe { Box::from_raw(self.contents.result) };
13150 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13151 let _ = unsafe { Box::from_raw(self.contents.err) };
13156 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
13157 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
13158 let contents = if o.result_ok {
13159 let result = unsafe { o.contents.result };
13160 unsafe { o.contents.result = core::ptr::null_mut() };
13161 CResult_NetAddressDecodeErrorZPtr { result }
13163 let err = unsafe { o.contents.err };
13164 unsafe { o.contents.err = core::ptr::null_mut(); }
13165 CResult_NetAddressDecodeErrorZPtr { err }
13169 result_ok: o.result_ok,
13173 impl Clone for CResult_NetAddressDecodeErrorZ {
13174 fn clone(&self) -> Self {
13175 if self.result_ok {
13176 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
13177 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
13180 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
13181 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13187 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
13188 /// but with all dynamically-allocated buffers duplicated in new buffers.
13189 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
13191 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
13192 /// This corresponds to std::vector in C++
13193 pub struct CVec_UpdateAddHTLCZ {
13194 /// The elements in the array.
13195 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13196 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13197 /// The number of elements pointed to by `data`.
13200 impl CVec_UpdateAddHTLCZ {
13201 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
13202 if self.datalen == 0 { return Vec::new(); }
13203 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13204 self.data = core::ptr::null_mut();
13208 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
13209 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13212 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
13213 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
13214 let datalen = v.len();
13215 let data = Box::into_raw(v.into_boxed_slice());
13216 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13220 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13221 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
13222 impl Drop for CVec_UpdateAddHTLCZ {
13223 fn drop(&mut self) {
13224 if self.datalen == 0 { return; }
13225 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13228 impl Clone for CVec_UpdateAddHTLCZ {
13229 fn clone(&self) -> Self {
13230 let mut res = Vec::new();
13231 if self.datalen == 0 { return Self::from(res); }
13232 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13237 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
13238 /// This corresponds to std::vector in C++
13239 pub struct CVec_UpdateFulfillHTLCZ {
13240 /// The elements in the array.
13241 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13242 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13243 /// The number of elements pointed to by `data`.
13246 impl CVec_UpdateFulfillHTLCZ {
13247 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
13248 if self.datalen == 0 { return Vec::new(); }
13249 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13250 self.data = core::ptr::null_mut();
13254 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
13255 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13258 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
13259 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
13260 let datalen = v.len();
13261 let data = Box::into_raw(v.into_boxed_slice());
13262 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13266 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13267 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
13268 impl Drop for CVec_UpdateFulfillHTLCZ {
13269 fn drop(&mut self) {
13270 if self.datalen == 0 { return; }
13271 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13274 impl Clone for CVec_UpdateFulfillHTLCZ {
13275 fn clone(&self) -> Self {
13276 let mut res = Vec::new();
13277 if self.datalen == 0 { return Self::from(res); }
13278 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13283 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
13284 /// This corresponds to std::vector in C++
13285 pub struct CVec_UpdateFailHTLCZ {
13286 /// The elements in the array.
13287 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13288 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13289 /// The number of elements pointed to by `data`.
13292 impl CVec_UpdateFailHTLCZ {
13293 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
13294 if self.datalen == 0 { return Vec::new(); }
13295 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13296 self.data = core::ptr::null_mut();
13300 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
13301 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13304 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
13305 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
13306 let datalen = v.len();
13307 let data = Box::into_raw(v.into_boxed_slice());
13308 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13312 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13313 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
13314 impl Drop for CVec_UpdateFailHTLCZ {
13315 fn drop(&mut self) {
13316 if self.datalen == 0 { return; }
13317 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13320 impl Clone for CVec_UpdateFailHTLCZ {
13321 fn clone(&self) -> Self {
13322 let mut res = Vec::new();
13323 if self.datalen == 0 { return Self::from(res); }
13324 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13329 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
13330 /// This corresponds to std::vector in C++
13331 pub struct CVec_UpdateFailMalformedHTLCZ {
13332 /// The elements in the array.
13333 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13334 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13335 /// The number of elements pointed to by `data`.
13338 impl CVec_UpdateFailMalformedHTLCZ {
13339 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
13340 if self.datalen == 0 { return Vec::new(); }
13341 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13342 self.data = core::ptr::null_mut();
13346 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
13347 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13350 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
13351 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
13352 let datalen = v.len();
13353 let data = Box::into_raw(v.into_boxed_slice());
13354 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13358 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13359 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
13360 impl Drop for CVec_UpdateFailMalformedHTLCZ {
13361 fn drop(&mut self) {
13362 if self.datalen == 0 { return; }
13363 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13366 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13367 fn clone(&self) -> Self {
13368 let mut res = Vec::new();
13369 if self.datalen == 0 { return Self::from(res); }
13370 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13375 /// The contents of CResult_AcceptChannelDecodeErrorZ
13376 pub union CResult_AcceptChannelDecodeErrorZPtr {
13377 /// A pointer to the contents in the success state.
13378 /// Reading from this pointer when `result_ok` is not set is undefined.
13379 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13380 /// A pointer to the contents in the error state.
13381 /// Reading from this pointer when `result_ok` is set is undefined.
13382 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13385 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13386 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13387 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13388 pub struct CResult_AcceptChannelDecodeErrorZ {
13389 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13390 /// `err` or `result` depending on the state of `result_ok`.
13391 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13392 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13393 pub result_ok: bool,
13396 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13397 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13398 CResult_AcceptChannelDecodeErrorZ {
13399 contents: CResult_AcceptChannelDecodeErrorZPtr {
13400 result: Box::into_raw(Box::new(o)),
13406 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13407 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13408 CResult_AcceptChannelDecodeErrorZ {
13409 contents: CResult_AcceptChannelDecodeErrorZPtr {
13410 err: Box::into_raw(Box::new(e)),
13415 /// Checks if the given object is currently in the success state
13417 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13421 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13422 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13423 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13424 fn drop(&mut self) {
13425 if self.result_ok {
13426 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13427 let _ = unsafe { Box::from_raw(self.contents.result) };
13430 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13431 let _ = unsafe { Box::from_raw(self.contents.err) };
13436 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13437 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13438 let contents = if o.result_ok {
13439 let result = unsafe { o.contents.result };
13440 unsafe { o.contents.result = core::ptr::null_mut() };
13441 CResult_AcceptChannelDecodeErrorZPtr { result }
13443 let err = unsafe { o.contents.err };
13444 unsafe { o.contents.err = core::ptr::null_mut(); }
13445 CResult_AcceptChannelDecodeErrorZPtr { err }
13449 result_ok: o.result_ok,
13453 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13454 fn clone(&self) -> Self {
13455 if self.result_ok {
13456 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13457 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13460 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13461 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13467 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13468 /// but with all dynamically-allocated buffers duplicated in new buffers.
13469 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13471 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
13472 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
13473 /// A pointer to the contents in the success state.
13474 /// Reading from this pointer when `result_ok` is not set is undefined.
13475 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
13476 /// A pointer to the contents in the error state.
13477 /// Reading from this pointer when `result_ok` is set is undefined.
13478 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13481 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
13482 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13483 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13484 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
13485 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
13486 /// `err` or `result` depending on the state of `result_ok`.
13487 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
13488 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
13489 pub result_ok: bool,
13492 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13493 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13494 CResult_AnnouncementSignaturesDecodeErrorZ {
13495 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13496 result: Box::into_raw(Box::new(o)),
13502 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13503 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13504 CResult_AnnouncementSignaturesDecodeErrorZ {
13505 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13506 err: Box::into_raw(Box::new(e)),
13511 /// Checks if the given object is currently in the success state
13513 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
13517 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13518 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
13519 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
13520 fn drop(&mut self) {
13521 if self.result_ok {
13522 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13523 let _ = unsafe { Box::from_raw(self.contents.result) };
13526 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13527 let _ = unsafe { Box::from_raw(self.contents.err) };
13532 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
13533 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13534 let contents = if o.result_ok {
13535 let result = unsafe { o.contents.result };
13536 unsafe { o.contents.result = core::ptr::null_mut() };
13537 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
13539 let err = unsafe { o.contents.err };
13540 unsafe { o.contents.err = core::ptr::null_mut(); }
13541 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
13545 result_ok: o.result_ok,
13549 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
13550 fn clone(&self) -> Self {
13551 if self.result_ok {
13552 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13553 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
13556 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13557 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13563 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13564 /// but with all dynamically-allocated buffers duplicated in new buffers.
13565 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
13567 /// The contents of CResult_ChannelReestablishDecodeErrorZ
13568 pub union CResult_ChannelReestablishDecodeErrorZPtr {
13569 /// A pointer to the contents in the success state.
13570 /// Reading from this pointer when `result_ok` is not set is undefined.
13571 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
13572 /// A pointer to the contents in the error state.
13573 /// Reading from this pointer when `result_ok` is set is undefined.
13574 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13577 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
13578 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
13579 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13580 pub struct CResult_ChannelReestablishDecodeErrorZ {
13581 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
13582 /// `err` or `result` depending on the state of `result_ok`.
13583 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
13584 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
13585 pub result_ok: bool,
13588 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13589 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
13590 CResult_ChannelReestablishDecodeErrorZ {
13591 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13592 result: Box::into_raw(Box::new(o)),
13598 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13599 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
13600 CResult_ChannelReestablishDecodeErrorZ {
13601 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13602 err: Box::into_raw(Box::new(e)),
13607 /// Checks if the given object is currently in the success state
13609 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
13613 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13614 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
13615 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
13616 fn drop(&mut self) {
13617 if self.result_ok {
13618 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13619 let _ = unsafe { Box::from_raw(self.contents.result) };
13622 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13623 let _ = unsafe { Box::from_raw(self.contents.err) };
13628 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
13629 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
13630 let contents = if o.result_ok {
13631 let result = unsafe { o.contents.result };
13632 unsafe { o.contents.result = core::ptr::null_mut() };
13633 CResult_ChannelReestablishDecodeErrorZPtr { result }
13635 let err = unsafe { o.contents.err };
13636 unsafe { o.contents.err = core::ptr::null_mut(); }
13637 CResult_ChannelReestablishDecodeErrorZPtr { err }
13641 result_ok: o.result_ok,
13645 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
13646 fn clone(&self) -> Self {
13647 if self.result_ok {
13648 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13649 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
13652 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13653 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13659 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
13660 /// but with all dynamically-allocated buffers duplicated in new buffers.
13661 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
13663 /// The contents of CResult_ClosingSignedDecodeErrorZ
13664 pub union CResult_ClosingSignedDecodeErrorZPtr {
13665 /// A pointer to the contents in the success state.
13666 /// Reading from this pointer when `result_ok` is not set is undefined.
13667 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
13668 /// A pointer to the contents in the error state.
13669 /// Reading from this pointer when `result_ok` is set is undefined.
13670 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13673 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
13674 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13675 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13676 pub struct CResult_ClosingSignedDecodeErrorZ {
13677 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
13678 /// `err` or `result` depending on the state of `result_ok`.
13679 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
13680 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
13681 pub result_ok: bool,
13684 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
13685 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
13686 CResult_ClosingSignedDecodeErrorZ {
13687 contents: CResult_ClosingSignedDecodeErrorZPtr {
13688 result: Box::into_raw(Box::new(o)),
13694 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
13695 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
13696 CResult_ClosingSignedDecodeErrorZ {
13697 contents: CResult_ClosingSignedDecodeErrorZPtr {
13698 err: Box::into_raw(Box::new(e)),
13703 /// Checks if the given object is currently in the success state
13705 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
13709 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
13710 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
13711 impl Drop for CResult_ClosingSignedDecodeErrorZ {
13712 fn drop(&mut self) {
13713 if self.result_ok {
13714 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13715 let _ = unsafe { Box::from_raw(self.contents.result) };
13718 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13719 let _ = unsafe { Box::from_raw(self.contents.err) };
13724 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
13725 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13726 let contents = if o.result_ok {
13727 let result = unsafe { o.contents.result };
13728 unsafe { o.contents.result = core::ptr::null_mut() };
13729 CResult_ClosingSignedDecodeErrorZPtr { result }
13731 let err = unsafe { o.contents.err };
13732 unsafe { o.contents.err = core::ptr::null_mut(); }
13733 CResult_ClosingSignedDecodeErrorZPtr { err }
13737 result_ok: o.result_ok,
13741 impl Clone for CResult_ClosingSignedDecodeErrorZ {
13742 fn clone(&self) -> Self {
13743 if self.result_ok {
13744 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
13745 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
13748 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
13749 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13755 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
13756 /// but with all dynamically-allocated buffers duplicated in new buffers.
13757 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
13759 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
13760 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13761 /// A pointer to the contents in the success state.
13762 /// Reading from this pointer when `result_ok` is not set is undefined.
13763 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
13764 /// A pointer to the contents in the error state.
13765 /// Reading from this pointer when `result_ok` is set is undefined.
13766 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13769 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
13770 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13771 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13772 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
13773 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
13774 /// `err` or `result` depending on the state of `result_ok`.
13775 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
13776 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
13777 pub result_ok: bool,
13780 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
13781 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13782 CResult_ClosingSignedFeeRangeDecodeErrorZ {
13783 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13784 result: Box::into_raw(Box::new(o)),
13790 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
13791 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13792 CResult_ClosingSignedFeeRangeDecodeErrorZ {
13793 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13794 err: Box::into_raw(Box::new(e)),
13799 /// Checks if the given object is currently in the success state
13801 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
13805 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
13806 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
13807 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13808 fn drop(&mut self) {
13809 if self.result_ok {
13810 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13811 let _ = unsafe { Box::from_raw(self.contents.result) };
13814 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13815 let _ = unsafe { Box::from_raw(self.contents.err) };
13820 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13821 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13822 let contents = if o.result_ok {
13823 let result = unsafe { o.contents.result };
13824 unsafe { o.contents.result = core::ptr::null_mut() };
13825 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
13827 let err = unsafe { o.contents.err };
13828 unsafe { o.contents.err = core::ptr::null_mut(); }
13829 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
13833 result_ok: o.result_ok,
13837 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13838 fn clone(&self) -> Self {
13839 if self.result_ok {
13840 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13841 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
13844 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13845 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13851 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13852 /// but with all dynamically-allocated buffers duplicated in new buffers.
13853 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
13855 /// The contents of CResult_CommitmentSignedDecodeErrorZ
13856 pub union CResult_CommitmentSignedDecodeErrorZPtr {
13857 /// A pointer to the contents in the success state.
13858 /// Reading from this pointer when `result_ok` is not set is undefined.
13859 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
13860 /// A pointer to the contents in the error state.
13861 /// Reading from this pointer when `result_ok` is set is undefined.
13862 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13865 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
13866 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13867 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13868 pub struct CResult_CommitmentSignedDecodeErrorZ {
13869 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
13870 /// `err` or `result` depending on the state of `result_ok`.
13871 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
13872 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
13873 pub result_ok: bool,
13876 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13877 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
13878 CResult_CommitmentSignedDecodeErrorZ {
13879 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13880 result: Box::into_raw(Box::new(o)),
13886 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13887 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
13888 CResult_CommitmentSignedDecodeErrorZ {
13889 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13890 err: Box::into_raw(Box::new(e)),
13895 /// Checks if the given object is currently in the success state
13897 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
13901 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13902 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
13903 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
13904 fn drop(&mut self) {
13905 if self.result_ok {
13906 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13907 let _ = unsafe { Box::from_raw(self.contents.result) };
13910 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13911 let _ = unsafe { Box::from_raw(self.contents.err) };
13916 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
13917 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13918 let contents = if o.result_ok {
13919 let result = unsafe { o.contents.result };
13920 unsafe { o.contents.result = core::ptr::null_mut() };
13921 CResult_CommitmentSignedDecodeErrorZPtr { result }
13923 let err = unsafe { o.contents.err };
13924 unsafe { o.contents.err = core::ptr::null_mut(); }
13925 CResult_CommitmentSignedDecodeErrorZPtr { err }
13929 result_ok: o.result_ok,
13933 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
13934 fn clone(&self) -> Self {
13935 if self.result_ok {
13936 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13937 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
13940 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13941 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13947 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13948 /// but with all dynamically-allocated buffers duplicated in new buffers.
13949 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
13951 /// The contents of CResult_FundingCreatedDecodeErrorZ
13952 pub union CResult_FundingCreatedDecodeErrorZPtr {
13953 /// A pointer to the contents in the success state.
13954 /// Reading from this pointer when `result_ok` is not set is undefined.
13955 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13956 /// A pointer to the contents in the error state.
13957 /// Reading from this pointer when `result_ok` is set is undefined.
13958 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13961 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13962 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13964 pub struct CResult_FundingCreatedDecodeErrorZ {
13965 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13966 /// `err` or `result` depending on the state of `result_ok`.
13967 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13968 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13969 pub result_ok: bool,
13972 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13973 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13974 CResult_FundingCreatedDecodeErrorZ {
13975 contents: CResult_FundingCreatedDecodeErrorZPtr {
13976 result: Box::into_raw(Box::new(o)),
13982 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13983 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13984 CResult_FundingCreatedDecodeErrorZ {
13985 contents: CResult_FundingCreatedDecodeErrorZPtr {
13986 err: Box::into_raw(Box::new(e)),
13991 /// Checks if the given object is currently in the success state
13993 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13997 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13998 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13999 impl Drop for CResult_FundingCreatedDecodeErrorZ {
14000 fn drop(&mut self) {
14001 if self.result_ok {
14002 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14003 let _ = unsafe { Box::from_raw(self.contents.result) };
14006 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14007 let _ = unsafe { Box::from_raw(self.contents.err) };
14012 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
14013 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
14014 let contents = if o.result_ok {
14015 let result = unsafe { o.contents.result };
14016 unsafe { o.contents.result = core::ptr::null_mut() };
14017 CResult_FundingCreatedDecodeErrorZPtr { result }
14019 let err = unsafe { o.contents.err };
14020 unsafe { o.contents.err = core::ptr::null_mut(); }
14021 CResult_FundingCreatedDecodeErrorZPtr { err }
14025 result_ok: o.result_ok,
14029 impl Clone for CResult_FundingCreatedDecodeErrorZ {
14030 fn clone(&self) -> Self {
14031 if self.result_ok {
14032 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
14033 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
14036 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
14037 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14043 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
14044 /// but with all dynamically-allocated buffers duplicated in new buffers.
14045 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
14047 /// The contents of CResult_FundingSignedDecodeErrorZ
14048 pub union CResult_FundingSignedDecodeErrorZPtr {
14049 /// A pointer to the contents in the success state.
14050 /// Reading from this pointer when `result_ok` is not set is undefined.
14051 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
14052 /// A pointer to the contents in the error state.
14053 /// Reading from this pointer when `result_ok` is set is undefined.
14054 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14057 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
14058 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14059 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14060 pub struct CResult_FundingSignedDecodeErrorZ {
14061 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
14062 /// `err` or `result` depending on the state of `result_ok`.
14063 pub contents: CResult_FundingSignedDecodeErrorZPtr,
14064 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
14065 pub result_ok: bool,
14068 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
14069 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
14070 CResult_FundingSignedDecodeErrorZ {
14071 contents: CResult_FundingSignedDecodeErrorZPtr {
14072 result: Box::into_raw(Box::new(o)),
14078 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
14079 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
14080 CResult_FundingSignedDecodeErrorZ {
14081 contents: CResult_FundingSignedDecodeErrorZPtr {
14082 err: Box::into_raw(Box::new(e)),
14087 /// Checks if the given object is currently in the success state
14089 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
14093 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
14094 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
14095 impl Drop for CResult_FundingSignedDecodeErrorZ {
14096 fn drop(&mut self) {
14097 if self.result_ok {
14098 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14099 let _ = unsafe { Box::from_raw(self.contents.result) };
14102 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14103 let _ = unsafe { Box::from_raw(self.contents.err) };
14108 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
14109 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14110 let contents = if o.result_ok {
14111 let result = unsafe { o.contents.result };
14112 unsafe { o.contents.result = core::ptr::null_mut() };
14113 CResult_FundingSignedDecodeErrorZPtr { result }
14115 let err = unsafe { o.contents.err };
14116 unsafe { o.contents.err = core::ptr::null_mut(); }
14117 CResult_FundingSignedDecodeErrorZPtr { err }
14121 result_ok: o.result_ok,
14125 impl Clone for CResult_FundingSignedDecodeErrorZ {
14126 fn clone(&self) -> Self {
14127 if self.result_ok {
14128 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
14129 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
14132 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
14133 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14139 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
14140 /// but with all dynamically-allocated buffers duplicated in new buffers.
14141 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
14143 /// The contents of CResult_ChannelReadyDecodeErrorZ
14144 pub union CResult_ChannelReadyDecodeErrorZPtr {
14145 /// A pointer to the contents in the success state.
14146 /// Reading from this pointer when `result_ok` is not set is undefined.
14147 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
14148 /// A pointer to the contents in the error state.
14149 /// Reading from this pointer when `result_ok` is set is undefined.
14150 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14153 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
14154 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
14155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14156 pub struct CResult_ChannelReadyDecodeErrorZ {
14157 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
14158 /// `err` or `result` depending on the state of `result_ok`.
14159 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
14160 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
14161 pub result_ok: bool,
14164 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
14165 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
14166 CResult_ChannelReadyDecodeErrorZ {
14167 contents: CResult_ChannelReadyDecodeErrorZPtr {
14168 result: Box::into_raw(Box::new(o)),
14174 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
14175 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
14176 CResult_ChannelReadyDecodeErrorZ {
14177 contents: CResult_ChannelReadyDecodeErrorZPtr {
14178 err: Box::into_raw(Box::new(e)),
14183 /// Checks if the given object is currently in the success state
14185 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
14189 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
14190 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
14191 impl Drop for CResult_ChannelReadyDecodeErrorZ {
14192 fn drop(&mut self) {
14193 if self.result_ok {
14194 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14195 let _ = unsafe { Box::from_raw(self.contents.result) };
14198 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14199 let _ = unsafe { Box::from_raw(self.contents.err) };
14204 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
14205 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
14206 let contents = if o.result_ok {
14207 let result = unsafe { o.contents.result };
14208 unsafe { o.contents.result = core::ptr::null_mut() };
14209 CResult_ChannelReadyDecodeErrorZPtr { result }
14211 let err = unsafe { o.contents.err };
14212 unsafe { o.contents.err = core::ptr::null_mut(); }
14213 CResult_ChannelReadyDecodeErrorZPtr { err }
14217 result_ok: o.result_ok,
14221 impl Clone for CResult_ChannelReadyDecodeErrorZ {
14222 fn clone(&self) -> Self {
14223 if self.result_ok {
14224 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
14225 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
14228 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
14229 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14235 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
14236 /// but with all dynamically-allocated buffers duplicated in new buffers.
14237 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
14239 /// The contents of CResult_InitDecodeErrorZ
14240 pub union CResult_InitDecodeErrorZPtr {
14241 /// A pointer to the contents in the success state.
14242 /// Reading from this pointer when `result_ok` is not set is undefined.
14243 pub result: *mut crate::lightning::ln::msgs::Init,
14244 /// A pointer to the contents in the error state.
14245 /// Reading from this pointer when `result_ok` is set is undefined.
14246 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14249 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
14250 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
14251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14252 pub struct CResult_InitDecodeErrorZ {
14253 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
14254 /// `err` or `result` depending on the state of `result_ok`.
14255 pub contents: CResult_InitDecodeErrorZPtr,
14256 /// Whether this CResult_InitDecodeErrorZ represents a success state.
14257 pub result_ok: bool,
14260 /// Creates a new CResult_InitDecodeErrorZ in the success state.
14261 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
14262 CResult_InitDecodeErrorZ {
14263 contents: CResult_InitDecodeErrorZPtr {
14264 result: Box::into_raw(Box::new(o)),
14270 /// Creates a new CResult_InitDecodeErrorZ in the error state.
14271 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
14272 CResult_InitDecodeErrorZ {
14273 contents: CResult_InitDecodeErrorZPtr {
14274 err: Box::into_raw(Box::new(e)),
14279 /// Checks if the given object is currently in the success state
14281 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
14285 /// Frees any resources used by the CResult_InitDecodeErrorZ.
14286 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
14287 impl Drop for CResult_InitDecodeErrorZ {
14288 fn drop(&mut self) {
14289 if self.result_ok {
14290 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14291 let _ = unsafe { Box::from_raw(self.contents.result) };
14294 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14295 let _ = unsafe { Box::from_raw(self.contents.err) };
14300 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
14301 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
14302 let contents = if o.result_ok {
14303 let result = unsafe { o.contents.result };
14304 unsafe { o.contents.result = core::ptr::null_mut() };
14305 CResult_InitDecodeErrorZPtr { result }
14307 let err = unsafe { o.contents.err };
14308 unsafe { o.contents.err = core::ptr::null_mut(); }
14309 CResult_InitDecodeErrorZPtr { err }
14313 result_ok: o.result_ok,
14317 impl Clone for CResult_InitDecodeErrorZ {
14318 fn clone(&self) -> Self {
14319 if self.result_ok {
14320 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
14321 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
14324 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
14325 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14331 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
14332 /// but with all dynamically-allocated buffers duplicated in new buffers.
14333 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
14335 /// The contents of CResult_OpenChannelDecodeErrorZ
14336 pub union CResult_OpenChannelDecodeErrorZPtr {
14337 /// A pointer to the contents in the success state.
14338 /// Reading from this pointer when `result_ok` is not set is undefined.
14339 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
14340 /// A pointer to the contents in the error state.
14341 /// Reading from this pointer when `result_ok` is set is undefined.
14342 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14345 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
14346 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14348 pub struct CResult_OpenChannelDecodeErrorZ {
14349 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
14350 /// `err` or `result` depending on the state of `result_ok`.
14351 pub contents: CResult_OpenChannelDecodeErrorZPtr,
14352 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
14353 pub result_ok: bool,
14356 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
14357 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
14358 CResult_OpenChannelDecodeErrorZ {
14359 contents: CResult_OpenChannelDecodeErrorZPtr {
14360 result: Box::into_raw(Box::new(o)),
14366 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14367 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
14368 CResult_OpenChannelDecodeErrorZ {
14369 contents: CResult_OpenChannelDecodeErrorZPtr {
14370 err: Box::into_raw(Box::new(e)),
14375 /// Checks if the given object is currently in the success state
14377 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
14381 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14382 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
14383 impl Drop for CResult_OpenChannelDecodeErrorZ {
14384 fn drop(&mut self) {
14385 if self.result_ok {
14386 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14387 let _ = unsafe { Box::from_raw(self.contents.result) };
14390 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14391 let _ = unsafe { Box::from_raw(self.contents.err) };
14396 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
14397 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14398 let contents = if o.result_ok {
14399 let result = unsafe { o.contents.result };
14400 unsafe { o.contents.result = core::ptr::null_mut() };
14401 CResult_OpenChannelDecodeErrorZPtr { result }
14403 let err = unsafe { o.contents.err };
14404 unsafe { o.contents.err = core::ptr::null_mut(); }
14405 CResult_OpenChannelDecodeErrorZPtr { err }
14409 result_ok: o.result_ok,
14413 impl Clone for CResult_OpenChannelDecodeErrorZ {
14414 fn clone(&self) -> Self {
14415 if self.result_ok {
14416 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
14417 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
14420 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
14421 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14427 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14428 /// but with all dynamically-allocated buffers duplicated in new buffers.
14429 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
14431 /// The contents of CResult_RevokeAndACKDecodeErrorZ
14432 pub union CResult_RevokeAndACKDecodeErrorZPtr {
14433 /// A pointer to the contents in the success state.
14434 /// Reading from this pointer when `result_ok` is not set is undefined.
14435 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
14436 /// A pointer to the contents in the error state.
14437 /// Reading from this pointer when `result_ok` is set is undefined.
14438 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14441 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
14442 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
14443 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14444 pub struct CResult_RevokeAndACKDecodeErrorZ {
14445 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
14446 /// `err` or `result` depending on the state of `result_ok`.
14447 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
14448 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
14449 pub result_ok: bool,
14452 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14453 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
14454 CResult_RevokeAndACKDecodeErrorZ {
14455 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14456 result: Box::into_raw(Box::new(o)),
14462 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14463 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
14464 CResult_RevokeAndACKDecodeErrorZ {
14465 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14466 err: Box::into_raw(Box::new(e)),
14471 /// Checks if the given object is currently in the success state
14473 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
14477 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14478 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
14479 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
14480 fn drop(&mut self) {
14481 if self.result_ok {
14482 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14483 let _ = unsafe { Box::from_raw(self.contents.result) };
14486 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14487 let _ = unsafe { Box::from_raw(self.contents.err) };
14492 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
14493 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
14494 let contents = if o.result_ok {
14495 let result = unsafe { o.contents.result };
14496 unsafe { o.contents.result = core::ptr::null_mut() };
14497 CResult_RevokeAndACKDecodeErrorZPtr { result }
14499 let err = unsafe { o.contents.err };
14500 unsafe { o.contents.err = core::ptr::null_mut(); }
14501 CResult_RevokeAndACKDecodeErrorZPtr { err }
14505 result_ok: o.result_ok,
14509 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
14510 fn clone(&self) -> Self {
14511 if self.result_ok {
14512 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14513 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
14516 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14517 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14523 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14524 /// but with all dynamically-allocated buffers duplicated in new buffers.
14525 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
14527 /// The contents of CResult_ShutdownDecodeErrorZ
14528 pub union CResult_ShutdownDecodeErrorZPtr {
14529 /// A pointer to the contents in the success state.
14530 /// Reading from this pointer when `result_ok` is not set is undefined.
14531 pub result: *mut crate::lightning::ln::msgs::Shutdown,
14532 /// A pointer to the contents in the error state.
14533 /// Reading from this pointer when `result_ok` is set is undefined.
14534 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14537 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
14538 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
14539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14540 pub struct CResult_ShutdownDecodeErrorZ {
14541 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
14542 /// `err` or `result` depending on the state of `result_ok`.
14543 pub contents: CResult_ShutdownDecodeErrorZPtr,
14544 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
14545 pub result_ok: bool,
14548 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14549 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
14550 CResult_ShutdownDecodeErrorZ {
14551 contents: CResult_ShutdownDecodeErrorZPtr {
14552 result: Box::into_raw(Box::new(o)),
14558 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14559 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
14560 CResult_ShutdownDecodeErrorZ {
14561 contents: CResult_ShutdownDecodeErrorZPtr {
14562 err: Box::into_raw(Box::new(e)),
14567 /// Checks if the given object is currently in the success state
14569 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
14573 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14574 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
14575 impl Drop for CResult_ShutdownDecodeErrorZ {
14576 fn drop(&mut self) {
14577 if self.result_ok {
14578 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14579 let _ = unsafe { Box::from_raw(self.contents.result) };
14582 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14583 let _ = unsafe { Box::from_raw(self.contents.err) };
14588 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
14589 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
14590 let contents = if o.result_ok {
14591 let result = unsafe { o.contents.result };
14592 unsafe { o.contents.result = core::ptr::null_mut() };
14593 CResult_ShutdownDecodeErrorZPtr { result }
14595 let err = unsafe { o.contents.err };
14596 unsafe { o.contents.err = core::ptr::null_mut(); }
14597 CResult_ShutdownDecodeErrorZPtr { err }
14601 result_ok: o.result_ok,
14605 impl Clone for CResult_ShutdownDecodeErrorZ {
14606 fn clone(&self) -> Self {
14607 if self.result_ok {
14608 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
14609 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
14612 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
14613 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14619 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14620 /// but with all dynamically-allocated buffers duplicated in new buffers.
14621 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
14623 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
14624 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
14625 /// A pointer to the contents in the success state.
14626 /// Reading from this pointer when `result_ok` is not set is undefined.
14627 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14628 /// A pointer to the contents in the error state.
14629 /// Reading from this pointer when `result_ok` is set is undefined.
14630 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14633 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
14634 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14635 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14636 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
14637 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
14638 /// `err` or `result` depending on the state of `result_ok`.
14639 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
14640 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
14641 pub result_ok: bool,
14644 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
14645 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
14646 CResult_UpdateFailHTLCDecodeErrorZ {
14647 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14648 result: Box::into_raw(Box::new(o)),
14654 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
14655 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
14656 CResult_UpdateFailHTLCDecodeErrorZ {
14657 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14658 err: Box::into_raw(Box::new(e)),
14663 /// Checks if the given object is currently in the success state
14665 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
14669 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
14670 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
14671 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
14672 fn drop(&mut self) {
14673 if self.result_ok {
14674 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14675 let _ = unsafe { Box::from_raw(self.contents.result) };
14678 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14679 let _ = unsafe { Box::from_raw(self.contents.err) };
14684 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
14685 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14686 let contents = if o.result_ok {
14687 let result = unsafe { o.contents.result };
14688 unsafe { o.contents.result = core::ptr::null_mut() };
14689 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
14691 let err = unsafe { o.contents.err };
14692 unsafe { o.contents.err = core::ptr::null_mut(); }
14693 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
14697 result_ok: o.result_ok,
14701 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
14702 fn clone(&self) -> Self {
14703 if self.result_ok {
14704 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14705 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
14708 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14709 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14715 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
14716 /// but with all dynamically-allocated buffers duplicated in new buffers.
14717 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
14719 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
14720 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14721 /// A pointer to the contents in the success state.
14722 /// Reading from this pointer when `result_ok` is not set is undefined.
14723 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14724 /// A pointer to the contents in the error state.
14725 /// Reading from this pointer when `result_ok` is set is undefined.
14726 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14729 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
14730 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14731 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14732 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14733 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
14734 /// `err` or `result` depending on the state of `result_ok`.
14735 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
14736 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
14737 pub result_ok: bool,
14740 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
14741 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14742 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14743 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14744 result: Box::into_raw(Box::new(o)),
14750 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
14751 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14752 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14753 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14754 err: Box::into_raw(Box::new(e)),
14759 /// Checks if the given object is currently in the success state
14761 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
14765 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
14766 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
14767 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14768 fn drop(&mut self) {
14769 if self.result_ok {
14770 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14771 let _ = unsafe { Box::from_raw(self.contents.result) };
14774 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14775 let _ = unsafe { Box::from_raw(self.contents.err) };
14780 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14781 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14782 let contents = if o.result_ok {
14783 let result = unsafe { o.contents.result };
14784 unsafe { o.contents.result = core::ptr::null_mut() };
14785 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
14787 let err = unsafe { o.contents.err };
14788 unsafe { o.contents.err = core::ptr::null_mut(); }
14789 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
14793 result_ok: o.result_ok,
14797 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14798 fn clone(&self) -> Self {
14799 if self.result_ok {
14800 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14801 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
14804 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14805 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14811 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
14812 /// but with all dynamically-allocated buffers duplicated in new buffers.
14813 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
14815 /// The contents of CResult_UpdateFeeDecodeErrorZ
14816 pub union CResult_UpdateFeeDecodeErrorZPtr {
14817 /// A pointer to the contents in the success state.
14818 /// Reading from this pointer when `result_ok` is not set is undefined.
14819 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
14820 /// A pointer to the contents in the error state.
14821 /// Reading from this pointer when `result_ok` is set is undefined.
14822 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14825 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
14826 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
14827 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14828 pub struct CResult_UpdateFeeDecodeErrorZ {
14829 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
14830 /// `err` or `result` depending on the state of `result_ok`.
14831 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
14832 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
14833 pub result_ok: bool,
14836 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14837 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
14838 CResult_UpdateFeeDecodeErrorZ {
14839 contents: CResult_UpdateFeeDecodeErrorZPtr {
14840 result: Box::into_raw(Box::new(o)),
14846 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14847 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
14848 CResult_UpdateFeeDecodeErrorZ {
14849 contents: CResult_UpdateFeeDecodeErrorZPtr {
14850 err: Box::into_raw(Box::new(e)),
14855 /// Checks if the given object is currently in the success state
14857 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
14861 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14862 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
14863 impl Drop for CResult_UpdateFeeDecodeErrorZ {
14864 fn drop(&mut self) {
14865 if self.result_ok {
14866 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14867 let _ = unsafe { Box::from_raw(self.contents.result) };
14870 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14871 let _ = unsafe { Box::from_raw(self.contents.err) };
14876 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
14877 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
14878 let contents = if o.result_ok {
14879 let result = unsafe { o.contents.result };
14880 unsafe { o.contents.result = core::ptr::null_mut() };
14881 CResult_UpdateFeeDecodeErrorZPtr { result }
14883 let err = unsafe { o.contents.err };
14884 unsafe { o.contents.err = core::ptr::null_mut(); }
14885 CResult_UpdateFeeDecodeErrorZPtr { err }
14889 result_ok: o.result_ok,
14893 impl Clone for CResult_UpdateFeeDecodeErrorZ {
14894 fn clone(&self) -> Self {
14895 if self.result_ok {
14896 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
14897 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
14900 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
14901 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14907 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14908 /// but with all dynamically-allocated buffers duplicated in new buffers.
14909 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
14911 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
14912 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14913 /// A pointer to the contents in the success state.
14914 /// Reading from this pointer when `result_ok` is not set is undefined.
14915 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14916 /// A pointer to the contents in the error state.
14917 /// Reading from this pointer when `result_ok` is set is undefined.
14918 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14921 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
14922 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14923 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14924 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
14925 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
14926 /// `err` or `result` depending on the state of `result_ok`.
14927 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
14928 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
14929 pub result_ok: bool,
14932 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14933 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14934 CResult_UpdateFulfillHTLCDecodeErrorZ {
14935 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14936 result: Box::into_raw(Box::new(o)),
14942 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14943 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14944 CResult_UpdateFulfillHTLCDecodeErrorZ {
14945 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14946 err: Box::into_raw(Box::new(e)),
14951 /// Checks if the given object is currently in the success state
14953 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14957 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14958 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14959 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14960 fn drop(&mut self) {
14961 if self.result_ok {
14962 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14963 let _ = unsafe { Box::from_raw(self.contents.result) };
14966 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14967 let _ = unsafe { Box::from_raw(self.contents.err) };
14972 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14973 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14974 let contents = if o.result_ok {
14975 let result = unsafe { o.contents.result };
14976 unsafe { o.contents.result = core::ptr::null_mut() };
14977 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14979 let err = unsafe { o.contents.err };
14980 unsafe { o.contents.err = core::ptr::null_mut(); }
14981 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14985 result_ok: o.result_ok,
14989 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14990 fn clone(&self) -> Self {
14991 if self.result_ok {
14992 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14993 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14996 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14997 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15003 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
15004 /// but with all dynamically-allocated buffers duplicated in new buffers.
15005 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
15007 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
15008 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
15009 /// A pointer to the contents in the success state.
15010 /// Reading from this pointer when `result_ok` is not set is undefined.
15011 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15012 /// A pointer to the contents in the error state.
15013 /// Reading from this pointer when `result_ok` is set is undefined.
15014 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15017 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
15018 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15019 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15020 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
15021 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
15022 /// `err` or `result` depending on the state of `result_ok`.
15023 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
15024 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
15025 pub result_ok: bool,
15028 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
15029 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
15030 CResult_UpdateAddHTLCDecodeErrorZ {
15031 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15032 result: Box::into_raw(Box::new(o)),
15038 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
15039 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
15040 CResult_UpdateAddHTLCDecodeErrorZ {
15041 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15042 err: Box::into_raw(Box::new(e)),
15047 /// Checks if the given object is currently in the success state
15049 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
15053 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
15054 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
15055 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
15056 fn drop(&mut self) {
15057 if self.result_ok {
15058 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15059 let _ = unsafe { Box::from_raw(self.contents.result) };
15062 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15063 let _ = unsafe { Box::from_raw(self.contents.err) };
15068 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
15069 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15070 let contents = if o.result_ok {
15071 let result = unsafe { o.contents.result };
15072 unsafe { o.contents.result = core::ptr::null_mut() };
15073 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
15075 let err = unsafe { o.contents.err };
15076 unsafe { o.contents.err = core::ptr::null_mut(); }
15077 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
15081 result_ok: o.result_ok,
15085 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
15086 fn clone(&self) -> Self {
15087 if self.result_ok {
15088 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15089 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
15092 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15093 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15099 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
15100 /// but with all dynamically-allocated buffers duplicated in new buffers.
15101 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
15103 /// The contents of CResult_OnionMessageDecodeErrorZ
15104 pub union CResult_OnionMessageDecodeErrorZPtr {
15105 /// A pointer to the contents in the success state.
15106 /// Reading from this pointer when `result_ok` is not set is undefined.
15107 pub result: *mut crate::lightning::ln::msgs::OnionMessage,
15108 /// A pointer to the contents in the error state.
15109 /// Reading from this pointer when `result_ok` is set is undefined.
15110 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15113 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
15114 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15115 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15116 pub struct CResult_OnionMessageDecodeErrorZ {
15117 /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
15118 /// `err` or `result` depending on the state of `result_ok`.
15119 pub contents: CResult_OnionMessageDecodeErrorZPtr,
15120 /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
15121 pub result_ok: bool,
15124 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
15125 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
15126 CResult_OnionMessageDecodeErrorZ {
15127 contents: CResult_OnionMessageDecodeErrorZPtr {
15128 result: Box::into_raw(Box::new(o)),
15134 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
15135 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
15136 CResult_OnionMessageDecodeErrorZ {
15137 contents: CResult_OnionMessageDecodeErrorZPtr {
15138 err: Box::into_raw(Box::new(e)),
15143 /// Checks if the given object is currently in the success state
15145 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
15149 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
15150 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
15151 impl Drop for CResult_OnionMessageDecodeErrorZ {
15152 fn drop(&mut self) {
15153 if self.result_ok {
15154 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15155 let _ = unsafe { Box::from_raw(self.contents.result) };
15158 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15159 let _ = unsafe { Box::from_raw(self.contents.err) };
15164 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
15165 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15166 let contents = if o.result_ok {
15167 let result = unsafe { o.contents.result };
15168 unsafe { o.contents.result = core::ptr::null_mut() };
15169 CResult_OnionMessageDecodeErrorZPtr { result }
15171 let err = unsafe { o.contents.err };
15172 unsafe { o.contents.err = core::ptr::null_mut(); }
15173 CResult_OnionMessageDecodeErrorZPtr { err }
15177 result_ok: o.result_ok,
15181 impl Clone for CResult_OnionMessageDecodeErrorZ {
15182 fn clone(&self) -> Self {
15183 if self.result_ok {
15184 Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
15185 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
15188 Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
15189 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15195 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
15196 /// but with all dynamically-allocated buffers duplicated in new buffers.
15197 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
15199 /// The contents of CResult_PingDecodeErrorZ
15200 pub union CResult_PingDecodeErrorZPtr {
15201 /// A pointer to the contents in the success state.
15202 /// Reading from this pointer when `result_ok` is not set is undefined.
15203 pub result: *mut crate::lightning::ln::msgs::Ping,
15204 /// A pointer to the contents in the error state.
15205 /// Reading from this pointer when `result_ok` is set is undefined.
15206 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15209 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
15210 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
15211 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15212 pub struct CResult_PingDecodeErrorZ {
15213 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
15214 /// `err` or `result` depending on the state of `result_ok`.
15215 pub contents: CResult_PingDecodeErrorZPtr,
15216 /// Whether this CResult_PingDecodeErrorZ represents a success state.
15217 pub result_ok: bool,
15220 /// Creates a new CResult_PingDecodeErrorZ in the success state.
15221 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
15222 CResult_PingDecodeErrorZ {
15223 contents: CResult_PingDecodeErrorZPtr {
15224 result: Box::into_raw(Box::new(o)),
15230 /// Creates a new CResult_PingDecodeErrorZ in the error state.
15231 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
15232 CResult_PingDecodeErrorZ {
15233 contents: CResult_PingDecodeErrorZPtr {
15234 err: Box::into_raw(Box::new(e)),
15239 /// Checks if the given object is currently in the success state
15241 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
15245 /// Frees any resources used by the CResult_PingDecodeErrorZ.
15246 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
15247 impl Drop for CResult_PingDecodeErrorZ {
15248 fn drop(&mut self) {
15249 if self.result_ok {
15250 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15251 let _ = unsafe { Box::from_raw(self.contents.result) };
15254 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15255 let _ = unsafe { Box::from_raw(self.contents.err) };
15260 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
15261 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
15262 let contents = if o.result_ok {
15263 let result = unsafe { o.contents.result };
15264 unsafe { o.contents.result = core::ptr::null_mut() };
15265 CResult_PingDecodeErrorZPtr { result }
15267 let err = unsafe { o.contents.err };
15268 unsafe { o.contents.err = core::ptr::null_mut(); }
15269 CResult_PingDecodeErrorZPtr { err }
15273 result_ok: o.result_ok,
15277 impl Clone for CResult_PingDecodeErrorZ {
15278 fn clone(&self) -> Self {
15279 if self.result_ok {
15280 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
15281 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
15284 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
15285 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15291 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
15292 /// but with all dynamically-allocated buffers duplicated in new buffers.
15293 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
15295 /// The contents of CResult_PongDecodeErrorZ
15296 pub union CResult_PongDecodeErrorZPtr {
15297 /// A pointer to the contents in the success state.
15298 /// Reading from this pointer when `result_ok` is not set is undefined.
15299 pub result: *mut crate::lightning::ln::msgs::Pong,
15300 /// A pointer to the contents in the error state.
15301 /// Reading from this pointer when `result_ok` is set is undefined.
15302 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15305 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
15306 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
15307 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15308 pub struct CResult_PongDecodeErrorZ {
15309 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
15310 /// `err` or `result` depending on the state of `result_ok`.
15311 pub contents: CResult_PongDecodeErrorZPtr,
15312 /// Whether this CResult_PongDecodeErrorZ represents a success state.
15313 pub result_ok: bool,
15316 /// Creates a new CResult_PongDecodeErrorZ in the success state.
15317 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
15318 CResult_PongDecodeErrorZ {
15319 contents: CResult_PongDecodeErrorZPtr {
15320 result: Box::into_raw(Box::new(o)),
15326 /// Creates a new CResult_PongDecodeErrorZ in the error state.
15327 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
15328 CResult_PongDecodeErrorZ {
15329 contents: CResult_PongDecodeErrorZPtr {
15330 err: Box::into_raw(Box::new(e)),
15335 /// Checks if the given object is currently in the success state
15337 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
15341 /// Frees any resources used by the CResult_PongDecodeErrorZ.
15342 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
15343 impl Drop for CResult_PongDecodeErrorZ {
15344 fn drop(&mut self) {
15345 if self.result_ok {
15346 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15347 let _ = unsafe { Box::from_raw(self.contents.result) };
15350 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15351 let _ = unsafe { Box::from_raw(self.contents.err) };
15356 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
15357 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
15358 let contents = if o.result_ok {
15359 let result = unsafe { o.contents.result };
15360 unsafe { o.contents.result = core::ptr::null_mut() };
15361 CResult_PongDecodeErrorZPtr { result }
15363 let err = unsafe { o.contents.err };
15364 unsafe { o.contents.err = core::ptr::null_mut(); }
15365 CResult_PongDecodeErrorZPtr { err }
15369 result_ok: o.result_ok,
15373 impl Clone for CResult_PongDecodeErrorZ {
15374 fn clone(&self) -> Self {
15375 if self.result_ok {
15376 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
15377 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
15380 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
15381 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15387 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15388 /// but with all dynamically-allocated buffers duplicated in new buffers.
15389 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
15391 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15392 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15393 /// A pointer to the contents in the success state.
15394 /// Reading from this pointer when `result_ok` is not set is undefined.
15395 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
15396 /// A pointer to the contents in the error state.
15397 /// Reading from this pointer when `result_ok` is set is undefined.
15398 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15401 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15402 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15403 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15404 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15405 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15406 /// `err` or `result` depending on the state of `result_ok`.
15407 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
15408 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15409 pub result_ok: bool,
15412 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15413 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15414 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15415 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15416 result: Box::into_raw(Box::new(o)),
15422 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15423 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15424 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15425 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15426 err: Box::into_raw(Box::new(e)),
15431 /// Checks if the given object is currently in the success state
15433 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
15437 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15438 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
15439 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15440 fn drop(&mut self) {
15441 if self.result_ok {
15442 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15443 let _ = unsafe { Box::from_raw(self.contents.result) };
15446 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15447 let _ = unsafe { Box::from_raw(self.contents.err) };
15452 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15453 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15454 let contents = if o.result_ok {
15455 let result = unsafe { o.contents.result };
15456 unsafe { o.contents.result = core::ptr::null_mut() };
15457 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
15459 let err = unsafe { o.contents.err };
15460 unsafe { o.contents.err = core::ptr::null_mut(); }
15461 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
15465 result_ok: o.result_ok,
15469 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15470 fn clone(&self) -> Self {
15471 if self.result_ok {
15472 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15473 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15476 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15477 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15483 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15484 /// but with all dynamically-allocated buffers duplicated in new buffers.
15485 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15487 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
15488 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
15489 /// A pointer to the contents in the success state.
15490 /// Reading from this pointer when `result_ok` is not set is undefined.
15491 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
15492 /// A pointer to the contents in the error state.
15493 /// Reading from this pointer when `result_ok` is set is undefined.
15494 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15497 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15498 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15500 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
15501 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15502 /// `err` or `result` depending on the state of `result_ok`.
15503 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
15504 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
15505 pub result_ok: bool,
15508 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15509 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
15510 CResult_ChannelAnnouncementDecodeErrorZ {
15511 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15512 result: Box::into_raw(Box::new(o)),
15518 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15519 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
15520 CResult_ChannelAnnouncementDecodeErrorZ {
15521 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15522 err: Box::into_raw(Box::new(e)),
15527 /// Checks if the given object is currently in the success state
15529 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
15533 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15534 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
15535 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
15536 fn drop(&mut self) {
15537 if self.result_ok {
15538 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15539 let _ = unsafe { Box::from_raw(self.contents.result) };
15542 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15543 let _ = unsafe { Box::from_raw(self.contents.err) };
15548 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
15549 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15550 let contents = if o.result_ok {
15551 let result = unsafe { o.contents.result };
15552 unsafe { o.contents.result = core::ptr::null_mut() };
15553 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
15555 let err = unsafe { o.contents.err };
15556 unsafe { o.contents.err = core::ptr::null_mut(); }
15557 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
15561 result_ok: o.result_ok,
15565 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
15566 fn clone(&self) -> Self {
15567 if self.result_ok {
15568 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15569 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15572 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15573 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15579 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15580 /// but with all dynamically-allocated buffers duplicated in new buffers.
15581 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15583 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
15584 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15585 /// A pointer to the contents in the success state.
15586 /// Reading from this pointer when `result_ok` is not set is undefined.
15587 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
15588 /// A pointer to the contents in the error state.
15589 /// Reading from this pointer when `result_ok` is set is undefined.
15590 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15593 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15594 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15595 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15596 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
15597 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
15598 /// `err` or `result` depending on the state of `result_ok`.
15599 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
15600 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
15601 pub result_ok: bool,
15604 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15605 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15606 CResult_UnsignedChannelUpdateDecodeErrorZ {
15607 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15608 result: Box::into_raw(Box::new(o)),
15614 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15615 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15616 CResult_UnsignedChannelUpdateDecodeErrorZ {
15617 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15618 err: Box::into_raw(Box::new(e)),
15623 /// Checks if the given object is currently in the success state
15625 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
15629 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
15630 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
15631 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
15632 fn drop(&mut self) {
15633 if self.result_ok {
15634 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15635 let _ = unsafe { Box::from_raw(self.contents.result) };
15638 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15639 let _ = unsafe { Box::from_raw(self.contents.err) };
15644 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
15645 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15646 let contents = if o.result_ok {
15647 let result = unsafe { o.contents.result };
15648 unsafe { o.contents.result = core::ptr::null_mut() };
15649 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
15651 let err = unsafe { o.contents.err };
15652 unsafe { o.contents.err = core::ptr::null_mut(); }
15653 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
15657 result_ok: o.result_ok,
15661 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
15662 fn clone(&self) -> Self {
15663 if self.result_ok {
15664 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15665 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
15668 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15669 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15675 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
15676 /// but with all dynamically-allocated buffers duplicated in new buffers.
15677 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15679 /// The contents of CResult_ChannelUpdateDecodeErrorZ
15680 pub union CResult_ChannelUpdateDecodeErrorZPtr {
15681 /// A pointer to the contents in the success state.
15682 /// Reading from this pointer when `result_ok` is not set is undefined.
15683 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
15684 /// A pointer to the contents in the error state.
15685 /// Reading from this pointer when `result_ok` is set is undefined.
15686 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15689 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15690 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15692 pub struct CResult_ChannelUpdateDecodeErrorZ {
15693 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
15694 /// `err` or `result` depending on the state of `result_ok`.
15695 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
15696 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
15697 pub result_ok: bool,
15700 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
15701 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
15702 CResult_ChannelUpdateDecodeErrorZ {
15703 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15704 result: Box::into_raw(Box::new(o)),
15710 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
15711 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
15712 CResult_ChannelUpdateDecodeErrorZ {
15713 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15714 err: Box::into_raw(Box::new(e)),
15719 /// Checks if the given object is currently in the success state
15721 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
15725 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
15726 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
15727 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
15728 fn drop(&mut self) {
15729 if self.result_ok {
15730 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15731 let _ = unsafe { Box::from_raw(self.contents.result) };
15734 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15735 let _ = unsafe { Box::from_raw(self.contents.err) };
15740 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
15741 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15742 let contents = if o.result_ok {
15743 let result = unsafe { o.contents.result };
15744 unsafe { o.contents.result = core::ptr::null_mut() };
15745 CResult_ChannelUpdateDecodeErrorZPtr { result }
15747 let err = unsafe { o.contents.err };
15748 unsafe { o.contents.err = core::ptr::null_mut(); }
15749 CResult_ChannelUpdateDecodeErrorZPtr { err }
15753 result_ok: o.result_ok,
15757 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
15758 fn clone(&self) -> Self {
15759 if self.result_ok {
15760 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15761 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
15764 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15765 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15771 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
15772 /// but with all dynamically-allocated buffers duplicated in new buffers.
15773 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15775 /// The contents of CResult_ErrorMessageDecodeErrorZ
15776 pub union CResult_ErrorMessageDecodeErrorZPtr {
15777 /// A pointer to the contents in the success state.
15778 /// Reading from this pointer when `result_ok` is not set is undefined.
15779 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
15780 /// A pointer to the contents in the error state.
15781 /// Reading from this pointer when `result_ok` is set is undefined.
15782 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15785 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
15786 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15787 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15788 pub struct CResult_ErrorMessageDecodeErrorZ {
15789 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
15790 /// `err` or `result` depending on the state of `result_ok`.
15791 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
15792 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
15793 pub result_ok: bool,
15796 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
15797 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
15798 CResult_ErrorMessageDecodeErrorZ {
15799 contents: CResult_ErrorMessageDecodeErrorZPtr {
15800 result: Box::into_raw(Box::new(o)),
15806 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
15807 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
15808 CResult_ErrorMessageDecodeErrorZ {
15809 contents: CResult_ErrorMessageDecodeErrorZPtr {
15810 err: Box::into_raw(Box::new(e)),
15815 /// Checks if the given object is currently in the success state
15817 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
15821 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
15822 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
15823 impl Drop for CResult_ErrorMessageDecodeErrorZ {
15824 fn drop(&mut self) {
15825 if self.result_ok {
15826 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15827 let _ = unsafe { Box::from_raw(self.contents.result) };
15830 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15831 let _ = unsafe { Box::from_raw(self.contents.err) };
15836 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
15837 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15838 let contents = if o.result_ok {
15839 let result = unsafe { o.contents.result };
15840 unsafe { o.contents.result = core::ptr::null_mut() };
15841 CResult_ErrorMessageDecodeErrorZPtr { result }
15843 let err = unsafe { o.contents.err };
15844 unsafe { o.contents.err = core::ptr::null_mut(); }
15845 CResult_ErrorMessageDecodeErrorZPtr { err }
15849 result_ok: o.result_ok,
15853 impl Clone for CResult_ErrorMessageDecodeErrorZ {
15854 fn clone(&self) -> Self {
15855 if self.result_ok {
15856 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
15857 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
15860 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
15861 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15867 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
15868 /// but with all dynamically-allocated buffers duplicated in new buffers.
15869 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
15871 /// The contents of CResult_WarningMessageDecodeErrorZ
15872 pub union CResult_WarningMessageDecodeErrorZPtr {
15873 /// A pointer to the contents in the success state.
15874 /// Reading from this pointer when `result_ok` is not set is undefined.
15875 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
15876 /// A pointer to the contents in the error state.
15877 /// Reading from this pointer when `result_ok` is set is undefined.
15878 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15881 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
15882 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15883 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15884 pub struct CResult_WarningMessageDecodeErrorZ {
15885 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
15886 /// `err` or `result` depending on the state of `result_ok`.
15887 pub contents: CResult_WarningMessageDecodeErrorZPtr,
15888 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
15889 pub result_ok: bool,
15892 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
15893 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
15894 CResult_WarningMessageDecodeErrorZ {
15895 contents: CResult_WarningMessageDecodeErrorZPtr {
15896 result: Box::into_raw(Box::new(o)),
15902 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
15903 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
15904 CResult_WarningMessageDecodeErrorZ {
15905 contents: CResult_WarningMessageDecodeErrorZPtr {
15906 err: Box::into_raw(Box::new(e)),
15911 /// Checks if the given object is currently in the success state
15913 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
15917 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
15918 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
15919 impl Drop for CResult_WarningMessageDecodeErrorZ {
15920 fn drop(&mut self) {
15921 if self.result_ok {
15922 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15923 let _ = unsafe { Box::from_raw(self.contents.result) };
15926 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15927 let _ = unsafe { Box::from_raw(self.contents.err) };
15932 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
15933 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15934 let contents = if o.result_ok {
15935 let result = unsafe { o.contents.result };
15936 unsafe { o.contents.result = core::ptr::null_mut() };
15937 CResult_WarningMessageDecodeErrorZPtr { result }
15939 let err = unsafe { o.contents.err };
15940 unsafe { o.contents.err = core::ptr::null_mut(); }
15941 CResult_WarningMessageDecodeErrorZPtr { err }
15945 result_ok: o.result_ok,
15949 impl Clone for CResult_WarningMessageDecodeErrorZ {
15950 fn clone(&self) -> Self {
15951 if self.result_ok {
15952 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
15953 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
15956 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
15957 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15963 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
15964 /// but with all dynamically-allocated buffers duplicated in new buffers.
15965 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
15967 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
15968 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15969 /// A pointer to the contents in the success state.
15970 /// Reading from this pointer when `result_ok` is not set is undefined.
15971 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
15972 /// A pointer to the contents in the error state.
15973 /// Reading from this pointer when `result_ok` is set is undefined.
15974 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15977 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15978 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15980 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15981 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
15982 /// `err` or `result` depending on the state of `result_ok`.
15983 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
15984 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
15985 pub result_ok: bool,
15988 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15989 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15990 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15991 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15992 result: Box::into_raw(Box::new(o)),
15998 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15999 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16000 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16001 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16002 err: Box::into_raw(Box::new(e)),
16007 /// Checks if the given object is currently in the success state
16009 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
16013 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16014 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
16015 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16016 fn drop(&mut self) {
16017 if self.result_ok {
16018 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16019 let _ = unsafe { Box::from_raw(self.contents.result) };
16022 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16023 let _ = unsafe { Box::from_raw(self.contents.err) };
16028 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16029 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16030 let contents = if o.result_ok {
16031 let result = unsafe { o.contents.result };
16032 unsafe { o.contents.result = core::ptr::null_mut() };
16033 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
16035 let err = unsafe { o.contents.err };
16036 unsafe { o.contents.err = core::ptr::null_mut(); }
16037 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
16041 result_ok: o.result_ok,
16045 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16046 fn clone(&self) -> Self {
16047 if self.result_ok {
16048 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16049 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
16052 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16053 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16059 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16060 /// but with all dynamically-allocated buffers duplicated in new buffers.
16061 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16063 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
16064 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
16065 /// A pointer to the contents in the success state.
16066 /// Reading from this pointer when `result_ok` is not set is undefined.
16067 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
16068 /// A pointer to the contents in the error state.
16069 /// Reading from this pointer when `result_ok` is set is undefined.
16070 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16073 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16074 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16076 pub struct CResult_NodeAnnouncementDecodeErrorZ {
16077 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
16078 /// `err` or `result` depending on the state of `result_ok`.
16079 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
16080 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
16081 pub result_ok: bool,
16084 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16085 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
16086 CResult_NodeAnnouncementDecodeErrorZ {
16087 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16088 result: Box::into_raw(Box::new(o)),
16094 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16095 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
16096 CResult_NodeAnnouncementDecodeErrorZ {
16097 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16098 err: Box::into_raw(Box::new(e)),
16103 /// Checks if the given object is currently in the success state
16105 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
16109 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16110 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
16111 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
16112 fn drop(&mut self) {
16113 if self.result_ok {
16114 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16115 let _ = unsafe { Box::from_raw(self.contents.result) };
16118 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16119 let _ = unsafe { Box::from_raw(self.contents.err) };
16124 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
16125 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16126 let contents = if o.result_ok {
16127 let result = unsafe { o.contents.result };
16128 unsafe { o.contents.result = core::ptr::null_mut() };
16129 CResult_NodeAnnouncementDecodeErrorZPtr { result }
16131 let err = unsafe { o.contents.err };
16132 unsafe { o.contents.err = core::ptr::null_mut(); }
16133 CResult_NodeAnnouncementDecodeErrorZPtr { err }
16137 result_ok: o.result_ok,
16141 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
16142 fn clone(&self) -> Self {
16143 if self.result_ok {
16144 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16145 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
16148 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16149 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16155 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16156 /// but with all dynamically-allocated buffers duplicated in new buffers.
16157 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16159 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
16160 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
16161 /// A pointer to the contents in the success state.
16162 /// Reading from this pointer when `result_ok` is not set is undefined.
16163 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
16164 /// A pointer to the contents in the error state.
16165 /// Reading from this pointer when `result_ok` is set is undefined.
16166 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16169 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
16170 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
16171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16172 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
16173 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
16174 /// `err` or `result` depending on the state of `result_ok`.
16175 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
16176 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
16177 pub result_ok: bool,
16180 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16181 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
16182 CResult_QueryShortChannelIdsDecodeErrorZ {
16183 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16184 result: Box::into_raw(Box::new(o)),
16190 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16191 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
16192 CResult_QueryShortChannelIdsDecodeErrorZ {
16193 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16194 err: Box::into_raw(Box::new(e)),
16199 /// Checks if the given object is currently in the success state
16201 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
16205 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16206 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
16207 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
16208 fn drop(&mut self) {
16209 if self.result_ok {
16210 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16211 let _ = unsafe { Box::from_raw(self.contents.result) };
16214 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16215 let _ = unsafe { Box::from_raw(self.contents.err) };
16220 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
16221 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
16222 let contents = if o.result_ok {
16223 let result = unsafe { o.contents.result };
16224 unsafe { o.contents.result = core::ptr::null_mut() };
16225 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
16227 let err = unsafe { o.contents.err };
16228 unsafe { o.contents.err = core::ptr::null_mut(); }
16229 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
16233 result_ok: o.result_ok,
16237 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
16238 fn clone(&self) -> Self {
16239 if self.result_ok {
16240 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16241 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
16244 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16245 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16251 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16252 /// but with all dynamically-allocated buffers duplicated in new buffers.
16253 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
16255 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
16256 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16257 /// A pointer to the contents in the success state.
16258 /// Reading from this pointer when `result_ok` is not set is undefined.
16259 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
16260 /// A pointer to the contents in the error state.
16261 /// Reading from this pointer when `result_ok` is set is undefined.
16262 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16265 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
16266 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
16267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16268 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16269 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
16270 /// `err` or `result` depending on the state of `result_ok`.
16271 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
16272 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
16273 pub result_ok: bool,
16276 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16277 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16278 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16279 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16280 result: Box::into_raw(Box::new(o)),
16286 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16287 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16288 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16289 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16290 err: Box::into_raw(Box::new(e)),
16295 /// Checks if the given object is currently in the success state
16297 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
16301 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16302 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
16303 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16304 fn drop(&mut self) {
16305 if self.result_ok {
16306 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16307 let _ = unsafe { Box::from_raw(self.contents.result) };
16310 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16311 let _ = unsafe { Box::from_raw(self.contents.err) };
16316 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16317 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
16318 let contents = if o.result_ok {
16319 let result = unsafe { o.contents.result };
16320 unsafe { o.contents.result = core::ptr::null_mut() };
16321 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
16323 let err = unsafe { o.contents.err };
16324 unsafe { o.contents.err = core::ptr::null_mut(); }
16325 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
16329 result_ok: o.result_ok,
16333 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16334 fn clone(&self) -> Self {
16335 if self.result_ok {
16336 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16337 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
16340 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16341 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16347 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16348 /// but with all dynamically-allocated buffers duplicated in new buffers.
16349 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
16351 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
16352 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
16353 /// A pointer to the contents in the success state.
16354 /// Reading from this pointer when `result_ok` is not set is undefined.
16355 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
16356 /// A pointer to the contents in the error state.
16357 /// Reading from this pointer when `result_ok` is set is undefined.
16358 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16361 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
16362 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16364 pub struct CResult_QueryChannelRangeDecodeErrorZ {
16365 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16366 /// `err` or `result` depending on the state of `result_ok`.
16367 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
16368 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16369 pub result_ok: bool,
16372 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16373 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
16374 CResult_QueryChannelRangeDecodeErrorZ {
16375 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16376 result: Box::into_raw(Box::new(o)),
16382 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16383 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
16384 CResult_QueryChannelRangeDecodeErrorZ {
16385 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16386 err: Box::into_raw(Box::new(e)),
16391 /// Checks if the given object is currently in the success state
16393 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
16397 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16398 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
16399 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
16400 fn drop(&mut self) {
16401 if self.result_ok {
16402 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16403 let _ = unsafe { Box::from_raw(self.contents.result) };
16406 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16407 let _ = unsafe { Box::from_raw(self.contents.err) };
16412 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
16413 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16414 let contents = if o.result_ok {
16415 let result = unsafe { o.contents.result };
16416 unsafe { o.contents.result = core::ptr::null_mut() };
16417 CResult_QueryChannelRangeDecodeErrorZPtr { result }
16419 let err = unsafe { o.contents.err };
16420 unsafe { o.contents.err = core::ptr::null_mut(); }
16421 CResult_QueryChannelRangeDecodeErrorZPtr { err }
16425 result_ok: o.result_ok,
16429 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
16430 fn clone(&self) -> Self {
16431 if self.result_ok {
16432 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16433 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
16436 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16437 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16443 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16444 /// but with all dynamically-allocated buffers duplicated in new buffers.
16445 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16447 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
16448 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
16449 /// A pointer to the contents in the success state.
16450 /// Reading from this pointer when `result_ok` is not set is undefined.
16451 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
16452 /// A pointer to the contents in the error state.
16453 /// Reading from this pointer when `result_ok` is set is undefined.
16454 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16457 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16458 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16460 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
16461 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16462 /// `err` or `result` depending on the state of `result_ok`.
16463 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
16464 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16465 pub result_ok: bool,
16468 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16469 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
16470 CResult_ReplyChannelRangeDecodeErrorZ {
16471 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16472 result: Box::into_raw(Box::new(o)),
16478 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16479 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
16480 CResult_ReplyChannelRangeDecodeErrorZ {
16481 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16482 err: Box::into_raw(Box::new(e)),
16487 /// Checks if the given object is currently in the success state
16489 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
16493 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16494 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
16495 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
16496 fn drop(&mut self) {
16497 if self.result_ok {
16498 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16499 let _ = unsafe { Box::from_raw(self.contents.result) };
16502 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16503 let _ = unsafe { Box::from_raw(self.contents.err) };
16508 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
16509 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16510 let contents = if o.result_ok {
16511 let result = unsafe { o.contents.result };
16512 unsafe { o.contents.result = core::ptr::null_mut() };
16513 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
16515 let err = unsafe { o.contents.err };
16516 unsafe { o.contents.err = core::ptr::null_mut(); }
16517 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
16521 result_ok: o.result_ok,
16525 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
16526 fn clone(&self) -> Self {
16527 if self.result_ok {
16528 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16529 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
16532 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16533 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16539 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16540 /// but with all dynamically-allocated buffers duplicated in new buffers.
16541 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16543 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
16544 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
16545 /// A pointer to the contents in the success state.
16546 /// Reading from this pointer when `result_ok` is not set is undefined.
16547 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
16548 /// A pointer to the contents in the error state.
16549 /// Reading from this pointer when `result_ok` is set is undefined.
16550 pub err: *mut crate::lightning::ln::msgs::DecodeError,
16553 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16554 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16556 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
16557 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16558 /// `err` or `result` depending on the state of `result_ok`.
16559 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
16560 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16561 pub result_ok: bool,
16564 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16565 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
16566 CResult_GossipTimestampFilterDecodeErrorZ {
16567 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16568 result: Box::into_raw(Box::new(o)),
16574 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16575 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
16576 CResult_GossipTimestampFilterDecodeErrorZ {
16577 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16578 err: Box::into_raw(Box::new(e)),
16583 /// Checks if the given object is currently in the success state
16585 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
16589 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16590 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
16591 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
16592 fn drop(&mut self) {
16593 if self.result_ok {
16594 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16595 let _ = unsafe { Box::from_raw(self.contents.result) };
16598 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16599 let _ = unsafe { Box::from_raw(self.contents.err) };
16604 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
16605 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
16606 let contents = if o.result_ok {
16607 let result = unsafe { o.contents.result };
16608 unsafe { o.contents.result = core::ptr::null_mut() };
16609 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
16611 let err = unsafe { o.contents.err };
16612 unsafe { o.contents.err = core::ptr::null_mut(); }
16613 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
16617 result_ok: o.result_ok,
16621 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
16622 fn clone(&self) -> Self {
16623 if self.result_ok {
16624 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16625 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
16628 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16629 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16635 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16636 /// but with all dynamically-allocated buffers duplicated in new buffers.
16637 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
16639 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
16640 /// This corresponds to std::vector in C++
16641 pub struct CVec_PhantomRouteHintsZ {
16642 /// The elements in the array.
16643 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16644 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
16645 /// The number of elements pointed to by `data`.
16648 impl CVec_PhantomRouteHintsZ {
16649 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
16650 if self.datalen == 0 { return Vec::new(); }
16651 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16652 self.data = core::ptr::null_mut();
16656 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
16657 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16660 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
16661 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
16662 let datalen = v.len();
16663 let data = Box::into_raw(v.into_boxed_slice());
16664 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16668 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16669 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
16670 impl Drop for CVec_PhantomRouteHintsZ {
16671 fn drop(&mut self) {
16672 if self.datalen == 0 { return; }
16673 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16676 impl Clone for CVec_PhantomRouteHintsZ {
16677 fn clone(&self) -> Self {
16678 let mut res = Vec::new();
16679 if self.datalen == 0 { return Self::from(res); }
16680 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16685 /// The contents of CResult_InvoiceSignOrCreationErrorZ
16686 pub union CResult_InvoiceSignOrCreationErrorZPtr {
16687 /// A pointer to the contents in the success state.
16688 /// Reading from this pointer when `result_ok` is not set is undefined.
16689 pub result: *mut crate::lightning_invoice::Invoice,
16690 /// A pointer to the contents in the error state.
16691 /// Reading from this pointer when `result_ok` is set is undefined.
16692 pub err: *mut crate::lightning_invoice::SignOrCreationError,
16695 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
16696 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
16697 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16698 pub struct CResult_InvoiceSignOrCreationErrorZ {
16699 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
16700 /// `err` or `result` depending on the state of `result_ok`.
16701 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
16702 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
16703 pub result_ok: bool,
16706 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16707 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
16708 CResult_InvoiceSignOrCreationErrorZ {
16709 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16710 result: Box::into_raw(Box::new(o)),
16716 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16717 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
16718 CResult_InvoiceSignOrCreationErrorZ {
16719 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16720 err: Box::into_raw(Box::new(e)),
16725 /// Checks if the given object is currently in the success state
16727 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
16731 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16732 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
16733 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
16734 fn drop(&mut self) {
16735 if self.result_ok {
16736 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16737 let _ = unsafe { Box::from_raw(self.contents.result) };
16740 if unsafe { !(self.contents.err as *mut ()).is_null() } {
16741 let _ = unsafe { Box::from_raw(self.contents.err) };
16746 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
16747 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
16748 let contents = if o.result_ok {
16749 let result = unsafe { o.contents.result };
16750 unsafe { o.contents.result = core::ptr::null_mut() };
16751 CResult_InvoiceSignOrCreationErrorZPtr { result }
16753 let err = unsafe { o.contents.err };
16754 unsafe { o.contents.err = core::ptr::null_mut(); }
16755 CResult_InvoiceSignOrCreationErrorZPtr { err }
16759 result_ok: o.result_ok,
16763 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
16764 fn clone(&self) -> Self {
16765 if self.result_ok {
16766 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16767 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
16770 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16771 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
16777 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16778 /// but with all dynamically-allocated buffers duplicated in new buffers.
16779 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
16781 /// An enum which can either contain a crate::lightning::chain::Filter or not
16782 pub enum COption_FilterZ {
16783 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
16784 Some(crate::lightning::chain::Filter),
16785 /// When we're in this state, this COption_FilterZ contains nothing
16788 impl COption_FilterZ {
16789 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
16790 if let Self::None = self { false } else { true }
16792 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
16795 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
16796 if let Self::Some(v) = self { v } else { unreachable!() }
16800 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16801 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
16802 COption_FilterZ::Some(o)
16805 /// Constructs a new COption_FilterZ containing nothing
16806 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
16807 COption_FilterZ::None
16810 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16811 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
16813 /// The contents of CResult_LockedChannelMonitorNoneZ
16814 pub union CResult_LockedChannelMonitorNoneZPtr {
16815 /// A pointer to the contents in the success state.
16816 /// Reading from this pointer when `result_ok` is not set is undefined.
16817 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
16818 /// Note that this value is always NULL, as there are no contents in the Err variant
16819 pub err: *mut core::ffi::c_void,
16822 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
16823 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
16824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16825 pub struct CResult_LockedChannelMonitorNoneZ {
16826 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
16827 /// `err` or `result` depending on the state of `result_ok`.
16828 pub contents: CResult_LockedChannelMonitorNoneZPtr,
16829 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
16830 pub result_ok: bool,
16833 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16834 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
16835 CResult_LockedChannelMonitorNoneZ {
16836 contents: CResult_LockedChannelMonitorNoneZPtr {
16837 result: Box::into_raw(Box::new(o)),
16843 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16844 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
16845 CResult_LockedChannelMonitorNoneZ {
16846 contents: CResult_LockedChannelMonitorNoneZPtr {
16847 err: core::ptr::null_mut(),
16852 /// Checks if the given object is currently in the success state
16854 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
16858 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16859 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
16860 impl Drop for CResult_LockedChannelMonitorNoneZ {
16861 fn drop(&mut self) {
16862 if self.result_ok {
16863 if unsafe { !(self.contents.result as *mut ()).is_null() } {
16864 let _ = unsafe { Box::from_raw(self.contents.result) };
16870 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
16871 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
16872 let contents = if o.result_ok {
16873 let result = unsafe { o.contents.result };
16874 unsafe { o.contents.result = core::ptr::null_mut() };
16875 CResult_LockedChannelMonitorNoneZPtr { result }
16877 let _ = unsafe { Box::from_raw(o.contents.err) };
16878 o.contents.err = core::ptr::null_mut();
16879 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
16883 result_ok: o.result_ok,
16888 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
16889 /// This corresponds to std::vector in C++
16890 pub struct CVec_OutPointZ {
16891 /// The elements in the array.
16892 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16893 pub data: *mut crate::lightning::chain::transaction::OutPoint,
16894 /// The number of elements pointed to by `data`.
16897 impl CVec_OutPointZ {
16898 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
16899 if self.datalen == 0 { return Vec::new(); }
16900 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16901 self.data = core::ptr::null_mut();
16905 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
16906 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16909 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
16910 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
16911 let datalen = v.len();
16912 let data = Box::into_raw(v.into_boxed_slice());
16913 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16917 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16918 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
16919 impl Drop for CVec_OutPointZ {
16920 fn drop(&mut self) {
16921 if self.datalen == 0 { return; }
16922 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16925 impl Clone for CVec_OutPointZ {
16926 fn clone(&self) -> Self {
16927 let mut res = Vec::new();
16928 if self.datalen == 0 { return Self::from(res); }
16929 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16934 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
16935 /// This corresponds to std::vector in C++
16936 pub struct CVec_MonitorUpdateIdZ {
16937 /// The elements in the array.
16938 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16939 pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
16940 /// The number of elements pointed to by `data`.
16943 impl CVec_MonitorUpdateIdZ {
16944 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
16945 if self.datalen == 0 { return Vec::new(); }
16946 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16947 self.data = core::ptr::null_mut();
16951 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
16952 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16955 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
16956 fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
16957 let datalen = v.len();
16958 let data = Box::into_raw(v.into_boxed_slice());
16959 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16963 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16964 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
16965 impl Drop for CVec_MonitorUpdateIdZ {
16966 fn drop(&mut self) {
16967 if self.datalen == 0 { return; }
16968 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16971 impl Clone for CVec_MonitorUpdateIdZ {
16972 fn clone(&self) -> Self {
16973 let mut res = Vec::new();
16974 if self.datalen == 0 { return Self::from(res); }
16975 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16980 /// A tuple of 2 elements. See the individual fields for the types contained.
16981 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
16982 /// The element at position 0
16983 pub a: crate::lightning::chain::transaction::OutPoint,
16984 /// The element at position 1
16985 pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
16987 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
16988 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
16995 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
16996 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
17000 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17001 fn clone(&self) -> Self {
17003 a: Clone::clone(&self.a),
17004 b: Clone::clone(&self.b),
17009 /// Creates a new tuple which has the same data as `orig`
17010 /// but with all dynamically-allocated buffers duplicated in new buffers.
17011 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
17012 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
17014 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17015 C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
17019 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
17020 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
17022 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
17023 /// This corresponds to std::vector in C++
17024 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17025 /// The elements in the array.
17026 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17027 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
17028 /// The number of elements pointed to by `data`.
17031 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17032 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
17033 if self.datalen == 0 { return Vec::new(); }
17034 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17035 self.data = core::ptr::null_mut();
17039 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
17040 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17043 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17044 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
17045 let datalen = v.len();
17046 let data = Box::into_raw(v.into_boxed_slice());
17047 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17051 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17052 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
17053 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17054 fn drop(&mut self) {
17055 if self.datalen == 0 { return; }
17056 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17059 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17060 fn clone(&self) -> Self {
17061 let mut res = Vec::new();
17062 if self.datalen == 0 { return Self::from(res); }
17063 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });