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 /// The contents of CResult_SecretKeyErrorZ
12 pub union CResult_SecretKeyErrorZPtr {
13 /// A pointer to the contents in the success state.
14 /// Reading from this pointer when `result_ok` is not set is undefined.
15 pub result: *mut crate::c_types::SecretKey,
16 /// A pointer to the contents in the error state.
17 /// Reading from this pointer when `result_ok` is set is undefined.
18 pub err: *mut crate::c_types::Secp256k1Error,
21 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
22 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
23 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24 pub struct CResult_SecretKeyErrorZ {
25 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
26 /// `err` or `result` depending on the state of `result_ok`.
27 pub contents: CResult_SecretKeyErrorZPtr,
28 /// Whether this CResult_SecretKeyErrorZ represents a success state.
32 /// Creates a new CResult_SecretKeyErrorZ in the success state.
33 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
34 CResult_SecretKeyErrorZ {
35 contents: CResult_SecretKeyErrorZPtr {
36 result: Box::into_raw(Box::new(o)),
42 /// Creates a new CResult_SecretKeyErrorZ in the error state.
43 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
44 CResult_SecretKeyErrorZ {
45 contents: CResult_SecretKeyErrorZPtr {
46 err: Box::into_raw(Box::new(e)),
51 /// Checks if the given object is currently in the success state
53 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
57 /// Frees any resources used by the CResult_SecretKeyErrorZ.
58 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
59 impl Drop for CResult_SecretKeyErrorZ {
62 if unsafe { !(self.contents.result as *mut ()).is_null() } {
63 let _ = unsafe { Box::from_raw(self.contents.result) };
66 if unsafe { !(self.contents.err as *mut ()).is_null() } {
67 let _ = unsafe { Box::from_raw(self.contents.err) };
72 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
73 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
74 let contents = if o.result_ok {
75 let result = unsafe { o.contents.result };
76 unsafe { o.contents.result = core::ptr::null_mut() };
77 CResult_SecretKeyErrorZPtr { result }
79 let err = unsafe { o.contents.err };
80 unsafe { o.contents.err = core::ptr::null_mut(); }
81 CResult_SecretKeyErrorZPtr { err }
85 result_ok: o.result_ok,
90 /// The contents of CResult_PublicKeyErrorZ
91 pub union CResult_PublicKeyErrorZPtr {
92 /// A pointer to the contents in the success state.
93 /// Reading from this pointer when `result_ok` is not set is undefined.
94 pub result: *mut crate::c_types::PublicKey,
95 /// A pointer to the contents in the error state.
96 /// Reading from this pointer when `result_ok` is set is undefined.
97 pub err: *mut crate::c_types::Secp256k1Error,
100 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
101 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
102 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
103 pub struct CResult_PublicKeyErrorZ {
104 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
105 /// `err` or `result` depending on the state of `result_ok`.
106 pub contents: CResult_PublicKeyErrorZPtr,
107 /// Whether this CResult_PublicKeyErrorZ represents a success state.
111 /// Creates a new CResult_PublicKeyErrorZ in the success state.
112 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
113 CResult_PublicKeyErrorZ {
114 contents: CResult_PublicKeyErrorZPtr {
115 result: Box::into_raw(Box::new(o)),
121 /// Creates a new CResult_PublicKeyErrorZ in the error state.
122 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
123 CResult_PublicKeyErrorZ {
124 contents: CResult_PublicKeyErrorZPtr {
125 err: Box::into_raw(Box::new(e)),
130 /// Checks if the given object is currently in the success state
132 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
136 /// Frees any resources used by the CResult_PublicKeyErrorZ.
137 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
138 impl Drop for CResult_PublicKeyErrorZ {
141 if unsafe { !(self.contents.result as *mut ()).is_null() } {
142 let _ = unsafe { Box::from_raw(self.contents.result) };
145 if unsafe { !(self.contents.err as *mut ()).is_null() } {
146 let _ = unsafe { Box::from_raw(self.contents.err) };
151 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
152 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
153 let contents = if o.result_ok {
154 let result = unsafe { o.contents.result };
155 unsafe { o.contents.result = core::ptr::null_mut() };
156 CResult_PublicKeyErrorZPtr { result }
158 let err = unsafe { o.contents.err };
159 unsafe { o.contents.err = core::ptr::null_mut(); }
160 CResult_PublicKeyErrorZPtr { err }
164 result_ok: o.result_ok,
168 impl Clone for CResult_PublicKeyErrorZ {
169 fn clone(&self) -> Self {
171 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
172 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
175 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
176 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
182 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
183 /// but with all dynamically-allocated buffers duplicated in new buffers.
184 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
186 /// The contents of CResult_TxCreationKeysDecodeErrorZ
187 pub union CResult_TxCreationKeysDecodeErrorZPtr {
188 /// A pointer to the contents in the success state.
189 /// Reading from this pointer when `result_ok` is not set is undefined.
190 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
191 /// A pointer to the contents in the error state.
192 /// Reading from this pointer when `result_ok` is set is undefined.
193 pub err: *mut crate::lightning::ln::msgs::DecodeError,
196 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
197 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
198 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
199 pub struct CResult_TxCreationKeysDecodeErrorZ {
200 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
201 /// `err` or `result` depending on the state of `result_ok`.
202 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
203 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
207 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
208 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
209 CResult_TxCreationKeysDecodeErrorZ {
210 contents: CResult_TxCreationKeysDecodeErrorZPtr {
211 result: Box::into_raw(Box::new(o)),
217 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
218 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
219 CResult_TxCreationKeysDecodeErrorZ {
220 contents: CResult_TxCreationKeysDecodeErrorZPtr {
221 err: Box::into_raw(Box::new(e)),
226 /// Checks if the given object is currently in the success state
228 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
232 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
233 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
234 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
237 if unsafe { !(self.contents.result as *mut ()).is_null() } {
238 let _ = unsafe { Box::from_raw(self.contents.result) };
241 if unsafe { !(self.contents.err as *mut ()).is_null() } {
242 let _ = unsafe { Box::from_raw(self.contents.err) };
247 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
248 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
249 let contents = if o.result_ok {
250 let result = unsafe { o.contents.result };
251 unsafe { o.contents.result = core::ptr::null_mut() };
252 CResult_TxCreationKeysDecodeErrorZPtr { result }
254 let err = unsafe { o.contents.err };
255 unsafe { o.contents.err = core::ptr::null_mut(); }
256 CResult_TxCreationKeysDecodeErrorZPtr { err }
260 result_ok: o.result_ok,
264 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
265 fn clone(&self) -> Self {
267 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
268 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
271 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
272 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
278 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
279 /// but with all dynamically-allocated buffers duplicated in new buffers.
280 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
282 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
283 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
284 /// A pointer to the contents in the success state.
285 /// Reading from this pointer when `result_ok` is not set is undefined.
286 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
287 /// A pointer to the contents in the error state.
288 /// Reading from this pointer when `result_ok` is set is undefined.
289 pub err: *mut crate::lightning::ln::msgs::DecodeError,
292 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
293 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
295 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
296 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
297 /// `err` or `result` depending on the state of `result_ok`.
298 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
299 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
303 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
304 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
305 CResult_ChannelPublicKeysDecodeErrorZ {
306 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
307 result: Box::into_raw(Box::new(o)),
313 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
314 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
315 CResult_ChannelPublicKeysDecodeErrorZ {
316 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
317 err: Box::into_raw(Box::new(e)),
322 /// Checks if the given object is currently in the success state
324 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
328 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
329 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
330 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
333 if unsafe { !(self.contents.result as *mut ()).is_null() } {
334 let _ = unsafe { Box::from_raw(self.contents.result) };
337 if unsafe { !(self.contents.err as *mut ()).is_null() } {
338 let _ = unsafe { Box::from_raw(self.contents.err) };
343 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
344 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
345 let contents = if o.result_ok {
346 let result = unsafe { o.contents.result };
347 unsafe { o.contents.result = core::ptr::null_mut() };
348 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
350 let err = unsafe { o.contents.err };
351 unsafe { o.contents.err = core::ptr::null_mut(); }
352 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
356 result_ok: o.result_ok,
360 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
361 fn clone(&self) -> Self {
363 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
364 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
367 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
368 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
374 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
375 /// but with all dynamically-allocated buffers duplicated in new buffers.
376 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
378 /// The contents of CResult_TxCreationKeysErrorZ
379 pub union CResult_TxCreationKeysErrorZPtr {
380 /// A pointer to the contents in the success state.
381 /// Reading from this pointer when `result_ok` is not set is undefined.
382 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
383 /// A pointer to the contents in the error state.
384 /// Reading from this pointer when `result_ok` is set is undefined.
385 pub err: *mut crate::c_types::Secp256k1Error,
388 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
389 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
391 pub struct CResult_TxCreationKeysErrorZ {
392 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
393 /// `err` or `result` depending on the state of `result_ok`.
394 pub contents: CResult_TxCreationKeysErrorZPtr,
395 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
399 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
400 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
401 CResult_TxCreationKeysErrorZ {
402 contents: CResult_TxCreationKeysErrorZPtr {
403 result: Box::into_raw(Box::new(o)),
409 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
410 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
411 CResult_TxCreationKeysErrorZ {
412 contents: CResult_TxCreationKeysErrorZPtr {
413 err: Box::into_raw(Box::new(e)),
418 /// Checks if the given object is currently in the success state
420 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
424 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
425 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
426 impl Drop for CResult_TxCreationKeysErrorZ {
429 if unsafe { !(self.contents.result as *mut ()).is_null() } {
430 let _ = unsafe { Box::from_raw(self.contents.result) };
433 if unsafe { !(self.contents.err as *mut ()).is_null() } {
434 let _ = unsafe { Box::from_raw(self.contents.err) };
439 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
440 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
441 let contents = if o.result_ok {
442 let result = unsafe { o.contents.result };
443 unsafe { o.contents.result = core::ptr::null_mut() };
444 CResult_TxCreationKeysErrorZPtr { result }
446 let err = unsafe { o.contents.err };
447 unsafe { o.contents.err = core::ptr::null_mut(); }
448 CResult_TxCreationKeysErrorZPtr { err }
452 result_ok: o.result_ok,
456 impl Clone for CResult_TxCreationKeysErrorZ {
457 fn clone(&self) -> Self {
459 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
460 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
463 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
464 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
470 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
471 /// but with all dynamically-allocated buffers duplicated in new buffers.
472 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
475 /// An enum which can either contain a u32 or not
476 pub enum COption_u32Z {
477 /// When we're in this state, this COption_u32Z contains a u32
479 /// When we're in this state, this COption_u32Z contains nothing
483 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
484 if let Self::None = self { false } else { true }
486 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
489 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
490 if let Self::Some(v) = self { v } else { unreachable!() }
494 /// Constructs a new COption_u32Z containing a u32
495 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
496 COption_u32Z::Some(o)
499 /// Constructs a new COption_u32Z containing nothing
500 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
504 /// Frees any resources associated with the u32, if we are in the Some state
505 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
507 /// Creates a new COption_u32Z which has the same data as `orig`
508 /// but with all dynamically-allocated buffers duplicated in new buffers.
509 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
511 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
512 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
513 /// A pointer to the contents in the success state.
514 /// Reading from this pointer when `result_ok` is not set is undefined.
515 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
516 /// A pointer to the contents in the error state.
517 /// Reading from this pointer when `result_ok` is set is undefined.
518 pub err: *mut crate::lightning::ln::msgs::DecodeError,
521 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
522 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
523 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
524 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
525 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
526 /// `err` or `result` depending on the state of `result_ok`.
527 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
528 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
532 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
533 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
534 CResult_HTLCOutputInCommitmentDecodeErrorZ {
535 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
536 result: Box::into_raw(Box::new(o)),
542 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
543 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
544 CResult_HTLCOutputInCommitmentDecodeErrorZ {
545 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
546 err: Box::into_raw(Box::new(e)),
551 /// Checks if the given object is currently in the success state
553 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
557 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
558 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
559 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
562 if unsafe { !(self.contents.result as *mut ()).is_null() } {
563 let _ = unsafe { Box::from_raw(self.contents.result) };
566 if unsafe { !(self.contents.err as *mut ()).is_null() } {
567 let _ = unsafe { Box::from_raw(self.contents.err) };
572 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
573 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
574 let contents = if o.result_ok {
575 let result = unsafe { o.contents.result };
576 unsafe { o.contents.result = core::ptr::null_mut() };
577 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
579 let err = unsafe { o.contents.err };
580 unsafe { o.contents.err = core::ptr::null_mut(); }
581 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
585 result_ok: o.result_ok,
589 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
590 fn clone(&self) -> Self {
592 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
593 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
596 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
597 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
603 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
604 /// but with all dynamically-allocated buffers duplicated in new buffers.
605 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
607 /// An enum which can either contain a or not
608 pub enum COption_NoneZ {
609 /// When we're in this state, this COption_NoneZ contains a
611 /// When we're in this state, this COption_NoneZ contains nothing
615 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
616 if let Self::None = self { false } else { true }
618 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
623 /// Constructs a new COption_NoneZ containing a
624 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
628 /// Constructs a new COption_NoneZ containing nothing
629 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
633 /// Frees any resources associated with the , if we are in the Some state
634 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
636 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
637 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
638 /// A pointer to the contents in the success state.
639 /// Reading from this pointer when `result_ok` is not set is undefined.
640 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
641 /// A pointer to the contents in the error state.
642 /// Reading from this pointer when `result_ok` is set is undefined.
643 pub err: *mut crate::lightning::ln::msgs::DecodeError,
646 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
647 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
648 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
649 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
650 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
651 /// `err` or `result` depending on the state of `result_ok`.
652 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
653 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
657 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
658 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
659 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
660 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
661 result: Box::into_raw(Box::new(o)),
667 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
668 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
669 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
670 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
671 err: Box::into_raw(Box::new(e)),
676 /// Checks if the given object is currently in the success state
678 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
682 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
683 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
684 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
687 if unsafe { !(self.contents.result as *mut ()).is_null() } {
688 let _ = unsafe { Box::from_raw(self.contents.result) };
691 if unsafe { !(self.contents.err as *mut ()).is_null() } {
692 let _ = unsafe { Box::from_raw(self.contents.err) };
697 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
698 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
699 let contents = if o.result_ok {
700 let result = unsafe { o.contents.result };
701 unsafe { o.contents.result = core::ptr::null_mut() };
702 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
704 let err = unsafe { o.contents.err };
705 unsafe { o.contents.err = core::ptr::null_mut(); }
706 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
710 result_ok: o.result_ok,
714 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
715 fn clone(&self) -> Self {
717 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
718 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
721 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
722 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
728 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
729 /// but with all dynamically-allocated buffers duplicated in new buffers.
730 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
732 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
733 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
734 /// A pointer to the contents in the success state.
735 /// Reading from this pointer when `result_ok` is not set is undefined.
736 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
737 /// A pointer to the contents in the error state.
738 /// Reading from this pointer when `result_ok` is set is undefined.
739 pub err: *mut crate::lightning::ln::msgs::DecodeError,
742 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
743 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
745 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
746 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
747 /// `err` or `result` depending on the state of `result_ok`.
748 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
749 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
753 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
754 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
755 CResult_ChannelTransactionParametersDecodeErrorZ {
756 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
757 result: Box::into_raw(Box::new(o)),
763 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
764 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
765 CResult_ChannelTransactionParametersDecodeErrorZ {
766 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
767 err: Box::into_raw(Box::new(e)),
772 /// Checks if the given object is currently in the success state
774 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
778 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
779 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
780 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
783 if unsafe { !(self.contents.result as *mut ()).is_null() } {
784 let _ = unsafe { Box::from_raw(self.contents.result) };
787 if unsafe { !(self.contents.err as *mut ()).is_null() } {
788 let _ = unsafe { Box::from_raw(self.contents.err) };
793 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
794 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
795 let contents = if o.result_ok {
796 let result = unsafe { o.contents.result };
797 unsafe { o.contents.result = core::ptr::null_mut() };
798 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
800 let err = unsafe { o.contents.err };
801 unsafe { o.contents.err = core::ptr::null_mut(); }
802 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
806 result_ok: o.result_ok,
810 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
811 fn clone(&self) -> Self {
813 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
814 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
817 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
818 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
824 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
825 /// but with all dynamically-allocated buffers duplicated in new buffers.
826 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
828 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
829 /// This corresponds to std::vector in C++
830 pub struct CVec_SignatureZ {
831 /// The elements in the array.
832 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
833 pub data: *mut crate::c_types::Signature,
834 /// The number of elements pointed to by `data`.
837 impl CVec_SignatureZ {
838 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
839 if self.datalen == 0 { return Vec::new(); }
840 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
841 self.data = core::ptr::null_mut();
845 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
846 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
849 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
850 fn from(v: Vec<crate::c_types::Signature>) -> Self {
851 let datalen = v.len();
852 let data = Box::into_raw(v.into_boxed_slice());
853 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
857 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
858 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
859 impl Drop for CVec_SignatureZ {
861 if self.datalen == 0 { return; }
862 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
865 impl Clone for CVec_SignatureZ {
866 fn clone(&self) -> Self {
867 let mut res = Vec::new();
868 if self.datalen == 0 { return Self::from(res); }
869 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
874 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
875 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
876 /// A pointer to the contents in the success state.
877 /// Reading from this pointer when `result_ok` is not set is undefined.
878 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
879 /// A pointer to the contents in the error state.
880 /// Reading from this pointer when `result_ok` is set is undefined.
881 pub err: *mut crate::lightning::ln::msgs::DecodeError,
884 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
885 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
887 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
888 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
889 /// `err` or `result` depending on the state of `result_ok`.
890 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
891 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
895 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
896 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
897 CResult_HolderCommitmentTransactionDecodeErrorZ {
898 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
899 result: Box::into_raw(Box::new(o)),
905 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
906 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
907 CResult_HolderCommitmentTransactionDecodeErrorZ {
908 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
909 err: Box::into_raw(Box::new(e)),
914 /// Checks if the given object is currently in the success state
916 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
920 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
921 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
922 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
925 if unsafe { !(self.contents.result as *mut ()).is_null() } {
926 let _ = unsafe { Box::from_raw(self.contents.result) };
929 if unsafe { !(self.contents.err as *mut ()).is_null() } {
930 let _ = unsafe { Box::from_raw(self.contents.err) };
935 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
936 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
937 let contents = if o.result_ok {
938 let result = unsafe { o.contents.result };
939 unsafe { o.contents.result = core::ptr::null_mut() };
940 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
942 let err = unsafe { o.contents.err };
943 unsafe { o.contents.err = core::ptr::null_mut(); }
944 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
948 result_ok: o.result_ok,
952 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
953 fn clone(&self) -> Self {
955 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
956 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
959 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
960 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
966 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
967 /// but with all dynamically-allocated buffers duplicated in new buffers.
968 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
970 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
971 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
972 /// A pointer to the contents in the success state.
973 /// Reading from this pointer when `result_ok` is not set is undefined.
974 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
975 /// A pointer to the contents in the error state.
976 /// Reading from this pointer when `result_ok` is set is undefined.
977 pub err: *mut crate::lightning::ln::msgs::DecodeError,
980 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
981 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
983 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
984 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
985 /// `err` or `result` depending on the state of `result_ok`.
986 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
987 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
991 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
992 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
993 CResult_BuiltCommitmentTransactionDecodeErrorZ {
994 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
995 result: Box::into_raw(Box::new(o)),
1001 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1002 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1003 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1004 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1005 err: Box::into_raw(Box::new(e)),
1010 /// Checks if the given object is currently in the success state
1012 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1016 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1017 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1018 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1019 fn drop(&mut self) {
1021 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1022 let _ = unsafe { Box::from_raw(self.contents.result) };
1025 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1026 let _ = unsafe { Box::from_raw(self.contents.err) };
1031 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1032 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1033 let contents = if o.result_ok {
1034 let result = unsafe { o.contents.result };
1035 unsafe { o.contents.result = core::ptr::null_mut() };
1036 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1038 let err = unsafe { o.contents.err };
1039 unsafe { o.contents.err = core::ptr::null_mut(); }
1040 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1044 result_ok: o.result_ok,
1048 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1049 fn clone(&self) -> Self {
1051 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1052 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1055 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1056 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1062 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1063 /// but with all dynamically-allocated buffers duplicated in new buffers.
1064 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1066 /// The contents of CResult_TrustedClosingTransactionNoneZ
1067 pub union CResult_TrustedClosingTransactionNoneZPtr {
1068 /// A pointer to the contents in the success state.
1069 /// Reading from this pointer when `result_ok` is not set is undefined.
1070 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1071 /// Note that this value is always NULL, as there are no contents in the Err variant
1072 pub err: *mut core::ffi::c_void,
1075 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1076 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1078 pub struct CResult_TrustedClosingTransactionNoneZ {
1079 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1080 /// `err` or `result` depending on the state of `result_ok`.
1081 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1082 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1083 pub result_ok: bool,
1086 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1087 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1088 CResult_TrustedClosingTransactionNoneZ {
1089 contents: CResult_TrustedClosingTransactionNoneZPtr {
1090 result: Box::into_raw(Box::new(o)),
1096 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1097 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1098 CResult_TrustedClosingTransactionNoneZ {
1099 contents: CResult_TrustedClosingTransactionNoneZPtr {
1100 err: core::ptr::null_mut(),
1105 /// Checks if the given object is currently in the success state
1107 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1111 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1112 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1113 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1114 fn drop(&mut self) {
1116 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1117 let _ = unsafe { Box::from_raw(self.contents.result) };
1123 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1124 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1125 let contents = if o.result_ok {
1126 let result = unsafe { o.contents.result };
1127 unsafe { o.contents.result = core::ptr::null_mut() };
1128 CResult_TrustedClosingTransactionNoneZPtr { result }
1130 let _ = unsafe { Box::from_raw(o.contents.err) };
1131 o.contents.err = core::ptr::null_mut();
1132 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1136 result_ok: o.result_ok,
1141 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1142 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1143 /// A pointer to the contents in the success state.
1144 /// Reading from this pointer when `result_ok` is not set is undefined.
1145 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1146 /// A pointer to the contents in the error state.
1147 /// Reading from this pointer when `result_ok` is set is undefined.
1148 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1151 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1152 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1153 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1154 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1155 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1156 /// `err` or `result` depending on the state of `result_ok`.
1157 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1158 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1159 pub result_ok: bool,
1162 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1163 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1164 CResult_CommitmentTransactionDecodeErrorZ {
1165 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1166 result: Box::into_raw(Box::new(o)),
1172 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1173 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1174 CResult_CommitmentTransactionDecodeErrorZ {
1175 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1176 err: Box::into_raw(Box::new(e)),
1181 /// Checks if the given object is currently in the success state
1183 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1187 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1188 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1189 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1190 fn drop(&mut self) {
1192 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1193 let _ = unsafe { Box::from_raw(self.contents.result) };
1196 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1197 let _ = unsafe { Box::from_raw(self.contents.err) };
1202 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1203 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1204 let contents = if o.result_ok {
1205 let result = unsafe { o.contents.result };
1206 unsafe { o.contents.result = core::ptr::null_mut() };
1207 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1209 let err = unsafe { o.contents.err };
1210 unsafe { o.contents.err = core::ptr::null_mut(); }
1211 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1215 result_ok: o.result_ok,
1219 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1220 fn clone(&self) -> Self {
1222 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1223 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1226 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1227 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1233 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1234 /// but with all dynamically-allocated buffers duplicated in new buffers.
1235 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1237 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1238 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1239 /// A pointer to the contents in the success state.
1240 /// Reading from this pointer when `result_ok` is not set is undefined.
1241 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1242 /// Note that this value is always NULL, as there are no contents in the Err variant
1243 pub err: *mut core::ffi::c_void,
1246 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1247 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1249 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1250 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1251 /// `err` or `result` depending on the state of `result_ok`.
1252 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1253 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1254 pub result_ok: bool,
1257 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1258 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1259 CResult_TrustedCommitmentTransactionNoneZ {
1260 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1261 result: Box::into_raw(Box::new(o)),
1267 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1268 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1269 CResult_TrustedCommitmentTransactionNoneZ {
1270 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1271 err: core::ptr::null_mut(),
1276 /// Checks if the given object is currently in the success state
1278 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1282 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1283 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1284 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1285 fn drop(&mut self) {
1287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1288 let _ = unsafe { Box::from_raw(self.contents.result) };
1294 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1295 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1296 let contents = if o.result_ok {
1297 let result = unsafe { o.contents.result };
1298 unsafe { o.contents.result = core::ptr::null_mut() };
1299 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1301 let _ = unsafe { Box::from_raw(o.contents.err) };
1302 o.contents.err = core::ptr::null_mut();
1303 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1307 result_ok: o.result_ok,
1312 /// The contents of CResult_CVec_SignatureZNoneZ
1313 pub union CResult_CVec_SignatureZNoneZPtr {
1314 /// A pointer to the contents in the success state.
1315 /// Reading from this pointer when `result_ok` is not set is undefined.
1316 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1317 /// Note that this value is always NULL, as there are no contents in the Err variant
1318 pub err: *mut core::ffi::c_void,
1321 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1322 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1324 pub struct CResult_CVec_SignatureZNoneZ {
1325 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1326 /// `err` or `result` depending on the state of `result_ok`.
1327 pub contents: CResult_CVec_SignatureZNoneZPtr,
1328 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1329 pub result_ok: bool,
1332 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1333 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1334 CResult_CVec_SignatureZNoneZ {
1335 contents: CResult_CVec_SignatureZNoneZPtr {
1336 result: Box::into_raw(Box::new(o)),
1342 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1343 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1344 CResult_CVec_SignatureZNoneZ {
1345 contents: CResult_CVec_SignatureZNoneZPtr {
1346 err: core::ptr::null_mut(),
1351 /// Checks if the given object is currently in the success state
1353 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1357 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1358 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1359 impl Drop for CResult_CVec_SignatureZNoneZ {
1360 fn drop(&mut self) {
1362 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1363 let _ = unsafe { Box::from_raw(self.contents.result) };
1369 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1370 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1371 let contents = if o.result_ok {
1372 let result = unsafe { o.contents.result };
1373 unsafe { o.contents.result = core::ptr::null_mut() };
1374 CResult_CVec_SignatureZNoneZPtr { result }
1376 let _ = unsafe { Box::from_raw(o.contents.err) };
1377 o.contents.err = core::ptr::null_mut();
1378 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1382 result_ok: o.result_ok,
1386 impl Clone for CResult_CVec_SignatureZNoneZ {
1387 fn clone(&self) -> Self {
1389 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1390 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1393 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1394 err: core::ptr::null_mut()
1400 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1401 /// but with all dynamically-allocated buffers duplicated in new buffers.
1402 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1404 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1405 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1406 /// A pointer to the contents in the success state.
1407 /// Reading from this pointer when `result_ok` is not set is undefined.
1408 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1409 /// A pointer to the contents in the error state.
1410 /// Reading from this pointer when `result_ok` is set is undefined.
1411 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1414 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1415 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1417 pub struct CResult_ShutdownScriptDecodeErrorZ {
1418 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1419 /// `err` or `result` depending on the state of `result_ok`.
1420 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1421 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1422 pub result_ok: bool,
1425 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1426 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1427 CResult_ShutdownScriptDecodeErrorZ {
1428 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1429 result: Box::into_raw(Box::new(o)),
1435 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1436 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1437 CResult_ShutdownScriptDecodeErrorZ {
1438 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1439 err: Box::into_raw(Box::new(e)),
1444 /// Checks if the given object is currently in the success state
1446 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1450 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1451 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1452 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1453 fn drop(&mut self) {
1455 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1456 let _ = unsafe { Box::from_raw(self.contents.result) };
1459 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1460 let _ = unsafe { Box::from_raw(self.contents.err) };
1465 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1466 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1467 let contents = if o.result_ok {
1468 let result = unsafe { o.contents.result };
1469 unsafe { o.contents.result = core::ptr::null_mut() };
1470 CResult_ShutdownScriptDecodeErrorZPtr { result }
1472 let err = unsafe { o.contents.err };
1473 unsafe { o.contents.err = core::ptr::null_mut(); }
1474 CResult_ShutdownScriptDecodeErrorZPtr { err }
1478 result_ok: o.result_ok,
1482 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1483 fn clone(&self) -> Self {
1485 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1486 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1489 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1490 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1496 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1497 /// but with all dynamically-allocated buffers duplicated in new buffers.
1498 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1500 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1501 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1502 /// A pointer to the contents in the success state.
1503 /// Reading from this pointer when `result_ok` is not set is undefined.
1504 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1505 /// A pointer to the contents in the error state.
1506 /// Reading from this pointer when `result_ok` is set is undefined.
1507 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1510 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1511 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1513 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1514 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1515 /// `err` or `result` depending on the state of `result_ok`.
1516 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1517 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1518 pub result_ok: bool,
1521 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1522 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1523 CResult_ShutdownScriptInvalidShutdownScriptZ {
1524 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1525 result: Box::into_raw(Box::new(o)),
1531 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1532 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1533 CResult_ShutdownScriptInvalidShutdownScriptZ {
1534 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1535 err: Box::into_raw(Box::new(e)),
1540 /// Checks if the given object is currently in the success state
1542 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1546 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1547 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1548 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1549 fn drop(&mut self) {
1551 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1552 let _ = unsafe { Box::from_raw(self.contents.result) };
1555 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1556 let _ = unsafe { Box::from_raw(self.contents.err) };
1561 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1562 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1563 let contents = if o.result_ok {
1564 let result = unsafe { o.contents.result };
1565 unsafe { o.contents.result = core::ptr::null_mut() };
1566 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1568 let err = unsafe { o.contents.err };
1569 unsafe { o.contents.err = core::ptr::null_mut(); }
1570 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1574 result_ok: o.result_ok,
1578 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1579 fn clone(&self) -> Self {
1581 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1582 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1585 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1586 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1592 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1593 /// but with all dynamically-allocated buffers duplicated in new buffers.
1594 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1596 /// The contents of CResult_NoneErrorZ
1597 pub union CResult_NoneErrorZPtr {
1598 /// Note that this value is always NULL, as there are no contents in the OK variant
1599 pub result: *mut core::ffi::c_void,
1600 /// A pointer to the contents in the error state.
1601 /// Reading from this pointer when `result_ok` is set is undefined.
1602 pub err: *mut crate::c_types::IOError,
1605 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1606 /// containing a () on success and a crate::c_types::IOError on failure.
1607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1608 pub struct CResult_NoneErrorZ {
1609 /// The contents of this CResult_NoneErrorZ, accessible via either
1610 /// `err` or `result` depending on the state of `result_ok`.
1611 pub contents: CResult_NoneErrorZPtr,
1612 /// Whether this CResult_NoneErrorZ represents a success state.
1613 pub result_ok: bool,
1616 /// Creates a new CResult_NoneErrorZ in the success state.
1617 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1618 CResult_NoneErrorZ {
1619 contents: CResult_NoneErrorZPtr {
1620 result: core::ptr::null_mut(),
1626 /// Creates a new CResult_NoneErrorZ in the error state.
1627 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1628 CResult_NoneErrorZ {
1629 contents: CResult_NoneErrorZPtr {
1630 err: Box::into_raw(Box::new(e)),
1635 /// Checks if the given object is currently in the success state
1637 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1641 /// Frees any resources used by the CResult_NoneErrorZ.
1642 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1643 impl Drop for CResult_NoneErrorZ {
1644 fn drop(&mut self) {
1647 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1648 let _ = unsafe { Box::from_raw(self.contents.err) };
1653 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1654 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1655 let contents = if o.result_ok {
1656 let _ = unsafe { Box::from_raw(o.contents.result) };
1657 o.contents.result = core::ptr::null_mut();
1658 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1660 let err = unsafe { o.contents.err };
1661 unsafe { o.contents.err = core::ptr::null_mut(); }
1662 CResult_NoneErrorZPtr { err }
1666 result_ok: o.result_ok,
1670 impl Clone for CResult_NoneErrorZ {
1671 fn clone(&self) -> Self {
1673 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1674 result: core::ptr::null_mut()
1677 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1678 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1684 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1685 /// but with all dynamically-allocated buffers duplicated in new buffers.
1686 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1688 /// The contents of CResult_RouteHopDecodeErrorZ
1689 pub union CResult_RouteHopDecodeErrorZPtr {
1690 /// A pointer to the contents in the success state.
1691 /// Reading from this pointer when `result_ok` is not set is undefined.
1692 pub result: *mut crate::lightning::routing::router::RouteHop,
1693 /// A pointer to the contents in the error state.
1694 /// Reading from this pointer when `result_ok` is set is undefined.
1695 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1698 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1699 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1701 pub struct CResult_RouteHopDecodeErrorZ {
1702 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1703 /// `err` or `result` depending on the state of `result_ok`.
1704 pub contents: CResult_RouteHopDecodeErrorZPtr,
1705 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1706 pub result_ok: bool,
1709 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1710 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1711 CResult_RouteHopDecodeErrorZ {
1712 contents: CResult_RouteHopDecodeErrorZPtr {
1713 result: Box::into_raw(Box::new(o)),
1719 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1720 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1721 CResult_RouteHopDecodeErrorZ {
1722 contents: CResult_RouteHopDecodeErrorZPtr {
1723 err: Box::into_raw(Box::new(e)),
1728 /// Checks if the given object is currently in the success state
1730 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1734 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1735 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1736 impl Drop for CResult_RouteHopDecodeErrorZ {
1737 fn drop(&mut self) {
1739 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1740 let _ = unsafe { Box::from_raw(self.contents.result) };
1743 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1744 let _ = unsafe { Box::from_raw(self.contents.err) };
1749 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1750 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1751 let contents = if o.result_ok {
1752 let result = unsafe { o.contents.result };
1753 unsafe { o.contents.result = core::ptr::null_mut() };
1754 CResult_RouteHopDecodeErrorZPtr { result }
1756 let err = unsafe { o.contents.err };
1757 unsafe { o.contents.err = core::ptr::null_mut(); }
1758 CResult_RouteHopDecodeErrorZPtr { err }
1762 result_ok: o.result_ok,
1766 impl Clone for CResult_RouteHopDecodeErrorZ {
1767 fn clone(&self) -> Self {
1769 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1770 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1773 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1774 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1780 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1781 /// but with all dynamically-allocated buffers duplicated in new buffers.
1782 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1784 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1785 /// This corresponds to std::vector in C++
1786 pub struct CVec_RouteHopZ {
1787 /// The elements in the array.
1788 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1789 pub data: *mut crate::lightning::routing::router::RouteHop,
1790 /// The number of elements pointed to by `data`.
1793 impl CVec_RouteHopZ {
1794 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1795 if self.datalen == 0 { return Vec::new(); }
1796 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1797 self.data = core::ptr::null_mut();
1801 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1802 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1805 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1806 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1807 let datalen = v.len();
1808 let data = Box::into_raw(v.into_boxed_slice());
1809 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1813 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1814 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1815 impl Drop for CVec_RouteHopZ {
1816 fn drop(&mut self) {
1817 if self.datalen == 0 { return; }
1818 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1821 impl Clone for CVec_RouteHopZ {
1822 fn clone(&self) -> Self {
1823 let mut res = Vec::new();
1824 if self.datalen == 0 { return Self::from(res); }
1825 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1830 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1831 /// This corresponds to std::vector in C++
1832 pub struct CVec_CVec_RouteHopZZ {
1833 /// The elements in the array.
1834 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1835 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1836 /// The number of elements pointed to by `data`.
1839 impl CVec_CVec_RouteHopZZ {
1840 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1841 if self.datalen == 0 { return Vec::new(); }
1842 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1843 self.data = core::ptr::null_mut();
1847 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1848 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1851 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1852 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1853 let datalen = v.len();
1854 let data = Box::into_raw(v.into_boxed_slice());
1855 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1859 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1860 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1861 impl Drop for CVec_CVec_RouteHopZZ {
1862 fn drop(&mut self) {
1863 if self.datalen == 0 { return; }
1864 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1867 impl Clone for CVec_CVec_RouteHopZZ {
1868 fn clone(&self) -> Self {
1869 let mut res = Vec::new();
1870 if self.datalen == 0 { return Self::from(res); }
1871 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1876 /// The contents of CResult_RouteDecodeErrorZ
1877 pub union CResult_RouteDecodeErrorZPtr {
1878 /// A pointer to the contents in the success state.
1879 /// Reading from this pointer when `result_ok` is not set is undefined.
1880 pub result: *mut crate::lightning::routing::router::Route,
1881 /// A pointer to the contents in the error state.
1882 /// Reading from this pointer when `result_ok` is set is undefined.
1883 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1886 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1887 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1889 pub struct CResult_RouteDecodeErrorZ {
1890 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1891 /// `err` or `result` depending on the state of `result_ok`.
1892 pub contents: CResult_RouteDecodeErrorZPtr,
1893 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1894 pub result_ok: bool,
1897 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1898 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1899 CResult_RouteDecodeErrorZ {
1900 contents: CResult_RouteDecodeErrorZPtr {
1901 result: Box::into_raw(Box::new(o)),
1907 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1908 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1909 CResult_RouteDecodeErrorZ {
1910 contents: CResult_RouteDecodeErrorZPtr {
1911 err: Box::into_raw(Box::new(e)),
1916 /// Checks if the given object is currently in the success state
1918 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
1922 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1923 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1924 impl Drop for CResult_RouteDecodeErrorZ {
1925 fn drop(&mut self) {
1927 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1928 let _ = unsafe { Box::from_raw(self.contents.result) };
1931 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1932 let _ = unsafe { Box::from_raw(self.contents.err) };
1937 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1938 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1939 let contents = if o.result_ok {
1940 let result = unsafe { o.contents.result };
1941 unsafe { o.contents.result = core::ptr::null_mut() };
1942 CResult_RouteDecodeErrorZPtr { result }
1944 let err = unsafe { o.contents.err };
1945 unsafe { o.contents.err = core::ptr::null_mut(); }
1946 CResult_RouteDecodeErrorZPtr { err }
1950 result_ok: o.result_ok,
1954 impl Clone for CResult_RouteDecodeErrorZ {
1955 fn clone(&self) -> Self {
1957 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1958 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1961 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1962 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1968 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1969 /// but with all dynamically-allocated buffers duplicated in new buffers.
1970 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1972 /// The contents of CResult_RouteParametersDecodeErrorZ
1973 pub union CResult_RouteParametersDecodeErrorZPtr {
1974 /// A pointer to the contents in the success state.
1975 /// Reading from this pointer when `result_ok` is not set is undefined.
1976 pub result: *mut crate::lightning::routing::router::RouteParameters,
1977 /// A pointer to the contents in the error state.
1978 /// Reading from this pointer when `result_ok` is set is undefined.
1979 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1982 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1983 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1984 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1985 pub struct CResult_RouteParametersDecodeErrorZ {
1986 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1987 /// `err` or `result` depending on the state of `result_ok`.
1988 pub contents: CResult_RouteParametersDecodeErrorZPtr,
1989 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1990 pub result_ok: bool,
1993 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
1994 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
1995 CResult_RouteParametersDecodeErrorZ {
1996 contents: CResult_RouteParametersDecodeErrorZPtr {
1997 result: Box::into_raw(Box::new(o)),
2003 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2004 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2005 CResult_RouteParametersDecodeErrorZ {
2006 contents: CResult_RouteParametersDecodeErrorZPtr {
2007 err: Box::into_raw(Box::new(e)),
2012 /// Checks if the given object is currently in the success state
2014 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2018 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2019 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2020 impl Drop for CResult_RouteParametersDecodeErrorZ {
2021 fn drop(&mut self) {
2023 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2024 let _ = unsafe { Box::from_raw(self.contents.result) };
2027 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2028 let _ = unsafe { Box::from_raw(self.contents.err) };
2033 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2034 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2035 let contents = if o.result_ok {
2036 let result = unsafe { o.contents.result };
2037 unsafe { o.contents.result = core::ptr::null_mut() };
2038 CResult_RouteParametersDecodeErrorZPtr { result }
2040 let err = unsafe { o.contents.err };
2041 unsafe { o.contents.err = core::ptr::null_mut(); }
2042 CResult_RouteParametersDecodeErrorZPtr { err }
2046 result_ok: o.result_ok,
2050 impl Clone for CResult_RouteParametersDecodeErrorZ {
2051 fn clone(&self) -> Self {
2053 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2054 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2057 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2058 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2064 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2065 /// but with all dynamically-allocated buffers duplicated in new buffers.
2066 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2068 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2069 /// This corresponds to std::vector in C++
2070 pub struct CVec_RouteHintZ {
2071 /// The elements in the array.
2072 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2073 pub data: *mut crate::lightning::routing::router::RouteHint,
2074 /// The number of elements pointed to by `data`.
2077 impl CVec_RouteHintZ {
2078 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2079 if self.datalen == 0 { return Vec::new(); }
2080 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2081 self.data = core::ptr::null_mut();
2085 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2086 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2089 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2090 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2091 let datalen = v.len();
2092 let data = Box::into_raw(v.into_boxed_slice());
2093 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2097 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2098 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2099 impl Drop for CVec_RouteHintZ {
2100 fn drop(&mut self) {
2101 if self.datalen == 0 { return; }
2102 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2105 impl Clone for CVec_RouteHintZ {
2106 fn clone(&self) -> Self {
2107 let mut res = Vec::new();
2108 if self.datalen == 0 { return Self::from(res); }
2109 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2115 /// An enum which can either contain a u64 or not
2116 pub enum COption_u64Z {
2117 /// When we're in this state, this COption_u64Z contains a u64
2119 /// When we're in this state, this COption_u64Z contains nothing
2123 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2124 if let Self::None = self { false } else { true }
2126 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2129 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2130 if let Self::Some(v) = self { v } else { unreachable!() }
2134 /// Constructs a new COption_u64Z containing a u64
2135 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2136 COption_u64Z::Some(o)
2139 /// Constructs a new COption_u64Z containing nothing
2140 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2144 /// Frees any resources associated with the u64, if we are in the Some state
2145 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2147 /// Creates a new COption_u64Z which has the same data as `orig`
2148 /// but with all dynamically-allocated buffers duplicated in new buffers.
2149 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2151 /// The contents of CResult_PayeeDecodeErrorZ
2152 pub union CResult_PayeeDecodeErrorZPtr {
2153 /// A pointer to the contents in the success state.
2154 /// Reading from this pointer when `result_ok` is not set is undefined.
2155 pub result: *mut crate::lightning::routing::router::Payee,
2156 /// A pointer to the contents in the error state.
2157 /// Reading from this pointer when `result_ok` is set is undefined.
2158 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2161 /// A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
2162 /// containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
2163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2164 pub struct CResult_PayeeDecodeErrorZ {
2165 /// The contents of this CResult_PayeeDecodeErrorZ, accessible via either
2166 /// `err` or `result` depending on the state of `result_ok`.
2167 pub contents: CResult_PayeeDecodeErrorZPtr,
2168 /// Whether this CResult_PayeeDecodeErrorZ represents a success state.
2169 pub result_ok: bool,
2172 /// Creates a new CResult_PayeeDecodeErrorZ in the success state.
2173 pub extern "C" fn CResult_PayeeDecodeErrorZ_ok(o: crate::lightning::routing::router::Payee) -> CResult_PayeeDecodeErrorZ {
2174 CResult_PayeeDecodeErrorZ {
2175 contents: CResult_PayeeDecodeErrorZPtr {
2176 result: Box::into_raw(Box::new(o)),
2182 /// Creates a new CResult_PayeeDecodeErrorZ in the error state.
2183 pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PayeeDecodeErrorZ {
2184 CResult_PayeeDecodeErrorZ {
2185 contents: CResult_PayeeDecodeErrorZPtr {
2186 err: Box::into_raw(Box::new(e)),
2191 /// Checks if the given object is currently in the success state
2193 pub extern "C" fn CResult_PayeeDecodeErrorZ_is_ok(o: &CResult_PayeeDecodeErrorZ) -> bool {
2197 /// Frees any resources used by the CResult_PayeeDecodeErrorZ.
2198 pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { }
2199 impl Drop for CResult_PayeeDecodeErrorZ {
2200 fn drop(&mut self) {
2202 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2203 let _ = unsafe { Box::from_raw(self.contents.result) };
2206 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2207 let _ = unsafe { Box::from_raw(self.contents.err) };
2212 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>> for CResult_PayeeDecodeErrorZ {
2213 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>) -> Self {
2214 let contents = if o.result_ok {
2215 let result = unsafe { o.contents.result };
2216 unsafe { o.contents.result = core::ptr::null_mut() };
2217 CResult_PayeeDecodeErrorZPtr { result }
2219 let err = unsafe { o.contents.err };
2220 unsafe { o.contents.err = core::ptr::null_mut(); }
2221 CResult_PayeeDecodeErrorZPtr { err }
2225 result_ok: o.result_ok,
2229 impl Clone for CResult_PayeeDecodeErrorZ {
2230 fn clone(&self) -> Self {
2232 Self { result_ok: true, contents: CResult_PayeeDecodeErrorZPtr {
2233 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Payee>::clone(unsafe { &*self.contents.result })))
2236 Self { result_ok: false, contents: CResult_PayeeDecodeErrorZPtr {
2237 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2243 /// Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
2244 /// but with all dynamically-allocated buffers duplicated in new buffers.
2245 pub extern "C" fn CResult_PayeeDecodeErrorZ_clone(orig: &CResult_PayeeDecodeErrorZ) -> CResult_PayeeDecodeErrorZ { Clone::clone(&orig) }
2247 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2248 /// This corresponds to std::vector in C++
2249 pub struct CVec_RouteHintHopZ {
2250 /// The elements in the array.
2251 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2252 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2253 /// The number of elements pointed to by `data`.
2256 impl CVec_RouteHintHopZ {
2257 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2258 if self.datalen == 0 { return Vec::new(); }
2259 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2260 self.data = core::ptr::null_mut();
2264 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2265 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2268 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2269 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2270 let datalen = v.len();
2271 let data = Box::into_raw(v.into_boxed_slice());
2272 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2276 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2277 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2278 impl Drop for CVec_RouteHintHopZ {
2279 fn drop(&mut self) {
2280 if self.datalen == 0 { return; }
2281 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2284 impl Clone for CVec_RouteHintHopZ {
2285 fn clone(&self) -> Self {
2286 let mut res = Vec::new();
2287 if self.datalen == 0 { return Self::from(res); }
2288 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2293 /// The contents of CResult_RouteHintDecodeErrorZ
2294 pub union CResult_RouteHintDecodeErrorZPtr {
2295 /// A pointer to the contents in the success state.
2296 /// Reading from this pointer when `result_ok` is not set is undefined.
2297 pub result: *mut crate::lightning::routing::router::RouteHint,
2298 /// A pointer to the contents in the error state.
2299 /// Reading from this pointer when `result_ok` is set is undefined.
2300 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2303 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2304 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2305 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2306 pub struct CResult_RouteHintDecodeErrorZ {
2307 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2308 /// `err` or `result` depending on the state of `result_ok`.
2309 pub contents: CResult_RouteHintDecodeErrorZPtr,
2310 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2311 pub result_ok: bool,
2314 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2315 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2316 CResult_RouteHintDecodeErrorZ {
2317 contents: CResult_RouteHintDecodeErrorZPtr {
2318 result: Box::into_raw(Box::new(o)),
2324 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2325 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2326 CResult_RouteHintDecodeErrorZ {
2327 contents: CResult_RouteHintDecodeErrorZPtr {
2328 err: Box::into_raw(Box::new(e)),
2333 /// Checks if the given object is currently in the success state
2335 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2339 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2340 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2341 impl Drop for CResult_RouteHintDecodeErrorZ {
2342 fn drop(&mut self) {
2344 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2345 let _ = unsafe { Box::from_raw(self.contents.result) };
2348 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2349 let _ = unsafe { Box::from_raw(self.contents.err) };
2354 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2355 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2356 let contents = if o.result_ok {
2357 let result = unsafe { o.contents.result };
2358 unsafe { o.contents.result = core::ptr::null_mut() };
2359 CResult_RouteHintDecodeErrorZPtr { result }
2361 let err = unsafe { o.contents.err };
2362 unsafe { o.contents.err = core::ptr::null_mut(); }
2363 CResult_RouteHintDecodeErrorZPtr { err }
2367 result_ok: o.result_ok,
2371 impl Clone for CResult_RouteHintDecodeErrorZ {
2372 fn clone(&self) -> Self {
2374 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2375 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2378 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2379 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2385 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2386 /// but with all dynamically-allocated buffers duplicated in new buffers.
2387 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2389 /// The contents of CResult_RouteHintHopDecodeErrorZ
2390 pub union CResult_RouteHintHopDecodeErrorZPtr {
2391 /// A pointer to the contents in the success state.
2392 /// Reading from this pointer when `result_ok` is not set is undefined.
2393 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2394 /// A pointer to the contents in the error state.
2395 /// Reading from this pointer when `result_ok` is set is undefined.
2396 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2399 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2400 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2401 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2402 pub struct CResult_RouteHintHopDecodeErrorZ {
2403 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2404 /// `err` or `result` depending on the state of `result_ok`.
2405 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2406 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2407 pub result_ok: bool,
2410 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2411 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2412 CResult_RouteHintHopDecodeErrorZ {
2413 contents: CResult_RouteHintHopDecodeErrorZPtr {
2414 result: Box::into_raw(Box::new(o)),
2420 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2421 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2422 CResult_RouteHintHopDecodeErrorZ {
2423 contents: CResult_RouteHintHopDecodeErrorZPtr {
2424 err: Box::into_raw(Box::new(e)),
2429 /// Checks if the given object is currently in the success state
2431 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2435 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2436 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2437 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2438 fn drop(&mut self) {
2440 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2441 let _ = unsafe { Box::from_raw(self.contents.result) };
2444 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2445 let _ = unsafe { Box::from_raw(self.contents.err) };
2450 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2451 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2452 let contents = if o.result_ok {
2453 let result = unsafe { o.contents.result };
2454 unsafe { o.contents.result = core::ptr::null_mut() };
2455 CResult_RouteHintHopDecodeErrorZPtr { result }
2457 let err = unsafe { o.contents.err };
2458 unsafe { o.contents.err = core::ptr::null_mut(); }
2459 CResult_RouteHintHopDecodeErrorZPtr { err }
2463 result_ok: o.result_ok,
2467 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2468 fn clone(&self) -> Self {
2470 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2471 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2474 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2475 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2481 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2482 /// but with all dynamically-allocated buffers duplicated in new buffers.
2483 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2485 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2486 /// This corresponds to std::vector in C++
2487 pub struct CVec_ChannelDetailsZ {
2488 /// The elements in the array.
2489 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2490 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2491 /// The number of elements pointed to by `data`.
2494 impl CVec_ChannelDetailsZ {
2495 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2496 if self.datalen == 0 { return Vec::new(); }
2497 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2498 self.data = core::ptr::null_mut();
2502 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2503 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2506 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2507 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2508 let datalen = v.len();
2509 let data = Box::into_raw(v.into_boxed_slice());
2510 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2514 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2515 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2516 impl Drop for CVec_ChannelDetailsZ {
2517 fn drop(&mut self) {
2518 if self.datalen == 0 { return; }
2519 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2522 impl Clone for CVec_ChannelDetailsZ {
2523 fn clone(&self) -> Self {
2524 let mut res = Vec::new();
2525 if self.datalen == 0 { return Self::from(res); }
2526 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2531 /// The contents of CResult_RouteLightningErrorZ
2532 pub union CResult_RouteLightningErrorZPtr {
2533 /// A pointer to the contents in the success state.
2534 /// Reading from this pointer when `result_ok` is not set is undefined.
2535 pub result: *mut crate::lightning::routing::router::Route,
2536 /// A pointer to the contents in the error state.
2537 /// Reading from this pointer when `result_ok` is set is undefined.
2538 pub err: *mut crate::lightning::ln::msgs::LightningError,
2541 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2542 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2544 pub struct CResult_RouteLightningErrorZ {
2545 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2546 /// `err` or `result` depending on the state of `result_ok`.
2547 pub contents: CResult_RouteLightningErrorZPtr,
2548 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2549 pub result_ok: bool,
2552 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2553 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2554 CResult_RouteLightningErrorZ {
2555 contents: CResult_RouteLightningErrorZPtr {
2556 result: Box::into_raw(Box::new(o)),
2562 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2563 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2564 CResult_RouteLightningErrorZ {
2565 contents: CResult_RouteLightningErrorZPtr {
2566 err: Box::into_raw(Box::new(e)),
2571 /// Checks if the given object is currently in the success state
2573 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2577 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2578 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2579 impl Drop for CResult_RouteLightningErrorZ {
2580 fn drop(&mut self) {
2582 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2583 let _ = unsafe { Box::from_raw(self.contents.result) };
2586 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2587 let _ = unsafe { Box::from_raw(self.contents.err) };
2592 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2593 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2594 let contents = if o.result_ok {
2595 let result = unsafe { o.contents.result };
2596 unsafe { o.contents.result = core::ptr::null_mut() };
2597 CResult_RouteLightningErrorZPtr { result }
2599 let err = unsafe { o.contents.err };
2600 unsafe { o.contents.err = core::ptr::null_mut(); }
2601 CResult_RouteLightningErrorZPtr { err }
2605 result_ok: o.result_ok,
2609 impl Clone for CResult_RouteLightningErrorZ {
2610 fn clone(&self) -> Self {
2612 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2613 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2616 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2617 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2623 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2624 /// but with all dynamically-allocated buffers duplicated in new buffers.
2625 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2627 /// The contents of CResult_TxOutAccessErrorZ
2628 pub union CResult_TxOutAccessErrorZPtr {
2629 /// A pointer to the contents in the success state.
2630 /// Reading from this pointer when `result_ok` is not set is undefined.
2631 pub result: *mut crate::c_types::TxOut,
2632 /// A pointer to the contents in the error state.
2633 /// Reading from this pointer when `result_ok` is set is undefined.
2634 pub err: *mut crate::lightning::chain::AccessError,
2637 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2638 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2640 pub struct CResult_TxOutAccessErrorZ {
2641 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2642 /// `err` or `result` depending on the state of `result_ok`.
2643 pub contents: CResult_TxOutAccessErrorZPtr,
2644 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2645 pub result_ok: bool,
2648 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2649 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2650 CResult_TxOutAccessErrorZ {
2651 contents: CResult_TxOutAccessErrorZPtr {
2652 result: Box::into_raw(Box::new(o)),
2658 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2659 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2660 CResult_TxOutAccessErrorZ {
2661 contents: CResult_TxOutAccessErrorZPtr {
2662 err: Box::into_raw(Box::new(e)),
2667 /// Checks if the given object is currently in the success state
2669 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2673 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2674 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2675 impl Drop for CResult_TxOutAccessErrorZ {
2676 fn drop(&mut self) {
2678 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2679 let _ = unsafe { Box::from_raw(self.contents.result) };
2682 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2683 let _ = unsafe { Box::from_raw(self.contents.err) };
2688 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2689 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2690 let contents = if o.result_ok {
2691 let result = unsafe { o.contents.result };
2692 unsafe { o.contents.result = core::ptr::null_mut() };
2693 CResult_TxOutAccessErrorZPtr { result }
2695 let err = unsafe { o.contents.err };
2696 unsafe { o.contents.err = core::ptr::null_mut(); }
2697 CResult_TxOutAccessErrorZPtr { err }
2701 result_ok: o.result_ok,
2705 impl Clone for CResult_TxOutAccessErrorZ {
2706 fn clone(&self) -> Self {
2708 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2709 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2712 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2713 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2719 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2720 /// but with all dynamically-allocated buffers duplicated in new buffers.
2721 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2723 /// A tuple of 2 elements. See the individual fields for the types contained.
2724 pub struct C2Tuple_usizeTransactionZ {
2725 /// The element at position 0
2727 /// The element at position 1
2728 pub b: crate::c_types::Transaction,
2730 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2731 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2738 impl C2Tuple_usizeTransactionZ {
2739 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2743 impl Clone for C2Tuple_usizeTransactionZ {
2744 fn clone(&self) -> Self {
2746 a: Clone::clone(&self.a),
2747 b: Clone::clone(&self.b),
2752 /// Creates a new tuple which has the same data as `orig`
2753 /// but with all dynamically-allocated buffers duplicated in new buffers.
2754 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2755 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2757 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2758 C2Tuple_usizeTransactionZ { a, b, }
2762 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2763 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2765 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2766 /// This corresponds to std::vector in C++
2767 pub struct CVec_C2Tuple_usizeTransactionZZ {
2768 /// The elements in the array.
2769 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2770 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2771 /// The number of elements pointed to by `data`.
2774 impl CVec_C2Tuple_usizeTransactionZZ {
2775 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2776 if self.datalen == 0 { return Vec::new(); }
2777 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2778 self.data = core::ptr::null_mut();
2782 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2783 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2786 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2787 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2788 let datalen = v.len();
2789 let data = Box::into_raw(v.into_boxed_slice());
2790 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2794 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2795 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2796 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2797 fn drop(&mut self) {
2798 if self.datalen == 0 { return; }
2799 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2802 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2803 fn clone(&self) -> Self {
2804 let mut res = Vec::new();
2805 if self.datalen == 0 { return Self::from(res); }
2806 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2811 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2812 /// This corresponds to std::vector in C++
2813 pub struct CVec_TxidZ {
2814 /// The elements in the array.
2815 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2816 pub data: *mut crate::c_types::ThirtyTwoBytes,
2817 /// The number of elements pointed to by `data`.
2821 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2822 if self.datalen == 0 { return Vec::new(); }
2823 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2824 self.data = core::ptr::null_mut();
2828 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2829 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2832 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2833 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2834 let datalen = v.len();
2835 let data = Box::into_raw(v.into_boxed_slice());
2836 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2840 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2841 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2842 impl Drop for CVec_TxidZ {
2843 fn drop(&mut self) {
2844 if self.datalen == 0 { return; }
2845 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2848 impl Clone for CVec_TxidZ {
2849 fn clone(&self) -> Self {
2850 let mut res = Vec::new();
2851 if self.datalen == 0 { return Self::from(res); }
2852 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2857 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2858 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2859 /// Note that this value is always NULL, as there are no contents in the OK variant
2860 pub result: *mut core::ffi::c_void,
2861 /// A pointer to the contents in the error state.
2862 /// Reading from this pointer when `result_ok` is set is undefined.
2863 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2866 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2867 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2869 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2870 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2871 /// `err` or `result` depending on the state of `result_ok`.
2872 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2873 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2874 pub result_ok: bool,
2877 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2878 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2879 CResult_NoneChannelMonitorUpdateErrZ {
2880 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2881 result: core::ptr::null_mut(),
2887 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2888 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2889 CResult_NoneChannelMonitorUpdateErrZ {
2890 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2891 err: Box::into_raw(Box::new(e)),
2896 /// Checks if the given object is currently in the success state
2898 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
2902 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2903 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2904 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2905 fn drop(&mut self) {
2908 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2909 let _ = unsafe { Box::from_raw(self.contents.err) };
2914 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2915 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2916 let contents = if o.result_ok {
2917 let _ = unsafe { Box::from_raw(o.contents.result) };
2918 o.contents.result = core::ptr::null_mut();
2919 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
2921 let err = unsafe { o.contents.err };
2922 unsafe { o.contents.err = core::ptr::null_mut(); }
2923 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2927 result_ok: o.result_ok,
2931 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2932 fn clone(&self) -> Self {
2934 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2935 result: core::ptr::null_mut()
2938 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2939 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2945 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2946 /// but with all dynamically-allocated buffers duplicated in new buffers.
2947 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2949 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2950 /// This corresponds to std::vector in C++
2951 pub struct CVec_MonitorEventZ {
2952 /// The elements in the array.
2953 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2954 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2955 /// The number of elements pointed to by `data`.
2958 impl CVec_MonitorEventZ {
2959 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2960 if self.datalen == 0 { return Vec::new(); }
2961 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2962 self.data = core::ptr::null_mut();
2966 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2967 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2970 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2971 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2972 let datalen = v.len();
2973 let data = Box::into_raw(v.into_boxed_slice());
2974 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2978 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2979 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2980 impl Drop for CVec_MonitorEventZ {
2981 fn drop(&mut self) {
2982 if self.datalen == 0 { return; }
2983 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2986 impl Clone for CVec_MonitorEventZ {
2987 fn clone(&self) -> Self {
2988 let mut res = Vec::new();
2989 if self.datalen == 0 { return Self::from(res); }
2990 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2996 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2997 pub enum COption_C2Tuple_usizeTransactionZZ {
2998 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2999 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3000 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3003 impl COption_C2Tuple_usizeTransactionZZ {
3004 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3005 if let Self::None = self { false } else { true }
3007 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3010 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3011 if let Self::Some(v) = self { v } else { unreachable!() }
3015 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3016 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3017 COption_C2Tuple_usizeTransactionZZ::Some(o)
3020 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3021 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3022 COption_C2Tuple_usizeTransactionZZ::None
3025 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3026 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3028 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3029 /// but with all dynamically-allocated buffers duplicated in new buffers.
3030 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3033 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3034 pub enum COption_ClosureReasonZ {
3035 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3036 Some(crate::lightning::util::events::ClosureReason),
3037 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3040 impl COption_ClosureReasonZ {
3041 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3042 if let Self::None = self { false } else { true }
3044 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3047 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3048 if let Self::Some(v) = self { v } else { unreachable!() }
3052 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3053 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3054 COption_ClosureReasonZ::Some(o)
3057 /// Constructs a new COption_ClosureReasonZ containing nothing
3058 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3059 COption_ClosureReasonZ::None
3062 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3063 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3065 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3066 /// but with all dynamically-allocated buffers duplicated in new buffers.
3067 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3069 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3070 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3071 /// A pointer to the contents in the success state.
3072 /// Reading from this pointer when `result_ok` is not set is undefined.
3073 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3074 /// A pointer to the contents in the error state.
3075 /// Reading from this pointer when `result_ok` is set is undefined.
3076 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3079 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3080 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3082 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3083 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3084 /// `err` or `result` depending on the state of `result_ok`.
3085 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3086 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3087 pub result_ok: bool,
3090 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3091 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3092 CResult_COption_ClosureReasonZDecodeErrorZ {
3093 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3094 result: Box::into_raw(Box::new(o)),
3100 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3101 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3102 CResult_COption_ClosureReasonZDecodeErrorZ {
3103 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3104 err: Box::into_raw(Box::new(e)),
3109 /// Checks if the given object is currently in the success state
3111 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3115 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3116 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3117 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3118 fn drop(&mut self) {
3120 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3121 let _ = unsafe { Box::from_raw(self.contents.result) };
3124 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3125 let _ = unsafe { Box::from_raw(self.contents.err) };
3130 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3131 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3132 let contents = if o.result_ok {
3133 let result = unsafe { o.contents.result };
3134 unsafe { o.contents.result = core::ptr::null_mut() };
3135 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3137 let err = unsafe { o.contents.err };
3138 unsafe { o.contents.err = core::ptr::null_mut(); }
3139 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3143 result_ok: o.result_ok,
3147 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3148 fn clone(&self) -> Self {
3150 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3151 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3154 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3155 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3161 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3162 /// but with all dynamically-allocated buffers duplicated in new buffers.
3163 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3166 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3167 pub enum COption_NetworkUpdateZ {
3168 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3169 Some(crate::lightning::routing::network_graph::NetworkUpdate),
3170 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3173 impl COption_NetworkUpdateZ {
3174 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3175 if let Self::None = self { false } else { true }
3177 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3180 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3181 if let Self::Some(v) = self { v } else { unreachable!() }
3185 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3186 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3187 COption_NetworkUpdateZ::Some(o)
3190 /// Constructs a new COption_NetworkUpdateZ containing nothing
3191 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3192 COption_NetworkUpdateZ::None
3195 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3196 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3198 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3199 /// but with all dynamically-allocated buffers duplicated in new buffers.
3200 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3202 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3203 /// This corresponds to std::vector in C++
3204 pub struct CVec_SpendableOutputDescriptorZ {
3205 /// The elements in the array.
3206 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3207 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3208 /// The number of elements pointed to by `data`.
3211 impl CVec_SpendableOutputDescriptorZ {
3212 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3213 if self.datalen == 0 { return Vec::new(); }
3214 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3215 self.data = core::ptr::null_mut();
3219 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3220 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3223 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3224 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3225 let datalen = v.len();
3226 let data = Box::into_raw(v.into_boxed_slice());
3227 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3231 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3232 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3233 impl Drop for CVec_SpendableOutputDescriptorZ {
3234 fn drop(&mut self) {
3235 if self.datalen == 0 { return; }
3236 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3239 impl Clone for CVec_SpendableOutputDescriptorZ {
3240 fn clone(&self) -> Self {
3241 let mut res = Vec::new();
3242 if self.datalen == 0 { return Self::from(res); }
3243 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3249 /// An enum which can either contain a crate::lightning::util::events::Event or not
3250 pub enum COption_EventZ {
3251 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3252 Some(crate::lightning::util::events::Event),
3253 /// When we're in this state, this COption_EventZ contains nothing
3256 impl COption_EventZ {
3257 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3258 if let Self::None = self { false } else { true }
3260 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3263 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3264 if let Self::Some(v) = self { v } else { unreachable!() }
3268 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3269 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3270 COption_EventZ::Some(o)
3273 /// Constructs a new COption_EventZ containing nothing
3274 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3275 COption_EventZ::None
3278 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3279 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3281 /// Creates a new COption_EventZ which has the same data as `orig`
3282 /// but with all dynamically-allocated buffers duplicated in new buffers.
3283 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3285 /// The contents of CResult_COption_EventZDecodeErrorZ
3286 pub union CResult_COption_EventZDecodeErrorZPtr {
3287 /// A pointer to the contents in the success state.
3288 /// Reading from this pointer when `result_ok` is not set is undefined.
3289 pub result: *mut crate::c_types::derived::COption_EventZ,
3290 /// A pointer to the contents in the error state.
3291 /// Reading from this pointer when `result_ok` is set is undefined.
3292 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3295 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3296 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3297 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3298 pub struct CResult_COption_EventZDecodeErrorZ {
3299 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3300 /// `err` or `result` depending on the state of `result_ok`.
3301 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3302 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3303 pub result_ok: bool,
3306 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3307 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3308 CResult_COption_EventZDecodeErrorZ {
3309 contents: CResult_COption_EventZDecodeErrorZPtr {
3310 result: Box::into_raw(Box::new(o)),
3316 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3317 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3318 CResult_COption_EventZDecodeErrorZ {
3319 contents: CResult_COption_EventZDecodeErrorZPtr {
3320 err: Box::into_raw(Box::new(e)),
3325 /// Checks if the given object is currently in the success state
3327 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3331 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3332 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3333 impl Drop for CResult_COption_EventZDecodeErrorZ {
3334 fn drop(&mut self) {
3336 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3337 let _ = unsafe { Box::from_raw(self.contents.result) };
3340 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3341 let _ = unsafe { Box::from_raw(self.contents.err) };
3346 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3347 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3348 let contents = if o.result_ok {
3349 let result = unsafe { o.contents.result };
3350 unsafe { o.contents.result = core::ptr::null_mut() };
3351 CResult_COption_EventZDecodeErrorZPtr { result }
3353 let err = unsafe { o.contents.err };
3354 unsafe { o.contents.err = core::ptr::null_mut(); }
3355 CResult_COption_EventZDecodeErrorZPtr { err }
3359 result_ok: o.result_ok,
3363 impl Clone for CResult_COption_EventZDecodeErrorZ {
3364 fn clone(&self) -> Self {
3366 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3367 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3370 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3371 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3377 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3378 /// but with all dynamically-allocated buffers duplicated in new buffers.
3379 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3381 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3382 /// This corresponds to std::vector in C++
3383 pub struct CVec_MessageSendEventZ {
3384 /// The elements in the array.
3385 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3386 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3387 /// The number of elements pointed to by `data`.
3390 impl CVec_MessageSendEventZ {
3391 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3392 if self.datalen == 0 { return Vec::new(); }
3393 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3394 self.data = core::ptr::null_mut();
3398 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3399 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3402 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3403 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3404 let datalen = v.len();
3405 let data = Box::into_raw(v.into_boxed_slice());
3406 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3410 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3411 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3412 impl Drop for CVec_MessageSendEventZ {
3413 fn drop(&mut self) {
3414 if self.datalen == 0 { return; }
3415 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3418 impl Clone for CVec_MessageSendEventZ {
3419 fn clone(&self) -> Self {
3420 let mut res = Vec::new();
3421 if self.datalen == 0 { return Self::from(res); }
3422 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3427 /// The contents of CResult_ScoringParametersDecodeErrorZ
3428 pub union CResult_ScoringParametersDecodeErrorZPtr {
3429 /// A pointer to the contents in the success state.
3430 /// Reading from this pointer when `result_ok` is not set is undefined.
3431 pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3432 /// A pointer to the contents in the error state.
3433 /// Reading from this pointer when `result_ok` is set is undefined.
3434 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3437 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3438 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3440 pub struct CResult_ScoringParametersDecodeErrorZ {
3441 /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3442 /// `err` or `result` depending on the state of `result_ok`.
3443 pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3444 /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3445 pub result_ok: bool,
3448 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3449 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3450 CResult_ScoringParametersDecodeErrorZ {
3451 contents: CResult_ScoringParametersDecodeErrorZPtr {
3452 result: Box::into_raw(Box::new(o)),
3458 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3459 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3460 CResult_ScoringParametersDecodeErrorZ {
3461 contents: CResult_ScoringParametersDecodeErrorZPtr {
3462 err: Box::into_raw(Box::new(e)),
3467 /// Checks if the given object is currently in the success state
3469 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3473 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3474 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3475 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3476 fn drop(&mut self) {
3478 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3479 let _ = unsafe { Box::from_raw(self.contents.result) };
3482 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3483 let _ = unsafe { Box::from_raw(self.contents.err) };
3488 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3489 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3490 let contents = if o.result_ok {
3491 let result = unsafe { o.contents.result };
3492 unsafe { o.contents.result = core::ptr::null_mut() };
3493 CResult_ScoringParametersDecodeErrorZPtr { result }
3495 let err = unsafe { o.contents.err };
3496 unsafe { o.contents.err = core::ptr::null_mut(); }
3497 CResult_ScoringParametersDecodeErrorZPtr { err }
3501 result_ok: o.result_ok,
3506 /// The contents of CResult_ScorerDecodeErrorZ
3507 pub union CResult_ScorerDecodeErrorZPtr {
3508 /// A pointer to the contents in the success state.
3509 /// Reading from this pointer when `result_ok` is not set is undefined.
3510 pub result: *mut crate::lightning::routing::scoring::Scorer,
3511 /// A pointer to the contents in the error state.
3512 /// Reading from this pointer when `result_ok` is set is undefined.
3513 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3516 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3517 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3518 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3519 pub struct CResult_ScorerDecodeErrorZ {
3520 /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3521 /// `err` or `result` depending on the state of `result_ok`.
3522 pub contents: CResult_ScorerDecodeErrorZPtr,
3523 /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3524 pub result_ok: bool,
3527 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3528 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3529 CResult_ScorerDecodeErrorZ {
3530 contents: CResult_ScorerDecodeErrorZPtr {
3531 result: Box::into_raw(Box::new(o)),
3537 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3538 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3539 CResult_ScorerDecodeErrorZ {
3540 contents: CResult_ScorerDecodeErrorZPtr {
3541 err: Box::into_raw(Box::new(e)),
3546 /// Checks if the given object is currently in the success state
3548 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3552 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3553 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3554 impl Drop for CResult_ScorerDecodeErrorZ {
3555 fn drop(&mut self) {
3557 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3558 let _ = unsafe { Box::from_raw(self.contents.result) };
3561 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3562 let _ = unsafe { Box::from_raw(self.contents.err) };
3567 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3568 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3569 let contents = if o.result_ok {
3570 let result = unsafe { o.contents.result };
3571 unsafe { o.contents.result = core::ptr::null_mut() };
3572 CResult_ScorerDecodeErrorZPtr { result }
3574 let err = unsafe { o.contents.err };
3575 unsafe { o.contents.err = core::ptr::null_mut(); }
3576 CResult_ScorerDecodeErrorZPtr { err }
3580 result_ok: o.result_ok,
3585 /// The contents of CResult_InitFeaturesDecodeErrorZ
3586 pub union CResult_InitFeaturesDecodeErrorZPtr {
3587 /// A pointer to the contents in the success state.
3588 /// Reading from this pointer when `result_ok` is not set is undefined.
3589 pub result: *mut crate::lightning::ln::features::InitFeatures,
3590 /// A pointer to the contents in the error state.
3591 /// Reading from this pointer when `result_ok` is set is undefined.
3592 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3595 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3596 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3597 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3598 pub struct CResult_InitFeaturesDecodeErrorZ {
3599 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3600 /// `err` or `result` depending on the state of `result_ok`.
3601 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3602 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3603 pub result_ok: bool,
3606 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
3607 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
3608 CResult_InitFeaturesDecodeErrorZ {
3609 contents: CResult_InitFeaturesDecodeErrorZPtr {
3610 result: Box::into_raw(Box::new(o)),
3616 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3617 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3618 CResult_InitFeaturesDecodeErrorZ {
3619 contents: CResult_InitFeaturesDecodeErrorZPtr {
3620 err: Box::into_raw(Box::new(e)),
3625 /// Checks if the given object is currently in the success state
3627 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
3631 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3632 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3633 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3634 fn drop(&mut self) {
3636 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3637 let _ = unsafe { Box::from_raw(self.contents.result) };
3640 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3641 let _ = unsafe { Box::from_raw(self.contents.err) };
3646 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
3647 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3648 let contents = if o.result_ok {
3649 let result = unsafe { o.contents.result };
3650 unsafe { o.contents.result = core::ptr::null_mut() };
3651 CResult_InitFeaturesDecodeErrorZPtr { result }
3653 let err = unsafe { o.contents.err };
3654 unsafe { o.contents.err = core::ptr::null_mut(); }
3655 CResult_InitFeaturesDecodeErrorZPtr { err }
3659 result_ok: o.result_ok,
3664 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
3665 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
3666 /// A pointer to the contents in the success state.
3667 /// Reading from this pointer when `result_ok` is not set is undefined.
3668 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
3669 /// A pointer to the contents in the error state.
3670 /// Reading from this pointer when `result_ok` is set is undefined.
3671 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3674 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3675 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3676 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3677 pub struct CResult_ChannelFeaturesDecodeErrorZ {
3678 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3679 /// `err` or `result` depending on the state of `result_ok`.
3680 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
3681 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3682 pub result_ok: bool,
3685 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
3686 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
3687 CResult_ChannelFeaturesDecodeErrorZ {
3688 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3689 result: Box::into_raw(Box::new(o)),
3695 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
3696 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
3697 CResult_ChannelFeaturesDecodeErrorZ {
3698 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3699 err: Box::into_raw(Box::new(e)),
3704 /// Checks if the given object is currently in the success state
3706 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
3710 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
3711 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
3712 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
3713 fn drop(&mut self) {
3715 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3716 let _ = unsafe { Box::from_raw(self.contents.result) };
3719 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3720 let _ = unsafe { Box::from_raw(self.contents.err) };
3725 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
3726 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3727 let contents = if o.result_ok {
3728 let result = unsafe { o.contents.result };
3729 unsafe { o.contents.result = core::ptr::null_mut() };
3730 CResult_ChannelFeaturesDecodeErrorZPtr { result }
3732 let err = unsafe { o.contents.err };
3733 unsafe { o.contents.err = core::ptr::null_mut(); }
3734 CResult_ChannelFeaturesDecodeErrorZPtr { err }
3738 result_ok: o.result_ok,
3743 /// The contents of CResult_NodeFeaturesDecodeErrorZ
3744 pub union CResult_NodeFeaturesDecodeErrorZPtr {
3745 /// A pointer to the contents in the success state.
3746 /// Reading from this pointer when `result_ok` is not set is undefined.
3747 pub result: *mut crate::lightning::ln::features::NodeFeatures,
3748 /// A pointer to the contents in the error state.
3749 /// Reading from this pointer when `result_ok` is set is undefined.
3750 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3753 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3754 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3755 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3756 pub struct CResult_NodeFeaturesDecodeErrorZ {
3757 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3758 /// `err` or `result` depending on the state of `result_ok`.
3759 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
3760 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3761 pub result_ok: bool,
3764 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
3765 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
3766 CResult_NodeFeaturesDecodeErrorZ {
3767 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3768 result: Box::into_raw(Box::new(o)),
3774 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
3775 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
3776 CResult_NodeFeaturesDecodeErrorZ {
3777 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3778 err: Box::into_raw(Box::new(e)),
3783 /// Checks if the given object is currently in the success state
3785 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
3789 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
3790 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
3791 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
3792 fn drop(&mut self) {
3794 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3795 let _ = unsafe { Box::from_raw(self.contents.result) };
3798 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3799 let _ = unsafe { Box::from_raw(self.contents.err) };
3804 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
3805 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3806 let contents = if o.result_ok {
3807 let result = unsafe { o.contents.result };
3808 unsafe { o.contents.result = core::ptr::null_mut() };
3809 CResult_NodeFeaturesDecodeErrorZPtr { result }
3811 let err = unsafe { o.contents.err };
3812 unsafe { o.contents.err = core::ptr::null_mut(); }
3813 CResult_NodeFeaturesDecodeErrorZPtr { err }
3817 result_ok: o.result_ok,
3822 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
3823 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
3824 /// A pointer to the contents in the success state.
3825 /// Reading from this pointer when `result_ok` is not set is undefined.
3826 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
3827 /// A pointer to the contents in the error state.
3828 /// Reading from this pointer when `result_ok` is set is undefined.
3829 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3832 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3833 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3835 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
3836 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3837 /// `err` or `result` depending on the state of `result_ok`.
3838 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
3839 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3840 pub result_ok: bool,
3843 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
3844 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
3845 CResult_InvoiceFeaturesDecodeErrorZ {
3846 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3847 result: Box::into_raw(Box::new(o)),
3853 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
3854 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
3855 CResult_InvoiceFeaturesDecodeErrorZ {
3856 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3857 err: Box::into_raw(Box::new(e)),
3862 /// Checks if the given object is currently in the success state
3864 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
3868 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
3869 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
3870 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
3871 fn drop(&mut self) {
3873 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3874 let _ = unsafe { Box::from_raw(self.contents.result) };
3877 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3878 let _ = unsafe { Box::from_raw(self.contents.err) };
3883 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
3884 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3885 let contents = if o.result_ok {
3886 let result = unsafe { o.contents.result };
3887 unsafe { o.contents.result = core::ptr::null_mut() };
3888 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
3890 let err = unsafe { o.contents.err };
3891 unsafe { o.contents.err = core::ptr::null_mut(); }
3892 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
3896 result_ok: o.result_ok,
3901 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
3902 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3903 /// A pointer to the contents in the success state.
3904 /// Reading from this pointer when `result_ok` is not set is undefined.
3905 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
3906 /// A pointer to the contents in the error state.
3907 /// Reading from this pointer when `result_ok` is set is undefined.
3908 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3911 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
3912 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3913 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3914 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
3915 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
3916 /// `err` or `result` depending on the state of `result_ok`.
3917 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
3918 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
3919 pub result_ok: bool,
3922 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
3923 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
3924 CResult_ChannelTypeFeaturesDecodeErrorZ {
3925 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3926 result: Box::into_raw(Box::new(o)),
3932 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
3933 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
3934 CResult_ChannelTypeFeaturesDecodeErrorZ {
3935 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3936 err: Box::into_raw(Box::new(e)),
3941 /// Checks if the given object is currently in the success state
3943 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
3947 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
3948 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
3949 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
3950 fn drop(&mut self) {
3952 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3953 let _ = unsafe { Box::from_raw(self.contents.result) };
3956 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3957 let _ = unsafe { Box::from_raw(self.contents.err) };
3962 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
3963 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3964 let contents = if o.result_ok {
3965 let result = unsafe { o.contents.result };
3966 unsafe { o.contents.result = core::ptr::null_mut() };
3967 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
3969 let err = unsafe { o.contents.err };
3970 unsafe { o.contents.err = core::ptr::null_mut(); }
3971 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
3975 result_ok: o.result_ok,
3980 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3981 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3982 /// A pointer to the contents in the success state.
3983 /// Reading from this pointer when `result_ok` is not set is undefined.
3984 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
3985 /// A pointer to the contents in the error state.
3986 /// Reading from this pointer when `result_ok` is set is undefined.
3987 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3990 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3991 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3993 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3994 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3995 /// `err` or `result` depending on the state of `result_ok`.
3996 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
3997 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3998 pub result_ok: bool,
4001 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4002 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4003 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4004 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4005 result: Box::into_raw(Box::new(o)),
4011 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4012 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4013 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4014 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4015 err: Box::into_raw(Box::new(e)),
4020 /// Checks if the given object is currently in the success state
4022 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4026 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4027 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4028 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4029 fn drop(&mut self) {
4031 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4032 let _ = unsafe { Box::from_raw(self.contents.result) };
4035 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4036 let _ = unsafe { Box::from_raw(self.contents.err) };
4041 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4042 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4043 let contents = if o.result_ok {
4044 let result = unsafe { o.contents.result };
4045 unsafe { o.contents.result = core::ptr::null_mut() };
4046 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4048 let err = unsafe { o.contents.err };
4049 unsafe { o.contents.err = core::ptr::null_mut(); }
4050 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4054 result_ok: o.result_ok,
4058 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4059 fn clone(&self) -> Self {
4061 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4062 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4065 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4066 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4072 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4073 /// but with all dynamically-allocated buffers duplicated in new buffers.
4074 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4076 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4077 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4078 /// A pointer to the contents in the success state.
4079 /// Reading from this pointer when `result_ok` is not set is undefined.
4080 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4081 /// A pointer to the contents in the error state.
4082 /// Reading from this pointer when `result_ok` is set is undefined.
4083 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4086 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4087 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4089 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4090 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4091 /// `err` or `result` depending on the state of `result_ok`.
4092 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4093 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4094 pub result_ok: bool,
4097 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4098 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4099 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4100 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4101 result: Box::into_raw(Box::new(o)),
4107 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4108 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4109 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4110 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4111 err: Box::into_raw(Box::new(e)),
4116 /// Checks if the given object is currently in the success state
4118 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4122 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4123 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4124 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4125 fn drop(&mut self) {
4127 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4128 let _ = unsafe { Box::from_raw(self.contents.result) };
4131 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4132 let _ = unsafe { Box::from_raw(self.contents.err) };
4137 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4138 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4139 let contents = if o.result_ok {
4140 let result = unsafe { o.contents.result };
4141 unsafe { o.contents.result = core::ptr::null_mut() };
4142 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4144 let err = unsafe { o.contents.err };
4145 unsafe { o.contents.err = core::ptr::null_mut(); }
4146 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4150 result_ok: o.result_ok,
4154 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4155 fn clone(&self) -> Self {
4157 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4158 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4161 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4162 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4168 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4169 /// but with all dynamically-allocated buffers duplicated in new buffers.
4170 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4172 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4173 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4174 /// A pointer to the contents in the success state.
4175 /// Reading from this pointer when `result_ok` is not set is undefined.
4176 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4177 /// A pointer to the contents in the error state.
4178 /// Reading from this pointer when `result_ok` is set is undefined.
4179 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4182 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4183 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4184 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4185 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4186 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4187 /// `err` or `result` depending on the state of `result_ok`.
4188 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4189 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4190 pub result_ok: bool,
4193 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4194 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4195 CResult_SpendableOutputDescriptorDecodeErrorZ {
4196 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4197 result: Box::into_raw(Box::new(o)),
4203 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4204 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4205 CResult_SpendableOutputDescriptorDecodeErrorZ {
4206 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4207 err: Box::into_raw(Box::new(e)),
4212 /// Checks if the given object is currently in the success state
4214 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4218 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4219 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4220 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4221 fn drop(&mut self) {
4223 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4224 let _ = unsafe { Box::from_raw(self.contents.result) };
4227 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4228 let _ = unsafe { Box::from_raw(self.contents.err) };
4233 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4234 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4235 let contents = if o.result_ok {
4236 let result = unsafe { o.contents.result };
4237 unsafe { o.contents.result = core::ptr::null_mut() };
4238 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4240 let err = unsafe { o.contents.err };
4241 unsafe { o.contents.err = core::ptr::null_mut(); }
4242 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4246 result_ok: o.result_ok,
4250 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4251 fn clone(&self) -> Self {
4253 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4254 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4257 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4258 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4264 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4265 /// but with all dynamically-allocated buffers duplicated in new buffers.
4266 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4268 /// The contents of CResult_NoneNoneZ
4269 pub union CResult_NoneNoneZPtr {
4270 /// Note that this value is always NULL, as there are no contents in the OK variant
4271 pub result: *mut core::ffi::c_void,
4272 /// Note that this value is always NULL, as there are no contents in the Err variant
4273 pub err: *mut core::ffi::c_void,
4276 /// A CResult_NoneNoneZ represents the result of a fallible operation,
4277 /// containing a () on success and a () on failure.
4278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4279 pub struct CResult_NoneNoneZ {
4280 /// The contents of this CResult_NoneNoneZ, accessible via either
4281 /// `err` or `result` depending on the state of `result_ok`.
4282 pub contents: CResult_NoneNoneZPtr,
4283 /// Whether this CResult_NoneNoneZ represents a success state.
4284 pub result_ok: bool,
4287 /// Creates a new CResult_NoneNoneZ in the success state.
4288 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
4290 contents: CResult_NoneNoneZPtr {
4291 result: core::ptr::null_mut(),
4297 /// Creates a new CResult_NoneNoneZ in the error state.
4298 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
4300 contents: CResult_NoneNoneZPtr {
4301 err: core::ptr::null_mut(),
4306 /// Checks if the given object is currently in the success state
4308 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
4312 /// Frees any resources used by the CResult_NoneNoneZ.
4313 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
4314 impl Drop for CResult_NoneNoneZ {
4315 fn drop(&mut self) {
4321 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
4322 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
4323 let contents = if o.result_ok {
4324 let _ = unsafe { Box::from_raw(o.contents.result) };
4325 o.contents.result = core::ptr::null_mut();
4326 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
4328 let _ = unsafe { Box::from_raw(o.contents.err) };
4329 o.contents.err = core::ptr::null_mut();
4330 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
4334 result_ok: o.result_ok,
4338 impl Clone for CResult_NoneNoneZ {
4339 fn clone(&self) -> Self {
4341 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
4342 result: core::ptr::null_mut()
4345 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
4346 err: core::ptr::null_mut()
4352 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
4353 /// but with all dynamically-allocated buffers duplicated in new buffers.
4354 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
4356 /// A tuple of 2 elements. See the individual fields for the types contained.
4357 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4358 /// The element at position 0
4359 pub a: crate::c_types::Signature,
4360 /// The element at position 1
4361 pub b: crate::c_types::derived::CVec_SignatureZ,
4363 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4364 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4371 impl C2Tuple_SignatureCVec_SignatureZZ {
4372 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4376 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4377 fn clone(&self) -> Self {
4379 a: Clone::clone(&self.a),
4380 b: Clone::clone(&self.b),
4385 /// Creates a new tuple which has the same data as `orig`
4386 /// but with all dynamically-allocated buffers duplicated in new buffers.
4387 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4388 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4390 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4391 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4395 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4396 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4398 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4399 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4400 /// A pointer to the contents in the success state.
4401 /// Reading from this pointer when `result_ok` is not set is undefined.
4402 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4403 /// Note that this value is always NULL, as there are no contents in the Err variant
4404 pub err: *mut core::ffi::c_void,
4407 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4408 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4410 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4411 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4412 /// `err` or `result` depending on the state of `result_ok`.
4413 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4414 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4415 pub result_ok: bool,
4418 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4419 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4420 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4421 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4422 result: Box::into_raw(Box::new(o)),
4428 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4429 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4430 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4431 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4432 err: core::ptr::null_mut(),
4437 /// Checks if the given object is currently in the success state
4439 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4443 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4444 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4445 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4446 fn drop(&mut self) {
4448 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4449 let _ = unsafe { Box::from_raw(self.contents.result) };
4455 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4456 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4457 let contents = if o.result_ok {
4458 let result = unsafe { o.contents.result };
4459 unsafe { o.contents.result = core::ptr::null_mut() };
4460 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4462 let _ = unsafe { Box::from_raw(o.contents.err) };
4463 o.contents.err = core::ptr::null_mut();
4464 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4468 result_ok: o.result_ok,
4472 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4473 fn clone(&self) -> Self {
4475 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4476 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4479 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4480 err: core::ptr::null_mut()
4486 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4487 /// but with all dynamically-allocated buffers duplicated in new buffers.
4488 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4490 /// The contents of CResult_SignatureNoneZ
4491 pub union CResult_SignatureNoneZPtr {
4492 /// A pointer to the contents in the success state.
4493 /// Reading from this pointer when `result_ok` is not set is undefined.
4494 pub result: *mut crate::c_types::Signature,
4495 /// Note that this value is always NULL, as there are no contents in the Err variant
4496 pub err: *mut core::ffi::c_void,
4499 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4500 /// containing a crate::c_types::Signature on success and a () on failure.
4501 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4502 pub struct CResult_SignatureNoneZ {
4503 /// The contents of this CResult_SignatureNoneZ, accessible via either
4504 /// `err` or `result` depending on the state of `result_ok`.
4505 pub contents: CResult_SignatureNoneZPtr,
4506 /// Whether this CResult_SignatureNoneZ represents a success state.
4507 pub result_ok: bool,
4510 /// Creates a new CResult_SignatureNoneZ in the success state.
4511 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4512 CResult_SignatureNoneZ {
4513 contents: CResult_SignatureNoneZPtr {
4514 result: Box::into_raw(Box::new(o)),
4520 /// Creates a new CResult_SignatureNoneZ in the error state.
4521 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4522 CResult_SignatureNoneZ {
4523 contents: CResult_SignatureNoneZPtr {
4524 err: core::ptr::null_mut(),
4529 /// Checks if the given object is currently in the success state
4531 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4535 /// Frees any resources used by the CResult_SignatureNoneZ.
4536 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4537 impl Drop for CResult_SignatureNoneZ {
4538 fn drop(&mut self) {
4540 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4541 let _ = unsafe { Box::from_raw(self.contents.result) };
4547 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4548 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4549 let contents = if o.result_ok {
4550 let result = unsafe { o.contents.result };
4551 unsafe { o.contents.result = core::ptr::null_mut() };
4552 CResult_SignatureNoneZPtr { result }
4554 let _ = unsafe { Box::from_raw(o.contents.err) };
4555 o.contents.err = core::ptr::null_mut();
4556 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
4560 result_ok: o.result_ok,
4564 impl Clone for CResult_SignatureNoneZ {
4565 fn clone(&self) -> Self {
4567 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4568 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4571 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4572 err: core::ptr::null_mut()
4578 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4579 /// but with all dynamically-allocated buffers duplicated in new buffers.
4580 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4582 /// The contents of CResult_SignDecodeErrorZ
4583 pub union CResult_SignDecodeErrorZPtr {
4584 /// A pointer to the contents in the success state.
4585 /// Reading from this pointer when `result_ok` is not set is undefined.
4586 pub result: *mut crate::lightning::chain::keysinterface::Sign,
4587 /// A pointer to the contents in the error state.
4588 /// Reading from this pointer when `result_ok` is set is undefined.
4589 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4592 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4593 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4595 pub struct CResult_SignDecodeErrorZ {
4596 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
4597 /// `err` or `result` depending on the state of `result_ok`.
4598 pub contents: CResult_SignDecodeErrorZPtr,
4599 /// Whether this CResult_SignDecodeErrorZ represents a success state.
4600 pub result_ok: bool,
4603 /// Creates a new CResult_SignDecodeErrorZ in the success state.
4604 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
4605 CResult_SignDecodeErrorZ {
4606 contents: CResult_SignDecodeErrorZPtr {
4607 result: Box::into_raw(Box::new(o)),
4613 /// Creates a new CResult_SignDecodeErrorZ in the error state.
4614 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
4615 CResult_SignDecodeErrorZ {
4616 contents: CResult_SignDecodeErrorZPtr {
4617 err: Box::into_raw(Box::new(e)),
4622 /// Checks if the given object is currently in the success state
4624 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
4628 /// Frees any resources used by the CResult_SignDecodeErrorZ.
4629 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
4630 impl Drop for CResult_SignDecodeErrorZ {
4631 fn drop(&mut self) {
4633 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4634 let _ = unsafe { Box::from_raw(self.contents.result) };
4637 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4638 let _ = unsafe { Box::from_raw(self.contents.err) };
4643 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
4644 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
4645 let contents = if o.result_ok {
4646 let result = unsafe { o.contents.result };
4647 unsafe { o.contents.result = core::ptr::null_mut() };
4648 CResult_SignDecodeErrorZPtr { result }
4650 let err = unsafe { o.contents.err };
4651 unsafe { o.contents.err = core::ptr::null_mut(); }
4652 CResult_SignDecodeErrorZPtr { err }
4656 result_ok: o.result_ok,
4660 impl Clone for CResult_SignDecodeErrorZ {
4661 fn clone(&self) -> Self {
4663 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
4664 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
4667 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
4668 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4674 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
4675 /// but with all dynamically-allocated buffers duplicated in new buffers.
4676 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
4678 /// A dynamically-allocated array of u8s of arbitrary size.
4679 /// This corresponds to std::vector in C++
4680 pub struct CVec_u8Z {
4681 /// The elements in the array.
4682 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4684 /// The number of elements pointed to by `data`.
4688 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
4689 if self.datalen == 0 { return Vec::new(); }
4690 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4691 self.data = core::ptr::null_mut();
4695 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
4696 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4699 impl From<Vec<u8>> for CVec_u8Z {
4700 fn from(v: Vec<u8>) -> Self {
4701 let datalen = v.len();
4702 let data = Box::into_raw(v.into_boxed_slice());
4703 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4707 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4708 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
4709 impl Drop for CVec_u8Z {
4710 fn drop(&mut self) {
4711 if self.datalen == 0 { return; }
4712 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4715 impl Clone for CVec_u8Z {
4716 fn clone(&self) -> Self {
4717 let mut res = Vec::new();
4718 if self.datalen == 0 { return Self::from(res); }
4719 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4724 /// The contents of CResult_RecoverableSignatureNoneZ
4725 pub union CResult_RecoverableSignatureNoneZPtr {
4726 /// A pointer to the contents in the success state.
4727 /// Reading from this pointer when `result_ok` is not set is undefined.
4728 pub result: *mut crate::c_types::RecoverableSignature,
4729 /// Note that this value is always NULL, as there are no contents in the Err variant
4730 pub err: *mut core::ffi::c_void,
4733 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4734 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
4735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4736 pub struct CResult_RecoverableSignatureNoneZ {
4737 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4738 /// `err` or `result` depending on the state of `result_ok`.
4739 pub contents: CResult_RecoverableSignatureNoneZPtr,
4740 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4741 pub result_ok: bool,
4744 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
4745 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
4746 CResult_RecoverableSignatureNoneZ {
4747 contents: CResult_RecoverableSignatureNoneZPtr {
4748 result: Box::into_raw(Box::new(o)),
4754 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
4755 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
4756 CResult_RecoverableSignatureNoneZ {
4757 contents: CResult_RecoverableSignatureNoneZPtr {
4758 err: core::ptr::null_mut(),
4763 /// Checks if the given object is currently in the success state
4765 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
4769 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
4770 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
4771 impl Drop for CResult_RecoverableSignatureNoneZ {
4772 fn drop(&mut self) {
4774 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4775 let _ = unsafe { Box::from_raw(self.contents.result) };
4781 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
4782 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
4783 let contents = if o.result_ok {
4784 let result = unsafe { o.contents.result };
4785 unsafe { o.contents.result = core::ptr::null_mut() };
4786 CResult_RecoverableSignatureNoneZPtr { result }
4788 let _ = unsafe { Box::from_raw(o.contents.err) };
4789 o.contents.err = core::ptr::null_mut();
4790 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
4794 result_ok: o.result_ok,
4798 impl Clone for CResult_RecoverableSignatureNoneZ {
4799 fn clone(&self) -> Self {
4801 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
4802 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
4805 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
4806 err: core::ptr::null_mut()
4812 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
4813 /// but with all dynamically-allocated buffers duplicated in new buffers.
4814 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
4816 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4817 /// This corresponds to std::vector in C++
4818 pub struct CVec_CVec_u8ZZ {
4819 /// The elements in the array.
4820 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4821 pub data: *mut crate::c_types::derived::CVec_u8Z,
4822 /// The number of elements pointed to by `data`.
4825 impl CVec_CVec_u8ZZ {
4826 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4827 if self.datalen == 0 { return Vec::new(); }
4828 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4829 self.data = core::ptr::null_mut();
4833 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4834 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4837 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4838 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4839 let datalen = v.len();
4840 let data = Box::into_raw(v.into_boxed_slice());
4841 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4845 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4846 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4847 impl Drop for CVec_CVec_u8ZZ {
4848 fn drop(&mut self) {
4849 if self.datalen == 0 { return; }
4850 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4853 impl Clone for CVec_CVec_u8ZZ {
4854 fn clone(&self) -> Self {
4855 let mut res = Vec::new();
4856 if self.datalen == 0 { return Self::from(res); }
4857 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4862 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
4863 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4864 /// A pointer to the contents in the success state.
4865 /// Reading from this pointer when `result_ok` is not set is undefined.
4866 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4867 /// Note that this value is always NULL, as there are no contents in the Err variant
4868 pub err: *mut core::ffi::c_void,
4871 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4872 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4873 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4874 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4875 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4876 /// `err` or `result` depending on the state of `result_ok`.
4877 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4878 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4879 pub result_ok: bool,
4882 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
4883 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4884 CResult_CVec_CVec_u8ZZNoneZ {
4885 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4886 result: Box::into_raw(Box::new(o)),
4892 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
4893 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4894 CResult_CVec_CVec_u8ZZNoneZ {
4895 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4896 err: core::ptr::null_mut(),
4901 /// Checks if the given object is currently in the success state
4903 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
4907 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
4908 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4909 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4910 fn drop(&mut self) {
4912 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4913 let _ = unsafe { Box::from_raw(self.contents.result) };
4919 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
4920 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
4921 let contents = if o.result_ok {
4922 let result = unsafe { o.contents.result };
4923 unsafe { o.contents.result = core::ptr::null_mut() };
4924 CResult_CVec_CVec_u8ZZNoneZPtr { result }
4926 let _ = unsafe { Box::from_raw(o.contents.err) };
4927 o.contents.err = core::ptr::null_mut();
4928 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
4932 result_ok: o.result_ok,
4936 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4937 fn clone(&self) -> Self {
4939 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4940 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4943 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4944 err: core::ptr::null_mut()
4950 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
4951 /// but with all dynamically-allocated buffers duplicated in new buffers.
4952 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
4954 /// The contents of CResult_InMemorySignerDecodeErrorZ
4955 pub union CResult_InMemorySignerDecodeErrorZPtr {
4956 /// A pointer to the contents in the success state.
4957 /// Reading from this pointer when `result_ok` is not set is undefined.
4958 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
4959 /// A pointer to the contents in the error state.
4960 /// Reading from this pointer when `result_ok` is set is undefined.
4961 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4964 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4965 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4967 pub struct CResult_InMemorySignerDecodeErrorZ {
4968 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4969 /// `err` or `result` depending on the state of `result_ok`.
4970 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4971 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4972 pub result_ok: bool,
4975 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
4976 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4977 CResult_InMemorySignerDecodeErrorZ {
4978 contents: CResult_InMemorySignerDecodeErrorZPtr {
4979 result: Box::into_raw(Box::new(o)),
4985 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
4986 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4987 CResult_InMemorySignerDecodeErrorZ {
4988 contents: CResult_InMemorySignerDecodeErrorZPtr {
4989 err: Box::into_raw(Box::new(e)),
4994 /// Checks if the given object is currently in the success state
4996 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5000 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5001 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5002 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5003 fn drop(&mut self) {
5005 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5006 let _ = unsafe { Box::from_raw(self.contents.result) };
5009 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5010 let _ = unsafe { Box::from_raw(self.contents.err) };
5015 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5016 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5017 let contents = if o.result_ok {
5018 let result = unsafe { o.contents.result };
5019 unsafe { o.contents.result = core::ptr::null_mut() };
5020 CResult_InMemorySignerDecodeErrorZPtr { result }
5022 let err = unsafe { o.contents.err };
5023 unsafe { o.contents.err = core::ptr::null_mut(); }
5024 CResult_InMemorySignerDecodeErrorZPtr { err }
5028 result_ok: o.result_ok,
5032 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5033 fn clone(&self) -> Self {
5035 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5036 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5039 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5040 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5046 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5047 /// but with all dynamically-allocated buffers duplicated in new buffers.
5048 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5050 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5051 /// This corresponds to std::vector in C++
5052 pub struct CVec_TxOutZ {
5053 /// The elements in the array.
5054 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5055 pub data: *mut crate::c_types::TxOut,
5056 /// The number of elements pointed to by `data`.
5060 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5061 if self.datalen == 0 { return Vec::new(); }
5062 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5063 self.data = core::ptr::null_mut();
5067 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5068 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5071 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5072 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5073 let datalen = v.len();
5074 let data = Box::into_raw(v.into_boxed_slice());
5075 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5079 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5080 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5081 impl Drop for CVec_TxOutZ {
5082 fn drop(&mut self) {
5083 if self.datalen == 0 { return; }
5084 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5087 impl Clone for CVec_TxOutZ {
5088 fn clone(&self) -> Self {
5089 let mut res = Vec::new();
5090 if self.datalen == 0 { return Self::from(res); }
5091 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5096 /// The contents of CResult_TransactionNoneZ
5097 pub union CResult_TransactionNoneZPtr {
5098 /// A pointer to the contents in the success state.
5099 /// Reading from this pointer when `result_ok` is not set is undefined.
5100 pub result: *mut crate::c_types::Transaction,
5101 /// Note that this value is always NULL, as there are no contents in the Err variant
5102 pub err: *mut core::ffi::c_void,
5105 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5106 /// containing a crate::c_types::Transaction on success and a () on failure.
5107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5108 pub struct CResult_TransactionNoneZ {
5109 /// The contents of this CResult_TransactionNoneZ, accessible via either
5110 /// `err` or `result` depending on the state of `result_ok`.
5111 pub contents: CResult_TransactionNoneZPtr,
5112 /// Whether this CResult_TransactionNoneZ represents a success state.
5113 pub result_ok: bool,
5116 /// Creates a new CResult_TransactionNoneZ in the success state.
5117 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5118 CResult_TransactionNoneZ {
5119 contents: CResult_TransactionNoneZPtr {
5120 result: Box::into_raw(Box::new(o)),
5126 /// Creates a new CResult_TransactionNoneZ in the error state.
5127 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5128 CResult_TransactionNoneZ {
5129 contents: CResult_TransactionNoneZPtr {
5130 err: core::ptr::null_mut(),
5135 /// Checks if the given object is currently in the success state
5137 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5141 /// Frees any resources used by the CResult_TransactionNoneZ.
5142 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5143 impl Drop for CResult_TransactionNoneZ {
5144 fn drop(&mut self) {
5146 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5147 let _ = unsafe { Box::from_raw(self.contents.result) };
5153 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5154 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5155 let contents = if o.result_ok {
5156 let result = unsafe { o.contents.result };
5157 unsafe { o.contents.result = core::ptr::null_mut() };
5158 CResult_TransactionNoneZPtr { result }
5160 let _ = unsafe { Box::from_raw(o.contents.err) };
5161 o.contents.err = core::ptr::null_mut();
5162 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5166 result_ok: o.result_ok,
5170 impl Clone for CResult_TransactionNoneZ {
5171 fn clone(&self) -> Self {
5173 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5174 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5177 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5178 err: core::ptr::null_mut()
5184 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5185 /// but with all dynamically-allocated buffers duplicated in new buffers.
5186 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5188 /// A tuple of 2 elements. See the individual fields for the types contained.
5189 pub struct C2Tuple_BlockHashChannelMonitorZ {
5190 /// The element at position 0
5191 pub a: crate::c_types::ThirtyTwoBytes,
5192 /// The element at position 1
5193 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5195 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5196 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5203 impl C2Tuple_BlockHashChannelMonitorZ {
5204 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5208 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5210 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5211 C2Tuple_BlockHashChannelMonitorZ { a, b, }
5215 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5216 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5218 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5219 /// This corresponds to std::vector in C++
5220 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5221 /// The elements in the array.
5222 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5223 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5224 /// The number of elements pointed to by `data`.
5227 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5228 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5229 if self.datalen == 0 { return Vec::new(); }
5230 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5231 self.data = core::ptr::null_mut();
5235 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5236 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5239 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5240 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5241 let datalen = v.len();
5242 let data = Box::into_raw(v.into_boxed_slice());
5243 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5247 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5248 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5249 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5250 fn drop(&mut self) {
5251 if self.datalen == 0 { return; }
5252 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5256 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5257 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5258 /// A pointer to the contents in the success state.
5259 /// Reading from this pointer when `result_ok` is not set is undefined.
5260 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5261 /// A pointer to the contents in the error state.
5262 /// Reading from this pointer when `result_ok` is set is undefined.
5263 pub err: *mut crate::c_types::IOError,
5266 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5267 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5268 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5269 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5270 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5271 /// `err` or `result` depending on the state of `result_ok`.
5272 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5273 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5274 pub result_ok: bool,
5277 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5278 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5279 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5280 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5281 result: Box::into_raw(Box::new(o)),
5287 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5288 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5289 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5290 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5291 err: Box::into_raw(Box::new(e)),
5296 /// Checks if the given object is currently in the success state
5298 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5302 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5303 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5304 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5305 fn drop(&mut self) {
5307 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5308 let _ = unsafe { Box::from_raw(self.contents.result) };
5311 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5312 let _ = unsafe { Box::from_raw(self.contents.err) };
5317 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5318 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5319 let contents = if o.result_ok {
5320 let result = unsafe { o.contents.result };
5321 unsafe { o.contents.result = core::ptr::null_mut() };
5322 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5324 let err = unsafe { o.contents.err };
5325 unsafe { o.contents.err = core::ptr::null_mut(); }
5326 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5330 result_ok: o.result_ok,
5336 /// An enum which can either contain a u16 or not
5337 pub enum COption_u16Z {
5338 /// When we're in this state, this COption_u16Z contains a u16
5340 /// When we're in this state, this COption_u16Z contains nothing
5344 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5345 if let Self::None = self { false } else { true }
5347 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5350 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5351 if let Self::Some(v) = self { v } else { unreachable!() }
5355 /// Constructs a new COption_u16Z containing a u16
5356 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5357 COption_u16Z::Some(o)
5360 /// Constructs a new COption_u16Z containing nothing
5361 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5365 /// Frees any resources associated with the u16, if we are in the Some state
5366 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5368 /// Creates a new COption_u16Z which has the same data as `orig`
5369 /// but with all dynamically-allocated buffers duplicated in new buffers.
5370 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5372 /// The contents of CResult_NoneAPIErrorZ
5373 pub union CResult_NoneAPIErrorZPtr {
5374 /// Note that this value is always NULL, as there are no contents in the OK variant
5375 pub result: *mut core::ffi::c_void,
5376 /// A pointer to the contents in the error state.
5377 /// Reading from this pointer when `result_ok` is set is undefined.
5378 pub err: *mut crate::lightning::util::errors::APIError,
5381 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5382 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
5383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5384 pub struct CResult_NoneAPIErrorZ {
5385 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
5386 /// `err` or `result` depending on the state of `result_ok`.
5387 pub contents: CResult_NoneAPIErrorZPtr,
5388 /// Whether this CResult_NoneAPIErrorZ represents a success state.
5389 pub result_ok: bool,
5392 /// Creates a new CResult_NoneAPIErrorZ in the success state.
5393 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
5394 CResult_NoneAPIErrorZ {
5395 contents: CResult_NoneAPIErrorZPtr {
5396 result: core::ptr::null_mut(),
5402 /// Creates a new CResult_NoneAPIErrorZ in the error state.
5403 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
5404 CResult_NoneAPIErrorZ {
5405 contents: CResult_NoneAPIErrorZPtr {
5406 err: Box::into_raw(Box::new(e)),
5411 /// Checks if the given object is currently in the success state
5413 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
5417 /// Frees any resources used by the CResult_NoneAPIErrorZ.
5418 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
5419 impl Drop for CResult_NoneAPIErrorZ {
5420 fn drop(&mut self) {
5423 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5424 let _ = unsafe { Box::from_raw(self.contents.err) };
5429 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
5430 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
5431 let contents = if o.result_ok {
5432 let _ = unsafe { Box::from_raw(o.contents.result) };
5433 o.contents.result = core::ptr::null_mut();
5434 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
5436 let err = unsafe { o.contents.err };
5437 unsafe { o.contents.err = core::ptr::null_mut(); }
5438 CResult_NoneAPIErrorZPtr { err }
5442 result_ok: o.result_ok,
5446 impl Clone for CResult_NoneAPIErrorZ {
5447 fn clone(&self) -> Self {
5449 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
5450 result: core::ptr::null_mut()
5453 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
5454 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5460 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
5461 /// but with all dynamically-allocated buffers duplicated in new buffers.
5462 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
5464 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5465 /// This corresponds to std::vector in C++
5466 pub struct CVec_CResult_NoneAPIErrorZZ {
5467 /// The elements in the array.
5468 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5469 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
5470 /// The number of elements pointed to by `data`.
5473 impl CVec_CResult_NoneAPIErrorZZ {
5474 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
5475 if self.datalen == 0 { return Vec::new(); }
5476 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5477 self.data = core::ptr::null_mut();
5481 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
5482 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5485 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
5486 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
5487 let datalen = v.len();
5488 let data = Box::into_raw(v.into_boxed_slice());
5489 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5493 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5494 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
5495 impl Drop for CVec_CResult_NoneAPIErrorZZ {
5496 fn drop(&mut self) {
5497 if self.datalen == 0 { return; }
5498 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5501 impl Clone for CVec_CResult_NoneAPIErrorZZ {
5502 fn clone(&self) -> Self {
5503 let mut res = Vec::new();
5504 if self.datalen == 0 { return Self::from(res); }
5505 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5510 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5511 /// This corresponds to std::vector in C++
5512 pub struct CVec_APIErrorZ {
5513 /// The elements in the array.
5514 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5515 pub data: *mut crate::lightning::util::errors::APIError,
5516 /// The number of elements pointed to by `data`.
5519 impl CVec_APIErrorZ {
5520 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
5521 if self.datalen == 0 { return Vec::new(); }
5522 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5523 self.data = core::ptr::null_mut();
5527 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
5528 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5531 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
5532 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
5533 let datalen = v.len();
5534 let data = Box::into_raw(v.into_boxed_slice());
5535 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5539 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5540 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
5541 impl Drop for CVec_APIErrorZ {
5542 fn drop(&mut self) {
5543 if self.datalen == 0 { return; }
5544 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5547 impl Clone for CVec_APIErrorZ {
5548 fn clone(&self) -> Self {
5549 let mut res = Vec::new();
5550 if self.datalen == 0 { return Self::from(res); }
5551 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5556 /// The contents of CResult__u832APIErrorZ
5557 pub union CResult__u832APIErrorZPtr {
5558 /// A pointer to the contents in the success state.
5559 /// Reading from this pointer when `result_ok` is not set is undefined.
5560 pub result: *mut crate::c_types::ThirtyTwoBytes,
5561 /// A pointer to the contents in the error state.
5562 /// Reading from this pointer when `result_ok` is set is undefined.
5563 pub err: *mut crate::lightning::util::errors::APIError,
5566 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
5567 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5568 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5569 pub struct CResult__u832APIErrorZ {
5570 /// The contents of this CResult__u832APIErrorZ, accessible via either
5571 /// `err` or `result` depending on the state of `result_ok`.
5572 pub contents: CResult__u832APIErrorZPtr,
5573 /// Whether this CResult__u832APIErrorZ represents a success state.
5574 pub result_ok: bool,
5577 /// Creates a new CResult__u832APIErrorZ in the success state.
5578 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
5579 CResult__u832APIErrorZ {
5580 contents: CResult__u832APIErrorZPtr {
5581 result: Box::into_raw(Box::new(o)),
5587 /// Creates a new CResult__u832APIErrorZ in the error state.
5588 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
5589 CResult__u832APIErrorZ {
5590 contents: CResult__u832APIErrorZPtr {
5591 err: Box::into_raw(Box::new(e)),
5596 /// Checks if the given object is currently in the success state
5598 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
5602 /// Frees any resources used by the CResult__u832APIErrorZ.
5603 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
5604 impl Drop for CResult__u832APIErrorZ {
5605 fn drop(&mut self) {
5607 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5608 let _ = unsafe { Box::from_raw(self.contents.result) };
5611 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5612 let _ = unsafe { Box::from_raw(self.contents.err) };
5617 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
5618 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5619 let contents = if o.result_ok {
5620 let result = unsafe { o.contents.result };
5621 unsafe { o.contents.result = core::ptr::null_mut() };
5622 CResult__u832APIErrorZPtr { result }
5624 let err = unsafe { o.contents.err };
5625 unsafe { o.contents.err = core::ptr::null_mut(); }
5626 CResult__u832APIErrorZPtr { err }
5630 result_ok: o.result_ok,
5634 impl Clone for CResult__u832APIErrorZ {
5635 fn clone(&self) -> Self {
5637 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
5638 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5641 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
5642 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5648 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
5649 /// but with all dynamically-allocated buffers duplicated in new buffers.
5650 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
5652 /// The contents of CResult_PaymentIdPaymentSendFailureZ
5653 pub union CResult_PaymentIdPaymentSendFailureZPtr {
5654 /// A pointer to the contents in the success state.
5655 /// Reading from this pointer when `result_ok` is not set is undefined.
5656 pub result: *mut crate::c_types::ThirtyTwoBytes,
5657 /// A pointer to the contents in the error state.
5658 /// Reading from this pointer when `result_ok` is set is undefined.
5659 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5662 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5663 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5664 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5665 pub struct CResult_PaymentIdPaymentSendFailureZ {
5666 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5667 /// `err` or `result` depending on the state of `result_ok`.
5668 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
5669 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5670 pub result_ok: bool,
5673 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
5674 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
5675 CResult_PaymentIdPaymentSendFailureZ {
5676 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5677 result: Box::into_raw(Box::new(o)),
5683 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
5684 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
5685 CResult_PaymentIdPaymentSendFailureZ {
5686 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5687 err: Box::into_raw(Box::new(e)),
5692 /// Checks if the given object is currently in the success state
5694 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
5698 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
5699 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
5700 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
5701 fn drop(&mut self) {
5703 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5704 let _ = unsafe { Box::from_raw(self.contents.result) };
5707 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5708 let _ = unsafe { Box::from_raw(self.contents.err) };
5713 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
5714 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5715 let contents = if o.result_ok {
5716 let result = unsafe { o.contents.result };
5717 unsafe { o.contents.result = core::ptr::null_mut() };
5718 CResult_PaymentIdPaymentSendFailureZPtr { result }
5720 let err = unsafe { o.contents.err };
5721 unsafe { o.contents.err = core::ptr::null_mut(); }
5722 CResult_PaymentIdPaymentSendFailureZPtr { err }
5726 result_ok: o.result_ok,
5730 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
5731 fn clone(&self) -> Self {
5733 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5734 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5737 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5738 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5744 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
5745 /// but with all dynamically-allocated buffers duplicated in new buffers.
5746 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
5748 /// The contents of CResult_NonePaymentSendFailureZ
5749 pub union CResult_NonePaymentSendFailureZPtr {
5750 /// Note that this value is always NULL, as there are no contents in the OK variant
5751 pub result: *mut core::ffi::c_void,
5752 /// A pointer to the contents in the error state.
5753 /// Reading from this pointer when `result_ok` is set is undefined.
5754 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5757 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5758 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5760 pub struct CResult_NonePaymentSendFailureZ {
5761 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5762 /// `err` or `result` depending on the state of `result_ok`.
5763 pub contents: CResult_NonePaymentSendFailureZPtr,
5764 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
5765 pub result_ok: bool,
5768 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
5769 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
5770 CResult_NonePaymentSendFailureZ {
5771 contents: CResult_NonePaymentSendFailureZPtr {
5772 result: core::ptr::null_mut(),
5778 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
5779 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
5780 CResult_NonePaymentSendFailureZ {
5781 contents: CResult_NonePaymentSendFailureZPtr {
5782 err: Box::into_raw(Box::new(e)),
5787 /// Checks if the given object is currently in the success state
5789 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
5793 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
5794 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
5795 impl Drop for CResult_NonePaymentSendFailureZ {
5796 fn drop(&mut self) {
5799 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5800 let _ = unsafe { Box::from_raw(self.contents.err) };
5805 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
5806 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5807 let contents = if o.result_ok {
5808 let _ = unsafe { Box::from_raw(o.contents.result) };
5809 o.contents.result = core::ptr::null_mut();
5810 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
5812 let err = unsafe { o.contents.err };
5813 unsafe { o.contents.err = core::ptr::null_mut(); }
5814 CResult_NonePaymentSendFailureZPtr { err }
5818 result_ok: o.result_ok,
5822 impl Clone for CResult_NonePaymentSendFailureZ {
5823 fn clone(&self) -> Self {
5825 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
5826 result: core::ptr::null_mut()
5829 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
5830 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5836 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
5837 /// but with all dynamically-allocated buffers duplicated in new buffers.
5838 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
5840 /// A tuple of 2 elements. See the individual fields for the types contained.
5841 pub struct C2Tuple_PaymentHashPaymentIdZ {
5842 /// The element at position 0
5843 pub a: crate::c_types::ThirtyTwoBytes,
5844 /// The element at position 1
5845 pub b: crate::c_types::ThirtyTwoBytes,
5847 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
5848 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5855 impl C2Tuple_PaymentHashPaymentIdZ {
5856 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5860 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
5861 fn clone(&self) -> Self {
5863 a: Clone::clone(&self.a),
5864 b: Clone::clone(&self.b),
5869 /// Creates a new tuple which has the same data as `orig`
5870 /// but with all dynamically-allocated buffers duplicated in new buffers.
5871 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
5872 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
5874 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
5875 C2Tuple_PaymentHashPaymentIdZ { a, b, }
5879 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
5880 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
5882 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5883 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5884 /// A pointer to the contents in the success state.
5885 /// Reading from this pointer when `result_ok` is not set is undefined.
5886 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
5887 /// A pointer to the contents in the error state.
5888 /// Reading from this pointer when `result_ok` is set is undefined.
5889 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5892 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5893 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5895 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5896 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5897 /// `err` or `result` depending on the state of `result_ok`.
5898 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
5899 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5900 pub result_ok: bool,
5903 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
5904 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5905 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5906 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5907 result: Box::into_raw(Box::new(o)),
5913 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
5914 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5915 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5916 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5917 err: Box::into_raw(Box::new(e)),
5922 /// Checks if the given object is currently in the success state
5924 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
5928 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
5929 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
5930 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5931 fn drop(&mut self) {
5933 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5934 let _ = unsafe { Box::from_raw(self.contents.result) };
5937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5938 let _ = unsafe { Box::from_raw(self.contents.err) };
5943 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5944 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5945 let contents = if o.result_ok {
5946 let result = unsafe { o.contents.result };
5947 unsafe { o.contents.result = core::ptr::null_mut() };
5948 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
5950 let err = unsafe { o.contents.err };
5951 unsafe { o.contents.err = core::ptr::null_mut(); }
5952 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
5956 result_ok: o.result_ok,
5960 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5961 fn clone(&self) -> Self {
5963 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5964 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
5967 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5968 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5974 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
5975 /// but with all dynamically-allocated buffers duplicated in new buffers.
5976 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
5978 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5979 /// This corresponds to std::vector in C++
5980 pub struct CVec_NetAddressZ {
5981 /// The elements in the array.
5982 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5983 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5984 /// The number of elements pointed to by `data`.
5987 impl CVec_NetAddressZ {
5988 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5989 if self.datalen == 0 { return Vec::new(); }
5990 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5991 self.data = core::ptr::null_mut();
5995 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5996 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5999 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6000 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6001 let datalen = v.len();
6002 let data = Box::into_raw(v.into_boxed_slice());
6003 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6007 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6008 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6009 impl Drop for CVec_NetAddressZ {
6010 fn drop(&mut self) {
6011 if self.datalen == 0 { return; }
6012 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6015 impl Clone for CVec_NetAddressZ {
6016 fn clone(&self) -> Self {
6017 let mut res = Vec::new();
6018 if self.datalen == 0 { return Self::from(res); }
6019 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6024 /// A tuple of 2 elements. See the individual fields for the types contained.
6025 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6026 /// The element at position 0
6027 pub a: crate::c_types::ThirtyTwoBytes,
6028 /// The element at position 1
6029 pub b: crate::c_types::ThirtyTwoBytes,
6031 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6032 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6039 impl C2Tuple_PaymentHashPaymentSecretZ {
6040 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6044 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6045 fn clone(&self) -> Self {
6047 a: Clone::clone(&self.a),
6048 b: Clone::clone(&self.b),
6053 /// Creates a new tuple which has the same data as `orig`
6054 /// but with all dynamically-allocated buffers duplicated in new buffers.
6055 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6056 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6058 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6059 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6063 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6064 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6066 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6067 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6068 /// A pointer to the contents in the success state.
6069 /// Reading from this pointer when `result_ok` is not set is undefined.
6070 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6071 /// Note that this value is always NULL, as there are no contents in the Err variant
6072 pub err: *mut core::ffi::c_void,
6075 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6076 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6078 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6079 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6080 /// `err` or `result` depending on the state of `result_ok`.
6081 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6082 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6083 pub result_ok: bool,
6086 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6087 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6088 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6089 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6090 result: Box::into_raw(Box::new(o)),
6096 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6097 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6098 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6099 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6100 err: core::ptr::null_mut(),
6105 /// Checks if the given object is currently in the success state
6107 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6111 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6112 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6113 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6114 fn drop(&mut self) {
6116 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6117 let _ = unsafe { Box::from_raw(self.contents.result) };
6123 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6124 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6125 let contents = if o.result_ok {
6126 let result = unsafe { o.contents.result };
6127 unsafe { o.contents.result = core::ptr::null_mut() };
6128 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6130 let _ = unsafe { Box::from_raw(o.contents.err) };
6131 o.contents.err = core::ptr::null_mut();
6132 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6136 result_ok: o.result_ok,
6140 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6141 fn clone(&self) -> Self {
6143 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6144 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6147 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6148 err: core::ptr::null_mut()
6154 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6155 /// but with all dynamically-allocated buffers duplicated in new buffers.
6156 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6158 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6159 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6160 /// A pointer to the contents in the success state.
6161 /// Reading from this pointer when `result_ok` is not set is undefined.
6162 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6163 /// A pointer to the contents in the error state.
6164 /// Reading from this pointer when `result_ok` is set is undefined.
6165 pub err: *mut crate::lightning::util::errors::APIError,
6168 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6169 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6170 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6171 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6172 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6173 /// `err` or `result` depending on the state of `result_ok`.
6174 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6175 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6176 pub result_ok: bool,
6179 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6180 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6181 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6182 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6183 result: Box::into_raw(Box::new(o)),
6189 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6190 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6191 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6192 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6193 err: Box::into_raw(Box::new(e)),
6198 /// Checks if the given object is currently in the success state
6200 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6204 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6205 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6206 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6207 fn drop(&mut self) {
6209 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6210 let _ = unsafe { Box::from_raw(self.contents.result) };
6213 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6214 let _ = unsafe { Box::from_raw(self.contents.err) };
6219 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6220 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6221 let contents = if o.result_ok {
6222 let result = unsafe { o.contents.result };
6223 unsafe { o.contents.result = core::ptr::null_mut() };
6224 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6226 let err = unsafe { o.contents.err };
6227 unsafe { o.contents.err = core::ptr::null_mut(); }
6228 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6232 result_ok: o.result_ok,
6236 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6237 fn clone(&self) -> Self {
6239 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6240 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6243 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6244 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6250 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6251 /// but with all dynamically-allocated buffers duplicated in new buffers.
6252 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6254 /// The contents of CResult_PaymentSecretNoneZ
6255 pub union CResult_PaymentSecretNoneZPtr {
6256 /// A pointer to the contents in the success state.
6257 /// Reading from this pointer when `result_ok` is not set is undefined.
6258 pub result: *mut crate::c_types::ThirtyTwoBytes,
6259 /// Note that this value is always NULL, as there are no contents in the Err variant
6260 pub err: *mut core::ffi::c_void,
6263 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6264 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6265 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6266 pub struct CResult_PaymentSecretNoneZ {
6267 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6268 /// `err` or `result` depending on the state of `result_ok`.
6269 pub contents: CResult_PaymentSecretNoneZPtr,
6270 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6271 pub result_ok: bool,
6274 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6275 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6276 CResult_PaymentSecretNoneZ {
6277 contents: CResult_PaymentSecretNoneZPtr {
6278 result: Box::into_raw(Box::new(o)),
6284 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6285 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6286 CResult_PaymentSecretNoneZ {
6287 contents: CResult_PaymentSecretNoneZPtr {
6288 err: core::ptr::null_mut(),
6293 /// Checks if the given object is currently in the success state
6295 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6299 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6300 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6301 impl Drop for CResult_PaymentSecretNoneZ {
6302 fn drop(&mut self) {
6304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6305 let _ = unsafe { Box::from_raw(self.contents.result) };
6311 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6312 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6313 let contents = if o.result_ok {
6314 let result = unsafe { o.contents.result };
6315 unsafe { o.contents.result = core::ptr::null_mut() };
6316 CResult_PaymentSecretNoneZPtr { result }
6318 let _ = unsafe { Box::from_raw(o.contents.err) };
6319 o.contents.err = core::ptr::null_mut();
6320 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
6324 result_ok: o.result_ok,
6328 impl Clone for CResult_PaymentSecretNoneZ {
6329 fn clone(&self) -> Self {
6331 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
6332 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6335 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
6336 err: core::ptr::null_mut()
6342 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
6343 /// but with all dynamically-allocated buffers duplicated in new buffers.
6344 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
6346 /// The contents of CResult_PaymentSecretAPIErrorZ
6347 pub union CResult_PaymentSecretAPIErrorZPtr {
6348 /// A pointer to the contents in the success state.
6349 /// Reading from this pointer when `result_ok` is not set is undefined.
6350 pub result: *mut crate::c_types::ThirtyTwoBytes,
6351 /// A pointer to the contents in the error state.
6352 /// Reading from this pointer when `result_ok` is set is undefined.
6353 pub err: *mut crate::lightning::util::errors::APIError,
6356 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6357 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6359 pub struct CResult_PaymentSecretAPIErrorZ {
6360 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6361 /// `err` or `result` depending on the state of `result_ok`.
6362 pub contents: CResult_PaymentSecretAPIErrorZPtr,
6363 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6364 pub result_ok: bool,
6367 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
6368 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
6369 CResult_PaymentSecretAPIErrorZ {
6370 contents: CResult_PaymentSecretAPIErrorZPtr {
6371 result: Box::into_raw(Box::new(o)),
6377 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
6378 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
6379 CResult_PaymentSecretAPIErrorZ {
6380 contents: CResult_PaymentSecretAPIErrorZPtr {
6381 err: Box::into_raw(Box::new(e)),
6386 /// Checks if the given object is currently in the success state
6388 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
6392 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
6393 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
6394 impl Drop for CResult_PaymentSecretAPIErrorZ {
6395 fn drop(&mut self) {
6397 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6398 let _ = unsafe { Box::from_raw(self.contents.result) };
6401 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6402 let _ = unsafe { Box::from_raw(self.contents.err) };
6407 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
6408 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6409 let contents = if o.result_ok {
6410 let result = unsafe { o.contents.result };
6411 unsafe { o.contents.result = core::ptr::null_mut() };
6412 CResult_PaymentSecretAPIErrorZPtr { result }
6414 let err = unsafe { o.contents.err };
6415 unsafe { o.contents.err = core::ptr::null_mut(); }
6416 CResult_PaymentSecretAPIErrorZPtr { err }
6420 result_ok: o.result_ok,
6424 impl Clone for CResult_PaymentSecretAPIErrorZ {
6425 fn clone(&self) -> Self {
6427 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
6428 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6431 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
6432 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6438 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
6439 /// but with all dynamically-allocated buffers duplicated in new buffers.
6440 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
6442 /// The contents of CResult_PaymentPreimageAPIErrorZ
6443 pub union CResult_PaymentPreimageAPIErrorZPtr {
6444 /// A pointer to the contents in the success state.
6445 /// Reading from this pointer when `result_ok` is not set is undefined.
6446 pub result: *mut crate::c_types::ThirtyTwoBytes,
6447 /// A pointer to the contents in the error state.
6448 /// Reading from this pointer when `result_ok` is set is undefined.
6449 pub err: *mut crate::lightning::util::errors::APIError,
6452 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
6453 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6454 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6455 pub struct CResult_PaymentPreimageAPIErrorZ {
6456 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
6457 /// `err` or `result` depending on the state of `result_ok`.
6458 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
6459 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
6460 pub result_ok: bool,
6463 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
6464 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
6465 CResult_PaymentPreimageAPIErrorZ {
6466 contents: CResult_PaymentPreimageAPIErrorZPtr {
6467 result: Box::into_raw(Box::new(o)),
6473 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
6474 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
6475 CResult_PaymentPreimageAPIErrorZ {
6476 contents: CResult_PaymentPreimageAPIErrorZPtr {
6477 err: Box::into_raw(Box::new(e)),
6482 /// Checks if the given object is currently in the success state
6484 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
6488 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
6489 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
6490 impl Drop for CResult_PaymentPreimageAPIErrorZ {
6491 fn drop(&mut self) {
6493 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6494 let _ = unsafe { Box::from_raw(self.contents.result) };
6497 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6498 let _ = unsafe { Box::from_raw(self.contents.err) };
6503 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
6504 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6505 let contents = if o.result_ok {
6506 let result = unsafe { o.contents.result };
6507 unsafe { o.contents.result = core::ptr::null_mut() };
6508 CResult_PaymentPreimageAPIErrorZPtr { result }
6510 let err = unsafe { o.contents.err };
6511 unsafe { o.contents.err = core::ptr::null_mut(); }
6512 CResult_PaymentPreimageAPIErrorZPtr { err }
6516 result_ok: o.result_ok,
6520 impl Clone for CResult_PaymentPreimageAPIErrorZ {
6521 fn clone(&self) -> Self {
6523 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
6524 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6527 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
6528 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6534 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
6535 /// but with all dynamically-allocated buffers duplicated in new buffers.
6536 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
6538 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6539 /// This corresponds to std::vector in C++
6540 pub struct CVec_ChannelMonitorZ {
6541 /// The elements in the array.
6542 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6543 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
6544 /// The number of elements pointed to by `data`.
6547 impl CVec_ChannelMonitorZ {
6548 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
6549 if self.datalen == 0 { return Vec::new(); }
6550 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6551 self.data = core::ptr::null_mut();
6555 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
6556 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6559 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
6560 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
6561 let datalen = v.len();
6562 let data = Box::into_raw(v.into_boxed_slice());
6563 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6567 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6568 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
6569 impl Drop for CVec_ChannelMonitorZ {
6570 fn drop(&mut self) {
6571 if self.datalen == 0 { return; }
6572 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6576 /// A tuple of 2 elements. See the individual fields for the types contained.
6577 pub struct C2Tuple_BlockHashChannelManagerZ {
6578 /// The element at position 0
6579 pub a: crate::c_types::ThirtyTwoBytes,
6580 /// The element at position 1
6581 pub b: crate::lightning::ln::channelmanager::ChannelManager,
6583 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
6584 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
6591 impl C2Tuple_BlockHashChannelManagerZ {
6592 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
6596 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
6598 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
6599 C2Tuple_BlockHashChannelManagerZ { a, b, }
6603 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
6604 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
6606 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6607 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6608 /// A pointer to the contents in the success state.
6609 /// Reading from this pointer when `result_ok` is not set is undefined.
6610 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
6611 /// A pointer to the contents in the error state.
6612 /// Reading from this pointer when `result_ok` is set is undefined.
6613 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6616 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6617 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6619 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6620 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6621 /// `err` or `result` depending on the state of `result_ok`.
6622 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
6623 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6624 pub result_ok: bool,
6627 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
6628 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6629 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6630 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6631 result: Box::into_raw(Box::new(o)),
6637 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
6638 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6639 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6640 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6641 err: Box::into_raw(Box::new(e)),
6646 /// Checks if the given object is currently in the success state
6648 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
6652 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
6653 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
6654 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6655 fn drop(&mut self) {
6657 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6658 let _ = unsafe { Box::from_raw(self.contents.result) };
6661 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6662 let _ = unsafe { Box::from_raw(self.contents.err) };
6667 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6668 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6669 let contents = if o.result_ok {
6670 let result = unsafe { o.contents.result };
6671 unsafe { o.contents.result = core::ptr::null_mut() };
6672 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
6674 let err = unsafe { o.contents.err };
6675 unsafe { o.contents.err = core::ptr::null_mut(); }
6676 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
6680 result_ok: o.result_ok,
6685 /// The contents of CResult_ChannelConfigDecodeErrorZ
6686 pub union CResult_ChannelConfigDecodeErrorZPtr {
6687 /// A pointer to the contents in the success state.
6688 /// Reading from this pointer when `result_ok` is not set is undefined.
6689 pub result: *mut crate::lightning::util::config::ChannelConfig,
6690 /// A pointer to the contents in the error state.
6691 /// Reading from this pointer when `result_ok` is set is undefined.
6692 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6695 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6696 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6697 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6698 pub struct CResult_ChannelConfigDecodeErrorZ {
6699 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6700 /// `err` or `result` depending on the state of `result_ok`.
6701 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
6702 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6703 pub result_ok: bool,
6706 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
6707 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
6708 CResult_ChannelConfigDecodeErrorZ {
6709 contents: CResult_ChannelConfigDecodeErrorZPtr {
6710 result: Box::into_raw(Box::new(o)),
6716 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
6717 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
6718 CResult_ChannelConfigDecodeErrorZ {
6719 contents: CResult_ChannelConfigDecodeErrorZPtr {
6720 err: Box::into_raw(Box::new(e)),
6725 /// Checks if the given object is currently in the success state
6727 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
6731 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
6732 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
6733 impl Drop for CResult_ChannelConfigDecodeErrorZ {
6734 fn drop(&mut self) {
6736 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6737 let _ = unsafe { Box::from_raw(self.contents.result) };
6740 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6741 let _ = unsafe { Box::from_raw(self.contents.err) };
6746 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
6747 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
6748 let contents = if o.result_ok {
6749 let result = unsafe { o.contents.result };
6750 unsafe { o.contents.result = core::ptr::null_mut() };
6751 CResult_ChannelConfigDecodeErrorZPtr { result }
6753 let err = unsafe { o.contents.err };
6754 unsafe { o.contents.err = core::ptr::null_mut(); }
6755 CResult_ChannelConfigDecodeErrorZPtr { err }
6759 result_ok: o.result_ok,
6763 impl Clone for CResult_ChannelConfigDecodeErrorZ {
6764 fn clone(&self) -> Self {
6766 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
6767 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
6770 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
6771 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6777 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
6778 /// but with all dynamically-allocated buffers duplicated in new buffers.
6779 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
6781 /// The contents of CResult_OutPointDecodeErrorZ
6782 pub union CResult_OutPointDecodeErrorZPtr {
6783 /// A pointer to the contents in the success state.
6784 /// Reading from this pointer when `result_ok` is not set is undefined.
6785 pub result: *mut crate::lightning::chain::transaction::OutPoint,
6786 /// A pointer to the contents in the error state.
6787 /// Reading from this pointer when `result_ok` is set is undefined.
6788 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6791 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
6792 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
6793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6794 pub struct CResult_OutPointDecodeErrorZ {
6795 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
6796 /// `err` or `result` depending on the state of `result_ok`.
6797 pub contents: CResult_OutPointDecodeErrorZPtr,
6798 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
6799 pub result_ok: bool,
6802 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
6803 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
6804 CResult_OutPointDecodeErrorZ {
6805 contents: CResult_OutPointDecodeErrorZPtr {
6806 result: Box::into_raw(Box::new(o)),
6812 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
6813 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
6814 CResult_OutPointDecodeErrorZ {
6815 contents: CResult_OutPointDecodeErrorZPtr {
6816 err: Box::into_raw(Box::new(e)),
6821 /// Checks if the given object is currently in the success state
6823 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
6827 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
6828 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
6829 impl Drop for CResult_OutPointDecodeErrorZ {
6830 fn drop(&mut self) {
6832 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6833 let _ = unsafe { Box::from_raw(self.contents.result) };
6836 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6837 let _ = unsafe { Box::from_raw(self.contents.err) };
6842 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
6843 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
6844 let contents = if o.result_ok {
6845 let result = unsafe { o.contents.result };
6846 unsafe { o.contents.result = core::ptr::null_mut() };
6847 CResult_OutPointDecodeErrorZPtr { result }
6849 let err = unsafe { o.contents.err };
6850 unsafe { o.contents.err = core::ptr::null_mut(); }
6851 CResult_OutPointDecodeErrorZPtr { err }
6855 result_ok: o.result_ok,
6859 impl Clone for CResult_OutPointDecodeErrorZ {
6860 fn clone(&self) -> Self {
6862 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
6863 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
6866 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
6867 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6873 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
6874 /// but with all dynamically-allocated buffers duplicated in new buffers.
6875 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
6877 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
6878 pub enum COption_TypeZ {
6879 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
6880 Some(crate::lightning::ln::wire::Type),
6881 /// When we're in this state, this COption_TypeZ contains nothing
6884 impl COption_TypeZ {
6885 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6886 if let Self::None = self { false } else { true }
6888 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6891 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
6892 if let Self::Some(v) = self { v } else { unreachable!() }
6896 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
6897 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
6898 COption_TypeZ::Some(o)
6901 /// Constructs a new COption_TypeZ containing nothing
6902 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
6906 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
6907 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
6909 /// The contents of CResult_COption_TypeZDecodeErrorZ
6910 pub union CResult_COption_TypeZDecodeErrorZPtr {
6911 /// A pointer to the contents in the success state.
6912 /// Reading from this pointer when `result_ok` is not set is undefined.
6913 pub result: *mut crate::c_types::derived::COption_TypeZ,
6914 /// A pointer to the contents in the error state.
6915 /// Reading from this pointer when `result_ok` is set is undefined.
6916 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6919 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
6920 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6921 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6922 pub struct CResult_COption_TypeZDecodeErrorZ {
6923 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
6924 /// `err` or `result` depending on the state of `result_ok`.
6925 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
6926 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
6927 pub result_ok: bool,
6930 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
6931 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
6932 CResult_COption_TypeZDecodeErrorZ {
6933 contents: CResult_COption_TypeZDecodeErrorZPtr {
6934 result: Box::into_raw(Box::new(o)),
6940 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
6941 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
6942 CResult_COption_TypeZDecodeErrorZ {
6943 contents: CResult_COption_TypeZDecodeErrorZPtr {
6944 err: Box::into_raw(Box::new(e)),
6949 /// Checks if the given object is currently in the success state
6951 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
6955 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
6956 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
6957 impl Drop for CResult_COption_TypeZDecodeErrorZ {
6958 fn drop(&mut self) {
6960 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6961 let _ = unsafe { Box::from_raw(self.contents.result) };
6964 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6965 let _ = unsafe { Box::from_raw(self.contents.err) };
6970 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
6971 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6972 let contents = if o.result_ok {
6973 let result = unsafe { o.contents.result };
6974 unsafe { o.contents.result = core::ptr::null_mut() };
6975 CResult_COption_TypeZDecodeErrorZPtr { result }
6977 let err = unsafe { o.contents.err };
6978 unsafe { o.contents.err = core::ptr::null_mut(); }
6979 CResult_COption_TypeZDecodeErrorZPtr { err }
6983 result_ok: o.result_ok,
6988 /// The contents of CResult_PaymentIdPaymentErrorZ
6989 pub union CResult_PaymentIdPaymentErrorZPtr {
6990 /// A pointer to the contents in the success state.
6991 /// Reading from this pointer when `result_ok` is not set is undefined.
6992 pub result: *mut crate::c_types::ThirtyTwoBytes,
6993 /// A pointer to the contents in the error state.
6994 /// Reading from this pointer when `result_ok` is set is undefined.
6995 pub err: *mut crate::lightning_invoice::payment::PaymentError,
6998 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
6999 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7000 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7001 pub struct CResult_PaymentIdPaymentErrorZ {
7002 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7003 /// `err` or `result` depending on the state of `result_ok`.
7004 pub contents: CResult_PaymentIdPaymentErrorZPtr,
7005 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7006 pub result_ok: bool,
7009 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
7010 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
7011 CResult_PaymentIdPaymentErrorZ {
7012 contents: CResult_PaymentIdPaymentErrorZPtr {
7013 result: Box::into_raw(Box::new(o)),
7019 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
7020 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
7021 CResult_PaymentIdPaymentErrorZ {
7022 contents: CResult_PaymentIdPaymentErrorZPtr {
7023 err: Box::into_raw(Box::new(e)),
7028 /// Checks if the given object is currently in the success state
7030 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
7034 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
7035 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
7036 impl Drop for CResult_PaymentIdPaymentErrorZ {
7037 fn drop(&mut self) {
7039 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7040 let _ = unsafe { Box::from_raw(self.contents.result) };
7043 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7044 let _ = unsafe { Box::from_raw(self.contents.err) };
7049 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
7050 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
7051 let contents = if o.result_ok {
7052 let result = unsafe { o.contents.result };
7053 unsafe { o.contents.result = core::ptr::null_mut() };
7054 CResult_PaymentIdPaymentErrorZPtr { result }
7056 let err = unsafe { o.contents.err };
7057 unsafe { o.contents.err = core::ptr::null_mut(); }
7058 CResult_PaymentIdPaymentErrorZPtr { err }
7062 result_ok: o.result_ok,
7066 impl Clone for CResult_PaymentIdPaymentErrorZ {
7067 fn clone(&self) -> Self {
7069 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
7070 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7073 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
7074 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
7080 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
7081 /// but with all dynamically-allocated buffers duplicated in new buffers.
7082 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
7084 /// The contents of CResult_SiPrefixNoneZ
7085 pub union CResult_SiPrefixNoneZPtr {
7086 /// A pointer to the contents in the success state.
7087 /// Reading from this pointer when `result_ok` is not set is undefined.
7088 pub result: *mut crate::lightning_invoice::SiPrefix,
7089 /// Note that this value is always NULL, as there are no contents in the Err variant
7090 pub err: *mut core::ffi::c_void,
7093 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
7094 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
7095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7096 pub struct CResult_SiPrefixNoneZ {
7097 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
7098 /// `err` or `result` depending on the state of `result_ok`.
7099 pub contents: CResult_SiPrefixNoneZPtr,
7100 /// Whether this CResult_SiPrefixNoneZ represents a success state.
7101 pub result_ok: bool,
7104 /// Creates a new CResult_SiPrefixNoneZ in the success state.
7105 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
7106 CResult_SiPrefixNoneZ {
7107 contents: CResult_SiPrefixNoneZPtr {
7108 result: Box::into_raw(Box::new(o)),
7114 /// Creates a new CResult_SiPrefixNoneZ in the error state.
7115 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
7116 CResult_SiPrefixNoneZ {
7117 contents: CResult_SiPrefixNoneZPtr {
7118 err: core::ptr::null_mut(),
7123 /// Checks if the given object is currently in the success state
7125 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
7129 /// Frees any resources used by the CResult_SiPrefixNoneZ.
7130 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
7131 impl Drop for CResult_SiPrefixNoneZ {
7132 fn drop(&mut self) {
7134 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7135 let _ = unsafe { Box::from_raw(self.contents.result) };
7141 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
7142 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
7143 let contents = if o.result_ok {
7144 let result = unsafe { o.contents.result };
7145 unsafe { o.contents.result = core::ptr::null_mut() };
7146 CResult_SiPrefixNoneZPtr { result }
7148 let _ = unsafe { Box::from_raw(o.contents.err) };
7149 o.contents.err = core::ptr::null_mut();
7150 CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
7154 result_ok: o.result_ok,
7158 impl Clone for CResult_SiPrefixNoneZ {
7159 fn clone(&self) -> Self {
7161 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
7162 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
7165 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
7166 err: core::ptr::null_mut()
7172 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
7173 /// but with all dynamically-allocated buffers duplicated in new buffers.
7174 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
7176 /// The contents of CResult_InvoiceNoneZ
7177 pub union CResult_InvoiceNoneZPtr {
7178 /// A pointer to the contents in the success state.
7179 /// Reading from this pointer when `result_ok` is not set is undefined.
7180 pub result: *mut crate::lightning_invoice::Invoice,
7181 /// Note that this value is always NULL, as there are no contents in the Err variant
7182 pub err: *mut core::ffi::c_void,
7185 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
7186 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
7187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7188 pub struct CResult_InvoiceNoneZ {
7189 /// The contents of this CResult_InvoiceNoneZ, accessible via either
7190 /// `err` or `result` depending on the state of `result_ok`.
7191 pub contents: CResult_InvoiceNoneZPtr,
7192 /// Whether this CResult_InvoiceNoneZ represents a success state.
7193 pub result_ok: bool,
7196 /// Creates a new CResult_InvoiceNoneZ in the success state.
7197 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
7198 CResult_InvoiceNoneZ {
7199 contents: CResult_InvoiceNoneZPtr {
7200 result: Box::into_raw(Box::new(o)),
7206 /// Creates a new CResult_InvoiceNoneZ in the error state.
7207 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
7208 CResult_InvoiceNoneZ {
7209 contents: CResult_InvoiceNoneZPtr {
7210 err: core::ptr::null_mut(),
7215 /// Checks if the given object is currently in the success state
7217 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
7221 /// Frees any resources used by the CResult_InvoiceNoneZ.
7222 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
7223 impl Drop for CResult_InvoiceNoneZ {
7224 fn drop(&mut self) {
7226 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7227 let _ = unsafe { Box::from_raw(self.contents.result) };
7233 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
7234 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
7235 let contents = if o.result_ok {
7236 let result = unsafe { o.contents.result };
7237 unsafe { o.contents.result = core::ptr::null_mut() };
7238 CResult_InvoiceNoneZPtr { result }
7240 let _ = unsafe { Box::from_raw(o.contents.err) };
7241 o.contents.err = core::ptr::null_mut();
7242 CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
7246 result_ok: o.result_ok,
7250 impl Clone for CResult_InvoiceNoneZ {
7251 fn clone(&self) -> Self {
7253 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
7254 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
7257 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
7258 err: core::ptr::null_mut()
7264 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
7265 /// but with all dynamically-allocated buffers duplicated in new buffers.
7266 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
7268 /// The contents of CResult_SignedRawInvoiceNoneZ
7269 pub union CResult_SignedRawInvoiceNoneZPtr {
7270 /// A pointer to the contents in the success state.
7271 /// Reading from this pointer when `result_ok` is not set is undefined.
7272 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
7273 /// Note that this value is always NULL, as there are no contents in the Err variant
7274 pub err: *mut core::ffi::c_void,
7277 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
7278 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
7279 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7280 pub struct CResult_SignedRawInvoiceNoneZ {
7281 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
7282 /// `err` or `result` depending on the state of `result_ok`.
7283 pub contents: CResult_SignedRawInvoiceNoneZPtr,
7284 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
7285 pub result_ok: bool,
7288 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
7289 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
7290 CResult_SignedRawInvoiceNoneZ {
7291 contents: CResult_SignedRawInvoiceNoneZPtr {
7292 result: Box::into_raw(Box::new(o)),
7298 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
7299 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
7300 CResult_SignedRawInvoiceNoneZ {
7301 contents: CResult_SignedRawInvoiceNoneZPtr {
7302 err: core::ptr::null_mut(),
7307 /// Checks if the given object is currently in the success state
7309 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
7313 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
7314 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
7315 impl Drop for CResult_SignedRawInvoiceNoneZ {
7316 fn drop(&mut self) {
7318 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7319 let _ = unsafe { Box::from_raw(self.contents.result) };
7325 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
7326 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
7327 let contents = if o.result_ok {
7328 let result = unsafe { o.contents.result };
7329 unsafe { o.contents.result = core::ptr::null_mut() };
7330 CResult_SignedRawInvoiceNoneZPtr { result }
7332 let _ = unsafe { Box::from_raw(o.contents.err) };
7333 o.contents.err = core::ptr::null_mut();
7334 CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
7338 result_ok: o.result_ok,
7342 impl Clone for CResult_SignedRawInvoiceNoneZ {
7343 fn clone(&self) -> Self {
7345 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
7346 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
7349 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
7350 err: core::ptr::null_mut()
7356 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
7357 /// but with all dynamically-allocated buffers duplicated in new buffers.
7358 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
7360 /// A tuple of 3 elements. See the individual fields for the types contained.
7361 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7362 /// The element at position 0
7363 pub a: crate::lightning_invoice::RawInvoice,
7364 /// The element at position 1
7365 pub b: crate::c_types::ThirtyTwoBytes,
7366 /// The element at position 2
7367 pub c: crate::lightning_invoice::InvoiceSignature,
7369 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7370 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
7378 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7379 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
7380 (self.a, self.b, self.c)
7383 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7384 fn clone(&self) -> Self {
7386 a: Clone::clone(&self.a),
7387 b: Clone::clone(&self.b),
7388 c: Clone::clone(&self.c),
7393 /// Creates a new tuple which has the same data as `orig`
7394 /// but with all dynamically-allocated buffers duplicated in new buffers.
7395 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
7396 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
7398 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 {
7399 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
7403 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
7404 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
7406 /// The contents of CResult_PayeePubKeyErrorZ
7407 pub union CResult_PayeePubKeyErrorZPtr {
7408 /// A pointer to the contents in the success state.
7409 /// Reading from this pointer when `result_ok` is not set is undefined.
7410 pub result: *mut crate::lightning_invoice::PayeePubKey,
7411 /// A pointer to the contents in the error state.
7412 /// Reading from this pointer when `result_ok` is set is undefined.
7413 pub err: *mut crate::c_types::Secp256k1Error,
7416 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
7417 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
7418 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7419 pub struct CResult_PayeePubKeyErrorZ {
7420 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
7421 /// `err` or `result` depending on the state of `result_ok`.
7422 pub contents: CResult_PayeePubKeyErrorZPtr,
7423 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
7424 pub result_ok: bool,
7427 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
7428 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
7429 CResult_PayeePubKeyErrorZ {
7430 contents: CResult_PayeePubKeyErrorZPtr {
7431 result: Box::into_raw(Box::new(o)),
7437 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
7438 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
7439 CResult_PayeePubKeyErrorZ {
7440 contents: CResult_PayeePubKeyErrorZPtr {
7441 err: Box::into_raw(Box::new(e)),
7446 /// Checks if the given object is currently in the success state
7448 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
7452 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
7453 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
7454 impl Drop for CResult_PayeePubKeyErrorZ {
7455 fn drop(&mut self) {
7457 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7458 let _ = unsafe { Box::from_raw(self.contents.result) };
7461 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7462 let _ = unsafe { Box::from_raw(self.contents.err) };
7467 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
7468 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
7469 let contents = if o.result_ok {
7470 let result = unsafe { o.contents.result };
7471 unsafe { o.contents.result = core::ptr::null_mut() };
7472 CResult_PayeePubKeyErrorZPtr { result }
7474 let err = unsafe { o.contents.err };
7475 unsafe { o.contents.err = core::ptr::null_mut(); }
7476 CResult_PayeePubKeyErrorZPtr { err }
7480 result_ok: o.result_ok,
7484 impl Clone for CResult_PayeePubKeyErrorZ {
7485 fn clone(&self) -> Self {
7487 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
7488 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
7491 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
7492 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
7498 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
7499 /// but with all dynamically-allocated buffers duplicated in new buffers.
7500 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
7502 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
7503 /// This corresponds to std::vector in C++
7504 pub struct CVec_PrivateRouteZ {
7505 /// The elements in the array.
7506 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7507 pub data: *mut crate::lightning_invoice::PrivateRoute,
7508 /// The number of elements pointed to by `data`.
7511 impl CVec_PrivateRouteZ {
7512 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
7513 if self.datalen == 0 { return Vec::new(); }
7514 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7515 self.data = core::ptr::null_mut();
7519 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
7520 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7523 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
7524 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
7525 let datalen = v.len();
7526 let data = Box::into_raw(v.into_boxed_slice());
7527 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7531 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7532 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
7533 impl Drop for CVec_PrivateRouteZ {
7534 fn drop(&mut self) {
7535 if self.datalen == 0 { return; }
7536 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7539 impl Clone for CVec_PrivateRouteZ {
7540 fn clone(&self) -> Self {
7541 let mut res = Vec::new();
7542 if self.datalen == 0 { return Self::from(res); }
7543 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7548 /// The contents of CResult_PositiveTimestampCreationErrorZ
7549 pub union CResult_PositiveTimestampCreationErrorZPtr {
7550 /// A pointer to the contents in the success state.
7551 /// Reading from this pointer when `result_ok` is not set is undefined.
7552 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
7553 /// A pointer to the contents in the error state.
7554 /// Reading from this pointer when `result_ok` is set is undefined.
7555 pub err: *mut crate::lightning_invoice::CreationError,
7558 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
7559 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
7560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7561 pub struct CResult_PositiveTimestampCreationErrorZ {
7562 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
7563 /// `err` or `result` depending on the state of `result_ok`.
7564 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
7565 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
7566 pub result_ok: bool,
7569 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
7570 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
7571 CResult_PositiveTimestampCreationErrorZ {
7572 contents: CResult_PositiveTimestampCreationErrorZPtr {
7573 result: Box::into_raw(Box::new(o)),
7579 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
7580 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
7581 CResult_PositiveTimestampCreationErrorZ {
7582 contents: CResult_PositiveTimestampCreationErrorZPtr {
7583 err: Box::into_raw(Box::new(e)),
7588 /// Checks if the given object is currently in the success state
7590 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
7594 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
7595 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
7596 impl Drop for CResult_PositiveTimestampCreationErrorZ {
7597 fn drop(&mut self) {
7599 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7600 let _ = unsafe { Box::from_raw(self.contents.result) };
7603 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7604 let _ = unsafe { Box::from_raw(self.contents.err) };
7609 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
7610 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
7611 let contents = if o.result_ok {
7612 let result = unsafe { o.contents.result };
7613 unsafe { o.contents.result = core::ptr::null_mut() };
7614 CResult_PositiveTimestampCreationErrorZPtr { result }
7616 let err = unsafe { o.contents.err };
7617 unsafe { o.contents.err = core::ptr::null_mut(); }
7618 CResult_PositiveTimestampCreationErrorZPtr { err }
7622 result_ok: o.result_ok,
7626 impl Clone for CResult_PositiveTimestampCreationErrorZ {
7627 fn clone(&self) -> Self {
7629 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
7630 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
7633 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
7634 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7640 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
7641 /// but with all dynamically-allocated buffers duplicated in new buffers.
7642 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
7644 /// The contents of CResult_NoneSemanticErrorZ
7645 pub union CResult_NoneSemanticErrorZPtr {
7646 /// Note that this value is always NULL, as there are no contents in the OK variant
7647 pub result: *mut core::ffi::c_void,
7648 /// A pointer to the contents in the error state.
7649 /// Reading from this pointer when `result_ok` is set is undefined.
7650 pub err: *mut crate::lightning_invoice::SemanticError,
7653 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
7654 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
7655 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7656 pub struct CResult_NoneSemanticErrorZ {
7657 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
7658 /// `err` or `result` depending on the state of `result_ok`.
7659 pub contents: CResult_NoneSemanticErrorZPtr,
7660 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
7661 pub result_ok: bool,
7664 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
7665 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
7666 CResult_NoneSemanticErrorZ {
7667 contents: CResult_NoneSemanticErrorZPtr {
7668 result: core::ptr::null_mut(),
7674 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
7675 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
7676 CResult_NoneSemanticErrorZ {
7677 contents: CResult_NoneSemanticErrorZPtr {
7678 err: Box::into_raw(Box::new(e)),
7683 /// Checks if the given object is currently in the success state
7685 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
7689 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
7690 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
7691 impl Drop for CResult_NoneSemanticErrorZ {
7692 fn drop(&mut self) {
7695 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7696 let _ = unsafe { Box::from_raw(self.contents.err) };
7701 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
7702 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
7703 let contents = if o.result_ok {
7704 let _ = unsafe { Box::from_raw(o.contents.result) };
7705 o.contents.result = core::ptr::null_mut();
7706 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
7708 let err = unsafe { o.contents.err };
7709 unsafe { o.contents.err = core::ptr::null_mut(); }
7710 CResult_NoneSemanticErrorZPtr { err }
7714 result_ok: o.result_ok,
7718 impl Clone for CResult_NoneSemanticErrorZ {
7719 fn clone(&self) -> Self {
7721 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
7722 result: core::ptr::null_mut()
7725 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
7726 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7732 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
7733 /// but with all dynamically-allocated buffers duplicated in new buffers.
7734 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
7736 /// The contents of CResult_InvoiceSemanticErrorZ
7737 pub union CResult_InvoiceSemanticErrorZPtr {
7738 /// A pointer to the contents in the success state.
7739 /// Reading from this pointer when `result_ok` is not set is undefined.
7740 pub result: *mut crate::lightning_invoice::Invoice,
7741 /// A pointer to the contents in the error state.
7742 /// Reading from this pointer when `result_ok` is set is undefined.
7743 pub err: *mut crate::lightning_invoice::SemanticError,
7746 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
7747 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
7748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7749 pub struct CResult_InvoiceSemanticErrorZ {
7750 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
7751 /// `err` or `result` depending on the state of `result_ok`.
7752 pub contents: CResult_InvoiceSemanticErrorZPtr,
7753 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
7754 pub result_ok: bool,
7757 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
7758 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
7759 CResult_InvoiceSemanticErrorZ {
7760 contents: CResult_InvoiceSemanticErrorZPtr {
7761 result: Box::into_raw(Box::new(o)),
7767 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
7768 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
7769 CResult_InvoiceSemanticErrorZ {
7770 contents: CResult_InvoiceSemanticErrorZPtr {
7771 err: Box::into_raw(Box::new(e)),
7776 /// Checks if the given object is currently in the success state
7778 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
7782 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
7783 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
7784 impl Drop for CResult_InvoiceSemanticErrorZ {
7785 fn drop(&mut self) {
7787 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7788 let _ = unsafe { Box::from_raw(self.contents.result) };
7791 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7792 let _ = unsafe { Box::from_raw(self.contents.err) };
7797 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
7798 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
7799 let contents = if o.result_ok {
7800 let result = unsafe { o.contents.result };
7801 unsafe { o.contents.result = core::ptr::null_mut() };
7802 CResult_InvoiceSemanticErrorZPtr { result }
7804 let err = unsafe { o.contents.err };
7805 unsafe { o.contents.err = core::ptr::null_mut(); }
7806 CResult_InvoiceSemanticErrorZPtr { err }
7810 result_ok: o.result_ok,
7814 impl Clone for CResult_InvoiceSemanticErrorZ {
7815 fn clone(&self) -> Self {
7817 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
7818 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
7821 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
7822 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7828 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
7829 /// but with all dynamically-allocated buffers duplicated in new buffers.
7830 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
7832 /// The contents of CResult_DescriptionCreationErrorZ
7833 pub union CResult_DescriptionCreationErrorZPtr {
7834 /// A pointer to the contents in the success state.
7835 /// Reading from this pointer when `result_ok` is not set is undefined.
7836 pub result: *mut crate::lightning_invoice::Description,
7837 /// A pointer to the contents in the error state.
7838 /// Reading from this pointer when `result_ok` is set is undefined.
7839 pub err: *mut crate::lightning_invoice::CreationError,
7842 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
7843 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
7844 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7845 pub struct CResult_DescriptionCreationErrorZ {
7846 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
7847 /// `err` or `result` depending on the state of `result_ok`.
7848 pub contents: CResult_DescriptionCreationErrorZPtr,
7849 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
7850 pub result_ok: bool,
7853 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
7854 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
7855 CResult_DescriptionCreationErrorZ {
7856 contents: CResult_DescriptionCreationErrorZPtr {
7857 result: Box::into_raw(Box::new(o)),
7863 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
7864 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
7865 CResult_DescriptionCreationErrorZ {
7866 contents: CResult_DescriptionCreationErrorZPtr {
7867 err: Box::into_raw(Box::new(e)),
7872 /// Checks if the given object is currently in the success state
7874 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
7878 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
7879 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
7880 impl Drop for CResult_DescriptionCreationErrorZ {
7881 fn drop(&mut self) {
7883 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7884 let _ = unsafe { Box::from_raw(self.contents.result) };
7887 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7888 let _ = unsafe { Box::from_raw(self.contents.err) };
7893 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
7894 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
7895 let contents = if o.result_ok {
7896 let result = unsafe { o.contents.result };
7897 unsafe { o.contents.result = core::ptr::null_mut() };
7898 CResult_DescriptionCreationErrorZPtr { result }
7900 let err = unsafe { o.contents.err };
7901 unsafe { o.contents.err = core::ptr::null_mut(); }
7902 CResult_DescriptionCreationErrorZPtr { err }
7906 result_ok: o.result_ok,
7910 impl Clone for CResult_DescriptionCreationErrorZ {
7911 fn clone(&self) -> Self {
7913 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
7914 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
7917 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
7918 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7924 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
7925 /// but with all dynamically-allocated buffers duplicated in new buffers.
7926 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
7928 /// The contents of CResult_ExpiryTimeCreationErrorZ
7929 pub union CResult_ExpiryTimeCreationErrorZPtr {
7930 /// A pointer to the contents in the success state.
7931 /// Reading from this pointer when `result_ok` is not set is undefined.
7932 pub result: *mut crate::lightning_invoice::ExpiryTime,
7933 /// A pointer to the contents in the error state.
7934 /// Reading from this pointer when `result_ok` is set is undefined.
7935 pub err: *mut crate::lightning_invoice::CreationError,
7938 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
7939 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
7940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7941 pub struct CResult_ExpiryTimeCreationErrorZ {
7942 /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
7943 /// `err` or `result` depending on the state of `result_ok`.
7944 pub contents: CResult_ExpiryTimeCreationErrorZPtr,
7945 /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
7946 pub result_ok: bool,
7949 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
7950 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
7951 CResult_ExpiryTimeCreationErrorZ {
7952 contents: CResult_ExpiryTimeCreationErrorZPtr {
7953 result: Box::into_raw(Box::new(o)),
7959 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
7960 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
7961 CResult_ExpiryTimeCreationErrorZ {
7962 contents: CResult_ExpiryTimeCreationErrorZPtr {
7963 err: Box::into_raw(Box::new(e)),
7968 /// Checks if the given object is currently in the success state
7970 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_is_ok(o: &CResult_ExpiryTimeCreationErrorZ) -> bool {
7974 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
7975 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
7976 impl Drop for CResult_ExpiryTimeCreationErrorZ {
7977 fn drop(&mut self) {
7979 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7980 let _ = unsafe { Box::from_raw(self.contents.result) };
7983 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7984 let _ = unsafe { Box::from_raw(self.contents.err) };
7989 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
7990 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
7991 let contents = if o.result_ok {
7992 let result = unsafe { o.contents.result };
7993 unsafe { o.contents.result = core::ptr::null_mut() };
7994 CResult_ExpiryTimeCreationErrorZPtr { result }
7996 let err = unsafe { o.contents.err };
7997 unsafe { o.contents.err = core::ptr::null_mut(); }
7998 CResult_ExpiryTimeCreationErrorZPtr { err }
8002 result_ok: o.result_ok,
8006 impl Clone for CResult_ExpiryTimeCreationErrorZ {
8007 fn clone(&self) -> Self {
8009 Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
8010 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
8013 Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
8014 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8020 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
8021 /// but with all dynamically-allocated buffers duplicated in new buffers.
8022 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
8024 /// The contents of CResult_PrivateRouteCreationErrorZ
8025 pub union CResult_PrivateRouteCreationErrorZPtr {
8026 /// A pointer to the contents in the success state.
8027 /// Reading from this pointer when `result_ok` is not set is undefined.
8028 pub result: *mut crate::lightning_invoice::PrivateRoute,
8029 /// A pointer to the contents in the error state.
8030 /// Reading from this pointer when `result_ok` is set is undefined.
8031 pub err: *mut crate::lightning_invoice::CreationError,
8034 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8035 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8037 pub struct CResult_PrivateRouteCreationErrorZ {
8038 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8039 /// `err` or `result` depending on the state of `result_ok`.
8040 pub contents: CResult_PrivateRouteCreationErrorZPtr,
8041 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8042 pub result_ok: bool,
8045 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
8046 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
8047 CResult_PrivateRouteCreationErrorZ {
8048 contents: CResult_PrivateRouteCreationErrorZPtr {
8049 result: Box::into_raw(Box::new(o)),
8055 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
8056 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
8057 CResult_PrivateRouteCreationErrorZ {
8058 contents: CResult_PrivateRouteCreationErrorZPtr {
8059 err: Box::into_raw(Box::new(e)),
8064 /// Checks if the given object is currently in the success state
8066 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
8070 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
8071 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
8072 impl Drop for CResult_PrivateRouteCreationErrorZ {
8073 fn drop(&mut self) {
8075 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8076 let _ = unsafe { Box::from_raw(self.contents.result) };
8079 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8080 let _ = unsafe { Box::from_raw(self.contents.err) };
8085 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
8086 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
8087 let contents = if o.result_ok {
8088 let result = unsafe { o.contents.result };
8089 unsafe { o.contents.result = core::ptr::null_mut() };
8090 CResult_PrivateRouteCreationErrorZPtr { result }
8092 let err = unsafe { o.contents.err };
8093 unsafe { o.contents.err = core::ptr::null_mut(); }
8094 CResult_PrivateRouteCreationErrorZPtr { err }
8098 result_ok: o.result_ok,
8102 impl Clone for CResult_PrivateRouteCreationErrorZ {
8103 fn clone(&self) -> Self {
8105 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
8106 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
8109 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
8110 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8116 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
8117 /// but with all dynamically-allocated buffers duplicated in new buffers.
8118 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
8120 /// The contents of CResult_StringErrorZ
8121 pub union CResult_StringErrorZPtr {
8122 /// A pointer to the contents in the success state.
8123 /// Reading from this pointer when `result_ok` is not set is undefined.
8124 pub result: *mut crate::c_types::Str,
8125 /// A pointer to the contents in the error state.
8126 /// Reading from this pointer when `result_ok` is set is undefined.
8127 pub err: *mut crate::c_types::Secp256k1Error,
8130 /// A CResult_StringErrorZ represents the result of a fallible operation,
8131 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
8132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8133 pub struct CResult_StringErrorZ {
8134 /// The contents of this CResult_StringErrorZ, accessible via either
8135 /// `err` or `result` depending on the state of `result_ok`.
8136 pub contents: CResult_StringErrorZPtr,
8137 /// Whether this CResult_StringErrorZ represents a success state.
8138 pub result_ok: bool,
8141 /// Creates a new CResult_StringErrorZ in the success state.
8142 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
8143 CResult_StringErrorZ {
8144 contents: CResult_StringErrorZPtr {
8145 result: Box::into_raw(Box::new(o)),
8151 /// Creates a new CResult_StringErrorZ in the error state.
8152 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
8153 CResult_StringErrorZ {
8154 contents: CResult_StringErrorZPtr {
8155 err: Box::into_raw(Box::new(e)),
8160 /// Checks if the given object is currently in the success state
8162 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
8166 /// Frees any resources used by the CResult_StringErrorZ.
8167 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
8168 impl Drop for CResult_StringErrorZ {
8169 fn drop(&mut self) {
8171 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8172 let _ = unsafe { Box::from_raw(self.contents.result) };
8175 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8176 let _ = unsafe { Box::from_raw(self.contents.err) };
8181 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
8182 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
8183 let contents = if o.result_ok {
8184 let result = unsafe { o.contents.result };
8185 unsafe { o.contents.result = core::ptr::null_mut() };
8186 CResult_StringErrorZPtr { result }
8188 let err = unsafe { o.contents.err };
8189 unsafe { o.contents.err = core::ptr::null_mut(); }
8190 CResult_StringErrorZPtr { err }
8194 result_ok: o.result_ok,
8199 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
8200 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8201 /// A pointer to the contents in the success state.
8202 /// Reading from this pointer when `result_ok` is not set is undefined.
8203 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
8204 /// A pointer to the contents in the error state.
8205 /// Reading from this pointer when `result_ok` is set is undefined.
8206 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8209 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
8210 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8211 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8212 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
8213 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
8214 /// `err` or `result` depending on the state of `result_ok`.
8215 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
8216 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
8217 pub result_ok: bool,
8220 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
8221 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
8222 CResult_ChannelMonitorUpdateDecodeErrorZ {
8223 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8224 result: Box::into_raw(Box::new(o)),
8230 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
8231 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
8232 CResult_ChannelMonitorUpdateDecodeErrorZ {
8233 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8234 err: Box::into_raw(Box::new(e)),
8239 /// Checks if the given object is currently in the success state
8241 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
8245 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
8246 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
8247 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
8248 fn drop(&mut self) {
8250 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8251 let _ = unsafe { Box::from_raw(self.contents.result) };
8254 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8255 let _ = unsafe { Box::from_raw(self.contents.err) };
8260 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
8261 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8262 let contents = if o.result_ok {
8263 let result = unsafe { o.contents.result };
8264 unsafe { o.contents.result = core::ptr::null_mut() };
8265 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
8267 let err = unsafe { o.contents.err };
8268 unsafe { o.contents.err = core::ptr::null_mut(); }
8269 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
8273 result_ok: o.result_ok,
8277 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
8278 fn clone(&self) -> Self {
8280 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8281 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
8284 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8285 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8291 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
8292 /// but with all dynamically-allocated buffers duplicated in new buffers.
8293 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
8296 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
8297 pub enum COption_MonitorEventZ {
8298 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
8299 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
8300 /// When we're in this state, this COption_MonitorEventZ contains nothing
8303 impl COption_MonitorEventZ {
8304 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8305 if let Self::None = self { false } else { true }
8307 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8310 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
8311 if let Self::Some(v) = self { v } else { unreachable!() }
8315 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
8316 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
8317 COption_MonitorEventZ::Some(o)
8320 /// Constructs a new COption_MonitorEventZ containing nothing
8321 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
8322 COption_MonitorEventZ::None
8325 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
8326 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
8328 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
8329 /// but with all dynamically-allocated buffers duplicated in new buffers.
8330 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
8332 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
8333 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
8334 /// A pointer to the contents in the success state.
8335 /// Reading from this pointer when `result_ok` is not set is undefined.
8336 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
8337 /// A pointer to the contents in the error state.
8338 /// Reading from this pointer when `result_ok` is set is undefined.
8339 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8342 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
8343 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8345 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
8346 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
8347 /// `err` or `result` depending on the state of `result_ok`.
8348 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
8349 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
8350 pub result_ok: bool,
8353 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
8354 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
8355 CResult_COption_MonitorEventZDecodeErrorZ {
8356 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8357 result: Box::into_raw(Box::new(o)),
8363 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
8364 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
8365 CResult_COption_MonitorEventZDecodeErrorZ {
8366 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8367 err: Box::into_raw(Box::new(e)),
8372 /// Checks if the given object is currently in the success state
8374 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
8378 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
8379 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
8380 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
8381 fn drop(&mut self) {
8383 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8384 let _ = unsafe { Box::from_raw(self.contents.result) };
8387 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8388 let _ = unsafe { Box::from_raw(self.contents.err) };
8393 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
8394 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8395 let contents = if o.result_ok {
8396 let result = unsafe { o.contents.result };
8397 unsafe { o.contents.result = core::ptr::null_mut() };
8398 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
8400 let err = unsafe { o.contents.err };
8401 unsafe { o.contents.err = core::ptr::null_mut(); }
8402 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
8406 result_ok: o.result_ok,
8410 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
8411 fn clone(&self) -> Self {
8413 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8414 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
8417 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8418 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8424 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
8425 /// but with all dynamically-allocated buffers duplicated in new buffers.
8426 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
8428 /// The contents of CResult_HTLCUpdateDecodeErrorZ
8429 pub union CResult_HTLCUpdateDecodeErrorZPtr {
8430 /// A pointer to the contents in the success state.
8431 /// Reading from this pointer when `result_ok` is not set is undefined.
8432 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
8433 /// A pointer to the contents in the error state.
8434 /// Reading from this pointer when `result_ok` is set is undefined.
8435 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8438 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
8439 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8440 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8441 pub struct CResult_HTLCUpdateDecodeErrorZ {
8442 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
8443 /// `err` or `result` depending on the state of `result_ok`.
8444 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
8445 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
8446 pub result_ok: bool,
8449 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
8450 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
8451 CResult_HTLCUpdateDecodeErrorZ {
8452 contents: CResult_HTLCUpdateDecodeErrorZPtr {
8453 result: Box::into_raw(Box::new(o)),
8459 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
8460 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
8461 CResult_HTLCUpdateDecodeErrorZ {
8462 contents: CResult_HTLCUpdateDecodeErrorZPtr {
8463 err: Box::into_raw(Box::new(e)),
8468 /// Checks if the given object is currently in the success state
8470 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
8474 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
8475 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
8476 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
8477 fn drop(&mut self) {
8479 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8480 let _ = unsafe { Box::from_raw(self.contents.result) };
8483 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8484 let _ = unsafe { Box::from_raw(self.contents.err) };
8489 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
8490 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8491 let contents = if o.result_ok {
8492 let result = unsafe { o.contents.result };
8493 unsafe { o.contents.result = core::ptr::null_mut() };
8494 CResult_HTLCUpdateDecodeErrorZPtr { result }
8496 let err = unsafe { o.contents.err };
8497 unsafe { o.contents.err = core::ptr::null_mut(); }
8498 CResult_HTLCUpdateDecodeErrorZPtr { err }
8502 result_ok: o.result_ok,
8506 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
8507 fn clone(&self) -> Self {
8509 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8510 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
8513 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8514 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8520 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
8521 /// but with all dynamically-allocated buffers duplicated in new buffers.
8522 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
8524 /// A tuple of 2 elements. See the individual fields for the types contained.
8525 pub struct C2Tuple_OutPointScriptZ {
8526 /// The element at position 0
8527 pub a: crate::lightning::chain::transaction::OutPoint,
8528 /// The element at position 1
8529 pub b: crate::c_types::derived::CVec_u8Z,
8531 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
8532 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
8539 impl C2Tuple_OutPointScriptZ {
8540 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
8544 impl Clone for C2Tuple_OutPointScriptZ {
8545 fn clone(&self) -> Self {
8547 a: Clone::clone(&self.a),
8548 b: Clone::clone(&self.b),
8553 /// Creates a new tuple which has the same data as `orig`
8554 /// but with all dynamically-allocated buffers duplicated in new buffers.
8555 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
8556 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
8558 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
8559 C2Tuple_OutPointScriptZ { a, b, }
8563 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
8564 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
8566 /// A tuple of 2 elements. See the individual fields for the types contained.
8567 pub struct C2Tuple_u32ScriptZ {
8568 /// The element at position 0
8570 /// The element at position 1
8571 pub b: crate::c_types::derived::CVec_u8Z,
8573 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
8574 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
8581 impl C2Tuple_u32ScriptZ {
8582 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
8586 impl Clone for C2Tuple_u32ScriptZ {
8587 fn clone(&self) -> Self {
8589 a: Clone::clone(&self.a),
8590 b: Clone::clone(&self.b),
8595 /// Creates a new tuple which has the same data as `orig`
8596 /// but with all dynamically-allocated buffers duplicated in new buffers.
8597 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
8598 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
8600 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
8601 C2Tuple_u32ScriptZ { a, b, }
8605 /// Frees any resources used by the C2Tuple_u32ScriptZ.
8606 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
8608 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
8609 /// This corresponds to std::vector in C++
8610 pub struct CVec_C2Tuple_u32ScriptZZ {
8611 /// The elements in the array.
8612 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8613 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
8614 /// The number of elements pointed to by `data`.
8617 impl CVec_C2Tuple_u32ScriptZZ {
8618 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
8619 if self.datalen == 0 { return Vec::new(); }
8620 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8621 self.data = core::ptr::null_mut();
8625 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
8626 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8629 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
8630 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
8631 let datalen = v.len();
8632 let data = Box::into_raw(v.into_boxed_slice());
8633 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8637 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8638 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
8639 impl Drop for CVec_C2Tuple_u32ScriptZZ {
8640 fn drop(&mut self) {
8641 if self.datalen == 0 { return; }
8642 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8645 impl Clone for CVec_C2Tuple_u32ScriptZZ {
8646 fn clone(&self) -> Self {
8647 let mut res = Vec::new();
8648 if self.datalen == 0 { return Self::from(res); }
8649 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8654 /// A tuple of 2 elements. See the individual fields for the types contained.
8655 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8656 /// The element at position 0
8657 pub a: crate::c_types::ThirtyTwoBytes,
8658 /// The element at position 1
8659 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
8661 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8662 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
8669 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8670 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
8674 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8675 fn clone(&self) -> Self {
8677 a: Clone::clone(&self.a),
8678 b: Clone::clone(&self.b),
8683 /// Creates a new tuple which has the same data as `orig`
8684 /// but with all dynamically-allocated buffers duplicated in new buffers.
8685 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
8686 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
8688 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 {
8689 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
8693 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
8694 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
8696 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
8697 /// This corresponds to std::vector in C++
8698 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8699 /// The elements in the array.
8700 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8701 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
8702 /// The number of elements pointed to by `data`.
8705 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8706 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
8707 if self.datalen == 0 { return Vec::new(); }
8708 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8709 self.data = core::ptr::null_mut();
8713 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
8714 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8717 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8718 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
8719 let datalen = v.len();
8720 let data = Box::into_raw(v.into_boxed_slice());
8721 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8725 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8726 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
8727 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8728 fn drop(&mut self) {
8729 if self.datalen == 0 { return; }
8730 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8733 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8734 fn clone(&self) -> Self {
8735 let mut res = Vec::new();
8736 if self.datalen == 0 { return Self::from(res); }
8737 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8742 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
8743 /// This corresponds to std::vector in C++
8744 pub struct CVec_EventZ {
8745 /// The elements in the array.
8746 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8747 pub data: *mut crate::lightning::util::events::Event,
8748 /// The number of elements pointed to by `data`.
8752 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
8753 if self.datalen == 0 { return Vec::new(); }
8754 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8755 self.data = core::ptr::null_mut();
8759 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
8760 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8763 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
8764 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
8765 let datalen = v.len();
8766 let data = Box::into_raw(v.into_boxed_slice());
8767 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8771 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8772 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
8773 impl Drop for CVec_EventZ {
8774 fn drop(&mut self) {
8775 if self.datalen == 0 { return; }
8776 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8779 impl Clone for CVec_EventZ {
8780 fn clone(&self) -> Self {
8781 let mut res = Vec::new();
8782 if self.datalen == 0 { return Self::from(res); }
8783 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8788 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8789 /// This corresponds to std::vector in C++
8790 pub struct CVec_TransactionZ {
8791 /// The elements in the array.
8792 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8793 pub data: *mut crate::c_types::Transaction,
8794 /// The number of elements pointed to by `data`.
8797 impl CVec_TransactionZ {
8798 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
8799 if self.datalen == 0 { return Vec::new(); }
8800 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8801 self.data = core::ptr::null_mut();
8805 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
8806 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8809 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
8810 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
8811 let datalen = v.len();
8812 let data = Box::into_raw(v.into_boxed_slice());
8813 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8817 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8818 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
8819 impl Drop for CVec_TransactionZ {
8820 fn drop(&mut self) {
8821 if self.datalen == 0 { return; }
8822 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8825 impl Clone for CVec_TransactionZ {
8826 fn clone(&self) -> Self {
8827 let mut res = Vec::new();
8828 if self.datalen == 0 { return Self::from(res); }
8829 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8834 /// A tuple of 2 elements. See the individual fields for the types contained.
8835 pub struct C2Tuple_u32TxOutZ {
8836 /// The element at position 0
8838 /// The element at position 1
8839 pub b: crate::c_types::TxOut,
8841 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
8842 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
8849 impl C2Tuple_u32TxOutZ {
8850 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
8854 impl Clone for C2Tuple_u32TxOutZ {
8855 fn clone(&self) -> Self {
8857 a: Clone::clone(&self.a),
8858 b: Clone::clone(&self.b),
8863 /// Creates a new tuple which has the same data as `orig`
8864 /// but with all dynamically-allocated buffers duplicated in new buffers.
8865 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
8866 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
8868 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
8869 C2Tuple_u32TxOutZ { a, b, }
8873 /// Frees any resources used by the C2Tuple_u32TxOutZ.
8874 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
8876 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
8877 /// This corresponds to std::vector in C++
8878 pub struct CVec_C2Tuple_u32TxOutZZ {
8879 /// The elements in the array.
8880 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8881 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
8882 /// The number of elements pointed to by `data`.
8885 impl CVec_C2Tuple_u32TxOutZZ {
8886 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
8887 if self.datalen == 0 { return Vec::new(); }
8888 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8889 self.data = core::ptr::null_mut();
8893 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
8894 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8897 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
8898 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
8899 let datalen = v.len();
8900 let data = Box::into_raw(v.into_boxed_slice());
8901 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8905 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8906 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
8907 impl Drop for CVec_C2Tuple_u32TxOutZZ {
8908 fn drop(&mut self) {
8909 if self.datalen == 0 { return; }
8910 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8913 impl Clone for CVec_C2Tuple_u32TxOutZZ {
8914 fn clone(&self) -> Self {
8915 let mut res = Vec::new();
8916 if self.datalen == 0 { return Self::from(res); }
8917 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8922 /// A tuple of 2 elements. See the individual fields for the types contained.
8923 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8924 /// The element at position 0
8925 pub a: crate::c_types::ThirtyTwoBytes,
8926 /// The element at position 1
8927 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
8929 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8930 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
8937 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8938 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
8942 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8943 fn clone(&self) -> Self {
8945 a: Clone::clone(&self.a),
8946 b: Clone::clone(&self.b),
8951 /// Creates a new tuple which has the same data as `orig`
8952 /// but with all dynamically-allocated buffers duplicated in new buffers.
8953 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
8954 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
8956 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 {
8957 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
8961 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
8962 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
8964 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
8965 /// This corresponds to std::vector in C++
8966 pub struct CVec_TransactionOutputsZ {
8967 /// The elements in the array.
8968 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8969 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
8970 /// The number of elements pointed to by `data`.
8973 impl CVec_TransactionOutputsZ {
8974 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
8975 if self.datalen == 0 { return Vec::new(); }
8976 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8977 self.data = core::ptr::null_mut();
8981 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
8982 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8985 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
8986 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
8987 let datalen = v.len();
8988 let data = Box::into_raw(v.into_boxed_slice());
8989 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8993 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8994 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
8995 impl Drop for CVec_TransactionOutputsZ {
8996 fn drop(&mut self) {
8997 if self.datalen == 0 { return; }
8998 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9001 impl Clone for CVec_TransactionOutputsZ {
9002 fn clone(&self) -> Self {
9003 let mut res = Vec::new();
9004 if self.datalen == 0 { return Self::from(res); }
9005 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9010 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9011 /// This corresponds to std::vector in C++
9012 pub struct CVec_BalanceZ {
9013 /// The elements in the array.
9014 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9015 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9016 /// The number of elements pointed to by `data`.
9019 impl CVec_BalanceZ {
9020 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9021 if self.datalen == 0 { return Vec::new(); }
9022 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9023 self.data = core::ptr::null_mut();
9027 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9028 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9031 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9032 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9033 let datalen = v.len();
9034 let data = Box::into_raw(v.into_boxed_slice());
9035 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9039 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9040 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9041 impl Drop for CVec_BalanceZ {
9042 fn drop(&mut self) {
9043 if self.datalen == 0 { return; }
9044 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9047 impl Clone for CVec_BalanceZ {
9048 fn clone(&self) -> Self {
9049 let mut res = Vec::new();
9050 if self.datalen == 0 { return Self::from(res); }
9051 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9056 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9057 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9058 /// A pointer to the contents in the success state.
9059 /// Reading from this pointer when `result_ok` is not set is undefined.
9060 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9061 /// A pointer to the contents in the error state.
9062 /// Reading from this pointer when `result_ok` is set is undefined.
9063 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9066 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9067 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9069 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9070 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9071 /// `err` or `result` depending on the state of `result_ok`.
9072 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
9073 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9074 pub result_ok: bool,
9077 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9078 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9079 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9080 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9081 result: Box::into_raw(Box::new(o)),
9087 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9088 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9089 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9090 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9091 err: Box::into_raw(Box::new(e)),
9096 /// Checks if the given object is currently in the success state
9098 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
9102 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9103 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
9104 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9105 fn drop(&mut self) {
9107 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9108 let _ = unsafe { Box::from_raw(self.contents.result) };
9111 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9112 let _ = unsafe { Box::from_raw(self.contents.err) };
9117 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9118 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9119 let contents = if o.result_ok {
9120 let result = unsafe { o.contents.result };
9121 unsafe { o.contents.result = core::ptr::null_mut() };
9122 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
9124 let err = unsafe { o.contents.err };
9125 unsafe { o.contents.err = core::ptr::null_mut(); }
9126 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
9130 result_ok: o.result_ok,
9135 /// The contents of CResult_NoneLightningErrorZ
9136 pub union CResult_NoneLightningErrorZPtr {
9137 /// Note that this value is always NULL, as there are no contents in the OK variant
9138 pub result: *mut core::ffi::c_void,
9139 /// A pointer to the contents in the error state.
9140 /// Reading from this pointer when `result_ok` is set is undefined.
9141 pub err: *mut crate::lightning::ln::msgs::LightningError,
9144 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
9145 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
9146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9147 pub struct CResult_NoneLightningErrorZ {
9148 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
9149 /// `err` or `result` depending on the state of `result_ok`.
9150 pub contents: CResult_NoneLightningErrorZPtr,
9151 /// Whether this CResult_NoneLightningErrorZ represents a success state.
9152 pub result_ok: bool,
9155 /// Creates a new CResult_NoneLightningErrorZ in the success state.
9156 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
9157 CResult_NoneLightningErrorZ {
9158 contents: CResult_NoneLightningErrorZPtr {
9159 result: core::ptr::null_mut(),
9165 /// Creates a new CResult_NoneLightningErrorZ in the error state.
9166 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
9167 CResult_NoneLightningErrorZ {
9168 contents: CResult_NoneLightningErrorZPtr {
9169 err: Box::into_raw(Box::new(e)),
9174 /// Checks if the given object is currently in the success state
9176 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
9180 /// Frees any resources used by the CResult_NoneLightningErrorZ.
9181 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
9182 impl Drop for CResult_NoneLightningErrorZ {
9183 fn drop(&mut self) {
9186 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9187 let _ = unsafe { Box::from_raw(self.contents.err) };
9192 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
9193 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
9194 let contents = if o.result_ok {
9195 let _ = unsafe { Box::from_raw(o.contents.result) };
9196 o.contents.result = core::ptr::null_mut();
9197 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
9199 let err = unsafe { o.contents.err };
9200 unsafe { o.contents.err = core::ptr::null_mut(); }
9201 CResult_NoneLightningErrorZPtr { err }
9205 result_ok: o.result_ok,
9209 impl Clone for CResult_NoneLightningErrorZ {
9210 fn clone(&self) -> Self {
9212 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
9213 result: core::ptr::null_mut()
9216 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
9217 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
9223 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
9224 /// but with all dynamically-allocated buffers duplicated in new buffers.
9225 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
9227 /// A tuple of 2 elements. See the individual fields for the types contained.
9228 pub struct C2Tuple_PublicKeyTypeZ {
9229 /// The element at position 0
9230 pub a: crate::c_types::PublicKey,
9231 /// The element at position 1
9232 pub b: crate::lightning::ln::wire::Type,
9234 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
9235 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
9242 impl C2Tuple_PublicKeyTypeZ {
9243 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
9247 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
9249 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
9250 C2Tuple_PublicKeyTypeZ { a, b, }
9254 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
9255 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
9257 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9258 /// This corresponds to std::vector in C++
9259 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
9260 /// The elements in the array.
9261 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9262 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
9263 /// The number of elements pointed to by `data`.
9266 impl CVec_C2Tuple_PublicKeyTypeZZ {
9267 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
9268 if self.datalen == 0 { return Vec::new(); }
9269 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9270 self.data = core::ptr::null_mut();
9274 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
9275 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9278 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
9279 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
9280 let datalen = v.len();
9281 let data = Box::into_raw(v.into_boxed_slice());
9282 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9286 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9287 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
9288 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
9289 fn drop(&mut self) {
9290 if self.datalen == 0 { return; }
9291 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9295 /// The contents of CResult_boolLightningErrorZ
9296 pub union CResult_boolLightningErrorZPtr {
9297 /// A pointer to the contents in the success state.
9298 /// Reading from this pointer when `result_ok` is not set is undefined.
9299 pub result: *mut bool,
9300 /// A pointer to the contents in the error state.
9301 /// Reading from this pointer when `result_ok` is set is undefined.
9302 pub err: *mut crate::lightning::ln::msgs::LightningError,
9305 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
9306 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
9307 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9308 pub struct CResult_boolLightningErrorZ {
9309 /// The contents of this CResult_boolLightningErrorZ, accessible via either
9310 /// `err` or `result` depending on the state of `result_ok`.
9311 pub contents: CResult_boolLightningErrorZPtr,
9312 /// Whether this CResult_boolLightningErrorZ represents a success state.
9313 pub result_ok: bool,
9316 /// Creates a new CResult_boolLightningErrorZ in the success state.
9317 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
9318 CResult_boolLightningErrorZ {
9319 contents: CResult_boolLightningErrorZPtr {
9320 result: Box::into_raw(Box::new(o)),
9326 /// Creates a new CResult_boolLightningErrorZ in the error state.
9327 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
9328 CResult_boolLightningErrorZ {
9329 contents: CResult_boolLightningErrorZPtr {
9330 err: Box::into_raw(Box::new(e)),
9335 /// Checks if the given object is currently in the success state
9337 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
9341 /// Frees any resources used by the CResult_boolLightningErrorZ.
9342 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
9343 impl Drop for CResult_boolLightningErrorZ {
9344 fn drop(&mut self) {
9346 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9347 let _ = unsafe { Box::from_raw(self.contents.result) };
9350 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9351 let _ = unsafe { Box::from_raw(self.contents.err) };
9356 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
9357 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
9358 let contents = if o.result_ok {
9359 let result = unsafe { o.contents.result };
9360 unsafe { o.contents.result = core::ptr::null_mut() };
9361 CResult_boolLightningErrorZPtr { result }
9363 let err = unsafe { o.contents.err };
9364 unsafe { o.contents.err = core::ptr::null_mut(); }
9365 CResult_boolLightningErrorZPtr { err }
9369 result_ok: o.result_ok,
9373 impl Clone for CResult_boolLightningErrorZ {
9374 fn clone(&self) -> Self {
9376 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
9377 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
9380 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
9381 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
9387 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
9388 /// but with all dynamically-allocated buffers duplicated in new buffers.
9389 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
9391 /// A tuple of 3 elements. See the individual fields for the types contained.
9392 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9393 /// The element at position 0
9394 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
9395 /// The element at position 1
9396 pub b: crate::lightning::ln::msgs::ChannelUpdate,
9397 /// The element at position 2
9398 pub c: crate::lightning::ln::msgs::ChannelUpdate,
9400 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9401 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
9409 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9410 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
9411 (self.a, self.b, self.c)
9414 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9415 fn clone(&self) -> Self {
9417 a: Clone::clone(&self.a),
9418 b: Clone::clone(&self.b),
9419 c: Clone::clone(&self.c),
9424 /// Creates a new tuple which has the same data as `orig`
9425 /// but with all dynamically-allocated buffers duplicated in new buffers.
9426 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
9427 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9429 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 {
9430 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
9434 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9435 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
9437 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
9438 /// This corresponds to std::vector in C++
9439 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9440 /// The elements in the array.
9441 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9442 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
9443 /// The number of elements pointed to by `data`.
9446 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9447 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
9448 if self.datalen == 0 { return Vec::new(); }
9449 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9450 self.data = core::ptr::null_mut();
9454 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
9455 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9458 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9459 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
9460 let datalen = v.len();
9461 let data = Box::into_raw(v.into_boxed_slice());
9462 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9466 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9467 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
9468 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9469 fn drop(&mut self) {
9470 if self.datalen == 0 { return; }
9471 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9474 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9475 fn clone(&self) -> Self {
9476 let mut res = Vec::new();
9477 if self.datalen == 0 { return Self::from(res); }
9478 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9483 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
9484 /// This corresponds to std::vector in C++
9485 pub struct CVec_NodeAnnouncementZ {
9486 /// The elements in the array.
9487 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9488 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
9489 /// The number of elements pointed to by `data`.
9492 impl CVec_NodeAnnouncementZ {
9493 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
9494 if self.datalen == 0 { return Vec::new(); }
9495 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9496 self.data = core::ptr::null_mut();
9500 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
9501 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9504 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
9505 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
9506 let datalen = v.len();
9507 let data = Box::into_raw(v.into_boxed_slice());
9508 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9512 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9513 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
9514 impl Drop for CVec_NodeAnnouncementZ {
9515 fn drop(&mut self) {
9516 if self.datalen == 0 { return; }
9517 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9520 impl Clone for CVec_NodeAnnouncementZ {
9521 fn clone(&self) -> Self {
9522 let mut res = Vec::new();
9523 if self.datalen == 0 { return Self::from(res); }
9524 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9529 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
9530 /// This corresponds to std::vector in C++
9531 pub struct CVec_PublicKeyZ {
9532 /// The elements in the array.
9533 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9534 pub data: *mut crate::c_types::PublicKey,
9535 /// The number of elements pointed to by `data`.
9538 impl CVec_PublicKeyZ {
9539 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
9540 if self.datalen == 0 { return Vec::new(); }
9541 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9542 self.data = core::ptr::null_mut();
9546 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
9547 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9550 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
9551 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
9552 let datalen = v.len();
9553 let data = Box::into_raw(v.into_boxed_slice());
9554 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9558 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9559 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
9560 impl Drop for CVec_PublicKeyZ {
9561 fn drop(&mut self) {
9562 if self.datalen == 0 { return; }
9563 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9566 impl Clone for CVec_PublicKeyZ {
9567 fn clone(&self) -> Self {
9568 let mut res = Vec::new();
9569 if self.datalen == 0 { return Self::from(res); }
9570 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9575 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
9576 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
9577 /// A pointer to the contents in the success state.
9578 /// Reading from this pointer when `result_ok` is not set is undefined.
9579 pub result: *mut crate::c_types::derived::CVec_u8Z,
9580 /// A pointer to the contents in the error state.
9581 /// Reading from this pointer when `result_ok` is set is undefined.
9582 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9585 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9586 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9587 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9588 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
9589 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9590 /// `err` or `result` depending on the state of `result_ok`.
9591 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
9592 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9593 pub result_ok: bool,
9596 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9597 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
9598 CResult_CVec_u8ZPeerHandleErrorZ {
9599 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9600 result: Box::into_raw(Box::new(o)),
9606 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9607 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
9608 CResult_CVec_u8ZPeerHandleErrorZ {
9609 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9610 err: Box::into_raw(Box::new(e)),
9615 /// Checks if the given object is currently in the success state
9617 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
9621 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9622 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
9623 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
9624 fn drop(&mut self) {
9626 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9627 let _ = unsafe { Box::from_raw(self.contents.result) };
9630 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9631 let _ = unsafe { Box::from_raw(self.contents.err) };
9636 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
9637 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9638 let contents = if o.result_ok {
9639 let result = unsafe { o.contents.result };
9640 unsafe { o.contents.result = core::ptr::null_mut() };
9641 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
9643 let err = unsafe { o.contents.err };
9644 unsafe { o.contents.err = core::ptr::null_mut(); }
9645 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
9649 result_ok: o.result_ok,
9653 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
9654 fn clone(&self) -> Self {
9656 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9657 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
9660 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9661 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9667 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9668 /// but with all dynamically-allocated buffers duplicated in new buffers.
9669 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
9671 /// The contents of CResult_NonePeerHandleErrorZ
9672 pub union CResult_NonePeerHandleErrorZPtr {
9673 /// Note that this value is always NULL, as there are no contents in the OK variant
9674 pub result: *mut core::ffi::c_void,
9675 /// A pointer to the contents in the error state.
9676 /// Reading from this pointer when `result_ok` is set is undefined.
9677 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9680 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9681 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9683 pub struct CResult_NonePeerHandleErrorZ {
9684 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9685 /// `err` or `result` depending on the state of `result_ok`.
9686 pub contents: CResult_NonePeerHandleErrorZPtr,
9687 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
9688 pub result_ok: bool,
9691 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
9692 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
9693 CResult_NonePeerHandleErrorZ {
9694 contents: CResult_NonePeerHandleErrorZPtr {
9695 result: core::ptr::null_mut(),
9701 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
9702 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
9703 CResult_NonePeerHandleErrorZ {
9704 contents: CResult_NonePeerHandleErrorZPtr {
9705 err: Box::into_raw(Box::new(e)),
9710 /// Checks if the given object is currently in the success state
9712 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
9716 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
9717 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
9718 impl Drop for CResult_NonePeerHandleErrorZ {
9719 fn drop(&mut self) {
9722 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9723 let _ = unsafe { Box::from_raw(self.contents.err) };
9728 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
9729 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9730 let contents = if o.result_ok {
9731 let _ = unsafe { Box::from_raw(o.contents.result) };
9732 o.contents.result = core::ptr::null_mut();
9733 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
9735 let err = unsafe { o.contents.err };
9736 unsafe { o.contents.err = core::ptr::null_mut(); }
9737 CResult_NonePeerHandleErrorZPtr { err }
9741 result_ok: o.result_ok,
9745 impl Clone for CResult_NonePeerHandleErrorZ {
9746 fn clone(&self) -> Self {
9748 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
9749 result: core::ptr::null_mut()
9752 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
9753 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9759 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9760 /// but with all dynamically-allocated buffers duplicated in new buffers.
9761 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
9763 /// The contents of CResult_boolPeerHandleErrorZ
9764 pub union CResult_boolPeerHandleErrorZPtr {
9765 /// A pointer to the contents in the success state.
9766 /// Reading from this pointer when `result_ok` is not set is undefined.
9767 pub result: *mut bool,
9768 /// A pointer to the contents in the error state.
9769 /// Reading from this pointer when `result_ok` is set is undefined.
9770 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9773 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9774 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9775 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9776 pub struct CResult_boolPeerHandleErrorZ {
9777 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9778 /// `err` or `result` depending on the state of `result_ok`.
9779 pub contents: CResult_boolPeerHandleErrorZPtr,
9780 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
9781 pub result_ok: bool,
9784 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
9785 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
9786 CResult_boolPeerHandleErrorZ {
9787 contents: CResult_boolPeerHandleErrorZPtr {
9788 result: Box::into_raw(Box::new(o)),
9794 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
9795 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
9796 CResult_boolPeerHandleErrorZ {
9797 contents: CResult_boolPeerHandleErrorZPtr {
9798 err: Box::into_raw(Box::new(e)),
9803 /// Checks if the given object is currently in the success state
9805 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
9809 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
9810 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
9811 impl Drop for CResult_boolPeerHandleErrorZ {
9812 fn drop(&mut self) {
9814 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9815 let _ = unsafe { Box::from_raw(self.contents.result) };
9818 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9819 let _ = unsafe { Box::from_raw(self.contents.err) };
9824 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
9825 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9826 let contents = if o.result_ok {
9827 let result = unsafe { o.contents.result };
9828 unsafe { o.contents.result = core::ptr::null_mut() };
9829 CResult_boolPeerHandleErrorZPtr { result }
9831 let err = unsafe { o.contents.err };
9832 unsafe { o.contents.err = core::ptr::null_mut(); }
9833 CResult_boolPeerHandleErrorZPtr { err }
9837 result_ok: o.result_ok,
9841 impl Clone for CResult_boolPeerHandleErrorZ {
9842 fn clone(&self) -> Self {
9844 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
9845 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
9848 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
9849 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9855 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
9856 /// but with all dynamically-allocated buffers duplicated in new buffers.
9857 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
9859 /// The contents of CResult_NodeIdDecodeErrorZ
9860 pub union CResult_NodeIdDecodeErrorZPtr {
9861 /// A pointer to the contents in the success state.
9862 /// Reading from this pointer when `result_ok` is not set is undefined.
9863 pub result: *mut crate::lightning::routing::network_graph::NodeId,
9864 /// A pointer to the contents in the error state.
9865 /// Reading from this pointer when `result_ok` is set is undefined.
9866 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9869 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
9870 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
9871 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9872 pub struct CResult_NodeIdDecodeErrorZ {
9873 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
9874 /// `err` or `result` depending on the state of `result_ok`.
9875 pub contents: CResult_NodeIdDecodeErrorZPtr,
9876 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
9877 pub result_ok: bool,
9880 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
9881 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
9882 CResult_NodeIdDecodeErrorZ {
9883 contents: CResult_NodeIdDecodeErrorZPtr {
9884 result: Box::into_raw(Box::new(o)),
9890 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
9891 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
9892 CResult_NodeIdDecodeErrorZ {
9893 contents: CResult_NodeIdDecodeErrorZPtr {
9894 err: Box::into_raw(Box::new(e)),
9899 /// Checks if the given object is currently in the success state
9901 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
9905 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
9906 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
9907 impl Drop for CResult_NodeIdDecodeErrorZ {
9908 fn drop(&mut self) {
9910 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9911 let _ = unsafe { Box::from_raw(self.contents.result) };
9914 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9915 let _ = unsafe { Box::from_raw(self.contents.err) };
9920 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
9921 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
9922 let contents = if o.result_ok {
9923 let result = unsafe { o.contents.result };
9924 unsafe { o.contents.result = core::ptr::null_mut() };
9925 CResult_NodeIdDecodeErrorZPtr { result }
9927 let err = unsafe { o.contents.err };
9928 unsafe { o.contents.err = core::ptr::null_mut(); }
9929 CResult_NodeIdDecodeErrorZPtr { err }
9933 result_ok: o.result_ok,
9937 impl Clone for CResult_NodeIdDecodeErrorZ {
9938 fn clone(&self) -> Self {
9940 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
9941 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
9944 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
9945 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9951 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
9952 /// but with all dynamically-allocated buffers duplicated in new buffers.
9953 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
9955 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
9956 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9957 /// A pointer to the contents in the success state.
9958 /// Reading from this pointer when `result_ok` is not set is undefined.
9959 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
9960 /// A pointer to the contents in the error state.
9961 /// Reading from this pointer when `result_ok` is set is undefined.
9962 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9965 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
9966 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9968 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
9969 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
9970 /// `err` or `result` depending on the state of `result_ok`.
9971 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
9972 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
9973 pub result_ok: bool,
9976 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
9977 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9978 CResult_COption_NetworkUpdateZDecodeErrorZ {
9979 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9980 result: Box::into_raw(Box::new(o)),
9986 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
9987 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9988 CResult_COption_NetworkUpdateZDecodeErrorZ {
9989 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9990 err: Box::into_raw(Box::new(e)),
9995 /// Checks if the given object is currently in the success state
9997 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10001 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10002 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10003 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10004 fn drop(&mut self) {
10005 if self.result_ok {
10006 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10007 let _ = unsafe { Box::from_raw(self.contents.result) };
10010 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10011 let _ = unsafe { Box::from_raw(self.contents.err) };
10016 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10017 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10018 let contents = if o.result_ok {
10019 let result = unsafe { o.contents.result };
10020 unsafe { o.contents.result = core::ptr::null_mut() };
10021 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10023 let err = unsafe { o.contents.err };
10024 unsafe { o.contents.err = core::ptr::null_mut(); }
10025 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10029 result_ok: o.result_ok,
10033 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10034 fn clone(&self) -> Self {
10035 if self.result_ok {
10036 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10037 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10040 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10041 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10047 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
10048 /// but with all dynamically-allocated buffers duplicated in new buffers.
10049 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
10051 /// An enum which can either contain a crate::lightning::chain::Access or not
10052 pub enum COption_AccessZ {
10053 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
10054 Some(crate::lightning::chain::Access),
10055 /// When we're in this state, this COption_AccessZ contains nothing
10058 impl COption_AccessZ {
10059 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10060 if let Self::None = self { false } else { true }
10062 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10065 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
10066 if let Self::Some(v) = self { v } else { unreachable!() }
10070 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
10071 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
10072 COption_AccessZ::Some(o)
10075 /// Constructs a new COption_AccessZ containing nothing
10076 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
10077 COption_AccessZ::None
10080 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
10081 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
10083 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
10084 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
10085 /// A pointer to the contents in the success state.
10086 /// Reading from this pointer when `result_ok` is not set is undefined.
10087 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
10088 /// A pointer to the contents in the error state.
10089 /// Reading from this pointer when `result_ok` is set is undefined.
10090 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10093 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
10094 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10096 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
10097 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
10098 /// `err` or `result` depending on the state of `result_ok`.
10099 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
10100 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
10101 pub result_ok: bool,
10104 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
10105 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
10106 CResult_DirectionalChannelInfoDecodeErrorZ {
10107 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10108 result: Box::into_raw(Box::new(o)),
10114 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
10115 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
10116 CResult_DirectionalChannelInfoDecodeErrorZ {
10117 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10118 err: Box::into_raw(Box::new(e)),
10123 /// Checks if the given object is currently in the success state
10125 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o: &CResult_DirectionalChannelInfoDecodeErrorZ) -> bool {
10129 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
10130 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
10131 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
10132 fn drop(&mut self) {
10133 if self.result_ok {
10134 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10135 let _ = unsafe { Box::from_raw(self.contents.result) };
10138 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10139 let _ = unsafe { Box::from_raw(self.contents.err) };
10144 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
10145 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10146 let contents = if o.result_ok {
10147 let result = unsafe { o.contents.result };
10148 unsafe { o.contents.result = core::ptr::null_mut() };
10149 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
10151 let err = unsafe { o.contents.err };
10152 unsafe { o.contents.err = core::ptr::null_mut(); }
10153 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
10157 result_ok: o.result_ok,
10161 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
10162 fn clone(&self) -> Self {
10163 if self.result_ok {
10164 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10165 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
10168 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10169 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10175 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
10176 /// but with all dynamically-allocated buffers duplicated in new buffers.
10177 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
10179 /// The contents of CResult_ChannelInfoDecodeErrorZ
10180 pub union CResult_ChannelInfoDecodeErrorZPtr {
10181 /// A pointer to the contents in the success state.
10182 /// Reading from this pointer when `result_ok` is not set is undefined.
10183 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
10184 /// A pointer to the contents in the error state.
10185 /// Reading from this pointer when `result_ok` is set is undefined.
10186 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10189 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
10190 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10191 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10192 pub struct CResult_ChannelInfoDecodeErrorZ {
10193 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
10194 /// `err` or `result` depending on the state of `result_ok`.
10195 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
10196 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
10197 pub result_ok: bool,
10200 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
10201 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
10202 CResult_ChannelInfoDecodeErrorZ {
10203 contents: CResult_ChannelInfoDecodeErrorZPtr {
10204 result: Box::into_raw(Box::new(o)),
10210 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
10211 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
10212 CResult_ChannelInfoDecodeErrorZ {
10213 contents: CResult_ChannelInfoDecodeErrorZPtr {
10214 err: Box::into_raw(Box::new(e)),
10219 /// Checks if the given object is currently in the success state
10221 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
10225 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
10226 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
10227 impl Drop for CResult_ChannelInfoDecodeErrorZ {
10228 fn drop(&mut self) {
10229 if self.result_ok {
10230 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10231 let _ = unsafe { Box::from_raw(self.contents.result) };
10234 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10235 let _ = unsafe { Box::from_raw(self.contents.err) };
10240 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
10241 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10242 let contents = if o.result_ok {
10243 let result = unsafe { o.contents.result };
10244 unsafe { o.contents.result = core::ptr::null_mut() };
10245 CResult_ChannelInfoDecodeErrorZPtr { result }
10247 let err = unsafe { o.contents.err };
10248 unsafe { o.contents.err = core::ptr::null_mut(); }
10249 CResult_ChannelInfoDecodeErrorZPtr { err }
10253 result_ok: o.result_ok,
10257 impl Clone for CResult_ChannelInfoDecodeErrorZ {
10258 fn clone(&self) -> Self {
10259 if self.result_ok {
10260 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
10261 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
10264 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
10265 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10271 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
10272 /// but with all dynamically-allocated buffers duplicated in new buffers.
10273 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
10275 /// The contents of CResult_RoutingFeesDecodeErrorZ
10276 pub union CResult_RoutingFeesDecodeErrorZPtr {
10277 /// A pointer to the contents in the success state.
10278 /// Reading from this pointer when `result_ok` is not set is undefined.
10279 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
10280 /// A pointer to the contents in the error state.
10281 /// Reading from this pointer when `result_ok` is set is undefined.
10282 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10285 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
10286 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
10287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10288 pub struct CResult_RoutingFeesDecodeErrorZ {
10289 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
10290 /// `err` or `result` depending on the state of `result_ok`.
10291 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
10292 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
10293 pub result_ok: bool,
10296 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
10297 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
10298 CResult_RoutingFeesDecodeErrorZ {
10299 contents: CResult_RoutingFeesDecodeErrorZPtr {
10300 result: Box::into_raw(Box::new(o)),
10306 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
10307 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
10308 CResult_RoutingFeesDecodeErrorZ {
10309 contents: CResult_RoutingFeesDecodeErrorZPtr {
10310 err: Box::into_raw(Box::new(e)),
10315 /// Checks if the given object is currently in the success state
10317 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
10321 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
10322 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
10323 impl Drop for CResult_RoutingFeesDecodeErrorZ {
10324 fn drop(&mut self) {
10325 if self.result_ok {
10326 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10327 let _ = unsafe { Box::from_raw(self.contents.result) };
10330 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10331 let _ = unsafe { Box::from_raw(self.contents.err) };
10336 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
10337 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
10338 let contents = if o.result_ok {
10339 let result = unsafe { o.contents.result };
10340 unsafe { o.contents.result = core::ptr::null_mut() };
10341 CResult_RoutingFeesDecodeErrorZPtr { result }
10343 let err = unsafe { o.contents.err };
10344 unsafe { o.contents.err = core::ptr::null_mut(); }
10345 CResult_RoutingFeesDecodeErrorZPtr { err }
10349 result_ok: o.result_ok,
10353 impl Clone for CResult_RoutingFeesDecodeErrorZ {
10354 fn clone(&self) -> Self {
10355 if self.result_ok {
10356 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
10357 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
10360 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
10361 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10367 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
10368 /// but with all dynamically-allocated buffers duplicated in new buffers.
10369 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
10371 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
10372 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10373 /// A pointer to the contents in the success state.
10374 /// Reading from this pointer when `result_ok` is not set is undefined.
10375 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
10376 /// A pointer to the contents in the error state.
10377 /// Reading from this pointer when `result_ok` is set is undefined.
10378 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10381 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
10382 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10384 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
10385 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
10386 /// `err` or `result` depending on the state of `result_ok`.
10387 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
10388 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
10389 pub result_ok: bool,
10392 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
10393 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
10394 CResult_NodeAnnouncementInfoDecodeErrorZ {
10395 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10396 result: Box::into_raw(Box::new(o)),
10402 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
10403 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
10404 CResult_NodeAnnouncementInfoDecodeErrorZ {
10405 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10406 err: Box::into_raw(Box::new(e)),
10411 /// Checks if the given object is currently in the success state
10413 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
10417 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10418 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
10419 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
10420 fn drop(&mut self) {
10421 if self.result_ok {
10422 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10423 let _ = unsafe { Box::from_raw(self.contents.result) };
10426 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10427 let _ = unsafe { Box::from_raw(self.contents.err) };
10432 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
10433 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10434 let contents = if o.result_ok {
10435 let result = unsafe { o.contents.result };
10436 unsafe { o.contents.result = core::ptr::null_mut() };
10437 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
10439 let err = unsafe { o.contents.err };
10440 unsafe { o.contents.err = core::ptr::null_mut(); }
10441 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
10445 result_ok: o.result_ok,
10449 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
10450 fn clone(&self) -> Self {
10451 if self.result_ok {
10452 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10453 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
10456 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10457 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10463 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10464 /// but with all dynamically-allocated buffers duplicated in new buffers.
10465 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
10467 /// A dynamically-allocated array of u64s of arbitrary size.
10468 /// This corresponds to std::vector in C++
10469 pub struct CVec_u64Z {
10470 /// The elements in the array.
10471 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10472 pub data: *mut u64,
10473 /// The number of elements pointed to by `data`.
10477 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
10478 if self.datalen == 0 { return Vec::new(); }
10479 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10480 self.data = core::ptr::null_mut();
10484 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
10485 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10488 impl From<Vec<u64>> for CVec_u64Z {
10489 fn from(v: Vec<u64>) -> Self {
10490 let datalen = v.len();
10491 let data = Box::into_raw(v.into_boxed_slice());
10492 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10496 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10497 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
10498 impl Drop for CVec_u64Z {
10499 fn drop(&mut self) {
10500 if self.datalen == 0 { return; }
10501 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10504 impl Clone for CVec_u64Z {
10505 fn clone(&self) -> Self {
10506 let mut res = Vec::new();
10507 if self.datalen == 0 { return Self::from(res); }
10508 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10513 /// The contents of CResult_NodeInfoDecodeErrorZ
10514 pub union CResult_NodeInfoDecodeErrorZPtr {
10515 /// A pointer to the contents in the success state.
10516 /// Reading from this pointer when `result_ok` is not set is undefined.
10517 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
10518 /// A pointer to the contents in the error state.
10519 /// Reading from this pointer when `result_ok` is set is undefined.
10520 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10523 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
10524 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10526 pub struct CResult_NodeInfoDecodeErrorZ {
10527 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
10528 /// `err` or `result` depending on the state of `result_ok`.
10529 pub contents: CResult_NodeInfoDecodeErrorZPtr,
10530 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
10531 pub result_ok: bool,
10534 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10535 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
10536 CResult_NodeInfoDecodeErrorZ {
10537 contents: CResult_NodeInfoDecodeErrorZPtr {
10538 result: Box::into_raw(Box::new(o)),
10544 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10545 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
10546 CResult_NodeInfoDecodeErrorZ {
10547 contents: CResult_NodeInfoDecodeErrorZPtr {
10548 err: Box::into_raw(Box::new(e)),
10553 /// Checks if the given object is currently in the success state
10555 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
10559 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10560 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
10561 impl Drop for CResult_NodeInfoDecodeErrorZ {
10562 fn drop(&mut self) {
10563 if self.result_ok {
10564 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10565 let _ = unsafe { Box::from_raw(self.contents.result) };
10568 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10569 let _ = unsafe { Box::from_raw(self.contents.err) };
10574 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
10575 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10576 let contents = if o.result_ok {
10577 let result = unsafe { o.contents.result };
10578 unsafe { o.contents.result = core::ptr::null_mut() };
10579 CResult_NodeInfoDecodeErrorZPtr { result }
10581 let err = unsafe { o.contents.err };
10582 unsafe { o.contents.err = core::ptr::null_mut(); }
10583 CResult_NodeInfoDecodeErrorZPtr { err }
10587 result_ok: o.result_ok,
10591 impl Clone for CResult_NodeInfoDecodeErrorZ {
10592 fn clone(&self) -> Self {
10593 if self.result_ok {
10594 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
10595 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
10598 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
10599 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10605 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10606 /// but with all dynamically-allocated buffers duplicated in new buffers.
10607 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
10609 /// The contents of CResult_NetworkGraphDecodeErrorZ
10610 pub union CResult_NetworkGraphDecodeErrorZPtr {
10611 /// A pointer to the contents in the success state.
10612 /// Reading from this pointer when `result_ok` is not set is undefined.
10613 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
10614 /// A pointer to the contents in the error state.
10615 /// Reading from this pointer when `result_ok` is set is undefined.
10616 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10619 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
10620 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
10621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10622 pub struct CResult_NetworkGraphDecodeErrorZ {
10623 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
10624 /// `err` or `result` depending on the state of `result_ok`.
10625 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
10626 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
10627 pub result_ok: bool,
10630 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10631 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
10632 CResult_NetworkGraphDecodeErrorZ {
10633 contents: CResult_NetworkGraphDecodeErrorZPtr {
10634 result: Box::into_raw(Box::new(o)),
10640 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10641 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
10642 CResult_NetworkGraphDecodeErrorZ {
10643 contents: CResult_NetworkGraphDecodeErrorZPtr {
10644 err: Box::into_raw(Box::new(e)),
10649 /// Checks if the given object is currently in the success state
10651 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
10655 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10656 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
10657 impl Drop for CResult_NetworkGraphDecodeErrorZ {
10658 fn drop(&mut self) {
10659 if self.result_ok {
10660 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10661 let _ = unsafe { Box::from_raw(self.contents.result) };
10664 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10665 let _ = unsafe { Box::from_raw(self.contents.err) };
10670 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
10671 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
10672 let contents = if o.result_ok {
10673 let result = unsafe { o.contents.result };
10674 unsafe { o.contents.result = core::ptr::null_mut() };
10675 CResult_NetworkGraphDecodeErrorZPtr { result }
10677 let err = unsafe { o.contents.err };
10678 unsafe { o.contents.err = core::ptr::null_mut(); }
10679 CResult_NetworkGraphDecodeErrorZPtr { err }
10683 result_ok: o.result_ok,
10687 impl Clone for CResult_NetworkGraphDecodeErrorZ {
10688 fn clone(&self) -> Self {
10689 if self.result_ok {
10690 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
10691 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
10694 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
10695 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10701 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10702 /// but with all dynamically-allocated buffers duplicated in new buffers.
10703 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
10706 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
10707 pub enum COption_CVec_NetAddressZZ {
10708 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
10709 Some(crate::c_types::derived::CVec_NetAddressZ),
10710 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
10713 impl COption_CVec_NetAddressZZ {
10714 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10715 if let Self::None = self { false } else { true }
10717 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10720 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
10721 if let Self::Some(v) = self { v } else { unreachable!() }
10725 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
10726 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
10727 COption_CVec_NetAddressZZ::Some(o)
10730 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
10731 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
10732 COption_CVec_NetAddressZZ::None
10735 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
10736 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
10738 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
10739 /// but with all dynamically-allocated buffers duplicated in new buffers.
10740 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
10742 /// The contents of CResult_NetAddressDecodeErrorZ
10743 pub union CResult_NetAddressDecodeErrorZPtr {
10744 /// A pointer to the contents in the success state.
10745 /// Reading from this pointer when `result_ok` is not set is undefined.
10746 pub result: *mut crate::lightning::ln::msgs::NetAddress,
10747 /// A pointer to the contents in the error state.
10748 /// Reading from this pointer when `result_ok` is set is undefined.
10749 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10752 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
10753 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
10754 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10755 pub struct CResult_NetAddressDecodeErrorZ {
10756 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
10757 /// `err` or `result` depending on the state of `result_ok`.
10758 pub contents: CResult_NetAddressDecodeErrorZPtr,
10759 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
10760 pub result_ok: bool,
10763 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10764 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
10765 CResult_NetAddressDecodeErrorZ {
10766 contents: CResult_NetAddressDecodeErrorZPtr {
10767 result: Box::into_raw(Box::new(o)),
10773 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10774 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
10775 CResult_NetAddressDecodeErrorZ {
10776 contents: CResult_NetAddressDecodeErrorZPtr {
10777 err: Box::into_raw(Box::new(e)),
10782 /// Checks if the given object is currently in the success state
10784 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
10788 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10789 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
10790 impl Drop for CResult_NetAddressDecodeErrorZ {
10791 fn drop(&mut self) {
10792 if self.result_ok {
10793 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10794 let _ = unsafe { Box::from_raw(self.contents.result) };
10797 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10798 let _ = unsafe { Box::from_raw(self.contents.err) };
10803 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
10804 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
10805 let contents = if o.result_ok {
10806 let result = unsafe { o.contents.result };
10807 unsafe { o.contents.result = core::ptr::null_mut() };
10808 CResult_NetAddressDecodeErrorZPtr { result }
10810 let err = unsafe { o.contents.err };
10811 unsafe { o.contents.err = core::ptr::null_mut(); }
10812 CResult_NetAddressDecodeErrorZPtr { err }
10816 result_ok: o.result_ok,
10820 impl Clone for CResult_NetAddressDecodeErrorZ {
10821 fn clone(&self) -> Self {
10822 if self.result_ok {
10823 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
10824 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
10827 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
10828 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10834 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10835 /// but with all dynamically-allocated buffers duplicated in new buffers.
10836 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
10838 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
10839 /// This corresponds to std::vector in C++
10840 pub struct CVec_UpdateAddHTLCZ {
10841 /// The elements in the array.
10842 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10843 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10844 /// The number of elements pointed to by `data`.
10847 impl CVec_UpdateAddHTLCZ {
10848 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
10849 if self.datalen == 0 { return Vec::new(); }
10850 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10851 self.data = core::ptr::null_mut();
10855 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
10856 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10859 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
10860 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
10861 let datalen = v.len();
10862 let data = Box::into_raw(v.into_boxed_slice());
10863 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10867 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10868 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
10869 impl Drop for CVec_UpdateAddHTLCZ {
10870 fn drop(&mut self) {
10871 if self.datalen == 0 { return; }
10872 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10875 impl Clone for CVec_UpdateAddHTLCZ {
10876 fn clone(&self) -> Self {
10877 let mut res = Vec::new();
10878 if self.datalen == 0 { return Self::from(res); }
10879 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10884 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
10885 /// This corresponds to std::vector in C++
10886 pub struct CVec_UpdateFulfillHTLCZ {
10887 /// The elements in the array.
10888 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10889 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
10890 /// The number of elements pointed to by `data`.
10893 impl CVec_UpdateFulfillHTLCZ {
10894 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
10895 if self.datalen == 0 { return Vec::new(); }
10896 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10897 self.data = core::ptr::null_mut();
10901 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
10902 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10905 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
10906 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
10907 let datalen = v.len();
10908 let data = Box::into_raw(v.into_boxed_slice());
10909 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10913 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10914 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
10915 impl Drop for CVec_UpdateFulfillHTLCZ {
10916 fn drop(&mut self) {
10917 if self.datalen == 0 { return; }
10918 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10921 impl Clone for CVec_UpdateFulfillHTLCZ {
10922 fn clone(&self) -> Self {
10923 let mut res = Vec::new();
10924 if self.datalen == 0 { return Self::from(res); }
10925 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10930 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
10931 /// This corresponds to std::vector in C++
10932 pub struct CVec_UpdateFailHTLCZ {
10933 /// The elements in the array.
10934 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10935 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10936 /// The number of elements pointed to by `data`.
10939 impl CVec_UpdateFailHTLCZ {
10940 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
10941 if self.datalen == 0 { return Vec::new(); }
10942 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10943 self.data = core::ptr::null_mut();
10947 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
10948 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10951 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
10952 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
10953 let datalen = v.len();
10954 let data = Box::into_raw(v.into_boxed_slice());
10955 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10959 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10960 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
10961 impl Drop for CVec_UpdateFailHTLCZ {
10962 fn drop(&mut self) {
10963 if self.datalen == 0 { return; }
10964 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10967 impl Clone for CVec_UpdateFailHTLCZ {
10968 fn clone(&self) -> Self {
10969 let mut res = Vec::new();
10970 if self.datalen == 0 { return Self::from(res); }
10971 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10976 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
10977 /// This corresponds to std::vector in C++
10978 pub struct CVec_UpdateFailMalformedHTLCZ {
10979 /// The elements in the array.
10980 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10981 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10982 /// The number of elements pointed to by `data`.
10985 impl CVec_UpdateFailMalformedHTLCZ {
10986 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
10987 if self.datalen == 0 { return Vec::new(); }
10988 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10989 self.data = core::ptr::null_mut();
10993 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
10994 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10997 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
10998 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
10999 let datalen = v.len();
11000 let data = Box::into_raw(v.into_boxed_slice());
11001 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11005 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11006 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11007 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11008 fn drop(&mut self) {
11009 if self.datalen == 0 { return; }
11010 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11013 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11014 fn clone(&self) -> Self {
11015 let mut res = Vec::new();
11016 if self.datalen == 0 { return Self::from(res); }
11017 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11022 /// The contents of CResult_AcceptChannelDecodeErrorZ
11023 pub union CResult_AcceptChannelDecodeErrorZPtr {
11024 /// A pointer to the contents in the success state.
11025 /// Reading from this pointer when `result_ok` is not set is undefined.
11026 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11027 /// A pointer to the contents in the error state.
11028 /// Reading from this pointer when `result_ok` is set is undefined.
11029 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11032 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11033 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11035 pub struct CResult_AcceptChannelDecodeErrorZ {
11036 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11037 /// `err` or `result` depending on the state of `result_ok`.
11038 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11039 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11040 pub result_ok: bool,
11043 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
11044 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
11045 CResult_AcceptChannelDecodeErrorZ {
11046 contents: CResult_AcceptChannelDecodeErrorZPtr {
11047 result: Box::into_raw(Box::new(o)),
11053 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
11054 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
11055 CResult_AcceptChannelDecodeErrorZ {
11056 contents: CResult_AcceptChannelDecodeErrorZPtr {
11057 err: Box::into_raw(Box::new(e)),
11062 /// Checks if the given object is currently in the success state
11064 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
11068 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
11069 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
11070 impl Drop for CResult_AcceptChannelDecodeErrorZ {
11071 fn drop(&mut self) {
11072 if self.result_ok {
11073 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11074 let _ = unsafe { Box::from_raw(self.contents.result) };
11077 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11078 let _ = unsafe { Box::from_raw(self.contents.err) };
11083 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
11084 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
11085 let contents = if o.result_ok {
11086 let result = unsafe { o.contents.result };
11087 unsafe { o.contents.result = core::ptr::null_mut() };
11088 CResult_AcceptChannelDecodeErrorZPtr { result }
11090 let err = unsafe { o.contents.err };
11091 unsafe { o.contents.err = core::ptr::null_mut(); }
11092 CResult_AcceptChannelDecodeErrorZPtr { err }
11096 result_ok: o.result_ok,
11100 impl Clone for CResult_AcceptChannelDecodeErrorZ {
11101 fn clone(&self) -> Self {
11102 if self.result_ok {
11103 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
11104 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
11107 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
11108 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11114 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
11115 /// but with all dynamically-allocated buffers duplicated in new buffers.
11116 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
11118 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
11119 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
11120 /// A pointer to the contents in the success state.
11121 /// Reading from this pointer when `result_ok` is not set is undefined.
11122 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
11123 /// A pointer to the contents in the error state.
11124 /// Reading from this pointer when `result_ok` is set is undefined.
11125 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11128 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
11129 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
11130 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11131 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
11132 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
11133 /// `err` or `result` depending on the state of `result_ok`.
11134 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
11135 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
11136 pub result_ok: bool,
11139 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
11140 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11141 CResult_AnnouncementSignaturesDecodeErrorZ {
11142 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11143 result: Box::into_raw(Box::new(o)),
11149 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
11150 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11151 CResult_AnnouncementSignaturesDecodeErrorZ {
11152 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11153 err: Box::into_raw(Box::new(e)),
11158 /// Checks if the given object is currently in the success state
11160 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
11164 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
11165 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
11166 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
11167 fn drop(&mut self) {
11168 if self.result_ok {
11169 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11170 let _ = unsafe { Box::from_raw(self.contents.result) };
11173 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11174 let _ = unsafe { Box::from_raw(self.contents.err) };
11179 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
11180 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
11181 let contents = if o.result_ok {
11182 let result = unsafe { o.contents.result };
11183 unsafe { o.contents.result = core::ptr::null_mut() };
11184 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
11186 let err = unsafe { o.contents.err };
11187 unsafe { o.contents.err = core::ptr::null_mut(); }
11188 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
11192 result_ok: o.result_ok,
11196 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
11197 fn clone(&self) -> Self {
11198 if self.result_ok {
11199 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11200 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
11203 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11204 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11210 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
11211 /// but with all dynamically-allocated buffers duplicated in new buffers.
11212 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
11214 /// The contents of CResult_ChannelReestablishDecodeErrorZ
11215 pub union CResult_ChannelReestablishDecodeErrorZPtr {
11216 /// A pointer to the contents in the success state.
11217 /// Reading from this pointer when `result_ok` is not set is undefined.
11218 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
11219 /// A pointer to the contents in the error state.
11220 /// Reading from this pointer when `result_ok` is set is undefined.
11221 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11224 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
11225 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
11226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11227 pub struct CResult_ChannelReestablishDecodeErrorZ {
11228 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
11229 /// `err` or `result` depending on the state of `result_ok`.
11230 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
11231 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
11232 pub result_ok: bool,
11235 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
11236 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
11237 CResult_ChannelReestablishDecodeErrorZ {
11238 contents: CResult_ChannelReestablishDecodeErrorZPtr {
11239 result: Box::into_raw(Box::new(o)),
11245 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
11246 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
11247 CResult_ChannelReestablishDecodeErrorZ {
11248 contents: CResult_ChannelReestablishDecodeErrorZPtr {
11249 err: Box::into_raw(Box::new(e)),
11254 /// Checks if the given object is currently in the success state
11256 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
11260 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
11261 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
11262 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
11263 fn drop(&mut self) {
11264 if self.result_ok {
11265 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11266 let _ = unsafe { Box::from_raw(self.contents.result) };
11269 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11270 let _ = unsafe { Box::from_raw(self.contents.err) };
11275 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
11276 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
11277 let contents = if o.result_ok {
11278 let result = unsafe { o.contents.result };
11279 unsafe { o.contents.result = core::ptr::null_mut() };
11280 CResult_ChannelReestablishDecodeErrorZPtr { result }
11282 let err = unsafe { o.contents.err };
11283 unsafe { o.contents.err = core::ptr::null_mut(); }
11284 CResult_ChannelReestablishDecodeErrorZPtr { err }
11288 result_ok: o.result_ok,
11292 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
11293 fn clone(&self) -> Self {
11294 if self.result_ok {
11295 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
11296 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
11299 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
11300 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11306 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
11307 /// but with all dynamically-allocated buffers duplicated in new buffers.
11308 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
11310 /// The contents of CResult_ClosingSignedDecodeErrorZ
11311 pub union CResult_ClosingSignedDecodeErrorZPtr {
11312 /// A pointer to the contents in the success state.
11313 /// Reading from this pointer when `result_ok` is not set is undefined.
11314 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
11315 /// A pointer to the contents in the error state.
11316 /// Reading from this pointer when `result_ok` is set is undefined.
11317 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11320 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
11321 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11322 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11323 pub struct CResult_ClosingSignedDecodeErrorZ {
11324 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
11325 /// `err` or `result` depending on the state of `result_ok`.
11326 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
11327 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
11328 pub result_ok: bool,
11331 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
11332 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
11333 CResult_ClosingSignedDecodeErrorZ {
11334 contents: CResult_ClosingSignedDecodeErrorZPtr {
11335 result: Box::into_raw(Box::new(o)),
11341 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
11342 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
11343 CResult_ClosingSignedDecodeErrorZ {
11344 contents: CResult_ClosingSignedDecodeErrorZPtr {
11345 err: Box::into_raw(Box::new(e)),
11350 /// Checks if the given object is currently in the success state
11352 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
11356 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
11357 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
11358 impl Drop for CResult_ClosingSignedDecodeErrorZ {
11359 fn drop(&mut self) {
11360 if self.result_ok {
11361 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11362 let _ = unsafe { Box::from_raw(self.contents.result) };
11365 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11366 let _ = unsafe { Box::from_raw(self.contents.err) };
11371 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
11372 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11373 let contents = if o.result_ok {
11374 let result = unsafe { o.contents.result };
11375 unsafe { o.contents.result = core::ptr::null_mut() };
11376 CResult_ClosingSignedDecodeErrorZPtr { result }
11378 let err = unsafe { o.contents.err };
11379 unsafe { o.contents.err = core::ptr::null_mut(); }
11380 CResult_ClosingSignedDecodeErrorZPtr { err }
11384 result_ok: o.result_ok,
11388 impl Clone for CResult_ClosingSignedDecodeErrorZ {
11389 fn clone(&self) -> Self {
11390 if self.result_ok {
11391 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
11392 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
11395 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
11396 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11402 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
11403 /// but with all dynamically-allocated buffers duplicated in new buffers.
11404 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
11406 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
11407 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11408 /// A pointer to the contents in the success state.
11409 /// Reading from this pointer when `result_ok` is not set is undefined.
11410 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
11411 /// A pointer to the contents in the error state.
11412 /// Reading from this pointer when `result_ok` is set is undefined.
11413 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11416 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
11417 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11418 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11419 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
11420 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
11421 /// `err` or `result` depending on the state of `result_ok`.
11422 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
11423 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
11424 pub result_ok: bool,
11427 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
11428 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11429 CResult_ClosingSignedFeeRangeDecodeErrorZ {
11430 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11431 result: Box::into_raw(Box::new(o)),
11437 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
11438 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11439 CResult_ClosingSignedFeeRangeDecodeErrorZ {
11440 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11441 err: Box::into_raw(Box::new(e)),
11446 /// Checks if the given object is currently in the success state
11448 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
11452 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
11453 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
11454 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11455 fn drop(&mut self) {
11456 if self.result_ok {
11457 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11458 let _ = unsafe { Box::from_raw(self.contents.result) };
11461 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11462 let _ = unsafe { Box::from_raw(self.contents.err) };
11467 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11468 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11469 let contents = if o.result_ok {
11470 let result = unsafe { o.contents.result };
11471 unsafe { o.contents.result = core::ptr::null_mut() };
11472 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
11474 let err = unsafe { o.contents.err };
11475 unsafe { o.contents.err = core::ptr::null_mut(); }
11476 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
11480 result_ok: o.result_ok,
11484 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11485 fn clone(&self) -> Self {
11486 if self.result_ok {
11487 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11488 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
11491 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11492 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11498 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
11499 /// but with all dynamically-allocated buffers duplicated in new buffers.
11500 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
11502 /// The contents of CResult_CommitmentSignedDecodeErrorZ
11503 pub union CResult_CommitmentSignedDecodeErrorZPtr {
11504 /// A pointer to the contents in the success state.
11505 /// Reading from this pointer when `result_ok` is not set is undefined.
11506 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
11507 /// A pointer to the contents in the error state.
11508 /// Reading from this pointer when `result_ok` is set is undefined.
11509 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11512 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
11513 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11515 pub struct CResult_CommitmentSignedDecodeErrorZ {
11516 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
11517 /// `err` or `result` depending on the state of `result_ok`.
11518 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
11519 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
11520 pub result_ok: bool,
11523 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
11524 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
11525 CResult_CommitmentSignedDecodeErrorZ {
11526 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11527 result: Box::into_raw(Box::new(o)),
11533 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
11534 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
11535 CResult_CommitmentSignedDecodeErrorZ {
11536 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11537 err: Box::into_raw(Box::new(e)),
11542 /// Checks if the given object is currently in the success state
11544 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
11548 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
11549 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
11550 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
11551 fn drop(&mut self) {
11552 if self.result_ok {
11553 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11554 let _ = unsafe { Box::from_raw(self.contents.result) };
11557 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11558 let _ = unsafe { Box::from_raw(self.contents.err) };
11563 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
11564 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11565 let contents = if o.result_ok {
11566 let result = unsafe { o.contents.result };
11567 unsafe { o.contents.result = core::ptr::null_mut() };
11568 CResult_CommitmentSignedDecodeErrorZPtr { result }
11570 let err = unsafe { o.contents.err };
11571 unsafe { o.contents.err = core::ptr::null_mut(); }
11572 CResult_CommitmentSignedDecodeErrorZPtr { err }
11576 result_ok: o.result_ok,
11580 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
11581 fn clone(&self) -> Self {
11582 if self.result_ok {
11583 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11584 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
11587 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11588 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11594 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
11595 /// but with all dynamically-allocated buffers duplicated in new buffers.
11596 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
11598 /// The contents of CResult_FundingCreatedDecodeErrorZ
11599 pub union CResult_FundingCreatedDecodeErrorZPtr {
11600 /// A pointer to the contents in the success state.
11601 /// Reading from this pointer when `result_ok` is not set is undefined.
11602 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
11603 /// A pointer to the contents in the error state.
11604 /// Reading from this pointer when `result_ok` is set is undefined.
11605 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11608 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
11609 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
11610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11611 pub struct CResult_FundingCreatedDecodeErrorZ {
11612 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
11613 /// `err` or `result` depending on the state of `result_ok`.
11614 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
11615 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
11616 pub result_ok: bool,
11619 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
11620 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
11621 CResult_FundingCreatedDecodeErrorZ {
11622 contents: CResult_FundingCreatedDecodeErrorZPtr {
11623 result: Box::into_raw(Box::new(o)),
11629 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
11630 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
11631 CResult_FundingCreatedDecodeErrorZ {
11632 contents: CResult_FundingCreatedDecodeErrorZPtr {
11633 err: Box::into_raw(Box::new(e)),
11638 /// Checks if the given object is currently in the success state
11640 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
11644 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
11645 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
11646 impl Drop for CResult_FundingCreatedDecodeErrorZ {
11647 fn drop(&mut self) {
11648 if self.result_ok {
11649 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11650 let _ = unsafe { Box::from_raw(self.contents.result) };
11653 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11654 let _ = unsafe { Box::from_raw(self.contents.err) };
11659 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
11660 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
11661 let contents = if o.result_ok {
11662 let result = unsafe { o.contents.result };
11663 unsafe { o.contents.result = core::ptr::null_mut() };
11664 CResult_FundingCreatedDecodeErrorZPtr { result }
11666 let err = unsafe { o.contents.err };
11667 unsafe { o.contents.err = core::ptr::null_mut(); }
11668 CResult_FundingCreatedDecodeErrorZPtr { err }
11672 result_ok: o.result_ok,
11676 impl Clone for CResult_FundingCreatedDecodeErrorZ {
11677 fn clone(&self) -> Self {
11678 if self.result_ok {
11679 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
11680 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
11683 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
11684 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11690 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
11691 /// but with all dynamically-allocated buffers duplicated in new buffers.
11692 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
11694 /// The contents of CResult_FundingSignedDecodeErrorZ
11695 pub union CResult_FundingSignedDecodeErrorZPtr {
11696 /// A pointer to the contents in the success state.
11697 /// Reading from this pointer when `result_ok` is not set is undefined.
11698 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
11699 /// A pointer to the contents in the error state.
11700 /// Reading from this pointer when `result_ok` is set is undefined.
11701 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11704 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
11705 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11707 pub struct CResult_FundingSignedDecodeErrorZ {
11708 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
11709 /// `err` or `result` depending on the state of `result_ok`.
11710 pub contents: CResult_FundingSignedDecodeErrorZPtr,
11711 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
11712 pub result_ok: bool,
11715 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
11716 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
11717 CResult_FundingSignedDecodeErrorZ {
11718 contents: CResult_FundingSignedDecodeErrorZPtr {
11719 result: Box::into_raw(Box::new(o)),
11725 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
11726 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
11727 CResult_FundingSignedDecodeErrorZ {
11728 contents: CResult_FundingSignedDecodeErrorZPtr {
11729 err: Box::into_raw(Box::new(e)),
11734 /// Checks if the given object is currently in the success state
11736 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
11740 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
11741 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
11742 impl Drop for CResult_FundingSignedDecodeErrorZ {
11743 fn drop(&mut self) {
11744 if self.result_ok {
11745 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11746 let _ = unsafe { Box::from_raw(self.contents.result) };
11749 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11750 let _ = unsafe { Box::from_raw(self.contents.err) };
11755 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
11756 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11757 let contents = if o.result_ok {
11758 let result = unsafe { o.contents.result };
11759 unsafe { o.contents.result = core::ptr::null_mut() };
11760 CResult_FundingSignedDecodeErrorZPtr { result }
11762 let err = unsafe { o.contents.err };
11763 unsafe { o.contents.err = core::ptr::null_mut(); }
11764 CResult_FundingSignedDecodeErrorZPtr { err }
11768 result_ok: o.result_ok,
11772 impl Clone for CResult_FundingSignedDecodeErrorZ {
11773 fn clone(&self) -> Self {
11774 if self.result_ok {
11775 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
11776 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
11779 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
11780 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11786 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
11787 /// but with all dynamically-allocated buffers duplicated in new buffers.
11788 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
11790 /// The contents of CResult_FundingLockedDecodeErrorZ
11791 pub union CResult_FundingLockedDecodeErrorZPtr {
11792 /// A pointer to the contents in the success state.
11793 /// Reading from this pointer when `result_ok` is not set is undefined.
11794 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
11795 /// A pointer to the contents in the error state.
11796 /// Reading from this pointer when `result_ok` is set is undefined.
11797 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11800 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
11801 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
11802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11803 pub struct CResult_FundingLockedDecodeErrorZ {
11804 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
11805 /// `err` or `result` depending on the state of `result_ok`.
11806 pub contents: CResult_FundingLockedDecodeErrorZPtr,
11807 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
11808 pub result_ok: bool,
11811 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
11812 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
11813 CResult_FundingLockedDecodeErrorZ {
11814 contents: CResult_FundingLockedDecodeErrorZPtr {
11815 result: Box::into_raw(Box::new(o)),
11821 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
11822 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
11823 CResult_FundingLockedDecodeErrorZ {
11824 contents: CResult_FundingLockedDecodeErrorZPtr {
11825 err: Box::into_raw(Box::new(e)),
11830 /// Checks if the given object is currently in the success state
11832 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
11836 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11837 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
11838 impl Drop for CResult_FundingLockedDecodeErrorZ {
11839 fn drop(&mut self) {
11840 if self.result_ok {
11841 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11842 let _ = unsafe { Box::from_raw(self.contents.result) };
11845 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11846 let _ = unsafe { Box::from_raw(self.contents.err) };
11851 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
11852 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
11853 let contents = if o.result_ok {
11854 let result = unsafe { o.contents.result };
11855 unsafe { o.contents.result = core::ptr::null_mut() };
11856 CResult_FundingLockedDecodeErrorZPtr { result }
11858 let err = unsafe { o.contents.err };
11859 unsafe { o.contents.err = core::ptr::null_mut(); }
11860 CResult_FundingLockedDecodeErrorZPtr { err }
11864 result_ok: o.result_ok,
11868 impl Clone for CResult_FundingLockedDecodeErrorZ {
11869 fn clone(&self) -> Self {
11870 if self.result_ok {
11871 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
11872 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
11875 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
11876 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11882 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11883 /// but with all dynamically-allocated buffers duplicated in new buffers.
11884 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
11886 /// The contents of CResult_InitDecodeErrorZ
11887 pub union CResult_InitDecodeErrorZPtr {
11888 /// A pointer to the contents in the success state.
11889 /// Reading from this pointer when `result_ok` is not set is undefined.
11890 pub result: *mut crate::lightning::ln::msgs::Init,
11891 /// A pointer to the contents in the error state.
11892 /// Reading from this pointer when `result_ok` is set is undefined.
11893 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11896 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
11897 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
11898 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11899 pub struct CResult_InitDecodeErrorZ {
11900 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
11901 /// `err` or `result` depending on the state of `result_ok`.
11902 pub contents: CResult_InitDecodeErrorZPtr,
11903 /// Whether this CResult_InitDecodeErrorZ represents a success state.
11904 pub result_ok: bool,
11907 /// Creates a new CResult_InitDecodeErrorZ in the success state.
11908 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
11909 CResult_InitDecodeErrorZ {
11910 contents: CResult_InitDecodeErrorZPtr {
11911 result: Box::into_raw(Box::new(o)),
11917 /// Creates a new CResult_InitDecodeErrorZ in the error state.
11918 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
11919 CResult_InitDecodeErrorZ {
11920 contents: CResult_InitDecodeErrorZPtr {
11921 err: Box::into_raw(Box::new(e)),
11926 /// Checks if the given object is currently in the success state
11928 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
11932 /// Frees any resources used by the CResult_InitDecodeErrorZ.
11933 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
11934 impl Drop for CResult_InitDecodeErrorZ {
11935 fn drop(&mut self) {
11936 if self.result_ok {
11937 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11938 let _ = unsafe { Box::from_raw(self.contents.result) };
11941 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11942 let _ = unsafe { Box::from_raw(self.contents.err) };
11947 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
11948 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
11949 let contents = if o.result_ok {
11950 let result = unsafe { o.contents.result };
11951 unsafe { o.contents.result = core::ptr::null_mut() };
11952 CResult_InitDecodeErrorZPtr { result }
11954 let err = unsafe { o.contents.err };
11955 unsafe { o.contents.err = core::ptr::null_mut(); }
11956 CResult_InitDecodeErrorZPtr { err }
11960 result_ok: o.result_ok,
11964 impl Clone for CResult_InitDecodeErrorZ {
11965 fn clone(&self) -> Self {
11966 if self.result_ok {
11967 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
11968 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
11971 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
11972 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11978 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11979 /// but with all dynamically-allocated buffers duplicated in new buffers.
11980 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
11982 /// The contents of CResult_OpenChannelDecodeErrorZ
11983 pub union CResult_OpenChannelDecodeErrorZPtr {
11984 /// A pointer to the contents in the success state.
11985 /// Reading from this pointer when `result_ok` is not set is undefined.
11986 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
11987 /// A pointer to the contents in the error state.
11988 /// Reading from this pointer when `result_ok` is set is undefined.
11989 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11992 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
11993 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11994 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11995 pub struct CResult_OpenChannelDecodeErrorZ {
11996 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
11997 /// `err` or `result` depending on the state of `result_ok`.
11998 pub contents: CResult_OpenChannelDecodeErrorZPtr,
11999 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12000 pub result_ok: bool,
12003 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12004 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12005 CResult_OpenChannelDecodeErrorZ {
12006 contents: CResult_OpenChannelDecodeErrorZPtr {
12007 result: Box::into_raw(Box::new(o)),
12013 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12014 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12015 CResult_OpenChannelDecodeErrorZ {
12016 contents: CResult_OpenChannelDecodeErrorZPtr {
12017 err: Box::into_raw(Box::new(e)),
12022 /// Checks if the given object is currently in the success state
12024 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12028 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12029 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12030 impl Drop for CResult_OpenChannelDecodeErrorZ {
12031 fn drop(&mut self) {
12032 if self.result_ok {
12033 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12034 let _ = unsafe { Box::from_raw(self.contents.result) };
12037 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12038 let _ = unsafe { Box::from_raw(self.contents.err) };
12043 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
12044 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12045 let contents = if o.result_ok {
12046 let result = unsafe { o.contents.result };
12047 unsafe { o.contents.result = core::ptr::null_mut() };
12048 CResult_OpenChannelDecodeErrorZPtr { result }
12050 let err = unsafe { o.contents.err };
12051 unsafe { o.contents.err = core::ptr::null_mut(); }
12052 CResult_OpenChannelDecodeErrorZPtr { err }
12056 result_ok: o.result_ok,
12060 impl Clone for CResult_OpenChannelDecodeErrorZ {
12061 fn clone(&self) -> Self {
12062 if self.result_ok {
12063 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
12064 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
12067 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
12068 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12074 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
12075 /// but with all dynamically-allocated buffers duplicated in new buffers.
12076 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
12078 /// The contents of CResult_RevokeAndACKDecodeErrorZ
12079 pub union CResult_RevokeAndACKDecodeErrorZPtr {
12080 /// A pointer to the contents in the success state.
12081 /// Reading from this pointer when `result_ok` is not set is undefined.
12082 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
12083 /// A pointer to the contents in the error state.
12084 /// Reading from this pointer when `result_ok` is set is undefined.
12085 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12088 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
12089 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
12090 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12091 pub struct CResult_RevokeAndACKDecodeErrorZ {
12092 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
12093 /// `err` or `result` depending on the state of `result_ok`.
12094 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
12095 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
12096 pub result_ok: bool,
12099 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
12100 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
12101 CResult_RevokeAndACKDecodeErrorZ {
12102 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12103 result: Box::into_raw(Box::new(o)),
12109 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
12110 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
12111 CResult_RevokeAndACKDecodeErrorZ {
12112 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12113 err: Box::into_raw(Box::new(e)),
12118 /// Checks if the given object is currently in the success state
12120 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
12124 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
12125 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
12126 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
12127 fn drop(&mut self) {
12128 if self.result_ok {
12129 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12130 let _ = unsafe { Box::from_raw(self.contents.result) };
12133 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12134 let _ = unsafe { Box::from_raw(self.contents.err) };
12139 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
12140 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
12141 let contents = if o.result_ok {
12142 let result = unsafe { o.contents.result };
12143 unsafe { o.contents.result = core::ptr::null_mut() };
12144 CResult_RevokeAndACKDecodeErrorZPtr { result }
12146 let err = unsafe { o.contents.err };
12147 unsafe { o.contents.err = core::ptr::null_mut(); }
12148 CResult_RevokeAndACKDecodeErrorZPtr { err }
12152 result_ok: o.result_ok,
12156 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
12157 fn clone(&self) -> Self {
12158 if self.result_ok {
12159 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
12160 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
12163 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
12164 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12170 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
12171 /// but with all dynamically-allocated buffers duplicated in new buffers.
12172 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
12174 /// The contents of CResult_ShutdownDecodeErrorZ
12175 pub union CResult_ShutdownDecodeErrorZPtr {
12176 /// A pointer to the contents in the success state.
12177 /// Reading from this pointer when `result_ok` is not set is undefined.
12178 pub result: *mut crate::lightning::ln::msgs::Shutdown,
12179 /// A pointer to the contents in the error state.
12180 /// Reading from this pointer when `result_ok` is set is undefined.
12181 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12184 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
12185 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
12186 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12187 pub struct CResult_ShutdownDecodeErrorZ {
12188 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
12189 /// `err` or `result` depending on the state of `result_ok`.
12190 pub contents: CResult_ShutdownDecodeErrorZPtr,
12191 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
12192 pub result_ok: bool,
12195 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
12196 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
12197 CResult_ShutdownDecodeErrorZ {
12198 contents: CResult_ShutdownDecodeErrorZPtr {
12199 result: Box::into_raw(Box::new(o)),
12205 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
12206 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
12207 CResult_ShutdownDecodeErrorZ {
12208 contents: CResult_ShutdownDecodeErrorZPtr {
12209 err: Box::into_raw(Box::new(e)),
12214 /// Checks if the given object is currently in the success state
12216 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
12220 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
12221 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
12222 impl Drop for CResult_ShutdownDecodeErrorZ {
12223 fn drop(&mut self) {
12224 if self.result_ok {
12225 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12226 let _ = unsafe { Box::from_raw(self.contents.result) };
12229 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12230 let _ = unsafe { Box::from_raw(self.contents.err) };
12235 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
12236 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
12237 let contents = if o.result_ok {
12238 let result = unsafe { o.contents.result };
12239 unsafe { o.contents.result = core::ptr::null_mut() };
12240 CResult_ShutdownDecodeErrorZPtr { result }
12242 let err = unsafe { o.contents.err };
12243 unsafe { o.contents.err = core::ptr::null_mut(); }
12244 CResult_ShutdownDecodeErrorZPtr { err }
12248 result_ok: o.result_ok,
12252 impl Clone for CResult_ShutdownDecodeErrorZ {
12253 fn clone(&self) -> Self {
12254 if self.result_ok {
12255 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
12256 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
12259 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
12260 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12266 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
12267 /// but with all dynamically-allocated buffers duplicated in new buffers.
12268 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
12270 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
12271 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
12272 /// A pointer to the contents in the success state.
12273 /// Reading from this pointer when `result_ok` is not set is undefined.
12274 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12275 /// A pointer to the contents in the error state.
12276 /// Reading from this pointer when `result_ok` is set is undefined.
12277 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12280 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
12281 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12283 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
12284 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
12285 /// `err` or `result` depending on the state of `result_ok`.
12286 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
12287 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
12288 pub result_ok: bool,
12291 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
12292 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
12293 CResult_UpdateFailHTLCDecodeErrorZ {
12294 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12295 result: Box::into_raw(Box::new(o)),
12301 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
12302 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
12303 CResult_UpdateFailHTLCDecodeErrorZ {
12304 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12305 err: Box::into_raw(Box::new(e)),
12310 /// Checks if the given object is currently in the success state
12312 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
12316 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
12317 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
12318 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
12319 fn drop(&mut self) {
12320 if self.result_ok {
12321 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12322 let _ = unsafe { Box::from_raw(self.contents.result) };
12325 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12326 let _ = unsafe { Box::from_raw(self.contents.err) };
12331 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
12332 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12333 let contents = if o.result_ok {
12334 let result = unsafe { o.contents.result };
12335 unsafe { o.contents.result = core::ptr::null_mut() };
12336 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
12338 let err = unsafe { o.contents.err };
12339 unsafe { o.contents.err = core::ptr::null_mut(); }
12340 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
12344 result_ok: o.result_ok,
12348 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
12349 fn clone(&self) -> Self {
12350 if self.result_ok {
12351 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12352 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
12355 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12356 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12362 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
12363 /// but with all dynamically-allocated buffers duplicated in new buffers.
12364 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
12366 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
12367 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12368 /// A pointer to the contents in the success state.
12369 /// Reading from this pointer when `result_ok` is not set is undefined.
12370 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12371 /// A pointer to the contents in the error state.
12372 /// Reading from this pointer when `result_ok` is set is undefined.
12373 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12376 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
12377 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12378 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12379 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12380 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
12381 /// `err` or `result` depending on the state of `result_ok`.
12382 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
12383 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
12384 pub result_ok: bool,
12387 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
12388 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12389 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12390 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12391 result: Box::into_raw(Box::new(o)),
12397 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
12398 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12399 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12400 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12401 err: Box::into_raw(Box::new(e)),
12406 /// Checks if the given object is currently in the success state
12408 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
12412 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
12413 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
12414 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12415 fn drop(&mut self) {
12416 if self.result_ok {
12417 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12418 let _ = unsafe { Box::from_raw(self.contents.result) };
12421 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12422 let _ = unsafe { Box::from_raw(self.contents.err) };
12427 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12428 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12429 let contents = if o.result_ok {
12430 let result = unsafe { o.contents.result };
12431 unsafe { o.contents.result = core::ptr::null_mut() };
12432 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
12434 let err = unsafe { o.contents.err };
12435 unsafe { o.contents.err = core::ptr::null_mut(); }
12436 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
12440 result_ok: o.result_ok,
12444 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12445 fn clone(&self) -> Self {
12446 if self.result_ok {
12447 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12448 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
12451 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12452 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12458 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
12459 /// but with all dynamically-allocated buffers duplicated in new buffers.
12460 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
12462 /// The contents of CResult_UpdateFeeDecodeErrorZ
12463 pub union CResult_UpdateFeeDecodeErrorZPtr {
12464 /// A pointer to the contents in the success state.
12465 /// Reading from this pointer when `result_ok` is not set is undefined.
12466 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
12467 /// A pointer to the contents in the error state.
12468 /// Reading from this pointer when `result_ok` is set is undefined.
12469 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12472 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
12473 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
12474 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12475 pub struct CResult_UpdateFeeDecodeErrorZ {
12476 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
12477 /// `err` or `result` depending on the state of `result_ok`.
12478 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
12479 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
12480 pub result_ok: bool,
12483 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
12484 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
12485 CResult_UpdateFeeDecodeErrorZ {
12486 contents: CResult_UpdateFeeDecodeErrorZPtr {
12487 result: Box::into_raw(Box::new(o)),
12493 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
12494 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
12495 CResult_UpdateFeeDecodeErrorZ {
12496 contents: CResult_UpdateFeeDecodeErrorZPtr {
12497 err: Box::into_raw(Box::new(e)),
12502 /// Checks if the given object is currently in the success state
12504 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
12508 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
12509 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
12510 impl Drop for CResult_UpdateFeeDecodeErrorZ {
12511 fn drop(&mut self) {
12512 if self.result_ok {
12513 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12514 let _ = unsafe { Box::from_raw(self.contents.result) };
12517 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12518 let _ = unsafe { Box::from_raw(self.contents.err) };
12523 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
12524 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
12525 let contents = if o.result_ok {
12526 let result = unsafe { o.contents.result };
12527 unsafe { o.contents.result = core::ptr::null_mut() };
12528 CResult_UpdateFeeDecodeErrorZPtr { result }
12530 let err = unsafe { o.contents.err };
12531 unsafe { o.contents.err = core::ptr::null_mut(); }
12532 CResult_UpdateFeeDecodeErrorZPtr { err }
12536 result_ok: o.result_ok,
12540 impl Clone for CResult_UpdateFeeDecodeErrorZ {
12541 fn clone(&self) -> Self {
12542 if self.result_ok {
12543 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
12544 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
12547 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
12548 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12554 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
12555 /// but with all dynamically-allocated buffers duplicated in new buffers.
12556 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
12558 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
12559 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12560 /// A pointer to the contents in the success state.
12561 /// Reading from this pointer when `result_ok` is not set is undefined.
12562 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12563 /// A pointer to the contents in the error state.
12564 /// Reading from this pointer when `result_ok` is set is undefined.
12565 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12568 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
12569 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12570 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12571 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
12572 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
12573 /// `err` or `result` depending on the state of `result_ok`.
12574 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
12575 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
12576 pub result_ok: bool,
12579 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
12580 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12581 CResult_UpdateFulfillHTLCDecodeErrorZ {
12582 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12583 result: Box::into_raw(Box::new(o)),
12589 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
12590 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12591 CResult_UpdateFulfillHTLCDecodeErrorZ {
12592 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12593 err: Box::into_raw(Box::new(e)),
12598 /// Checks if the given object is currently in the success state
12600 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
12604 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
12605 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
12606 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
12607 fn drop(&mut self) {
12608 if self.result_ok {
12609 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12610 let _ = unsafe { Box::from_raw(self.contents.result) };
12613 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12614 let _ = unsafe { Box::from_raw(self.contents.err) };
12619 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
12620 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12621 let contents = if o.result_ok {
12622 let result = unsafe { o.contents.result };
12623 unsafe { o.contents.result = core::ptr::null_mut() };
12624 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
12626 let err = unsafe { o.contents.err };
12627 unsafe { o.contents.err = core::ptr::null_mut(); }
12628 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
12632 result_ok: o.result_ok,
12636 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
12637 fn clone(&self) -> Self {
12638 if self.result_ok {
12639 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12640 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
12643 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12644 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12650 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
12651 /// but with all dynamically-allocated buffers duplicated in new buffers.
12652 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
12654 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
12655 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
12656 /// A pointer to the contents in the success state.
12657 /// Reading from this pointer when `result_ok` is not set is undefined.
12658 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12659 /// A pointer to the contents in the error state.
12660 /// Reading from this pointer when `result_ok` is set is undefined.
12661 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12664 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
12665 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12667 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
12668 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
12669 /// `err` or `result` depending on the state of `result_ok`.
12670 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
12671 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
12672 pub result_ok: bool,
12675 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
12676 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
12677 CResult_UpdateAddHTLCDecodeErrorZ {
12678 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12679 result: Box::into_raw(Box::new(o)),
12685 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
12686 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
12687 CResult_UpdateAddHTLCDecodeErrorZ {
12688 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12689 err: Box::into_raw(Box::new(e)),
12694 /// Checks if the given object is currently in the success state
12696 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
12700 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
12701 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
12702 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
12703 fn drop(&mut self) {
12704 if self.result_ok {
12705 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12706 let _ = unsafe { Box::from_raw(self.contents.result) };
12709 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12710 let _ = unsafe { Box::from_raw(self.contents.err) };
12715 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
12716 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12717 let contents = if o.result_ok {
12718 let result = unsafe { o.contents.result };
12719 unsafe { o.contents.result = core::ptr::null_mut() };
12720 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
12722 let err = unsafe { o.contents.err };
12723 unsafe { o.contents.err = core::ptr::null_mut(); }
12724 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
12728 result_ok: o.result_ok,
12732 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
12733 fn clone(&self) -> Self {
12734 if self.result_ok {
12735 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12736 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
12739 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12740 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12746 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
12747 /// but with all dynamically-allocated buffers duplicated in new buffers.
12748 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
12750 /// The contents of CResult_PingDecodeErrorZ
12751 pub union CResult_PingDecodeErrorZPtr {
12752 /// A pointer to the contents in the success state.
12753 /// Reading from this pointer when `result_ok` is not set is undefined.
12754 pub result: *mut crate::lightning::ln::msgs::Ping,
12755 /// A pointer to the contents in the error state.
12756 /// Reading from this pointer when `result_ok` is set is undefined.
12757 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12760 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
12761 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
12762 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12763 pub struct CResult_PingDecodeErrorZ {
12764 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
12765 /// `err` or `result` depending on the state of `result_ok`.
12766 pub contents: CResult_PingDecodeErrorZPtr,
12767 /// Whether this CResult_PingDecodeErrorZ represents a success state.
12768 pub result_ok: bool,
12771 /// Creates a new CResult_PingDecodeErrorZ in the success state.
12772 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
12773 CResult_PingDecodeErrorZ {
12774 contents: CResult_PingDecodeErrorZPtr {
12775 result: Box::into_raw(Box::new(o)),
12781 /// Creates a new CResult_PingDecodeErrorZ in the error state.
12782 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
12783 CResult_PingDecodeErrorZ {
12784 contents: CResult_PingDecodeErrorZPtr {
12785 err: Box::into_raw(Box::new(e)),
12790 /// Checks if the given object is currently in the success state
12792 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
12796 /// Frees any resources used by the CResult_PingDecodeErrorZ.
12797 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
12798 impl Drop for CResult_PingDecodeErrorZ {
12799 fn drop(&mut self) {
12800 if self.result_ok {
12801 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12802 let _ = unsafe { Box::from_raw(self.contents.result) };
12805 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12806 let _ = unsafe { Box::from_raw(self.contents.err) };
12811 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
12812 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
12813 let contents = if o.result_ok {
12814 let result = unsafe { o.contents.result };
12815 unsafe { o.contents.result = core::ptr::null_mut() };
12816 CResult_PingDecodeErrorZPtr { result }
12818 let err = unsafe { o.contents.err };
12819 unsafe { o.contents.err = core::ptr::null_mut(); }
12820 CResult_PingDecodeErrorZPtr { err }
12824 result_ok: o.result_ok,
12828 impl Clone for CResult_PingDecodeErrorZ {
12829 fn clone(&self) -> Self {
12830 if self.result_ok {
12831 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
12832 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
12835 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
12836 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12842 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
12843 /// but with all dynamically-allocated buffers duplicated in new buffers.
12844 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
12846 /// The contents of CResult_PongDecodeErrorZ
12847 pub union CResult_PongDecodeErrorZPtr {
12848 /// A pointer to the contents in the success state.
12849 /// Reading from this pointer when `result_ok` is not set is undefined.
12850 pub result: *mut crate::lightning::ln::msgs::Pong,
12851 /// A pointer to the contents in the error state.
12852 /// Reading from this pointer when `result_ok` is set is undefined.
12853 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12856 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
12857 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
12858 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12859 pub struct CResult_PongDecodeErrorZ {
12860 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
12861 /// `err` or `result` depending on the state of `result_ok`.
12862 pub contents: CResult_PongDecodeErrorZPtr,
12863 /// Whether this CResult_PongDecodeErrorZ represents a success state.
12864 pub result_ok: bool,
12867 /// Creates a new CResult_PongDecodeErrorZ in the success state.
12868 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
12869 CResult_PongDecodeErrorZ {
12870 contents: CResult_PongDecodeErrorZPtr {
12871 result: Box::into_raw(Box::new(o)),
12877 /// Creates a new CResult_PongDecodeErrorZ in the error state.
12878 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
12879 CResult_PongDecodeErrorZ {
12880 contents: CResult_PongDecodeErrorZPtr {
12881 err: Box::into_raw(Box::new(e)),
12886 /// Checks if the given object is currently in the success state
12888 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
12892 /// Frees any resources used by the CResult_PongDecodeErrorZ.
12893 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
12894 impl Drop for CResult_PongDecodeErrorZ {
12895 fn drop(&mut self) {
12896 if self.result_ok {
12897 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12898 let _ = unsafe { Box::from_raw(self.contents.result) };
12901 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12902 let _ = unsafe { Box::from_raw(self.contents.err) };
12907 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
12908 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
12909 let contents = if o.result_ok {
12910 let result = unsafe { o.contents.result };
12911 unsafe { o.contents.result = core::ptr::null_mut() };
12912 CResult_PongDecodeErrorZPtr { result }
12914 let err = unsafe { o.contents.err };
12915 unsafe { o.contents.err = core::ptr::null_mut(); }
12916 CResult_PongDecodeErrorZPtr { err }
12920 result_ok: o.result_ok,
12924 impl Clone for CResult_PongDecodeErrorZ {
12925 fn clone(&self) -> Self {
12926 if self.result_ok {
12927 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
12928 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
12931 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
12932 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12938 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
12939 /// but with all dynamically-allocated buffers duplicated in new buffers.
12940 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
12942 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
12943 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12944 /// A pointer to the contents in the success state.
12945 /// Reading from this pointer when `result_ok` is not set is undefined.
12946 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
12947 /// A pointer to the contents in the error state.
12948 /// Reading from this pointer when `result_ok` is set is undefined.
12949 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12952 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12953 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12955 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12956 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
12957 /// `err` or `result` depending on the state of `result_ok`.
12958 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
12959 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
12960 pub result_ok: bool,
12963 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
12964 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12965 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12966 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12967 result: Box::into_raw(Box::new(o)),
12973 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
12974 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12975 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12976 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12977 err: Box::into_raw(Box::new(e)),
12982 /// Checks if the given object is currently in the success state
12984 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
12988 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
12989 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
12990 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12991 fn drop(&mut self) {
12992 if self.result_ok {
12993 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12994 let _ = unsafe { Box::from_raw(self.contents.result) };
12997 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12998 let _ = unsafe { Box::from_raw(self.contents.err) };
13003 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13004 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13005 let contents = if o.result_ok {
13006 let result = unsafe { o.contents.result };
13007 unsafe { o.contents.result = core::ptr::null_mut() };
13008 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13010 let err = unsafe { o.contents.err };
13011 unsafe { o.contents.err = core::ptr::null_mut(); }
13012 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13016 result_ok: o.result_ok,
13020 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13021 fn clone(&self) -> Self {
13022 if self.result_ok {
13023 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13024 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13027 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13028 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13034 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13035 /// but with all dynamically-allocated buffers duplicated in new buffers.
13036 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13038 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13039 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
13040 /// A pointer to the contents in the success state.
13041 /// Reading from this pointer when `result_ok` is not set is undefined.
13042 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
13043 /// A pointer to the contents in the error state.
13044 /// Reading from this pointer when `result_ok` is set is undefined.
13045 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13048 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13049 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13051 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
13052 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
13053 /// `err` or `result` depending on the state of `result_ok`.
13054 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
13055 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
13056 pub result_ok: bool,
13059 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
13060 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
13061 CResult_ChannelAnnouncementDecodeErrorZ {
13062 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13063 result: Box::into_raw(Box::new(o)),
13069 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
13070 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
13071 CResult_ChannelAnnouncementDecodeErrorZ {
13072 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13073 err: Box::into_raw(Box::new(e)),
13078 /// Checks if the given object is currently in the success state
13080 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
13084 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
13085 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
13086 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
13087 fn drop(&mut self) {
13088 if self.result_ok {
13089 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13090 let _ = unsafe { Box::from_raw(self.contents.result) };
13093 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13094 let _ = unsafe { Box::from_raw(self.contents.err) };
13099 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
13100 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13101 let contents = if o.result_ok {
13102 let result = unsafe { o.contents.result };
13103 unsafe { o.contents.result = core::ptr::null_mut() };
13104 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
13106 let err = unsafe { o.contents.err };
13107 unsafe { o.contents.err = core::ptr::null_mut(); }
13108 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
13112 result_ok: o.result_ok,
13116 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
13117 fn clone(&self) -> Self {
13118 if self.result_ok {
13119 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13120 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13123 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13124 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13130 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13131 /// but with all dynamically-allocated buffers duplicated in new buffers.
13132 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13134 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
13135 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13136 /// A pointer to the contents in the success state.
13137 /// Reading from this pointer when `result_ok` is not set is undefined.
13138 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
13139 /// A pointer to the contents in the error state.
13140 /// Reading from this pointer when `result_ok` is set is undefined.
13141 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13144 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
13145 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
13146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13147 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
13148 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
13149 /// `err` or `result` depending on the state of `result_ok`.
13150 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
13151 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
13152 pub result_ok: bool,
13155 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
13156 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
13157 CResult_UnsignedChannelUpdateDecodeErrorZ {
13158 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13159 result: Box::into_raw(Box::new(o)),
13165 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
13166 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
13167 CResult_UnsignedChannelUpdateDecodeErrorZ {
13168 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13169 err: Box::into_raw(Box::new(e)),
13174 /// Checks if the given object is currently in the success state
13176 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
13180 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
13181 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
13182 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
13183 fn drop(&mut self) {
13184 if self.result_ok {
13185 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13186 let _ = unsafe { Box::from_raw(self.contents.result) };
13189 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13190 let _ = unsafe { Box::from_raw(self.contents.err) };
13195 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
13196 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
13197 let contents = if o.result_ok {
13198 let result = unsafe { o.contents.result };
13199 unsafe { o.contents.result = core::ptr::null_mut() };
13200 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
13202 let err = unsafe { o.contents.err };
13203 unsafe { o.contents.err = core::ptr::null_mut(); }
13204 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
13208 result_ok: o.result_ok,
13212 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
13213 fn clone(&self) -> Self {
13214 if self.result_ok {
13215 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13216 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
13219 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13220 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13226 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
13227 /// but with all dynamically-allocated buffers duplicated in new buffers.
13228 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
13230 /// The contents of CResult_ChannelUpdateDecodeErrorZ
13231 pub union CResult_ChannelUpdateDecodeErrorZPtr {
13232 /// A pointer to the contents in the success state.
13233 /// Reading from this pointer when `result_ok` is not set is undefined.
13234 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
13235 /// A pointer to the contents in the error state.
13236 /// Reading from this pointer when `result_ok` is set is undefined.
13237 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13240 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
13241 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
13242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13243 pub struct CResult_ChannelUpdateDecodeErrorZ {
13244 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
13245 /// `err` or `result` depending on the state of `result_ok`.
13246 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
13247 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
13248 pub result_ok: bool,
13251 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
13252 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
13253 CResult_ChannelUpdateDecodeErrorZ {
13254 contents: CResult_ChannelUpdateDecodeErrorZPtr {
13255 result: Box::into_raw(Box::new(o)),
13261 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
13262 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
13263 CResult_ChannelUpdateDecodeErrorZ {
13264 contents: CResult_ChannelUpdateDecodeErrorZPtr {
13265 err: Box::into_raw(Box::new(e)),
13270 /// Checks if the given object is currently in the success state
13272 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
13276 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
13277 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
13278 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
13279 fn drop(&mut self) {
13280 if self.result_ok {
13281 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13282 let _ = unsafe { Box::from_raw(self.contents.result) };
13285 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13286 let _ = unsafe { Box::from_raw(self.contents.err) };
13291 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
13292 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
13293 let contents = if o.result_ok {
13294 let result = unsafe { o.contents.result };
13295 unsafe { o.contents.result = core::ptr::null_mut() };
13296 CResult_ChannelUpdateDecodeErrorZPtr { result }
13298 let err = unsafe { o.contents.err };
13299 unsafe { o.contents.err = core::ptr::null_mut(); }
13300 CResult_ChannelUpdateDecodeErrorZPtr { err }
13304 result_ok: o.result_ok,
13308 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
13309 fn clone(&self) -> Self {
13310 if self.result_ok {
13311 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
13312 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
13315 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
13316 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13322 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
13323 /// but with all dynamically-allocated buffers duplicated in new buffers.
13324 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
13326 /// The contents of CResult_ErrorMessageDecodeErrorZ
13327 pub union CResult_ErrorMessageDecodeErrorZPtr {
13328 /// A pointer to the contents in the success state.
13329 /// Reading from this pointer when `result_ok` is not set is undefined.
13330 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
13331 /// A pointer to the contents in the error state.
13332 /// Reading from this pointer when `result_ok` is set is undefined.
13333 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13336 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
13337 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
13338 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13339 pub struct CResult_ErrorMessageDecodeErrorZ {
13340 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
13341 /// `err` or `result` depending on the state of `result_ok`.
13342 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
13343 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
13344 pub result_ok: bool,
13347 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
13348 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
13349 CResult_ErrorMessageDecodeErrorZ {
13350 contents: CResult_ErrorMessageDecodeErrorZPtr {
13351 result: Box::into_raw(Box::new(o)),
13357 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
13358 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
13359 CResult_ErrorMessageDecodeErrorZ {
13360 contents: CResult_ErrorMessageDecodeErrorZPtr {
13361 err: Box::into_raw(Box::new(e)),
13366 /// Checks if the given object is currently in the success state
13368 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
13372 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
13373 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
13374 impl Drop for CResult_ErrorMessageDecodeErrorZ {
13375 fn drop(&mut self) {
13376 if self.result_ok {
13377 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13378 let _ = unsafe { Box::from_raw(self.contents.result) };
13381 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13382 let _ = unsafe { Box::from_raw(self.contents.err) };
13387 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
13388 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
13389 let contents = if o.result_ok {
13390 let result = unsafe { o.contents.result };
13391 unsafe { o.contents.result = core::ptr::null_mut() };
13392 CResult_ErrorMessageDecodeErrorZPtr { result }
13394 let err = unsafe { o.contents.err };
13395 unsafe { o.contents.err = core::ptr::null_mut(); }
13396 CResult_ErrorMessageDecodeErrorZPtr { err }
13400 result_ok: o.result_ok,
13404 impl Clone for CResult_ErrorMessageDecodeErrorZ {
13405 fn clone(&self) -> Self {
13406 if self.result_ok {
13407 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
13408 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
13411 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
13412 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13418 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
13419 /// but with all dynamically-allocated buffers duplicated in new buffers.
13420 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
13422 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
13423 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13424 /// A pointer to the contents in the success state.
13425 /// Reading from this pointer when `result_ok` is not set is undefined.
13426 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
13427 /// A pointer to the contents in the error state.
13428 /// Reading from this pointer when `result_ok` is set is undefined.
13429 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13432 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13433 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13435 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13436 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
13437 /// `err` or `result` depending on the state of `result_ok`.
13438 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
13439 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
13440 pub result_ok: bool,
13443 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
13444 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13445 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13446 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13447 result: Box::into_raw(Box::new(o)),
13453 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
13454 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13455 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13456 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13457 err: Box::into_raw(Box::new(e)),
13462 /// Checks if the given object is currently in the success state
13464 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
13468 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
13469 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
13470 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13471 fn drop(&mut self) {
13472 if self.result_ok {
13473 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13474 let _ = unsafe { Box::from_raw(self.contents.result) };
13477 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13478 let _ = unsafe { Box::from_raw(self.contents.err) };
13483 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13484 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13485 let contents = if o.result_ok {
13486 let result = unsafe { o.contents.result };
13487 unsafe { o.contents.result = core::ptr::null_mut() };
13488 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
13490 let err = unsafe { o.contents.err };
13491 unsafe { o.contents.err = core::ptr::null_mut(); }
13492 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
13496 result_ok: o.result_ok,
13500 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13501 fn clone(&self) -> Self {
13502 if self.result_ok {
13503 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13504 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13507 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13508 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13514 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
13515 /// but with all dynamically-allocated buffers duplicated in new buffers.
13516 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13518 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
13519 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
13520 /// A pointer to the contents in the success state.
13521 /// Reading from this pointer when `result_ok` is not set is undefined.
13522 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
13523 /// A pointer to the contents in the error state.
13524 /// Reading from this pointer when `result_ok` is set is undefined.
13525 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13528 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13529 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13531 pub struct CResult_NodeAnnouncementDecodeErrorZ {
13532 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
13533 /// `err` or `result` depending on the state of `result_ok`.
13534 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
13535 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
13536 pub result_ok: bool,
13539 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
13540 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
13541 CResult_NodeAnnouncementDecodeErrorZ {
13542 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13543 result: Box::into_raw(Box::new(o)),
13549 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
13550 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
13551 CResult_NodeAnnouncementDecodeErrorZ {
13552 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13553 err: Box::into_raw(Box::new(e)),
13558 /// Checks if the given object is currently in the success state
13560 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
13564 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
13565 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
13566 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
13567 fn drop(&mut self) {
13568 if self.result_ok {
13569 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13570 let _ = unsafe { Box::from_raw(self.contents.result) };
13573 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13574 let _ = unsafe { Box::from_raw(self.contents.err) };
13579 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
13580 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13581 let contents = if o.result_ok {
13582 let result = unsafe { o.contents.result };
13583 unsafe { o.contents.result = core::ptr::null_mut() };
13584 CResult_NodeAnnouncementDecodeErrorZPtr { result }
13586 let err = unsafe { o.contents.err };
13587 unsafe { o.contents.err = core::ptr::null_mut(); }
13588 CResult_NodeAnnouncementDecodeErrorZPtr { err }
13592 result_ok: o.result_ok,
13596 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
13597 fn clone(&self) -> Self {
13598 if self.result_ok {
13599 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13600 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13603 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13604 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13610 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
13611 /// but with all dynamically-allocated buffers duplicated in new buffers.
13612 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13614 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
13615 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
13616 /// A pointer to the contents in the success state.
13617 /// Reading from this pointer when `result_ok` is not set is undefined.
13618 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
13619 /// A pointer to the contents in the error state.
13620 /// Reading from this pointer when `result_ok` is set is undefined.
13621 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13624 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
13625 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
13626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13627 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
13628 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
13629 /// `err` or `result` depending on the state of `result_ok`.
13630 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
13631 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
13632 pub result_ok: bool,
13635 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
13636 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13637 CResult_QueryShortChannelIdsDecodeErrorZ {
13638 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13639 result: Box::into_raw(Box::new(o)),
13645 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
13646 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13647 CResult_QueryShortChannelIdsDecodeErrorZ {
13648 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13649 err: Box::into_raw(Box::new(e)),
13654 /// Checks if the given object is currently in the success state
13656 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
13660 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
13661 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
13662 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
13663 fn drop(&mut self) {
13664 if self.result_ok {
13665 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13666 let _ = unsafe { Box::from_raw(self.contents.result) };
13669 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13670 let _ = unsafe { Box::from_raw(self.contents.err) };
13675 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
13676 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
13677 let contents = if o.result_ok {
13678 let result = unsafe { o.contents.result };
13679 unsafe { o.contents.result = core::ptr::null_mut() };
13680 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
13682 let err = unsafe { o.contents.err };
13683 unsafe { o.contents.err = core::ptr::null_mut(); }
13684 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
13688 result_ok: o.result_ok,
13692 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
13693 fn clone(&self) -> Self {
13694 if self.result_ok {
13695 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13696 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
13699 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13700 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13706 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
13707 /// but with all dynamically-allocated buffers duplicated in new buffers.
13708 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
13710 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
13711 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13712 /// A pointer to the contents in the success state.
13713 /// Reading from this pointer when `result_ok` is not set is undefined.
13714 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
13715 /// A pointer to the contents in the error state.
13716 /// Reading from this pointer when `result_ok` is set is undefined.
13717 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13720 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
13721 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
13722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13723 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13724 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
13725 /// `err` or `result` depending on the state of `result_ok`.
13726 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
13727 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
13728 pub result_ok: bool,
13731 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
13732 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13733 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13734 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13735 result: Box::into_raw(Box::new(o)),
13741 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
13742 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13743 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13744 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13745 err: Box::into_raw(Box::new(e)),
13750 /// Checks if the given object is currently in the success state
13752 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
13756 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
13757 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
13758 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13759 fn drop(&mut self) {
13760 if self.result_ok {
13761 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13762 let _ = unsafe { Box::from_raw(self.contents.result) };
13765 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13766 let _ = unsafe { Box::from_raw(self.contents.err) };
13771 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13772 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
13773 let contents = if o.result_ok {
13774 let result = unsafe { o.contents.result };
13775 unsafe { o.contents.result = core::ptr::null_mut() };
13776 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
13778 let err = unsafe { o.contents.err };
13779 unsafe { o.contents.err = core::ptr::null_mut(); }
13780 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
13784 result_ok: o.result_ok,
13788 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13789 fn clone(&self) -> Self {
13790 if self.result_ok {
13791 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13792 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
13795 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13796 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13802 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
13803 /// but with all dynamically-allocated buffers duplicated in new buffers.
13804 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
13806 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
13807 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
13808 /// A pointer to the contents in the success state.
13809 /// Reading from this pointer when `result_ok` is not set is undefined.
13810 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
13811 /// A pointer to the contents in the error state.
13812 /// Reading from this pointer when `result_ok` is set is undefined.
13813 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13816 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
13817 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13819 pub struct CResult_QueryChannelRangeDecodeErrorZ {
13820 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
13821 /// `err` or `result` depending on the state of `result_ok`.
13822 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
13823 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
13824 pub result_ok: bool,
13827 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
13828 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
13829 CResult_QueryChannelRangeDecodeErrorZ {
13830 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13831 result: Box::into_raw(Box::new(o)),
13837 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
13838 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
13839 CResult_QueryChannelRangeDecodeErrorZ {
13840 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13841 err: Box::into_raw(Box::new(e)),
13846 /// Checks if the given object is currently in the success state
13848 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
13852 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
13853 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
13854 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
13855 fn drop(&mut self) {
13856 if self.result_ok {
13857 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13858 let _ = unsafe { Box::from_raw(self.contents.result) };
13861 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13862 let _ = unsafe { Box::from_raw(self.contents.err) };
13867 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
13868 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13869 let contents = if o.result_ok {
13870 let result = unsafe { o.contents.result };
13871 unsafe { o.contents.result = core::ptr::null_mut() };
13872 CResult_QueryChannelRangeDecodeErrorZPtr { result }
13874 let err = unsafe { o.contents.err };
13875 unsafe { o.contents.err = core::ptr::null_mut(); }
13876 CResult_QueryChannelRangeDecodeErrorZPtr { err }
13880 result_ok: o.result_ok,
13884 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
13885 fn clone(&self) -> Self {
13886 if self.result_ok {
13887 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13888 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
13891 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13892 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13898 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
13899 /// but with all dynamically-allocated buffers duplicated in new buffers.
13900 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13902 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
13903 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
13904 /// A pointer to the contents in the success state.
13905 /// Reading from this pointer when `result_ok` is not set is undefined.
13906 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
13907 /// A pointer to the contents in the error state.
13908 /// Reading from this pointer when `result_ok` is set is undefined.
13909 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13912 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
13913 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13915 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
13916 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
13917 /// `err` or `result` depending on the state of `result_ok`.
13918 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
13919 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
13920 pub result_ok: bool,
13923 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
13924 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
13925 CResult_ReplyChannelRangeDecodeErrorZ {
13926 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13927 result: Box::into_raw(Box::new(o)),
13933 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
13934 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
13935 CResult_ReplyChannelRangeDecodeErrorZ {
13936 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13937 err: Box::into_raw(Box::new(e)),
13942 /// Checks if the given object is currently in the success state
13944 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
13948 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
13949 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
13950 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
13951 fn drop(&mut self) {
13952 if self.result_ok {
13953 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13954 let _ = unsafe { Box::from_raw(self.contents.result) };
13957 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13958 let _ = unsafe { Box::from_raw(self.contents.err) };
13963 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
13964 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13965 let contents = if o.result_ok {
13966 let result = unsafe { o.contents.result };
13967 unsafe { o.contents.result = core::ptr::null_mut() };
13968 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
13970 let err = unsafe { o.contents.err };
13971 unsafe { o.contents.err = core::ptr::null_mut(); }
13972 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
13976 result_ok: o.result_ok,
13980 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
13981 fn clone(&self) -> Self {
13982 if self.result_ok {
13983 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13984 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
13987 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13988 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13994 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
13995 /// but with all dynamically-allocated buffers duplicated in new buffers.
13996 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13998 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
13999 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
14000 /// A pointer to the contents in the success state.
14001 /// Reading from this pointer when `result_ok` is not set is undefined.
14002 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
14003 /// A pointer to the contents in the error state.
14004 /// Reading from this pointer when `result_ok` is set is undefined.
14005 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14008 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
14009 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
14010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14011 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
14012 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
14013 /// `err` or `result` depending on the state of `result_ok`.
14014 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
14015 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
14016 pub result_ok: bool,
14019 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
14020 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
14021 CResult_GossipTimestampFilterDecodeErrorZ {
14022 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14023 result: Box::into_raw(Box::new(o)),
14029 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
14030 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
14031 CResult_GossipTimestampFilterDecodeErrorZ {
14032 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14033 err: Box::into_raw(Box::new(e)),
14038 /// Checks if the given object is currently in the success state
14040 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
14044 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
14045 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
14046 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
14047 fn drop(&mut self) {
14048 if self.result_ok {
14049 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14050 let _ = unsafe { Box::from_raw(self.contents.result) };
14053 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14054 let _ = unsafe { Box::from_raw(self.contents.err) };
14059 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
14060 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
14061 let contents = if o.result_ok {
14062 let result = unsafe { o.contents.result };
14063 unsafe { o.contents.result = core::ptr::null_mut() };
14064 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
14066 let err = unsafe { o.contents.err };
14067 unsafe { o.contents.err = core::ptr::null_mut(); }
14068 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
14072 result_ok: o.result_ok,
14076 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
14077 fn clone(&self) -> Self {
14078 if self.result_ok {
14079 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14080 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
14083 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14084 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14090 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
14091 /// but with all dynamically-allocated buffers duplicated in new buffers.
14092 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
14094 /// The contents of CResult_InvoiceSignOrCreationErrorZ
14095 pub union CResult_InvoiceSignOrCreationErrorZPtr {
14096 /// A pointer to the contents in the success state.
14097 /// Reading from this pointer when `result_ok` is not set is undefined.
14098 pub result: *mut crate::lightning_invoice::Invoice,
14099 /// A pointer to the contents in the error state.
14100 /// Reading from this pointer when `result_ok` is set is undefined.
14101 pub err: *mut crate::lightning_invoice::SignOrCreationError,
14104 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
14105 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
14106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14107 pub struct CResult_InvoiceSignOrCreationErrorZ {
14108 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
14109 /// `err` or `result` depending on the state of `result_ok`.
14110 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
14111 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
14112 pub result_ok: bool,
14115 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
14116 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
14117 CResult_InvoiceSignOrCreationErrorZ {
14118 contents: CResult_InvoiceSignOrCreationErrorZPtr {
14119 result: Box::into_raw(Box::new(o)),
14125 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
14126 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
14127 CResult_InvoiceSignOrCreationErrorZ {
14128 contents: CResult_InvoiceSignOrCreationErrorZPtr {
14129 err: Box::into_raw(Box::new(e)),
14134 /// Checks if the given object is currently in the success state
14136 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
14140 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
14141 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
14142 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
14143 fn drop(&mut self) {
14144 if self.result_ok {
14145 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14146 let _ = unsafe { Box::from_raw(self.contents.result) };
14149 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14150 let _ = unsafe { Box::from_raw(self.contents.err) };
14155 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
14156 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
14157 let contents = if o.result_ok {
14158 let result = unsafe { o.contents.result };
14159 unsafe { o.contents.result = core::ptr::null_mut() };
14160 CResult_InvoiceSignOrCreationErrorZPtr { result }
14162 let err = unsafe { o.contents.err };
14163 unsafe { o.contents.err = core::ptr::null_mut(); }
14164 CResult_InvoiceSignOrCreationErrorZPtr { err }
14168 result_ok: o.result_ok,
14172 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
14173 fn clone(&self) -> Self {
14174 if self.result_ok {
14175 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
14176 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
14179 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
14180 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
14186 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
14187 /// but with all dynamically-allocated buffers duplicated in new buffers.
14188 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
14190 /// An enum which can either contain a crate::lightning::chain::Filter or not
14191 pub enum COption_FilterZ {
14192 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
14193 Some(crate::lightning::chain::Filter),
14194 /// When we're in this state, this COption_FilterZ contains nothing
14197 impl COption_FilterZ {
14198 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
14199 if let Self::None = self { false } else { true }
14201 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
14204 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
14205 if let Self::Some(v) = self { v } else { unreachable!() }
14209 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
14210 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
14211 COption_FilterZ::Some(o)
14214 /// Constructs a new COption_FilterZ containing nothing
14215 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
14216 COption_FilterZ::None
14219 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
14220 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
14222 /// The contents of CResult_LockedChannelMonitorNoneZ
14223 pub union CResult_LockedChannelMonitorNoneZPtr {
14224 /// A pointer to the contents in the success state.
14225 /// Reading from this pointer when `result_ok` is not set is undefined.
14226 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
14227 /// Note that this value is always NULL, as there are no contents in the Err variant
14228 pub err: *mut core::ffi::c_void,
14231 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
14232 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
14233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14234 pub struct CResult_LockedChannelMonitorNoneZ {
14235 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
14236 /// `err` or `result` depending on the state of `result_ok`.
14237 pub contents: CResult_LockedChannelMonitorNoneZPtr,
14238 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
14239 pub result_ok: bool,
14242 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
14243 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
14244 CResult_LockedChannelMonitorNoneZ {
14245 contents: CResult_LockedChannelMonitorNoneZPtr {
14246 result: Box::into_raw(Box::new(o)),
14252 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
14253 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
14254 CResult_LockedChannelMonitorNoneZ {
14255 contents: CResult_LockedChannelMonitorNoneZPtr {
14256 err: core::ptr::null_mut(),
14261 /// Checks if the given object is currently in the success state
14263 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
14267 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
14268 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
14269 impl Drop for CResult_LockedChannelMonitorNoneZ {
14270 fn drop(&mut self) {
14271 if self.result_ok {
14272 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14273 let _ = unsafe { Box::from_raw(self.contents.result) };
14279 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
14280 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
14281 let contents = if o.result_ok {
14282 let result = unsafe { o.contents.result };
14283 unsafe { o.contents.result = core::ptr::null_mut() };
14284 CResult_LockedChannelMonitorNoneZPtr { result }
14286 let _ = unsafe { Box::from_raw(o.contents.err) };
14287 o.contents.err = core::ptr::null_mut();
14288 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
14292 result_ok: o.result_ok,
14297 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
14298 /// This corresponds to std::vector in C++
14299 pub struct CVec_OutPointZ {
14300 /// The elements in the array.
14301 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14302 pub data: *mut crate::lightning::chain::transaction::OutPoint,
14303 /// The number of elements pointed to by `data`.
14306 impl CVec_OutPointZ {
14307 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
14308 if self.datalen == 0 { return Vec::new(); }
14309 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14310 self.data = core::ptr::null_mut();
14314 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
14315 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14318 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
14319 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
14320 let datalen = v.len();
14321 let data = Box::into_raw(v.into_boxed_slice());
14322 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14326 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14327 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
14328 impl Drop for CVec_OutPointZ {
14329 fn drop(&mut self) {
14330 if self.datalen == 0 { return; }
14331 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14334 impl Clone for CVec_OutPointZ {
14335 fn clone(&self) -> Self {
14336 let mut res = Vec::new();
14337 if self.datalen == 0 { return Self::from(res); }
14338 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });