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_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13 /// Note that this value is always NULL, as there are no contents in the OK variant
14 pub result: *mut core::ffi::c_void,
15 /// Note that this value is always NULL, as there are no contents in the Err variant
16 pub err: *mut core::ffi::c_void,
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23 /// The contents of this CResult_NoneNoneZ, accessible via either
24 /// `err` or `result` depending on the state of `result_ok`.
25 pub contents: CResult_NoneNoneZPtr,
26 /// Whether this CResult_NoneNoneZ represents a success state.
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
33 contents: CResult_NoneNoneZPtr {
34 result: core::ptr::null_mut(),
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
43 contents: CResult_NoneNoneZPtr {
44 err: core::ptr::null_mut(),
49 /// Checks if the given object is currently in the success state
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66 let contents = if o.result_ok {
67 let _ = unsafe { Box::from_raw(o.contents.result) };
68 o.contents.result = core::ptr::null_mut();
69 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
71 let _ = unsafe { Box::from_raw(o.contents.err) };
72 o.contents.err = core::ptr::null_mut();
73 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
77 result_ok: o.result_ok,
81 impl Clone for CResult_NoneNoneZ {
82 fn clone(&self) -> Self {
84 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85 result: core::ptr::null_mut()
88 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89 err: core::ptr::null_mut()
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101 /// A pointer to the contents in the success state.
102 /// Reading from this pointer when `result_ok` is not set is undefined.
103 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104 /// A pointer to the contents in the error state.
105 /// Reading from this pointer when `result_ok` is set is undefined.
106 pub err: *mut crate::lightning::ln::msgs::DecodeError,
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114 /// `err` or `result` depending on the state of `result_ok`.
115 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124 result: Box::into_raw(Box::new(o)),
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134 err: Box::into_raw(Box::new(e)),
139 /// Checks if the given object is currently in the success state
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
150 if unsafe { !(self.contents.result as *mut ()).is_null() } {
151 let _ = unsafe { Box::from_raw(self.contents.result) };
154 if unsafe { !(self.contents.err as *mut ()).is_null() } {
155 let _ = unsafe { Box::from_raw(self.contents.err) };
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162 let contents = if o.result_ok {
163 let result = unsafe { o.contents.result };
164 unsafe { o.contents.result = core::ptr::null_mut() };
165 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
167 let err = unsafe { o.contents.err };
168 unsafe { o.contents.err = core::ptr::null_mut(); }
169 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
173 result_ok: o.result_ok,
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178 fn clone(&self) -> Self {
180 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
184 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197 /// A pointer to the contents in the success state.
198 /// Reading from this pointer when `result_ok` is not set is undefined.
199 pub result: *mut crate::c_types::SecretKey,
200 /// A pointer to the contents in the error state.
201 /// Reading from this pointer when `result_ok` is set is undefined.
202 pub err: *mut crate::c_types::Secp256k1Error,
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210 /// `err` or `result` depending on the state of `result_ok`.
211 pub contents: CResult_SecretKeyErrorZPtr,
212 /// Whether this CResult_SecretKeyErrorZ represents a success state.
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218 CResult_SecretKeyErrorZ {
219 contents: CResult_SecretKeyErrorZPtr {
220 result: Box::into_raw(Box::new(o)),
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228 CResult_SecretKeyErrorZ {
229 contents: CResult_SecretKeyErrorZPtr {
230 err: Box::into_raw(Box::new(e)),
235 /// Checks if the given object is currently in the success state
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
247 let _ = unsafe { Box::from_raw(self.contents.result) };
250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
251 let _ = unsafe { Box::from_raw(self.contents.err) };
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258 let contents = if o.result_ok {
259 let result = unsafe { o.contents.result };
260 unsafe { o.contents.result = core::ptr::null_mut() };
261 CResult_SecretKeyErrorZPtr { result }
263 let err = unsafe { o.contents.err };
264 unsafe { o.contents.err = core::ptr::null_mut(); }
265 CResult_SecretKeyErrorZPtr { err }
269 result_ok: o.result_ok,
273 impl Clone for CResult_SecretKeyErrorZ {
274 fn clone(&self) -> Self {
276 Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
280 Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293 /// A pointer to the contents in the success state.
294 /// Reading from this pointer when `result_ok` is not set is undefined.
295 pub result: *mut crate::c_types::PublicKey,
296 /// A pointer to the contents in the error state.
297 /// Reading from this pointer when `result_ok` is set is undefined.
298 pub err: *mut crate::c_types::Secp256k1Error,
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306 /// `err` or `result` depending on the state of `result_ok`.
307 pub contents: CResult_PublicKeyErrorZPtr,
308 /// Whether this CResult_PublicKeyErrorZ represents a success state.
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314 CResult_PublicKeyErrorZ {
315 contents: CResult_PublicKeyErrorZPtr {
316 result: Box::into_raw(Box::new(o)),
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324 CResult_PublicKeyErrorZ {
325 contents: CResult_PublicKeyErrorZPtr {
326 err: Box::into_raw(Box::new(e)),
331 /// Checks if the given object is currently in the success state
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
343 let _ = unsafe { Box::from_raw(self.contents.result) };
346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
347 let _ = unsafe { Box::from_raw(self.contents.err) };
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354 let contents = if o.result_ok {
355 let result = unsafe { o.contents.result };
356 unsafe { o.contents.result = core::ptr::null_mut() };
357 CResult_PublicKeyErrorZPtr { result }
359 let err = unsafe { o.contents.err };
360 unsafe { o.contents.err = core::ptr::null_mut(); }
361 CResult_PublicKeyErrorZPtr { err }
365 result_ok: o.result_ok,
369 impl Clone for CResult_PublicKeyErrorZ {
370 fn clone(&self) -> Self {
372 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
376 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389 /// A pointer to the contents in the success state.
390 /// Reading from this pointer when `result_ok` is not set is undefined.
391 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392 /// A pointer to the contents in the error state.
393 /// Reading from this pointer when `result_ok` is set is undefined.
394 pub err: *mut crate::lightning::ln::msgs::DecodeError,
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402 /// `err` or `result` depending on the state of `result_ok`.
403 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410 CResult_TxCreationKeysDecodeErrorZ {
411 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412 result: Box::into_raw(Box::new(o)),
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420 CResult_TxCreationKeysDecodeErrorZ {
421 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422 err: Box::into_raw(Box::new(e)),
427 /// Checks if the given object is currently in the success state
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
438 if unsafe { !(self.contents.result as *mut ()).is_null() } {
439 let _ = unsafe { Box::from_raw(self.contents.result) };
442 if unsafe { !(self.contents.err as *mut ()).is_null() } {
443 let _ = unsafe { Box::from_raw(self.contents.err) };
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450 let contents = if o.result_ok {
451 let result = unsafe { o.contents.result };
452 unsafe { o.contents.result = core::ptr::null_mut() };
453 CResult_TxCreationKeysDecodeErrorZPtr { result }
455 let err = unsafe { o.contents.err };
456 unsafe { o.contents.err = core::ptr::null_mut(); }
457 CResult_TxCreationKeysDecodeErrorZPtr { err }
461 result_ok: o.result_ok,
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466 fn clone(&self) -> Self {
468 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
472 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485 /// A pointer to the contents in the success state.
486 /// Reading from this pointer when `result_ok` is not set is undefined.
487 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488 /// A pointer to the contents in the error state.
489 /// Reading from this pointer when `result_ok` is set is undefined.
490 pub err: *mut crate::lightning::ln::msgs::DecodeError,
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498 /// `err` or `result` depending on the state of `result_ok`.
499 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506 CResult_ChannelPublicKeysDecodeErrorZ {
507 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508 result: Box::into_raw(Box::new(o)),
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516 CResult_ChannelPublicKeysDecodeErrorZ {
517 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518 err: Box::into_raw(Box::new(e)),
523 /// Checks if the given object is currently in the success state
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
534 if unsafe { !(self.contents.result as *mut ()).is_null() } {
535 let _ = unsafe { Box::from_raw(self.contents.result) };
538 if unsafe { !(self.contents.err as *mut ()).is_null() } {
539 let _ = unsafe { Box::from_raw(self.contents.err) };
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546 let contents = if o.result_ok {
547 let result = unsafe { o.contents.result };
548 unsafe { o.contents.result = core::ptr::null_mut() };
549 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
551 let err = unsafe { o.contents.err };
552 unsafe { o.contents.err = core::ptr::null_mut(); }
553 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
557 result_ok: o.result_ok,
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562 fn clone(&self) -> Self {
564 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
568 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581 /// A pointer to the contents in the success state.
582 /// Reading from this pointer when `result_ok` is not set is undefined.
583 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584 /// A pointer to the contents in the error state.
585 /// Reading from this pointer when `result_ok` is set is undefined.
586 pub err: *mut crate::c_types::Secp256k1Error,
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594 /// `err` or `result` depending on the state of `result_ok`.
595 pub contents: CResult_TxCreationKeysErrorZPtr,
596 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602 CResult_TxCreationKeysErrorZ {
603 contents: CResult_TxCreationKeysErrorZPtr {
604 result: Box::into_raw(Box::new(o)),
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612 CResult_TxCreationKeysErrorZ {
613 contents: CResult_TxCreationKeysErrorZPtr {
614 err: Box::into_raw(Box::new(e)),
619 /// Checks if the given object is currently in the success state
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
630 if unsafe { !(self.contents.result as *mut ()).is_null() } {
631 let _ = unsafe { Box::from_raw(self.contents.result) };
634 if unsafe { !(self.contents.err as *mut ()).is_null() } {
635 let _ = unsafe { Box::from_raw(self.contents.err) };
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642 let contents = if o.result_ok {
643 let result = unsafe { o.contents.result };
644 unsafe { o.contents.result = core::ptr::null_mut() };
645 CResult_TxCreationKeysErrorZPtr { result }
647 let err = unsafe { o.contents.err };
648 unsafe { o.contents.err = core::ptr::null_mut(); }
649 CResult_TxCreationKeysErrorZPtr { err }
653 result_ok: o.result_ok,
657 impl Clone for CResult_TxCreationKeysErrorZ {
658 fn clone(&self) -> Self {
660 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
664 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678 /// When we're in this state, this COption_u32Z contains a u32
680 /// When we're in this state, this COption_u32Z contains nothing
684 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685 if let Self::None = self { false } else { true }
687 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
690 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691 if let Self::Some(v) = self { v } else { unreachable!() }
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697 COption_u32Z::Some(o)
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714 /// A pointer to the contents in the success state.
715 /// Reading from this pointer when `result_ok` is not set is undefined.
716 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717 /// A pointer to the contents in the error state.
718 /// Reading from this pointer when `result_ok` is set is undefined.
719 pub err: *mut crate::lightning::ln::msgs::DecodeError,
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727 /// `err` or `result` depending on the state of `result_ok`.
728 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735 CResult_HTLCOutputInCommitmentDecodeErrorZ {
736 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737 result: Box::into_raw(Box::new(o)),
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745 CResult_HTLCOutputInCommitmentDecodeErrorZ {
746 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747 err: Box::into_raw(Box::new(e)),
752 /// Checks if the given object is currently in the success state
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
763 if unsafe { !(self.contents.result as *mut ()).is_null() } {
764 let _ = unsafe { Box::from_raw(self.contents.result) };
767 if unsafe { !(self.contents.err as *mut ()).is_null() } {
768 let _ = unsafe { Box::from_raw(self.contents.err) };
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775 let contents = if o.result_ok {
776 let result = unsafe { o.contents.result };
777 unsafe { o.contents.result = core::ptr::null_mut() };
778 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
780 let err = unsafe { o.contents.err };
781 unsafe { o.contents.err = core::ptr::null_mut(); }
782 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
786 result_ok: o.result_ok,
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791 fn clone(&self) -> Self {
793 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
797 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
808 /// An enum which can either contain a or not
809 pub enum COption_NoneZ {
810 /// When we're in this state, this COption_NoneZ contains a
812 /// When we're in this state, this COption_NoneZ contains nothing
816 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817 if let Self::None = self { false } else { true }
819 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
824 /// Constructs a new COption_NoneZ containing a
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839 /// A pointer to the contents in the success state.
840 /// Reading from this pointer when `result_ok` is not set is undefined.
841 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842 /// A pointer to the contents in the error state.
843 /// Reading from this pointer when `result_ok` is set is undefined.
844 pub err: *mut crate::lightning::ln::msgs::DecodeError,
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852 /// `err` or `result` depending on the state of `result_ok`.
853 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862 result: Box::into_raw(Box::new(o)),
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872 err: Box::into_raw(Box::new(e)),
877 /// Checks if the given object is currently in the success state
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
888 if unsafe { !(self.contents.result as *mut ()).is_null() } {
889 let _ = unsafe { Box::from_raw(self.contents.result) };
892 if unsafe { !(self.contents.err as *mut ()).is_null() } {
893 let _ = unsafe { Box::from_raw(self.contents.err) };
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900 let contents = if o.result_ok {
901 let result = unsafe { o.contents.result };
902 unsafe { o.contents.result = core::ptr::null_mut() };
903 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
905 let err = unsafe { o.contents.err };
906 unsafe { o.contents.err = core::ptr::null_mut(); }
907 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
911 result_ok: o.result_ok,
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916 fn clone(&self) -> Self {
918 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
922 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935 /// A pointer to the contents in the success state.
936 /// Reading from this pointer when `result_ok` is not set is undefined.
937 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938 /// A pointer to the contents in the error state.
939 /// Reading from this pointer when `result_ok` is set is undefined.
940 pub err: *mut crate::lightning::ln::msgs::DecodeError,
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948 /// `err` or `result` depending on the state of `result_ok`.
949 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956 CResult_ChannelTransactionParametersDecodeErrorZ {
957 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958 result: Box::into_raw(Box::new(o)),
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966 CResult_ChannelTransactionParametersDecodeErrorZ {
967 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968 err: Box::into_raw(Box::new(e)),
973 /// Checks if the given object is currently in the success state
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
984 if unsafe { !(self.contents.result as *mut ()).is_null() } {
985 let _ = unsafe { Box::from_raw(self.contents.result) };
988 if unsafe { !(self.contents.err as *mut ()).is_null() } {
989 let _ = unsafe { Box::from_raw(self.contents.err) };
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996 let contents = if o.result_ok {
997 let result = unsafe { o.contents.result };
998 unsafe { o.contents.result = core::ptr::null_mut() };
999 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1001 let err = unsafe { o.contents.err };
1002 unsafe { o.contents.err = core::ptr::null_mut(); }
1003 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1007 result_ok: o.result_ok,
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012 fn clone(&self) -> Self {
1014 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1018 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032 /// The elements in the array.
1033 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034 pub data: *mut crate::c_types::Signature,
1035 /// The number of elements pointed to by `data`.
1038 impl CVec_SignatureZ {
1039 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040 if self.datalen == 0 { return Vec::new(); }
1041 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042 self.data = core::ptr::null_mut();
1046 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051 fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052 let datalen = v.len();
1053 let data = Box::into_raw(v.into_boxed_slice());
1054 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061 fn drop(&mut self) {
1062 if self.datalen == 0 { return; }
1063 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1066 impl Clone for CVec_SignatureZ {
1067 fn clone(&self) -> Self {
1068 let mut res = Vec::new();
1069 if self.datalen == 0 { return Self::from(res); }
1070 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077 /// A pointer to the contents in the success state.
1078 /// Reading from this pointer when `result_ok` is not set is undefined.
1079 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080 /// A pointer to the contents in the error state.
1081 /// Reading from this pointer when `result_ok` is set is undefined.
1082 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090 /// `err` or `result` depending on the state of `result_ok`.
1091 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093 pub result_ok: bool,
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098 CResult_HolderCommitmentTransactionDecodeErrorZ {
1099 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100 result: Box::into_raw(Box::new(o)),
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108 CResult_HolderCommitmentTransactionDecodeErrorZ {
1109 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110 err: Box::into_raw(Box::new(e)),
1115 /// Checks if the given object is currently in the success state
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124 fn drop(&mut self) {
1126 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127 let _ = unsafe { Box::from_raw(self.contents.result) };
1130 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131 let _ = unsafe { Box::from_raw(self.contents.err) };
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138 let contents = if o.result_ok {
1139 let result = unsafe { o.contents.result };
1140 unsafe { o.contents.result = core::ptr::null_mut() };
1141 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1143 let err = unsafe { o.contents.err };
1144 unsafe { o.contents.err = core::ptr::null_mut(); }
1145 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1149 result_ok: o.result_ok,
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154 fn clone(&self) -> Self {
1156 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1160 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173 /// A pointer to the contents in the success state.
1174 /// Reading from this pointer when `result_ok` is not set is undefined.
1175 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176 /// A pointer to the contents in the error state.
1177 /// Reading from this pointer when `result_ok` is set is undefined.
1178 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186 /// `err` or `result` depending on the state of `result_ok`.
1187 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189 pub result_ok: bool,
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196 result: Box::into_raw(Box::new(o)),
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206 err: Box::into_raw(Box::new(e)),
1211 /// Checks if the given object is currently in the success state
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220 fn drop(&mut self) {
1222 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223 let _ = unsafe { Box::from_raw(self.contents.result) };
1226 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227 let _ = unsafe { Box::from_raw(self.contents.err) };
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234 let contents = if o.result_ok {
1235 let result = unsafe { o.contents.result };
1236 unsafe { o.contents.result = core::ptr::null_mut() };
1237 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1239 let err = unsafe { o.contents.err };
1240 unsafe { o.contents.err = core::ptr::null_mut(); }
1241 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1245 result_ok: o.result_ok,
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250 fn clone(&self) -> Self {
1252 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1256 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269 /// A pointer to the contents in the success state.
1270 /// Reading from this pointer when `result_ok` is not set is undefined.
1271 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272 /// Note that this value is always NULL, as there are no contents in the Err variant
1273 pub err: *mut core::ffi::c_void,
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281 /// `err` or `result` depending on the state of `result_ok`.
1282 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284 pub result_ok: bool,
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289 CResult_TrustedClosingTransactionNoneZ {
1290 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291 result: Box::into_raw(Box::new(o)),
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299 CResult_TrustedClosingTransactionNoneZ {
1300 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301 err: core::ptr::null_mut(),
1306 /// Checks if the given object is currently in the success state
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315 fn drop(&mut self) {
1317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318 let _ = unsafe { Box::from_raw(self.contents.result) };
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326 let contents = if o.result_ok {
1327 let result = unsafe { o.contents.result };
1328 unsafe { o.contents.result = core::ptr::null_mut() };
1329 CResult_TrustedClosingTransactionNoneZPtr { result }
1331 let _ = unsafe { Box::from_raw(o.contents.err) };
1332 o.contents.err = core::ptr::null_mut();
1333 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1337 result_ok: o.result_ok,
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344 /// A pointer to the contents in the success state.
1345 /// Reading from this pointer when `result_ok` is not set is undefined.
1346 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347 /// A pointer to the contents in the error state.
1348 /// Reading from this pointer when `result_ok` is set is undefined.
1349 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357 /// `err` or `result` depending on the state of `result_ok`.
1358 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360 pub result_ok: bool,
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365 CResult_CommitmentTransactionDecodeErrorZ {
1366 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367 result: Box::into_raw(Box::new(o)),
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375 CResult_CommitmentTransactionDecodeErrorZ {
1376 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377 err: Box::into_raw(Box::new(e)),
1382 /// Checks if the given object is currently in the success state
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391 fn drop(&mut self) {
1393 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394 let _ = unsafe { Box::from_raw(self.contents.result) };
1397 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398 let _ = unsafe { Box::from_raw(self.contents.err) };
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405 let contents = if o.result_ok {
1406 let result = unsafe { o.contents.result };
1407 unsafe { o.contents.result = core::ptr::null_mut() };
1408 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1410 let err = unsafe { o.contents.err };
1411 unsafe { o.contents.err = core::ptr::null_mut(); }
1412 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1416 result_ok: o.result_ok,
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421 fn clone(&self) -> Self {
1423 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1427 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440 /// A pointer to the contents in the success state.
1441 /// Reading from this pointer when `result_ok` is not set is undefined.
1442 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443 /// Note that this value is always NULL, as there are no contents in the Err variant
1444 pub err: *mut core::ffi::c_void,
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452 /// `err` or `result` depending on the state of `result_ok`.
1453 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455 pub result_ok: bool,
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460 CResult_TrustedCommitmentTransactionNoneZ {
1461 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462 result: Box::into_raw(Box::new(o)),
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470 CResult_TrustedCommitmentTransactionNoneZ {
1471 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472 err: core::ptr::null_mut(),
1477 /// Checks if the given object is currently in the success state
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486 fn drop(&mut self) {
1488 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489 let _ = unsafe { Box::from_raw(self.contents.result) };
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497 let contents = if o.result_ok {
1498 let result = unsafe { o.contents.result };
1499 unsafe { o.contents.result = core::ptr::null_mut() };
1500 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1502 let _ = unsafe { Box::from_raw(o.contents.err) };
1503 o.contents.err = core::ptr::null_mut();
1504 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1508 result_ok: o.result_ok,
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515 /// A pointer to the contents in the success state.
1516 /// Reading from this pointer when `result_ok` is not set is undefined.
1517 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518 /// Note that this value is always NULL, as there are no contents in the Err variant
1519 pub err: *mut core::ffi::c_void,
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527 /// `err` or `result` depending on the state of `result_ok`.
1528 pub contents: CResult_CVec_SignatureZNoneZPtr,
1529 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530 pub result_ok: bool,
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535 CResult_CVec_SignatureZNoneZ {
1536 contents: CResult_CVec_SignatureZNoneZPtr {
1537 result: Box::into_raw(Box::new(o)),
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545 CResult_CVec_SignatureZNoneZ {
1546 contents: CResult_CVec_SignatureZNoneZPtr {
1547 err: core::ptr::null_mut(),
1552 /// Checks if the given object is currently in the success state
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561 fn drop(&mut self) {
1563 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564 let _ = unsafe { Box::from_raw(self.contents.result) };
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572 let contents = if o.result_ok {
1573 let result = unsafe { o.contents.result };
1574 unsafe { o.contents.result = core::ptr::null_mut() };
1575 CResult_CVec_SignatureZNoneZPtr { result }
1577 let _ = unsafe { Box::from_raw(o.contents.err) };
1578 o.contents.err = core::ptr::null_mut();
1579 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1583 result_ok: o.result_ok,
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588 fn clone(&self) -> Self {
1590 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1594 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595 err: core::ptr::null_mut()
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607 /// A pointer to the contents in the success state.
1608 /// Reading from this pointer when `result_ok` is not set is undefined.
1609 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610 /// A pointer to the contents in the error state.
1611 /// Reading from this pointer when `result_ok` is set is undefined.
1612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620 /// `err` or `result` depending on the state of `result_ok`.
1621 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623 pub result_ok: bool,
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628 CResult_ShutdownScriptDecodeErrorZ {
1629 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630 result: Box::into_raw(Box::new(o)),
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638 CResult_ShutdownScriptDecodeErrorZ {
1639 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640 err: Box::into_raw(Box::new(e)),
1645 /// Checks if the given object is currently in the success state
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654 fn drop(&mut self) {
1656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657 let _ = unsafe { Box::from_raw(self.contents.result) };
1660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661 let _ = unsafe { Box::from_raw(self.contents.err) };
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668 let contents = if o.result_ok {
1669 let result = unsafe { o.contents.result };
1670 unsafe { o.contents.result = core::ptr::null_mut() };
1671 CResult_ShutdownScriptDecodeErrorZPtr { result }
1673 let err = unsafe { o.contents.err };
1674 unsafe { o.contents.err = core::ptr::null_mut(); }
1675 CResult_ShutdownScriptDecodeErrorZPtr { err }
1679 result_ok: o.result_ok,
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684 fn clone(&self) -> Self {
1686 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1690 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703 /// A pointer to the contents in the success state.
1704 /// Reading from this pointer when `result_ok` is not set is undefined.
1705 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706 /// A pointer to the contents in the error state.
1707 /// Reading from this pointer when `result_ok` is set is undefined.
1708 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716 /// `err` or `result` depending on the state of `result_ok`.
1717 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719 pub result_ok: bool,
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724 CResult_ShutdownScriptInvalidShutdownScriptZ {
1725 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726 result: Box::into_raw(Box::new(o)),
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734 CResult_ShutdownScriptInvalidShutdownScriptZ {
1735 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736 err: Box::into_raw(Box::new(e)),
1741 /// Checks if the given object is currently in the success state
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750 fn drop(&mut self) {
1752 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753 let _ = unsafe { Box::from_raw(self.contents.result) };
1756 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757 let _ = unsafe { Box::from_raw(self.contents.err) };
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764 let contents = if o.result_ok {
1765 let result = unsafe { o.contents.result };
1766 unsafe { o.contents.result = core::ptr::null_mut() };
1767 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1769 let err = unsafe { o.contents.err };
1770 unsafe { o.contents.err = core::ptr::null_mut(); }
1771 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1775 result_ok: o.result_ok,
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780 fn clone(&self) -> Self {
1782 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1786 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799 /// Note that this value is always NULL, as there are no contents in the OK variant
1800 pub result: *mut core::ffi::c_void,
1801 /// A pointer to the contents in the error state.
1802 /// Reading from this pointer when `result_ok` is set is undefined.
1803 pub err: *mut crate::c_types::IOError,
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810 /// The contents of this CResult_NoneErrorZ, accessible via either
1811 /// `err` or `result` depending on the state of `result_ok`.
1812 pub contents: CResult_NoneErrorZPtr,
1813 /// Whether this CResult_NoneErrorZ represents a success state.
1814 pub result_ok: bool,
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819 CResult_NoneErrorZ {
1820 contents: CResult_NoneErrorZPtr {
1821 result: core::ptr::null_mut(),
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829 CResult_NoneErrorZ {
1830 contents: CResult_NoneErrorZPtr {
1831 err: Box::into_raw(Box::new(e)),
1836 /// Checks if the given object is currently in the success state
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845 fn drop(&mut self) {
1848 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849 let _ = unsafe { Box::from_raw(self.contents.err) };
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856 let contents = if o.result_ok {
1857 let _ = unsafe { Box::from_raw(o.contents.result) };
1858 o.contents.result = core::ptr::null_mut();
1859 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1861 let err = unsafe { o.contents.err };
1862 unsafe { o.contents.err = core::ptr::null_mut(); }
1863 CResult_NoneErrorZPtr { err }
1867 result_ok: o.result_ok,
1871 impl Clone for CResult_NoneErrorZ {
1872 fn clone(&self) -> Self {
1874 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875 result: core::ptr::null_mut()
1878 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891 /// A pointer to the contents in the success state.
1892 /// Reading from this pointer when `result_ok` is not set is undefined.
1893 pub result: *mut crate::lightning::routing::router::RouteHop,
1894 /// A pointer to the contents in the error state.
1895 /// Reading from this pointer when `result_ok` is set is undefined.
1896 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904 /// `err` or `result` depending on the state of `result_ok`.
1905 pub contents: CResult_RouteHopDecodeErrorZPtr,
1906 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907 pub result_ok: bool,
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912 CResult_RouteHopDecodeErrorZ {
1913 contents: CResult_RouteHopDecodeErrorZPtr {
1914 result: Box::into_raw(Box::new(o)),
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922 CResult_RouteHopDecodeErrorZ {
1923 contents: CResult_RouteHopDecodeErrorZPtr {
1924 err: Box::into_raw(Box::new(e)),
1929 /// Checks if the given object is currently in the success state
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938 fn drop(&mut self) {
1940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941 let _ = unsafe { Box::from_raw(self.contents.result) };
1944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945 let _ = unsafe { Box::from_raw(self.contents.err) };
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952 let contents = if o.result_ok {
1953 let result = unsafe { o.contents.result };
1954 unsafe { o.contents.result = core::ptr::null_mut() };
1955 CResult_RouteHopDecodeErrorZPtr { result }
1957 let err = unsafe { o.contents.err };
1958 unsafe { o.contents.err = core::ptr::null_mut(); }
1959 CResult_RouteHopDecodeErrorZPtr { err }
1963 result_ok: o.result_ok,
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968 fn clone(&self) -> Self {
1970 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1974 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988 /// The elements in the array.
1989 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990 pub data: *mut crate::lightning::routing::router::RouteHop,
1991 /// The number of elements pointed to by `data`.
1994 impl CVec_RouteHopZ {
1995 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996 if self.datalen == 0 { return Vec::new(); }
1997 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998 self.data = core::ptr::null_mut();
2002 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008 let datalen = v.len();
2009 let data = Box::into_raw(v.into_boxed_slice());
2010 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017 fn drop(&mut self) {
2018 if self.datalen == 0 { return; }
2019 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2022 impl Clone for CVec_RouteHopZ {
2023 fn clone(&self) -> Self {
2024 let mut res = Vec::new();
2025 if self.datalen == 0 { return Self::from(res); }
2026 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034 /// The elements in the array.
2035 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037 /// The number of elements pointed to by `data`.
2040 impl CVec_CVec_RouteHopZZ {
2041 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042 if self.datalen == 0 { return Vec::new(); }
2043 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044 self.data = core::ptr::null_mut();
2048 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054 let datalen = v.len();
2055 let data = Box::into_raw(v.into_boxed_slice());
2056 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063 fn drop(&mut self) {
2064 if self.datalen == 0 { return; }
2065 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069 fn clone(&self) -> Self {
2070 let mut res = Vec::new();
2071 if self.datalen == 0 { return Self::from(res); }
2072 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079 /// A pointer to the contents in the success state.
2080 /// Reading from this pointer when `result_ok` is not set is undefined.
2081 pub result: *mut crate::lightning::routing::router::Route,
2082 /// A pointer to the contents in the error state.
2083 /// Reading from this pointer when `result_ok` is set is undefined.
2084 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092 /// `err` or `result` depending on the state of `result_ok`.
2093 pub contents: CResult_RouteDecodeErrorZPtr,
2094 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095 pub result_ok: bool,
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100 CResult_RouteDecodeErrorZ {
2101 contents: CResult_RouteDecodeErrorZPtr {
2102 result: Box::into_raw(Box::new(o)),
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110 CResult_RouteDecodeErrorZ {
2111 contents: CResult_RouteDecodeErrorZPtr {
2112 err: Box::into_raw(Box::new(e)),
2117 /// Checks if the given object is currently in the success state
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126 fn drop(&mut self) {
2128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129 let _ = unsafe { Box::from_raw(self.contents.result) };
2132 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133 let _ = unsafe { Box::from_raw(self.contents.err) };
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140 let contents = if o.result_ok {
2141 let result = unsafe { o.contents.result };
2142 unsafe { o.contents.result = core::ptr::null_mut() };
2143 CResult_RouteDecodeErrorZPtr { result }
2145 let err = unsafe { o.contents.err };
2146 unsafe { o.contents.err = core::ptr::null_mut(); }
2147 CResult_RouteDecodeErrorZPtr { err }
2151 result_ok: o.result_ok,
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156 fn clone(&self) -> Self {
2158 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2162 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175 /// A pointer to the contents in the success state.
2176 /// Reading from this pointer when `result_ok` is not set is undefined.
2177 pub result: *mut crate::lightning::routing::router::RouteParameters,
2178 /// A pointer to the contents in the error state.
2179 /// Reading from this pointer when `result_ok` is set is undefined.
2180 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188 /// `err` or `result` depending on the state of `result_ok`.
2189 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191 pub result_ok: bool,
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196 CResult_RouteParametersDecodeErrorZ {
2197 contents: CResult_RouteParametersDecodeErrorZPtr {
2198 result: Box::into_raw(Box::new(o)),
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206 CResult_RouteParametersDecodeErrorZ {
2207 contents: CResult_RouteParametersDecodeErrorZPtr {
2208 err: Box::into_raw(Box::new(e)),
2213 /// Checks if the given object is currently in the success state
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222 fn drop(&mut self) {
2224 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225 let _ = unsafe { Box::from_raw(self.contents.result) };
2228 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229 let _ = unsafe { Box::from_raw(self.contents.err) };
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236 let contents = if o.result_ok {
2237 let result = unsafe { o.contents.result };
2238 unsafe { o.contents.result = core::ptr::null_mut() };
2239 CResult_RouteParametersDecodeErrorZPtr { result }
2241 let err = unsafe { o.contents.err };
2242 unsafe { o.contents.err = core::ptr::null_mut(); }
2243 CResult_RouteParametersDecodeErrorZPtr { err }
2247 result_ok: o.result_ok,
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252 fn clone(&self) -> Self {
2254 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2258 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272 /// The elements in the array.
2273 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274 pub data: *mut crate::lightning::routing::router::RouteHint,
2275 /// The number of elements pointed to by `data`.
2278 impl CVec_RouteHintZ {
2279 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280 if self.datalen == 0 { return Vec::new(); }
2281 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282 self.data = core::ptr::null_mut();
2286 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292 let datalen = v.len();
2293 let data = Box::into_raw(v.into_boxed_slice());
2294 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301 fn drop(&mut self) {
2302 if self.datalen == 0 { return; }
2303 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2306 impl Clone for CVec_RouteHintZ {
2307 fn clone(&self) -> Self {
2308 let mut res = Vec::new();
2309 if self.datalen == 0 { return Self::from(res); }
2310 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318 /// When we're in this state, this COption_u64Z contains a u64
2320 /// When we're in this state, this COption_u64Z contains nothing
2324 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325 if let Self::None = self { false } else { true }
2327 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2330 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331 if let Self::Some(v) = self { v } else { unreachable!() }
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337 COption_u64Z::Some(o)
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354 /// A pointer to the contents in the success state.
2355 /// Reading from this pointer when `result_ok` is not set is undefined.
2356 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357 /// A pointer to the contents in the error state.
2358 /// Reading from this pointer when `result_ok` is set is undefined.
2359 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367 /// `err` or `result` depending on the state of `result_ok`.
2368 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370 pub result_ok: bool,
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375 CResult_PaymentParametersDecodeErrorZ {
2376 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377 result: Box::into_raw(Box::new(o)),
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385 CResult_PaymentParametersDecodeErrorZ {
2386 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387 err: Box::into_raw(Box::new(e)),
2392 /// Checks if the given object is currently in the success state
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401 fn drop(&mut self) {
2403 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404 let _ = unsafe { Box::from_raw(self.contents.result) };
2407 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408 let _ = unsafe { Box::from_raw(self.contents.err) };
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415 let contents = if o.result_ok {
2416 let result = unsafe { o.contents.result };
2417 unsafe { o.contents.result = core::ptr::null_mut() };
2418 CResult_PaymentParametersDecodeErrorZPtr { result }
2420 let err = unsafe { o.contents.err };
2421 unsafe { o.contents.err = core::ptr::null_mut(); }
2422 CResult_PaymentParametersDecodeErrorZPtr { err }
2426 result_ok: o.result_ok,
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431 fn clone(&self) -> Self {
2433 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2437 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451 /// The elements in the array.
2452 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454 /// The number of elements pointed to by `data`.
2457 impl CVec_RouteHintHopZ {
2458 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459 if self.datalen == 0 { return Vec::new(); }
2460 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461 self.data = core::ptr::null_mut();
2465 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471 let datalen = v.len();
2472 let data = Box::into_raw(v.into_boxed_slice());
2473 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480 fn drop(&mut self) {
2481 if self.datalen == 0 { return; }
2482 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2485 impl Clone for CVec_RouteHintHopZ {
2486 fn clone(&self) -> Self {
2487 let mut res = Vec::new();
2488 if self.datalen == 0 { return Self::from(res); }
2489 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496 /// A pointer to the contents in the success state.
2497 /// Reading from this pointer when `result_ok` is not set is undefined.
2498 pub result: *mut crate::lightning::routing::router::RouteHint,
2499 /// A pointer to the contents in the error state.
2500 /// Reading from this pointer when `result_ok` is set is undefined.
2501 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509 /// `err` or `result` depending on the state of `result_ok`.
2510 pub contents: CResult_RouteHintDecodeErrorZPtr,
2511 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512 pub result_ok: bool,
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517 CResult_RouteHintDecodeErrorZ {
2518 contents: CResult_RouteHintDecodeErrorZPtr {
2519 result: Box::into_raw(Box::new(o)),
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527 CResult_RouteHintDecodeErrorZ {
2528 contents: CResult_RouteHintDecodeErrorZPtr {
2529 err: Box::into_raw(Box::new(e)),
2534 /// Checks if the given object is currently in the success state
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543 fn drop(&mut self) {
2545 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546 let _ = unsafe { Box::from_raw(self.contents.result) };
2549 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550 let _ = unsafe { Box::from_raw(self.contents.err) };
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557 let contents = if o.result_ok {
2558 let result = unsafe { o.contents.result };
2559 unsafe { o.contents.result = core::ptr::null_mut() };
2560 CResult_RouteHintDecodeErrorZPtr { result }
2562 let err = unsafe { o.contents.err };
2563 unsafe { o.contents.err = core::ptr::null_mut(); }
2564 CResult_RouteHintDecodeErrorZPtr { err }
2568 result_ok: o.result_ok,
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573 fn clone(&self) -> Self {
2575 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2579 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592 /// A pointer to the contents in the success state.
2593 /// Reading from this pointer when `result_ok` is not set is undefined.
2594 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595 /// A pointer to the contents in the error state.
2596 /// Reading from this pointer when `result_ok` is set is undefined.
2597 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605 /// `err` or `result` depending on the state of `result_ok`.
2606 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608 pub result_ok: bool,
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613 CResult_RouteHintHopDecodeErrorZ {
2614 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615 result: Box::into_raw(Box::new(o)),
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623 CResult_RouteHintHopDecodeErrorZ {
2624 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625 err: Box::into_raw(Box::new(e)),
2630 /// Checks if the given object is currently in the success state
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639 fn drop(&mut self) {
2641 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642 let _ = unsafe { Box::from_raw(self.contents.result) };
2645 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646 let _ = unsafe { Box::from_raw(self.contents.err) };
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653 let contents = if o.result_ok {
2654 let result = unsafe { o.contents.result };
2655 unsafe { o.contents.result = core::ptr::null_mut() };
2656 CResult_RouteHintHopDecodeErrorZPtr { result }
2658 let err = unsafe { o.contents.err };
2659 unsafe { o.contents.err = core::ptr::null_mut(); }
2660 CResult_RouteHintHopDecodeErrorZPtr { err }
2664 result_ok: o.result_ok,
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669 fn clone(&self) -> Self {
2671 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2675 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689 /// The elements in the array.
2690 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692 /// The number of elements pointed to by `data`.
2695 impl CVec_ChannelDetailsZ {
2696 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697 if self.datalen == 0 { return Vec::new(); }
2698 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699 self.data = core::ptr::null_mut();
2703 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709 let datalen = v.len();
2710 let data = Box::into_raw(v.into_boxed_slice());
2711 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718 fn drop(&mut self) {
2719 if self.datalen == 0 { return; }
2720 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2723 impl Clone for CVec_ChannelDetailsZ {
2724 fn clone(&self) -> Self {
2725 let mut res = Vec::new();
2726 if self.datalen == 0 { return Self::from(res); }
2727 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734 /// A pointer to the contents in the success state.
2735 /// Reading from this pointer when `result_ok` is not set is undefined.
2736 pub result: *mut crate::lightning::routing::router::Route,
2737 /// A pointer to the contents in the error state.
2738 /// Reading from this pointer when `result_ok` is set is undefined.
2739 pub err: *mut crate::lightning::ln::msgs::LightningError,
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747 /// `err` or `result` depending on the state of `result_ok`.
2748 pub contents: CResult_RouteLightningErrorZPtr,
2749 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750 pub result_ok: bool,
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755 CResult_RouteLightningErrorZ {
2756 contents: CResult_RouteLightningErrorZPtr {
2757 result: Box::into_raw(Box::new(o)),
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765 CResult_RouteLightningErrorZ {
2766 contents: CResult_RouteLightningErrorZPtr {
2767 err: Box::into_raw(Box::new(e)),
2772 /// Checks if the given object is currently in the success state
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781 fn drop(&mut self) {
2783 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784 let _ = unsafe { Box::from_raw(self.contents.result) };
2787 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788 let _ = unsafe { Box::from_raw(self.contents.err) };
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795 let contents = if o.result_ok {
2796 let result = unsafe { o.contents.result };
2797 unsafe { o.contents.result = core::ptr::null_mut() };
2798 CResult_RouteLightningErrorZPtr { result }
2800 let err = unsafe { o.contents.err };
2801 unsafe { o.contents.err = core::ptr::null_mut(); }
2802 CResult_RouteLightningErrorZPtr { err }
2806 result_ok: o.result_ok,
2810 impl Clone for CResult_RouteLightningErrorZ {
2811 fn clone(&self) -> Self {
2813 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2817 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2828 /// The contents of CResult_TxOutAccessErrorZ
2829 pub union CResult_TxOutAccessErrorZPtr {
2830 /// A pointer to the contents in the success state.
2831 /// Reading from this pointer when `result_ok` is not set is undefined.
2832 pub result: *mut crate::c_types::TxOut,
2833 /// A pointer to the contents in the error state.
2834 /// Reading from this pointer when `result_ok` is set is undefined.
2835 pub err: *mut crate::lightning::chain::AccessError,
2838 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2839 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2841 pub struct CResult_TxOutAccessErrorZ {
2842 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2843 /// `err` or `result` depending on the state of `result_ok`.
2844 pub contents: CResult_TxOutAccessErrorZPtr,
2845 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2846 pub result_ok: bool,
2849 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2850 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2851 CResult_TxOutAccessErrorZ {
2852 contents: CResult_TxOutAccessErrorZPtr {
2853 result: Box::into_raw(Box::new(o)),
2859 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2860 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2861 CResult_TxOutAccessErrorZ {
2862 contents: CResult_TxOutAccessErrorZPtr {
2863 err: Box::into_raw(Box::new(e)),
2868 /// Checks if the given object is currently in the success state
2870 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2874 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2875 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2876 impl Drop for CResult_TxOutAccessErrorZ {
2877 fn drop(&mut self) {
2879 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2880 let _ = unsafe { Box::from_raw(self.contents.result) };
2883 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2884 let _ = unsafe { Box::from_raw(self.contents.err) };
2889 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2890 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2891 let contents = if o.result_ok {
2892 let result = unsafe { o.contents.result };
2893 unsafe { o.contents.result = core::ptr::null_mut() };
2894 CResult_TxOutAccessErrorZPtr { result }
2896 let err = unsafe { o.contents.err };
2897 unsafe { o.contents.err = core::ptr::null_mut(); }
2898 CResult_TxOutAccessErrorZPtr { err }
2902 result_ok: o.result_ok,
2906 impl Clone for CResult_TxOutAccessErrorZ {
2907 fn clone(&self) -> Self {
2909 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2910 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2913 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2914 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2920 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2921 /// but with all dynamically-allocated buffers duplicated in new buffers.
2922 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2924 /// A tuple of 2 elements. See the individual fields for the types contained.
2925 pub struct C2Tuple_usizeTransactionZ {
2926 /// The element at position 0
2928 /// The element at position 1
2929 pub b: crate::c_types::Transaction,
2931 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2932 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2939 impl C2Tuple_usizeTransactionZ {
2940 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2944 impl Clone for C2Tuple_usizeTransactionZ {
2945 fn clone(&self) -> Self {
2947 a: Clone::clone(&self.a),
2948 b: Clone::clone(&self.b),
2953 /// Creates a new tuple which has the same data as `orig`
2954 /// but with all dynamically-allocated buffers duplicated in new buffers.
2955 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2956 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2958 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2959 C2Tuple_usizeTransactionZ { a, b, }
2963 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2964 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2967 /// This corresponds to std::vector in C++
2968 pub struct CVec_C2Tuple_usizeTransactionZZ {
2969 /// The elements in the array.
2970 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2971 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2972 /// The number of elements pointed to by `data`.
2975 impl CVec_C2Tuple_usizeTransactionZZ {
2976 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2977 if self.datalen == 0 { return Vec::new(); }
2978 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2979 self.data = core::ptr::null_mut();
2983 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2984 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2987 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2988 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2989 let datalen = v.len();
2990 let data = Box::into_raw(v.into_boxed_slice());
2991 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2996 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2997 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2998 fn drop(&mut self) {
2999 if self.datalen == 0 { return; }
3000 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3003 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3004 fn clone(&self) -> Self {
3005 let mut res = Vec::new();
3006 if self.datalen == 0 { return Self::from(res); }
3007 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3012 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3013 /// This corresponds to std::vector in C++
3014 pub struct CVec_TxidZ {
3015 /// The elements in the array.
3016 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3017 pub data: *mut crate::c_types::ThirtyTwoBytes,
3018 /// The number of elements pointed to by `data`.
3022 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3023 if self.datalen == 0 { return Vec::new(); }
3024 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3025 self.data = core::ptr::null_mut();
3029 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3030 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3033 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3034 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3035 let datalen = v.len();
3036 let data = Box::into_raw(v.into_boxed_slice());
3037 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3042 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3043 impl Drop for CVec_TxidZ {
3044 fn drop(&mut self) {
3045 if self.datalen == 0 { return; }
3046 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3049 impl Clone for CVec_TxidZ {
3050 fn clone(&self) -> Self {
3051 let mut res = Vec::new();
3052 if self.datalen == 0 { return Self::from(res); }
3053 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3058 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3059 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3060 /// Note that this value is always NULL, as there are no contents in the OK variant
3061 pub result: *mut core::ffi::c_void,
3062 /// A pointer to the contents in the error state.
3063 /// Reading from this pointer when `result_ok` is set is undefined.
3064 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3067 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3068 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3070 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3071 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3072 /// `err` or `result` depending on the state of `result_ok`.
3073 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3074 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3075 pub result_ok: bool,
3078 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3079 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3080 CResult_NoneChannelMonitorUpdateErrZ {
3081 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3082 result: core::ptr::null_mut(),
3088 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3089 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3090 CResult_NoneChannelMonitorUpdateErrZ {
3091 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3092 err: Box::into_raw(Box::new(e)),
3097 /// Checks if the given object is currently in the success state
3099 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3103 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3104 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3105 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3106 fn drop(&mut self) {
3109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3110 let _ = unsafe { Box::from_raw(self.contents.err) };
3115 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3116 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3117 let contents = if o.result_ok {
3118 let _ = unsafe { Box::from_raw(o.contents.result) };
3119 o.contents.result = core::ptr::null_mut();
3120 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3122 let err = unsafe { o.contents.err };
3123 unsafe { o.contents.err = core::ptr::null_mut(); }
3124 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3128 result_ok: o.result_ok,
3132 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3133 fn clone(&self) -> Self {
3135 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3136 result: core::ptr::null_mut()
3139 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3140 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3146 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3147 /// but with all dynamically-allocated buffers duplicated in new buffers.
3148 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3150 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3151 /// This corresponds to std::vector in C++
3152 pub struct CVec_MonitorEventZ {
3153 /// The elements in the array.
3154 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3155 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3156 /// The number of elements pointed to by `data`.
3159 impl CVec_MonitorEventZ {
3160 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3161 if self.datalen == 0 { return Vec::new(); }
3162 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3163 self.data = core::ptr::null_mut();
3167 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3168 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3171 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3172 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3173 let datalen = v.len();
3174 let data = Box::into_raw(v.into_boxed_slice());
3175 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3180 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3181 impl Drop for CVec_MonitorEventZ {
3182 fn drop(&mut self) {
3183 if self.datalen == 0 { return; }
3184 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3187 impl Clone for CVec_MonitorEventZ {
3188 fn clone(&self) -> Self {
3189 let mut res = Vec::new();
3190 if self.datalen == 0 { return Self::from(res); }
3191 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3197 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3198 pub enum COption_C2Tuple_usizeTransactionZZ {
3199 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3201 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3204 impl COption_C2Tuple_usizeTransactionZZ {
3205 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3206 if let Self::None = self { false } else { true }
3208 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3211 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3212 if let Self::Some(v) = self { v } else { unreachable!() }
3216 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3217 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3218 COption_C2Tuple_usizeTransactionZZ::Some(o)
3221 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3222 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3223 COption_C2Tuple_usizeTransactionZZ::None
3226 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3227 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3229 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3230 /// but with all dynamically-allocated buffers duplicated in new buffers.
3231 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3234 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3235 pub enum COption_ClosureReasonZ {
3236 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3237 Some(crate::lightning::util::events::ClosureReason),
3238 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3241 impl COption_ClosureReasonZ {
3242 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243 if let Self::None = self { false } else { true }
3245 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3248 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3249 if let Self::Some(v) = self { v } else { unreachable!() }
3253 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3254 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3255 COption_ClosureReasonZ::Some(o)
3258 /// Constructs a new COption_ClosureReasonZ containing nothing
3259 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3260 COption_ClosureReasonZ::None
3263 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3264 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3266 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3267 /// but with all dynamically-allocated buffers duplicated in new buffers.
3268 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3270 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3271 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3272 /// A pointer to the contents in the success state.
3273 /// Reading from this pointer when `result_ok` is not set is undefined.
3274 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3275 /// A pointer to the contents in the error state.
3276 /// Reading from this pointer when `result_ok` is set is undefined.
3277 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3280 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3281 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3283 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3284 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3285 /// `err` or `result` depending on the state of `result_ok`.
3286 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3287 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3288 pub result_ok: bool,
3291 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3292 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3293 CResult_COption_ClosureReasonZDecodeErrorZ {
3294 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295 result: Box::into_raw(Box::new(o)),
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3302 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3303 CResult_COption_ClosureReasonZDecodeErrorZ {
3304 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3305 err: Box::into_raw(Box::new(e)),
3310 /// Checks if the given object is currently in the success state
3312 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3316 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3317 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3318 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3319 fn drop(&mut self) {
3321 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3322 let _ = unsafe { Box::from_raw(self.contents.result) };
3325 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3326 let _ = unsafe { Box::from_raw(self.contents.err) };
3331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3332 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3333 let contents = if o.result_ok {
3334 let result = unsafe { o.contents.result };
3335 unsafe { o.contents.result = core::ptr::null_mut() };
3336 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3338 let err = unsafe { o.contents.err };
3339 unsafe { o.contents.err = core::ptr::null_mut(); }
3340 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3344 result_ok: o.result_ok,
3348 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3349 fn clone(&self) -> Self {
3351 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3352 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3355 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3356 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3362 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3363 /// but with all dynamically-allocated buffers duplicated in new buffers.
3364 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3367 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3368 pub enum COption_NetworkUpdateZ {
3369 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3370 Some(crate::lightning::routing::network_graph::NetworkUpdate),
3371 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3374 impl COption_NetworkUpdateZ {
3375 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376 if let Self::None = self { false } else { true }
3378 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3381 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3382 if let Self::Some(v) = self { v } else { unreachable!() }
3386 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3387 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3388 COption_NetworkUpdateZ::Some(o)
3391 /// Constructs a new COption_NetworkUpdateZ containing nothing
3392 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3393 COption_NetworkUpdateZ::None
3396 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3397 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3399 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3403 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_SpendableOutputDescriptorZ {
3406 /// The elements in the array.
3407 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3409 /// The number of elements pointed to by `data`.
3412 impl CVec_SpendableOutputDescriptorZ {
3413 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3414 if self.datalen == 0 { return Vec::new(); }
3415 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416 self.data = core::ptr::null_mut();
3420 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3421 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3424 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3425 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3426 let datalen = v.len();
3427 let data = Box::into_raw(v.into_boxed_slice());
3428 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3434 impl Drop for CVec_SpendableOutputDescriptorZ {
3435 fn drop(&mut self) {
3436 if self.datalen == 0 { return; }
3437 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3440 impl Clone for CVec_SpendableOutputDescriptorZ {
3441 fn clone(&self) -> Self {
3442 let mut res = Vec::new();
3443 if self.datalen == 0 { return Self::from(res); }
3444 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3450 /// An enum which can either contain a crate::lightning::util::events::Event or not
3451 pub enum COption_EventZ {
3452 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3453 Some(crate::lightning::util::events::Event),
3454 /// When we're in this state, this COption_EventZ contains nothing
3457 impl COption_EventZ {
3458 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3459 if let Self::None = self { false } else { true }
3461 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3464 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3465 if let Self::Some(v) = self { v } else { unreachable!() }
3469 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3470 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3471 COption_EventZ::Some(o)
3474 /// Constructs a new COption_EventZ containing nothing
3475 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3476 COption_EventZ::None
3479 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3480 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3482 /// Creates a new COption_EventZ which has the same data as `orig`
3483 /// but with all dynamically-allocated buffers duplicated in new buffers.
3484 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3486 /// The contents of CResult_COption_EventZDecodeErrorZ
3487 pub union CResult_COption_EventZDecodeErrorZPtr {
3488 /// A pointer to the contents in the success state.
3489 /// Reading from this pointer when `result_ok` is not set is undefined.
3490 pub result: *mut crate::c_types::derived::COption_EventZ,
3491 /// A pointer to the contents in the error state.
3492 /// Reading from this pointer when `result_ok` is set is undefined.
3493 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3496 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3497 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3499 pub struct CResult_COption_EventZDecodeErrorZ {
3500 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3501 /// `err` or `result` depending on the state of `result_ok`.
3502 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3503 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3504 pub result_ok: bool,
3507 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3508 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3509 CResult_COption_EventZDecodeErrorZ {
3510 contents: CResult_COption_EventZDecodeErrorZPtr {
3511 result: Box::into_raw(Box::new(o)),
3517 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3518 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3519 CResult_COption_EventZDecodeErrorZ {
3520 contents: CResult_COption_EventZDecodeErrorZPtr {
3521 err: Box::into_raw(Box::new(e)),
3526 /// Checks if the given object is currently in the success state
3528 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3532 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3533 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3534 impl Drop for CResult_COption_EventZDecodeErrorZ {
3535 fn drop(&mut self) {
3537 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3538 let _ = unsafe { Box::from_raw(self.contents.result) };
3541 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3542 let _ = unsafe { Box::from_raw(self.contents.err) };
3547 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3548 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3549 let contents = if o.result_ok {
3550 let result = unsafe { o.contents.result };
3551 unsafe { o.contents.result = core::ptr::null_mut() };
3552 CResult_COption_EventZDecodeErrorZPtr { result }
3554 let err = unsafe { o.contents.err };
3555 unsafe { o.contents.err = core::ptr::null_mut(); }
3556 CResult_COption_EventZDecodeErrorZPtr { err }
3560 result_ok: o.result_ok,
3564 impl Clone for CResult_COption_EventZDecodeErrorZ {
3565 fn clone(&self) -> Self {
3567 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3568 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3571 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3572 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3578 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3579 /// but with all dynamically-allocated buffers duplicated in new buffers.
3580 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3582 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3583 /// This corresponds to std::vector in C++
3584 pub struct CVec_MessageSendEventZ {
3585 /// The elements in the array.
3586 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3587 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3588 /// The number of elements pointed to by `data`.
3591 impl CVec_MessageSendEventZ {
3592 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3593 if self.datalen == 0 { return Vec::new(); }
3594 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3595 self.data = core::ptr::null_mut();
3599 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3600 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3603 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3604 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3605 let datalen = v.len();
3606 let data = Box::into_raw(v.into_boxed_slice());
3607 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3612 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3613 impl Drop for CVec_MessageSendEventZ {
3614 fn drop(&mut self) {
3615 if self.datalen == 0 { return; }
3616 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3619 impl Clone for CVec_MessageSendEventZ {
3620 fn clone(&self) -> Self {
3621 let mut res = Vec::new();
3622 if self.datalen == 0 { return Self::from(res); }
3623 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3628 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3629 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3630 /// A pointer to the contents in the success state.
3631 /// Reading from this pointer when `result_ok` is not set is undefined.
3632 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3633 /// A pointer to the contents in the error state.
3634 /// Reading from this pointer when `result_ok` is set is undefined.
3635 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3638 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3639 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3640 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3641 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3642 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3643 /// `err` or `result` depending on the state of `result_ok`.
3644 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3645 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3646 pub result_ok: bool,
3649 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3650 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3651 CResult_FixedPenaltyScorerDecodeErrorZ {
3652 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3653 result: Box::into_raw(Box::new(o)),
3659 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3660 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3661 CResult_FixedPenaltyScorerDecodeErrorZ {
3662 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3663 err: Box::into_raw(Box::new(e)),
3668 /// Checks if the given object is currently in the success state
3670 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3674 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3675 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3676 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3677 fn drop(&mut self) {
3679 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3680 let _ = unsafe { Box::from_raw(self.contents.result) };
3683 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3684 let _ = unsafe { Box::from_raw(self.contents.err) };
3689 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3690 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3691 let contents = if o.result_ok {
3692 let result = unsafe { o.contents.result };
3693 unsafe { o.contents.result = core::ptr::null_mut() };
3694 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3696 let err = unsafe { o.contents.err };
3697 unsafe { o.contents.err = core::ptr::null_mut(); }
3698 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3702 result_ok: o.result_ok,
3706 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3707 fn clone(&self) -> Self {
3709 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3710 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3713 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3714 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3720 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3721 /// but with all dynamically-allocated buffers duplicated in new buffers.
3722 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3724 /// The contents of CResult_ScoringParametersDecodeErrorZ
3725 pub union CResult_ScoringParametersDecodeErrorZPtr {
3726 /// A pointer to the contents in the success state.
3727 /// Reading from this pointer when `result_ok` is not set is undefined.
3728 pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3729 /// A pointer to the contents in the error state.
3730 /// Reading from this pointer when `result_ok` is set is undefined.
3731 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3734 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3735 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3736 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3737 pub struct CResult_ScoringParametersDecodeErrorZ {
3738 /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3739 /// `err` or `result` depending on the state of `result_ok`.
3740 pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3741 /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3742 pub result_ok: bool,
3745 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3746 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3747 CResult_ScoringParametersDecodeErrorZ {
3748 contents: CResult_ScoringParametersDecodeErrorZPtr {
3749 result: Box::into_raw(Box::new(o)),
3755 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3756 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3757 CResult_ScoringParametersDecodeErrorZ {
3758 contents: CResult_ScoringParametersDecodeErrorZPtr {
3759 err: Box::into_raw(Box::new(e)),
3764 /// Checks if the given object is currently in the success state
3766 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3770 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3771 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3772 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3773 fn drop(&mut self) {
3775 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3776 let _ = unsafe { Box::from_raw(self.contents.result) };
3779 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3780 let _ = unsafe { Box::from_raw(self.contents.err) };
3785 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3786 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3787 let contents = if o.result_ok {
3788 let result = unsafe { o.contents.result };
3789 unsafe { o.contents.result = core::ptr::null_mut() };
3790 CResult_ScoringParametersDecodeErrorZPtr { result }
3792 let err = unsafe { o.contents.err };
3793 unsafe { o.contents.err = core::ptr::null_mut(); }
3794 CResult_ScoringParametersDecodeErrorZPtr { err }
3798 result_ok: o.result_ok,
3802 impl Clone for CResult_ScoringParametersDecodeErrorZ {
3803 fn clone(&self) -> Self {
3805 Self { result_ok: true, contents: CResult_ScoringParametersDecodeErrorZPtr {
3806 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ScoringParameters>::clone(unsafe { &*self.contents.result })))
3809 Self { result_ok: false, contents: CResult_ScoringParametersDecodeErrorZPtr {
3810 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3816 /// Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig`
3817 /// but with all dynamically-allocated buffers duplicated in new buffers.
3818 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_clone(orig: &CResult_ScoringParametersDecodeErrorZ) -> CResult_ScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3820 /// The contents of CResult_ScorerDecodeErrorZ
3821 pub union CResult_ScorerDecodeErrorZPtr {
3822 /// A pointer to the contents in the success state.
3823 /// Reading from this pointer when `result_ok` is not set is undefined.
3824 pub result: *mut crate::lightning::routing::scoring::Scorer,
3825 /// A pointer to the contents in the error state.
3826 /// Reading from this pointer when `result_ok` is set is undefined.
3827 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3830 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3831 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3833 pub struct CResult_ScorerDecodeErrorZ {
3834 /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3835 /// `err` or `result` depending on the state of `result_ok`.
3836 pub contents: CResult_ScorerDecodeErrorZPtr,
3837 /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3838 pub result_ok: bool,
3841 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3842 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3843 CResult_ScorerDecodeErrorZ {
3844 contents: CResult_ScorerDecodeErrorZPtr {
3845 result: Box::into_raw(Box::new(o)),
3851 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3852 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3853 CResult_ScorerDecodeErrorZ {
3854 contents: CResult_ScorerDecodeErrorZPtr {
3855 err: Box::into_raw(Box::new(e)),
3860 /// Checks if the given object is currently in the success state
3862 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3866 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3867 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3868 impl Drop for CResult_ScorerDecodeErrorZ {
3869 fn drop(&mut self) {
3871 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3872 let _ = unsafe { Box::from_raw(self.contents.result) };
3875 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3876 let _ = unsafe { Box::from_raw(self.contents.err) };
3881 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3882 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3883 let contents = if o.result_ok {
3884 let result = unsafe { o.contents.result };
3885 unsafe { o.contents.result = core::ptr::null_mut() };
3886 CResult_ScorerDecodeErrorZPtr { result }
3888 let err = unsafe { o.contents.err };
3889 unsafe { o.contents.err = core::ptr::null_mut(); }
3890 CResult_ScorerDecodeErrorZPtr { err }
3894 result_ok: o.result_ok,
3899 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3900 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3901 /// A pointer to the contents in the success state.
3902 /// Reading from this pointer when `result_ok` is not set is undefined.
3903 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3904 /// A pointer to the contents in the error state.
3905 /// Reading from this pointer when `result_ok` is set is undefined.
3906 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3909 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3910 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3912 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
3913 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
3914 /// `err` or `result` depending on the state of `result_ok`.
3915 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
3916 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
3917 pub result_ok: bool,
3920 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
3921 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
3922 CResult_ProbabilisticScorerDecodeErrorZ {
3923 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3924 result: Box::into_raw(Box::new(o)),
3930 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
3931 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
3932 CResult_ProbabilisticScorerDecodeErrorZ {
3933 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3934 err: Box::into_raw(Box::new(e)),
3939 /// Checks if the given object is currently in the success state
3941 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
3945 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
3946 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
3947 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
3948 fn drop(&mut self) {
3950 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3951 let _ = unsafe { Box::from_raw(self.contents.result) };
3954 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3955 let _ = unsafe { Box::from_raw(self.contents.err) };
3960 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
3961 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3962 let contents = if o.result_ok {
3963 let result = unsafe { o.contents.result };
3964 unsafe { o.contents.result = core::ptr::null_mut() };
3965 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
3967 let err = unsafe { o.contents.err };
3968 unsafe { o.contents.err = core::ptr::null_mut(); }
3969 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
3973 result_ok: o.result_ok,
3978 /// The contents of CResult_InitFeaturesDecodeErrorZ
3979 pub union CResult_InitFeaturesDecodeErrorZPtr {
3980 /// A pointer to the contents in the success state.
3981 /// Reading from this pointer when `result_ok` is not set is undefined.
3982 pub result: *mut crate::lightning::ln::features::InitFeatures,
3983 /// A pointer to the contents in the error state.
3984 /// Reading from this pointer when `result_ok` is set is undefined.
3985 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3988 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3989 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3991 pub struct CResult_InitFeaturesDecodeErrorZ {
3992 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3993 /// `err` or `result` depending on the state of `result_ok`.
3994 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3995 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3996 pub result_ok: bool,
3999 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4000 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4001 CResult_InitFeaturesDecodeErrorZ {
4002 contents: CResult_InitFeaturesDecodeErrorZPtr {
4003 result: Box::into_raw(Box::new(o)),
4009 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4010 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4011 CResult_InitFeaturesDecodeErrorZ {
4012 contents: CResult_InitFeaturesDecodeErrorZPtr {
4013 err: Box::into_raw(Box::new(e)),
4018 /// Checks if the given object is currently in the success state
4020 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4024 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4025 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4026 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4027 fn drop(&mut self) {
4029 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4030 let _ = unsafe { Box::from_raw(self.contents.result) };
4033 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4034 let _ = unsafe { Box::from_raw(self.contents.err) };
4039 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4040 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4041 let contents = if o.result_ok {
4042 let result = unsafe { o.contents.result };
4043 unsafe { o.contents.result = core::ptr::null_mut() };
4044 CResult_InitFeaturesDecodeErrorZPtr { result }
4046 let err = unsafe { o.contents.err };
4047 unsafe { o.contents.err = core::ptr::null_mut(); }
4048 CResult_InitFeaturesDecodeErrorZPtr { err }
4052 result_ok: o.result_ok,
4057 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4058 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4059 /// A pointer to the contents in the success state.
4060 /// Reading from this pointer when `result_ok` is not set is undefined.
4061 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4062 /// A pointer to the contents in the error state.
4063 /// Reading from this pointer when `result_ok` is set is undefined.
4064 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4067 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4068 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4070 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4071 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4072 /// `err` or `result` depending on the state of `result_ok`.
4073 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4074 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4075 pub result_ok: bool,
4078 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4079 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4080 CResult_ChannelFeaturesDecodeErrorZ {
4081 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4082 result: Box::into_raw(Box::new(o)),
4088 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4089 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4090 CResult_ChannelFeaturesDecodeErrorZ {
4091 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4092 err: Box::into_raw(Box::new(e)),
4097 /// Checks if the given object is currently in the success state
4099 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4103 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4104 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4105 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4106 fn drop(&mut self) {
4108 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4109 let _ = unsafe { Box::from_raw(self.contents.result) };
4112 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4113 let _ = unsafe { Box::from_raw(self.contents.err) };
4118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4119 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4120 let contents = if o.result_ok {
4121 let result = unsafe { o.contents.result };
4122 unsafe { o.contents.result = core::ptr::null_mut() };
4123 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4125 let err = unsafe { o.contents.err };
4126 unsafe { o.contents.err = core::ptr::null_mut(); }
4127 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4131 result_ok: o.result_ok,
4136 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4137 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4138 /// A pointer to the contents in the success state.
4139 /// Reading from this pointer when `result_ok` is not set is undefined.
4140 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4141 /// A pointer to the contents in the error state.
4142 /// Reading from this pointer when `result_ok` is set is undefined.
4143 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4146 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4147 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4148 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4149 pub struct CResult_NodeFeaturesDecodeErrorZ {
4150 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4151 /// `err` or `result` depending on the state of `result_ok`.
4152 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4153 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4154 pub result_ok: bool,
4157 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4158 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4159 CResult_NodeFeaturesDecodeErrorZ {
4160 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4161 result: Box::into_raw(Box::new(o)),
4167 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4168 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4169 CResult_NodeFeaturesDecodeErrorZ {
4170 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4171 err: Box::into_raw(Box::new(e)),
4176 /// Checks if the given object is currently in the success state
4178 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4182 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4183 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4184 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4185 fn drop(&mut self) {
4187 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4188 let _ = unsafe { Box::from_raw(self.contents.result) };
4191 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4192 let _ = unsafe { Box::from_raw(self.contents.err) };
4197 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4198 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4199 let contents = if o.result_ok {
4200 let result = unsafe { o.contents.result };
4201 unsafe { o.contents.result = core::ptr::null_mut() };
4202 CResult_NodeFeaturesDecodeErrorZPtr { result }
4204 let err = unsafe { o.contents.err };
4205 unsafe { o.contents.err = core::ptr::null_mut(); }
4206 CResult_NodeFeaturesDecodeErrorZPtr { err }
4210 result_ok: o.result_ok,
4215 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4216 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4217 /// A pointer to the contents in the success state.
4218 /// Reading from this pointer when `result_ok` is not set is undefined.
4219 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4220 /// A pointer to the contents in the error state.
4221 /// Reading from this pointer when `result_ok` is set is undefined.
4222 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4225 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4226 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4228 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4229 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4230 /// `err` or `result` depending on the state of `result_ok`.
4231 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4232 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4233 pub result_ok: bool,
4236 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4237 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4238 CResult_InvoiceFeaturesDecodeErrorZ {
4239 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4240 result: Box::into_raw(Box::new(o)),
4246 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4247 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4248 CResult_InvoiceFeaturesDecodeErrorZ {
4249 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4250 err: Box::into_raw(Box::new(e)),
4255 /// Checks if the given object is currently in the success state
4257 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4261 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4262 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4263 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4264 fn drop(&mut self) {
4266 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4267 let _ = unsafe { Box::from_raw(self.contents.result) };
4270 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4271 let _ = unsafe { Box::from_raw(self.contents.err) };
4276 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4277 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4278 let contents = if o.result_ok {
4279 let result = unsafe { o.contents.result };
4280 unsafe { o.contents.result = core::ptr::null_mut() };
4281 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4283 let err = unsafe { o.contents.err };
4284 unsafe { o.contents.err = core::ptr::null_mut(); }
4285 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4289 result_ok: o.result_ok,
4294 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4295 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4296 /// A pointer to the contents in the success state.
4297 /// Reading from this pointer when `result_ok` is not set is undefined.
4298 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4299 /// A pointer to the contents in the error state.
4300 /// Reading from this pointer when `result_ok` is set is undefined.
4301 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4304 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4305 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4306 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4307 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4308 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4309 /// `err` or `result` depending on the state of `result_ok`.
4310 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4311 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4312 pub result_ok: bool,
4315 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4316 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4317 CResult_ChannelTypeFeaturesDecodeErrorZ {
4318 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4319 result: Box::into_raw(Box::new(o)),
4325 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4326 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4327 CResult_ChannelTypeFeaturesDecodeErrorZ {
4328 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4329 err: Box::into_raw(Box::new(e)),
4334 /// Checks if the given object is currently in the success state
4336 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4340 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4341 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4342 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4343 fn drop(&mut self) {
4345 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4346 let _ = unsafe { Box::from_raw(self.contents.result) };
4349 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4350 let _ = unsafe { Box::from_raw(self.contents.err) };
4355 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4356 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4357 let contents = if o.result_ok {
4358 let result = unsafe { o.contents.result };
4359 unsafe { o.contents.result = core::ptr::null_mut() };
4360 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4362 let err = unsafe { o.contents.err };
4363 unsafe { o.contents.err = core::ptr::null_mut(); }
4364 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4368 result_ok: o.result_ok,
4373 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4374 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4375 /// A pointer to the contents in the success state.
4376 /// Reading from this pointer when `result_ok` is not set is undefined.
4377 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4378 /// A pointer to the contents in the error state.
4379 /// Reading from this pointer when `result_ok` is set is undefined.
4380 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4383 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4384 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4385 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4386 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4387 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4388 /// `err` or `result` depending on the state of `result_ok`.
4389 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4390 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4391 pub result_ok: bool,
4394 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4395 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4396 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4397 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4398 result: Box::into_raw(Box::new(o)),
4404 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4405 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4406 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4407 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4408 err: Box::into_raw(Box::new(e)),
4413 /// Checks if the given object is currently in the success state
4415 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4419 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4420 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4421 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4422 fn drop(&mut self) {
4424 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4425 let _ = unsafe { Box::from_raw(self.contents.result) };
4428 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4429 let _ = unsafe { Box::from_raw(self.contents.err) };
4434 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4435 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4436 let contents = if o.result_ok {
4437 let result = unsafe { o.contents.result };
4438 unsafe { o.contents.result = core::ptr::null_mut() };
4439 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4441 let err = unsafe { o.contents.err };
4442 unsafe { o.contents.err = core::ptr::null_mut(); }
4443 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4447 result_ok: o.result_ok,
4451 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4452 fn clone(&self) -> Self {
4454 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4455 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4458 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4459 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4465 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4466 /// but with all dynamically-allocated buffers duplicated in new buffers.
4467 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4469 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4470 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4471 /// A pointer to the contents in the success state.
4472 /// Reading from this pointer when `result_ok` is not set is undefined.
4473 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4474 /// A pointer to the contents in the error state.
4475 /// Reading from this pointer when `result_ok` is set is undefined.
4476 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4479 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4480 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4481 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4482 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4483 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4484 /// `err` or `result` depending on the state of `result_ok`.
4485 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4486 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4487 pub result_ok: bool,
4490 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4491 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4492 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4493 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4494 result: Box::into_raw(Box::new(o)),
4500 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4501 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4502 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4503 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4504 err: Box::into_raw(Box::new(e)),
4509 /// Checks if the given object is currently in the success state
4511 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4515 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4516 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4517 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4518 fn drop(&mut self) {
4520 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4521 let _ = unsafe { Box::from_raw(self.contents.result) };
4524 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4525 let _ = unsafe { Box::from_raw(self.contents.err) };
4530 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4531 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4532 let contents = if o.result_ok {
4533 let result = unsafe { o.contents.result };
4534 unsafe { o.contents.result = core::ptr::null_mut() };
4535 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4537 let err = unsafe { o.contents.err };
4538 unsafe { o.contents.err = core::ptr::null_mut(); }
4539 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4543 result_ok: o.result_ok,
4547 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4548 fn clone(&self) -> Self {
4550 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4551 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4554 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4555 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4561 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4562 /// but with all dynamically-allocated buffers duplicated in new buffers.
4563 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4565 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4566 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4567 /// A pointer to the contents in the success state.
4568 /// Reading from this pointer when `result_ok` is not set is undefined.
4569 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4570 /// A pointer to the contents in the error state.
4571 /// Reading from this pointer when `result_ok` is set is undefined.
4572 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4575 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4576 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4578 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4579 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4580 /// `err` or `result` depending on the state of `result_ok`.
4581 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4582 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4583 pub result_ok: bool,
4586 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4587 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4588 CResult_SpendableOutputDescriptorDecodeErrorZ {
4589 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4590 result: Box::into_raw(Box::new(o)),
4596 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4597 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4598 CResult_SpendableOutputDescriptorDecodeErrorZ {
4599 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4600 err: Box::into_raw(Box::new(e)),
4605 /// Checks if the given object is currently in the success state
4607 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4611 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4612 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4613 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4614 fn drop(&mut self) {
4616 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4617 let _ = unsafe { Box::from_raw(self.contents.result) };
4620 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4621 let _ = unsafe { Box::from_raw(self.contents.err) };
4626 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4627 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4628 let contents = if o.result_ok {
4629 let result = unsafe { o.contents.result };
4630 unsafe { o.contents.result = core::ptr::null_mut() };
4631 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4633 let err = unsafe { o.contents.err };
4634 unsafe { o.contents.err = core::ptr::null_mut(); }
4635 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4639 result_ok: o.result_ok,
4643 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4644 fn clone(&self) -> Self {
4646 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4647 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4650 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4651 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4657 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4658 /// but with all dynamically-allocated buffers duplicated in new buffers.
4659 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4661 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4662 /// This corresponds to std::vector in C++
4663 pub struct CVec_PaymentPreimageZ {
4664 /// The elements in the array.
4665 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4666 pub data: *mut crate::c_types::ThirtyTwoBytes,
4667 /// The number of elements pointed to by `data`.
4670 impl CVec_PaymentPreimageZ {
4671 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4672 if self.datalen == 0 { return Vec::new(); }
4673 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4674 self.data = core::ptr::null_mut();
4678 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4679 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4682 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4683 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4684 let datalen = v.len();
4685 let data = Box::into_raw(v.into_boxed_slice());
4686 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4690 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4691 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4692 impl Drop for CVec_PaymentPreimageZ {
4693 fn drop(&mut self) {
4694 if self.datalen == 0 { return; }
4695 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4698 impl Clone for CVec_PaymentPreimageZ {
4699 fn clone(&self) -> Self {
4700 let mut res = Vec::new();
4701 if self.datalen == 0 { return Self::from(res); }
4702 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4707 /// A tuple of 2 elements. See the individual fields for the types contained.
4708 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4709 /// The element at position 0
4710 pub a: crate::c_types::Signature,
4711 /// The element at position 1
4712 pub b: crate::c_types::derived::CVec_SignatureZ,
4714 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4715 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4722 impl C2Tuple_SignatureCVec_SignatureZZ {
4723 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4727 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4728 fn clone(&self) -> Self {
4730 a: Clone::clone(&self.a),
4731 b: Clone::clone(&self.b),
4736 /// Creates a new tuple which has the same data as `orig`
4737 /// but with all dynamically-allocated buffers duplicated in new buffers.
4738 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4739 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4741 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4742 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4746 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4747 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4749 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4750 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4751 /// A pointer to the contents in the success state.
4752 /// Reading from this pointer when `result_ok` is not set is undefined.
4753 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4754 /// Note that this value is always NULL, as there are no contents in the Err variant
4755 pub err: *mut core::ffi::c_void,
4758 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4759 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4761 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4762 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4763 /// `err` or `result` depending on the state of `result_ok`.
4764 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4765 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4766 pub result_ok: bool,
4769 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4770 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4771 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4772 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4773 result: Box::into_raw(Box::new(o)),
4779 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4780 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4781 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4782 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4783 err: core::ptr::null_mut(),
4788 /// Checks if the given object is currently in the success state
4790 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4794 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4795 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4796 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4797 fn drop(&mut self) {
4799 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4800 let _ = unsafe { Box::from_raw(self.contents.result) };
4806 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4807 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4808 let contents = if o.result_ok {
4809 let result = unsafe { o.contents.result };
4810 unsafe { o.contents.result = core::ptr::null_mut() };
4811 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4813 let _ = unsafe { Box::from_raw(o.contents.err) };
4814 o.contents.err = core::ptr::null_mut();
4815 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4819 result_ok: o.result_ok,
4823 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4824 fn clone(&self) -> Self {
4826 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4827 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4830 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4831 err: core::ptr::null_mut()
4837 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4838 /// but with all dynamically-allocated buffers duplicated in new buffers.
4839 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4841 /// The contents of CResult_SignatureNoneZ
4842 pub union CResult_SignatureNoneZPtr {
4843 /// A pointer to the contents in the success state.
4844 /// Reading from this pointer when `result_ok` is not set is undefined.
4845 pub result: *mut crate::c_types::Signature,
4846 /// Note that this value is always NULL, as there are no contents in the Err variant
4847 pub err: *mut core::ffi::c_void,
4850 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4851 /// containing a crate::c_types::Signature on success and a () on failure.
4852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4853 pub struct CResult_SignatureNoneZ {
4854 /// The contents of this CResult_SignatureNoneZ, accessible via either
4855 /// `err` or `result` depending on the state of `result_ok`.
4856 pub contents: CResult_SignatureNoneZPtr,
4857 /// Whether this CResult_SignatureNoneZ represents a success state.
4858 pub result_ok: bool,
4861 /// Creates a new CResult_SignatureNoneZ in the success state.
4862 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4863 CResult_SignatureNoneZ {
4864 contents: CResult_SignatureNoneZPtr {
4865 result: Box::into_raw(Box::new(o)),
4871 /// Creates a new CResult_SignatureNoneZ in the error state.
4872 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4873 CResult_SignatureNoneZ {
4874 contents: CResult_SignatureNoneZPtr {
4875 err: core::ptr::null_mut(),
4880 /// Checks if the given object is currently in the success state
4882 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4886 /// Frees any resources used by the CResult_SignatureNoneZ.
4887 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4888 impl Drop for CResult_SignatureNoneZ {
4889 fn drop(&mut self) {
4891 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4892 let _ = unsafe { Box::from_raw(self.contents.result) };
4898 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4899 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4900 let contents = if o.result_ok {
4901 let result = unsafe { o.contents.result };
4902 unsafe { o.contents.result = core::ptr::null_mut() };
4903 CResult_SignatureNoneZPtr { result }
4905 let _ = unsafe { Box::from_raw(o.contents.err) };
4906 o.contents.err = core::ptr::null_mut();
4907 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
4911 result_ok: o.result_ok,
4915 impl Clone for CResult_SignatureNoneZ {
4916 fn clone(&self) -> Self {
4918 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4919 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4922 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4923 err: core::ptr::null_mut()
4929 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4930 /// but with all dynamically-allocated buffers duplicated in new buffers.
4931 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4933 /// A tuple of 2 elements. See the individual fields for the types contained.
4934 pub struct C2Tuple_SignatureSignatureZ {
4935 /// The element at position 0
4936 pub a: crate::c_types::Signature,
4937 /// The element at position 1
4938 pub b: crate::c_types::Signature,
4940 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
4941 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
4948 impl C2Tuple_SignatureSignatureZ {
4949 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
4953 impl Clone for C2Tuple_SignatureSignatureZ {
4954 fn clone(&self) -> Self {
4956 a: Clone::clone(&self.a),
4957 b: Clone::clone(&self.b),
4962 /// Creates a new tuple which has the same data as `orig`
4963 /// but with all dynamically-allocated buffers duplicated in new buffers.
4964 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
4965 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
4967 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
4968 C2Tuple_SignatureSignatureZ { a, b, }
4972 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
4973 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
4975 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
4976 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4977 /// A pointer to the contents in the success state.
4978 /// Reading from this pointer when `result_ok` is not set is undefined.
4979 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
4980 /// Note that this value is always NULL, as there are no contents in the Err variant
4981 pub err: *mut core::ffi::c_void,
4984 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
4985 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
4986 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4987 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
4988 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
4989 /// `err` or `result` depending on the state of `result_ok`.
4990 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
4991 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
4992 pub result_ok: bool,
4995 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
4996 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
4997 CResult_C2Tuple_SignatureSignatureZNoneZ {
4998 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4999 result: Box::into_raw(Box::new(o)),
5005 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
5006 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5007 CResult_C2Tuple_SignatureSignatureZNoneZ {
5008 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5009 err: core::ptr::null_mut(),
5014 /// Checks if the given object is currently in the success state
5016 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
5020 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
5021 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
5022 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
5023 fn drop(&mut self) {
5025 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5026 let _ = unsafe { Box::from_raw(self.contents.result) };
5032 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
5033 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5034 let contents = if o.result_ok {
5035 let result = unsafe { o.contents.result };
5036 unsafe { o.contents.result = core::ptr::null_mut() };
5037 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5039 let _ = unsafe { Box::from_raw(o.contents.err) };
5040 o.contents.err = core::ptr::null_mut();
5041 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5045 result_ok: o.result_ok,
5049 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5050 fn clone(&self) -> Self {
5052 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5053 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5056 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5057 err: core::ptr::null_mut()
5063 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5064 /// but with all dynamically-allocated buffers duplicated in new buffers.
5065 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5067 /// The contents of CResult_SecretKeyNoneZ
5068 pub union CResult_SecretKeyNoneZPtr {
5069 /// A pointer to the contents in the success state.
5070 /// Reading from this pointer when `result_ok` is not set is undefined.
5071 pub result: *mut crate::c_types::SecretKey,
5072 /// Note that this value is always NULL, as there are no contents in the Err variant
5073 pub err: *mut core::ffi::c_void,
5076 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5077 /// containing a crate::c_types::SecretKey on success and a () on failure.
5078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5079 pub struct CResult_SecretKeyNoneZ {
5080 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5081 /// `err` or `result` depending on the state of `result_ok`.
5082 pub contents: CResult_SecretKeyNoneZPtr,
5083 /// Whether this CResult_SecretKeyNoneZ represents a success state.
5084 pub result_ok: bool,
5087 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5088 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5089 CResult_SecretKeyNoneZ {
5090 contents: CResult_SecretKeyNoneZPtr {
5091 result: Box::into_raw(Box::new(o)),
5097 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5098 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5099 CResult_SecretKeyNoneZ {
5100 contents: CResult_SecretKeyNoneZPtr {
5101 err: core::ptr::null_mut(),
5106 /// Checks if the given object is currently in the success state
5108 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5112 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5113 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5114 impl Drop for CResult_SecretKeyNoneZ {
5115 fn drop(&mut self) {
5117 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5118 let _ = unsafe { Box::from_raw(self.contents.result) };
5124 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5125 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5126 let contents = if o.result_ok {
5127 let result = unsafe { o.contents.result };
5128 unsafe { o.contents.result = core::ptr::null_mut() };
5129 CResult_SecretKeyNoneZPtr { result }
5131 let _ = unsafe { Box::from_raw(o.contents.err) };
5132 o.contents.err = core::ptr::null_mut();
5133 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5137 result_ok: o.result_ok,
5141 impl Clone for CResult_SecretKeyNoneZ {
5142 fn clone(&self) -> Self {
5144 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
5145 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
5148 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
5149 err: core::ptr::null_mut()
5155 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
5156 /// but with all dynamically-allocated buffers duplicated in new buffers.
5157 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
5159 /// The contents of CResult_SignDecodeErrorZ
5160 pub union CResult_SignDecodeErrorZPtr {
5161 /// A pointer to the contents in the success state.
5162 /// Reading from this pointer when `result_ok` is not set is undefined.
5163 pub result: *mut crate::lightning::chain::keysinterface::Sign,
5164 /// A pointer to the contents in the error state.
5165 /// Reading from this pointer when `result_ok` is set is undefined.
5166 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5169 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5170 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172 pub struct CResult_SignDecodeErrorZ {
5173 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5174 /// `err` or `result` depending on the state of `result_ok`.
5175 pub contents: CResult_SignDecodeErrorZPtr,
5176 /// Whether this CResult_SignDecodeErrorZ represents a success state.
5177 pub result_ok: bool,
5180 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5181 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5182 CResult_SignDecodeErrorZ {
5183 contents: CResult_SignDecodeErrorZPtr {
5184 result: Box::into_raw(Box::new(o)),
5190 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5191 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5192 CResult_SignDecodeErrorZ {
5193 contents: CResult_SignDecodeErrorZPtr {
5194 err: Box::into_raw(Box::new(e)),
5199 /// Checks if the given object is currently in the success state
5201 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5205 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5206 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5207 impl Drop for CResult_SignDecodeErrorZ {
5208 fn drop(&mut self) {
5210 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5211 let _ = unsafe { Box::from_raw(self.contents.result) };
5214 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5215 let _ = unsafe { Box::from_raw(self.contents.err) };
5220 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5221 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5222 let contents = if o.result_ok {
5223 let result = unsafe { o.contents.result };
5224 unsafe { o.contents.result = core::ptr::null_mut() };
5225 CResult_SignDecodeErrorZPtr { result }
5227 let err = unsafe { o.contents.err };
5228 unsafe { o.contents.err = core::ptr::null_mut(); }
5229 CResult_SignDecodeErrorZPtr { err }
5233 result_ok: o.result_ok,
5237 impl Clone for CResult_SignDecodeErrorZ {
5238 fn clone(&self) -> Self {
5240 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5241 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5244 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5245 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5251 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5252 /// but with all dynamically-allocated buffers duplicated in new buffers.
5253 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5255 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5256 /// This corresponds to std::vector in C++
5257 pub struct CVec_u5Z {
5258 /// The elements in the array.
5259 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5260 pub data: *mut crate::c_types::u5,
5261 /// The number of elements pointed to by `data`.
5265 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5266 if self.datalen == 0 { return Vec::new(); }
5267 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5268 self.data = core::ptr::null_mut();
5272 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5273 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5276 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5277 fn from(v: Vec<crate::c_types::u5>) -> Self {
5278 let datalen = v.len();
5279 let data = Box::into_raw(v.into_boxed_slice());
5280 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5284 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5285 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5286 impl Drop for CVec_u5Z {
5287 fn drop(&mut self) {
5288 if self.datalen == 0 { return; }
5289 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5292 impl Clone for CVec_u5Z {
5293 fn clone(&self) -> Self {
5294 let mut res = Vec::new();
5295 if self.datalen == 0 { return Self::from(res); }
5296 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5301 /// The contents of CResult_RecoverableSignatureNoneZ
5302 pub union CResult_RecoverableSignatureNoneZPtr {
5303 /// A pointer to the contents in the success state.
5304 /// Reading from this pointer when `result_ok` is not set is undefined.
5305 pub result: *mut crate::c_types::RecoverableSignature,
5306 /// Note that this value is always NULL, as there are no contents in the Err variant
5307 pub err: *mut core::ffi::c_void,
5310 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5311 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5312 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5313 pub struct CResult_RecoverableSignatureNoneZ {
5314 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5315 /// `err` or `result` depending on the state of `result_ok`.
5316 pub contents: CResult_RecoverableSignatureNoneZPtr,
5317 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5318 pub result_ok: bool,
5321 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5322 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5323 CResult_RecoverableSignatureNoneZ {
5324 contents: CResult_RecoverableSignatureNoneZPtr {
5325 result: Box::into_raw(Box::new(o)),
5331 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5332 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5333 CResult_RecoverableSignatureNoneZ {
5334 contents: CResult_RecoverableSignatureNoneZPtr {
5335 err: core::ptr::null_mut(),
5340 /// Checks if the given object is currently in the success state
5342 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5346 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5347 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5348 impl Drop for CResult_RecoverableSignatureNoneZ {
5349 fn drop(&mut self) {
5351 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5352 let _ = unsafe { Box::from_raw(self.contents.result) };
5358 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5359 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5360 let contents = if o.result_ok {
5361 let result = unsafe { o.contents.result };
5362 unsafe { o.contents.result = core::ptr::null_mut() };
5363 CResult_RecoverableSignatureNoneZPtr { result }
5365 let _ = unsafe { Box::from_raw(o.contents.err) };
5366 o.contents.err = core::ptr::null_mut();
5367 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5371 result_ok: o.result_ok,
5375 impl Clone for CResult_RecoverableSignatureNoneZ {
5376 fn clone(&self) -> Self {
5378 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5379 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5382 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5383 err: core::ptr::null_mut()
5389 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5390 /// but with all dynamically-allocated buffers duplicated in new buffers.
5391 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5393 /// A dynamically-allocated array of u8s of arbitrary size.
5394 /// This corresponds to std::vector in C++
5395 pub struct CVec_u8Z {
5396 /// The elements in the array.
5397 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5399 /// The number of elements pointed to by `data`.
5403 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5404 if self.datalen == 0 { return Vec::new(); }
5405 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5406 self.data = core::ptr::null_mut();
5410 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5411 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5414 impl From<Vec<u8>> for CVec_u8Z {
5415 fn from(v: Vec<u8>) -> Self {
5416 let datalen = v.len();
5417 let data = Box::into_raw(v.into_boxed_slice());
5418 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5422 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5423 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5424 impl Drop for CVec_u8Z {
5425 fn drop(&mut self) {
5426 if self.datalen == 0 { return; }
5427 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5430 impl Clone for CVec_u8Z {
5431 fn clone(&self) -> Self {
5432 let mut res = Vec::new();
5433 if self.datalen == 0 { return Self::from(res); }
5434 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5439 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5440 /// This corresponds to std::vector in C++
5441 pub struct CVec_CVec_u8ZZ {
5442 /// The elements in the array.
5443 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5444 pub data: *mut crate::c_types::derived::CVec_u8Z,
5445 /// The number of elements pointed to by `data`.
5448 impl CVec_CVec_u8ZZ {
5449 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5450 if self.datalen == 0 { return Vec::new(); }
5451 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5452 self.data = core::ptr::null_mut();
5456 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5457 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5460 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5461 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5462 let datalen = v.len();
5463 let data = Box::into_raw(v.into_boxed_slice());
5464 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5468 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5469 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5470 impl Drop for CVec_CVec_u8ZZ {
5471 fn drop(&mut self) {
5472 if self.datalen == 0 { return; }
5473 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5476 impl Clone for CVec_CVec_u8ZZ {
5477 fn clone(&self) -> Self {
5478 let mut res = Vec::new();
5479 if self.datalen == 0 { return Self::from(res); }
5480 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5485 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5486 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5487 /// A pointer to the contents in the success state.
5488 /// Reading from this pointer when `result_ok` is not set is undefined.
5489 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5490 /// Note that this value is always NULL, as there are no contents in the Err variant
5491 pub err: *mut core::ffi::c_void,
5494 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5495 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5497 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5498 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5499 /// `err` or `result` depending on the state of `result_ok`.
5500 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5501 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5502 pub result_ok: bool,
5505 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5506 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5507 CResult_CVec_CVec_u8ZZNoneZ {
5508 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5509 result: Box::into_raw(Box::new(o)),
5515 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5516 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5517 CResult_CVec_CVec_u8ZZNoneZ {
5518 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5519 err: core::ptr::null_mut(),
5524 /// Checks if the given object is currently in the success state
5526 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5530 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5531 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5532 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5533 fn drop(&mut self) {
5535 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5536 let _ = unsafe { Box::from_raw(self.contents.result) };
5542 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5543 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5544 let contents = if o.result_ok {
5545 let result = unsafe { o.contents.result };
5546 unsafe { o.contents.result = core::ptr::null_mut() };
5547 CResult_CVec_CVec_u8ZZNoneZPtr { result }
5549 let _ = unsafe { Box::from_raw(o.contents.err) };
5550 o.contents.err = core::ptr::null_mut();
5551 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5555 result_ok: o.result_ok,
5559 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5560 fn clone(&self) -> Self {
5562 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5563 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5566 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5567 err: core::ptr::null_mut()
5573 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5574 /// but with all dynamically-allocated buffers duplicated in new buffers.
5575 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5577 /// The contents of CResult_InMemorySignerDecodeErrorZ
5578 pub union CResult_InMemorySignerDecodeErrorZPtr {
5579 /// A pointer to the contents in the success state.
5580 /// Reading from this pointer when `result_ok` is not set is undefined.
5581 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5582 /// A pointer to the contents in the error state.
5583 /// Reading from this pointer when `result_ok` is set is undefined.
5584 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5587 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5588 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5589 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5590 pub struct CResult_InMemorySignerDecodeErrorZ {
5591 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5592 /// `err` or `result` depending on the state of `result_ok`.
5593 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5594 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5595 pub result_ok: bool,
5598 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5599 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5600 CResult_InMemorySignerDecodeErrorZ {
5601 contents: CResult_InMemorySignerDecodeErrorZPtr {
5602 result: Box::into_raw(Box::new(o)),
5608 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5609 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5610 CResult_InMemorySignerDecodeErrorZ {
5611 contents: CResult_InMemorySignerDecodeErrorZPtr {
5612 err: Box::into_raw(Box::new(e)),
5617 /// Checks if the given object is currently in the success state
5619 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5623 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5624 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5625 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5626 fn drop(&mut self) {
5628 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5629 let _ = unsafe { Box::from_raw(self.contents.result) };
5632 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5633 let _ = unsafe { Box::from_raw(self.contents.err) };
5638 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5639 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5640 let contents = if o.result_ok {
5641 let result = unsafe { o.contents.result };
5642 unsafe { o.contents.result = core::ptr::null_mut() };
5643 CResult_InMemorySignerDecodeErrorZPtr { result }
5645 let err = unsafe { o.contents.err };
5646 unsafe { o.contents.err = core::ptr::null_mut(); }
5647 CResult_InMemorySignerDecodeErrorZPtr { err }
5651 result_ok: o.result_ok,
5655 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5656 fn clone(&self) -> Self {
5658 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5659 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5662 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5663 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5669 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5670 /// but with all dynamically-allocated buffers duplicated in new buffers.
5671 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5673 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5674 /// This corresponds to std::vector in C++
5675 pub struct CVec_TxOutZ {
5676 /// The elements in the array.
5677 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5678 pub data: *mut crate::c_types::TxOut,
5679 /// The number of elements pointed to by `data`.
5683 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5684 if self.datalen == 0 { return Vec::new(); }
5685 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5686 self.data = core::ptr::null_mut();
5690 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5691 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5694 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5695 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5696 let datalen = v.len();
5697 let data = Box::into_raw(v.into_boxed_slice());
5698 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5702 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5703 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5704 impl Drop for CVec_TxOutZ {
5705 fn drop(&mut self) {
5706 if self.datalen == 0 { return; }
5707 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5710 impl Clone for CVec_TxOutZ {
5711 fn clone(&self) -> Self {
5712 let mut res = Vec::new();
5713 if self.datalen == 0 { return Self::from(res); }
5714 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5719 /// The contents of CResult_TransactionNoneZ
5720 pub union CResult_TransactionNoneZPtr {
5721 /// A pointer to the contents in the success state.
5722 /// Reading from this pointer when `result_ok` is not set is undefined.
5723 pub result: *mut crate::c_types::Transaction,
5724 /// Note that this value is always NULL, as there are no contents in the Err variant
5725 pub err: *mut core::ffi::c_void,
5728 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5729 /// containing a crate::c_types::Transaction on success and a () on failure.
5730 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5731 pub struct CResult_TransactionNoneZ {
5732 /// The contents of this CResult_TransactionNoneZ, accessible via either
5733 /// `err` or `result` depending on the state of `result_ok`.
5734 pub contents: CResult_TransactionNoneZPtr,
5735 /// Whether this CResult_TransactionNoneZ represents a success state.
5736 pub result_ok: bool,
5739 /// Creates a new CResult_TransactionNoneZ in the success state.
5740 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5741 CResult_TransactionNoneZ {
5742 contents: CResult_TransactionNoneZPtr {
5743 result: Box::into_raw(Box::new(o)),
5749 /// Creates a new CResult_TransactionNoneZ in the error state.
5750 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5751 CResult_TransactionNoneZ {
5752 contents: CResult_TransactionNoneZPtr {
5753 err: core::ptr::null_mut(),
5758 /// Checks if the given object is currently in the success state
5760 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5764 /// Frees any resources used by the CResult_TransactionNoneZ.
5765 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5766 impl Drop for CResult_TransactionNoneZ {
5767 fn drop(&mut self) {
5769 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5770 let _ = unsafe { Box::from_raw(self.contents.result) };
5776 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5777 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5778 let contents = if o.result_ok {
5779 let result = unsafe { o.contents.result };
5780 unsafe { o.contents.result = core::ptr::null_mut() };
5781 CResult_TransactionNoneZPtr { result }
5783 let _ = unsafe { Box::from_raw(o.contents.err) };
5784 o.contents.err = core::ptr::null_mut();
5785 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5789 result_ok: o.result_ok,
5793 impl Clone for CResult_TransactionNoneZ {
5794 fn clone(&self) -> Self {
5796 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5797 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5800 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5801 err: core::ptr::null_mut()
5807 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5808 /// but with all dynamically-allocated buffers duplicated in new buffers.
5809 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5811 /// A tuple of 2 elements. See the individual fields for the types contained.
5812 pub struct C2Tuple_BlockHashChannelMonitorZ {
5813 /// The element at position 0
5814 pub a: crate::c_types::ThirtyTwoBytes,
5815 /// The element at position 1
5816 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5818 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5819 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5826 impl C2Tuple_BlockHashChannelMonitorZ {
5827 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5831 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5833 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5834 C2Tuple_BlockHashChannelMonitorZ { a, b, }
5838 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5839 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5841 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5842 /// This corresponds to std::vector in C++
5843 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5844 /// The elements in the array.
5845 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5846 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5847 /// The number of elements pointed to by `data`.
5850 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5851 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5852 if self.datalen == 0 { return Vec::new(); }
5853 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5854 self.data = core::ptr::null_mut();
5858 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5859 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5862 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5863 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5864 let datalen = v.len();
5865 let data = Box::into_raw(v.into_boxed_slice());
5866 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5870 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5871 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5872 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5873 fn drop(&mut self) {
5874 if self.datalen == 0 { return; }
5875 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5879 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5880 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5881 /// A pointer to the contents in the success state.
5882 /// Reading from this pointer when `result_ok` is not set is undefined.
5883 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5884 /// A pointer to the contents in the error state.
5885 /// Reading from this pointer when `result_ok` is set is undefined.
5886 pub err: *mut crate::c_types::IOError,
5889 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5890 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5891 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5892 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5893 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5894 /// `err` or `result` depending on the state of `result_ok`.
5895 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5896 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5897 pub result_ok: bool,
5900 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5901 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5902 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5903 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5904 result: Box::into_raw(Box::new(o)),
5910 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5911 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5912 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5913 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5914 err: Box::into_raw(Box::new(e)),
5919 /// Checks if the given object is currently in the success state
5921 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5925 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5926 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5927 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5928 fn drop(&mut self) {
5930 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5931 let _ = unsafe { Box::from_raw(self.contents.result) };
5934 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5935 let _ = unsafe { Box::from_raw(self.contents.err) };
5940 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5941 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5942 let contents = if o.result_ok {
5943 let result = unsafe { o.contents.result };
5944 unsafe { o.contents.result = core::ptr::null_mut() };
5945 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5947 let err = unsafe { o.contents.err };
5948 unsafe { o.contents.err = core::ptr::null_mut(); }
5949 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5953 result_ok: o.result_ok,
5959 /// An enum which can either contain a u16 or not
5960 pub enum COption_u16Z {
5961 /// When we're in this state, this COption_u16Z contains a u16
5963 /// When we're in this state, this COption_u16Z contains nothing
5967 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5968 if let Self::None = self { false } else { true }
5970 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5973 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5974 if let Self::Some(v) = self { v } else { unreachable!() }
5978 /// Constructs a new COption_u16Z containing a u16
5979 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5980 COption_u16Z::Some(o)
5983 /// Constructs a new COption_u16Z containing nothing
5984 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5988 /// Frees any resources associated with the u16, if we are in the Some state
5989 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5991 /// Creates a new COption_u16Z which has the same data as `orig`
5992 /// but with all dynamically-allocated buffers duplicated in new buffers.
5993 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5995 /// The contents of CResult_NoneAPIErrorZ
5996 pub union CResult_NoneAPIErrorZPtr {
5997 /// Note that this value is always NULL, as there are no contents in the OK variant
5998 pub result: *mut core::ffi::c_void,
5999 /// A pointer to the contents in the error state.
6000 /// Reading from this pointer when `result_ok` is set is undefined.
6001 pub err: *mut crate::lightning::util::errors::APIError,
6004 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6005 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
6006 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6007 pub struct CResult_NoneAPIErrorZ {
6008 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
6009 /// `err` or `result` depending on the state of `result_ok`.
6010 pub contents: CResult_NoneAPIErrorZPtr,
6011 /// Whether this CResult_NoneAPIErrorZ represents a success state.
6012 pub result_ok: bool,
6015 /// Creates a new CResult_NoneAPIErrorZ in the success state.
6016 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
6017 CResult_NoneAPIErrorZ {
6018 contents: CResult_NoneAPIErrorZPtr {
6019 result: core::ptr::null_mut(),
6025 /// Creates a new CResult_NoneAPIErrorZ in the error state.
6026 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
6027 CResult_NoneAPIErrorZ {
6028 contents: CResult_NoneAPIErrorZPtr {
6029 err: Box::into_raw(Box::new(e)),
6034 /// Checks if the given object is currently in the success state
6036 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
6040 /// Frees any resources used by the CResult_NoneAPIErrorZ.
6041 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
6042 impl Drop for CResult_NoneAPIErrorZ {
6043 fn drop(&mut self) {
6046 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6047 let _ = unsafe { Box::from_raw(self.contents.err) };
6052 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6053 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6054 let contents = if o.result_ok {
6055 let _ = unsafe { Box::from_raw(o.contents.result) };
6056 o.contents.result = core::ptr::null_mut();
6057 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6059 let err = unsafe { o.contents.err };
6060 unsafe { o.contents.err = core::ptr::null_mut(); }
6061 CResult_NoneAPIErrorZPtr { err }
6065 result_ok: o.result_ok,
6069 impl Clone for CResult_NoneAPIErrorZ {
6070 fn clone(&self) -> Self {
6072 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6073 result: core::ptr::null_mut()
6076 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6077 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6083 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6084 /// but with all dynamically-allocated buffers duplicated in new buffers.
6085 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6087 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6088 /// This corresponds to std::vector in C++
6089 pub struct CVec_CResult_NoneAPIErrorZZ {
6090 /// The elements in the array.
6091 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6092 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6093 /// The number of elements pointed to by `data`.
6096 impl CVec_CResult_NoneAPIErrorZZ {
6097 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6098 if self.datalen == 0 { return Vec::new(); }
6099 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6100 self.data = core::ptr::null_mut();
6104 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6105 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6108 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6109 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6110 let datalen = v.len();
6111 let data = Box::into_raw(v.into_boxed_slice());
6112 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6116 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6117 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6118 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6119 fn drop(&mut self) {
6120 if self.datalen == 0 { return; }
6121 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6124 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6125 fn clone(&self) -> Self {
6126 let mut res = Vec::new();
6127 if self.datalen == 0 { return Self::from(res); }
6128 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6133 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6134 /// This corresponds to std::vector in C++
6135 pub struct CVec_APIErrorZ {
6136 /// The elements in the array.
6137 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6138 pub data: *mut crate::lightning::util::errors::APIError,
6139 /// The number of elements pointed to by `data`.
6142 impl CVec_APIErrorZ {
6143 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6144 if self.datalen == 0 { return Vec::new(); }
6145 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6146 self.data = core::ptr::null_mut();
6150 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6151 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6154 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6155 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6156 let datalen = v.len();
6157 let data = Box::into_raw(v.into_boxed_slice());
6158 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6162 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6163 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6164 impl Drop for CVec_APIErrorZ {
6165 fn drop(&mut self) {
6166 if self.datalen == 0 { return; }
6167 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6170 impl Clone for CVec_APIErrorZ {
6171 fn clone(&self) -> Self {
6172 let mut res = Vec::new();
6173 if self.datalen == 0 { return Self::from(res); }
6174 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6179 /// The contents of CResult__u832APIErrorZ
6180 pub union CResult__u832APIErrorZPtr {
6181 /// A pointer to the contents in the success state.
6182 /// Reading from this pointer when `result_ok` is not set is undefined.
6183 pub result: *mut crate::c_types::ThirtyTwoBytes,
6184 /// A pointer to the contents in the error state.
6185 /// Reading from this pointer when `result_ok` is set is undefined.
6186 pub err: *mut crate::lightning::util::errors::APIError,
6189 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6190 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6191 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6192 pub struct CResult__u832APIErrorZ {
6193 /// The contents of this CResult__u832APIErrorZ, accessible via either
6194 /// `err` or `result` depending on the state of `result_ok`.
6195 pub contents: CResult__u832APIErrorZPtr,
6196 /// Whether this CResult__u832APIErrorZ represents a success state.
6197 pub result_ok: bool,
6200 /// Creates a new CResult__u832APIErrorZ in the success state.
6201 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6202 CResult__u832APIErrorZ {
6203 contents: CResult__u832APIErrorZPtr {
6204 result: Box::into_raw(Box::new(o)),
6210 /// Creates a new CResult__u832APIErrorZ in the error state.
6211 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6212 CResult__u832APIErrorZ {
6213 contents: CResult__u832APIErrorZPtr {
6214 err: Box::into_raw(Box::new(e)),
6219 /// Checks if the given object is currently in the success state
6221 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6225 /// Frees any resources used by the CResult__u832APIErrorZ.
6226 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6227 impl Drop for CResult__u832APIErrorZ {
6228 fn drop(&mut self) {
6230 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6231 let _ = unsafe { Box::from_raw(self.contents.result) };
6234 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6235 let _ = unsafe { Box::from_raw(self.contents.err) };
6240 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6241 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6242 let contents = if o.result_ok {
6243 let result = unsafe { o.contents.result };
6244 unsafe { o.contents.result = core::ptr::null_mut() };
6245 CResult__u832APIErrorZPtr { result }
6247 let err = unsafe { o.contents.err };
6248 unsafe { o.contents.err = core::ptr::null_mut(); }
6249 CResult__u832APIErrorZPtr { err }
6253 result_ok: o.result_ok,
6257 impl Clone for CResult__u832APIErrorZ {
6258 fn clone(&self) -> Self {
6260 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6261 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6264 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6265 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6271 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6272 /// but with all dynamically-allocated buffers duplicated in new buffers.
6273 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6275 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6276 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6277 /// A pointer to the contents in the success state.
6278 /// Reading from this pointer when `result_ok` is not set is undefined.
6279 pub result: *mut crate::c_types::ThirtyTwoBytes,
6280 /// A pointer to the contents in the error state.
6281 /// Reading from this pointer when `result_ok` is set is undefined.
6282 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6285 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6286 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6288 pub struct CResult_PaymentIdPaymentSendFailureZ {
6289 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6290 /// `err` or `result` depending on the state of `result_ok`.
6291 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6292 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6293 pub result_ok: bool,
6296 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6297 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6298 CResult_PaymentIdPaymentSendFailureZ {
6299 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6300 result: Box::into_raw(Box::new(o)),
6306 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6307 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6308 CResult_PaymentIdPaymentSendFailureZ {
6309 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6310 err: Box::into_raw(Box::new(e)),
6315 /// Checks if the given object is currently in the success state
6317 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6321 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6322 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6323 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6324 fn drop(&mut self) {
6326 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6327 let _ = unsafe { Box::from_raw(self.contents.result) };
6330 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6331 let _ = unsafe { Box::from_raw(self.contents.err) };
6336 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6337 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6338 let contents = if o.result_ok {
6339 let result = unsafe { o.contents.result };
6340 unsafe { o.contents.result = core::ptr::null_mut() };
6341 CResult_PaymentIdPaymentSendFailureZPtr { result }
6343 let err = unsafe { o.contents.err };
6344 unsafe { o.contents.err = core::ptr::null_mut(); }
6345 CResult_PaymentIdPaymentSendFailureZPtr { err }
6349 result_ok: o.result_ok,
6353 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6354 fn clone(&self) -> Self {
6356 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6357 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6360 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6361 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6367 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6368 /// but with all dynamically-allocated buffers duplicated in new buffers.
6369 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6371 /// The contents of CResult_NonePaymentSendFailureZ
6372 pub union CResult_NonePaymentSendFailureZPtr {
6373 /// Note that this value is always NULL, as there are no contents in the OK variant
6374 pub result: *mut core::ffi::c_void,
6375 /// A pointer to the contents in the error state.
6376 /// Reading from this pointer when `result_ok` is set is undefined.
6377 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6380 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6381 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6383 pub struct CResult_NonePaymentSendFailureZ {
6384 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6385 /// `err` or `result` depending on the state of `result_ok`.
6386 pub contents: CResult_NonePaymentSendFailureZPtr,
6387 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6388 pub result_ok: bool,
6391 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6392 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6393 CResult_NonePaymentSendFailureZ {
6394 contents: CResult_NonePaymentSendFailureZPtr {
6395 result: core::ptr::null_mut(),
6401 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6402 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6403 CResult_NonePaymentSendFailureZ {
6404 contents: CResult_NonePaymentSendFailureZPtr {
6405 err: Box::into_raw(Box::new(e)),
6410 /// Checks if the given object is currently in the success state
6412 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6416 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6417 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6418 impl Drop for CResult_NonePaymentSendFailureZ {
6419 fn drop(&mut self) {
6422 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6423 let _ = unsafe { Box::from_raw(self.contents.err) };
6428 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6429 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6430 let contents = if o.result_ok {
6431 let _ = unsafe { Box::from_raw(o.contents.result) };
6432 o.contents.result = core::ptr::null_mut();
6433 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6435 let err = unsafe { o.contents.err };
6436 unsafe { o.contents.err = core::ptr::null_mut(); }
6437 CResult_NonePaymentSendFailureZPtr { err }
6441 result_ok: o.result_ok,
6445 impl Clone for CResult_NonePaymentSendFailureZ {
6446 fn clone(&self) -> Self {
6448 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6449 result: core::ptr::null_mut()
6452 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6453 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6459 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6460 /// but with all dynamically-allocated buffers duplicated in new buffers.
6461 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6463 /// A tuple of 2 elements. See the individual fields for the types contained.
6464 pub struct C2Tuple_PaymentHashPaymentIdZ {
6465 /// The element at position 0
6466 pub a: crate::c_types::ThirtyTwoBytes,
6467 /// The element at position 1
6468 pub b: crate::c_types::ThirtyTwoBytes,
6470 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6471 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6478 impl C2Tuple_PaymentHashPaymentIdZ {
6479 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6483 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6484 fn clone(&self) -> Self {
6486 a: Clone::clone(&self.a),
6487 b: Clone::clone(&self.b),
6492 /// Creates a new tuple which has the same data as `orig`
6493 /// but with all dynamically-allocated buffers duplicated in new buffers.
6494 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6495 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6497 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6498 C2Tuple_PaymentHashPaymentIdZ { a, b, }
6502 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6503 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6505 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6506 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6507 /// A pointer to the contents in the success state.
6508 /// Reading from this pointer when `result_ok` is not set is undefined.
6509 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6510 /// A pointer to the contents in the error state.
6511 /// Reading from this pointer when `result_ok` is set is undefined.
6512 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6515 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6516 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6518 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6519 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6520 /// `err` or `result` depending on the state of `result_ok`.
6521 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6522 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6523 pub result_ok: bool,
6526 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6527 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6528 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6529 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6530 result: Box::into_raw(Box::new(o)),
6536 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6537 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6538 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6539 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6540 err: Box::into_raw(Box::new(e)),
6545 /// Checks if the given object is currently in the success state
6547 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6551 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6552 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6553 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6554 fn drop(&mut self) {
6556 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6557 let _ = unsafe { Box::from_raw(self.contents.result) };
6560 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6561 let _ = unsafe { Box::from_raw(self.contents.err) };
6566 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6567 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6568 let contents = if o.result_ok {
6569 let result = unsafe { o.contents.result };
6570 unsafe { o.contents.result = core::ptr::null_mut() };
6571 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6573 let err = unsafe { o.contents.err };
6574 unsafe { o.contents.err = core::ptr::null_mut(); }
6575 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6579 result_ok: o.result_ok,
6583 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6584 fn clone(&self) -> Self {
6586 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6587 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6590 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6591 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6597 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6598 /// but with all dynamically-allocated buffers duplicated in new buffers.
6599 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6601 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6602 /// This corresponds to std::vector in C++
6603 pub struct CVec_NetAddressZ {
6604 /// The elements in the array.
6605 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6606 pub data: *mut crate::lightning::ln::msgs::NetAddress,
6607 /// The number of elements pointed to by `data`.
6610 impl CVec_NetAddressZ {
6611 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6612 if self.datalen == 0 { return Vec::new(); }
6613 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6614 self.data = core::ptr::null_mut();
6618 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6619 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6622 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6623 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6624 let datalen = v.len();
6625 let data = Box::into_raw(v.into_boxed_slice());
6626 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6630 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6631 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6632 impl Drop for CVec_NetAddressZ {
6633 fn drop(&mut self) {
6634 if self.datalen == 0 { return; }
6635 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6638 impl Clone for CVec_NetAddressZ {
6639 fn clone(&self) -> Self {
6640 let mut res = Vec::new();
6641 if self.datalen == 0 { return Self::from(res); }
6642 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6647 /// A tuple of 2 elements. See the individual fields for the types contained.
6648 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6649 /// The element at position 0
6650 pub a: crate::c_types::ThirtyTwoBytes,
6651 /// The element at position 1
6652 pub b: crate::c_types::ThirtyTwoBytes,
6654 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6655 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6662 impl C2Tuple_PaymentHashPaymentSecretZ {
6663 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6667 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6668 fn clone(&self) -> Self {
6670 a: Clone::clone(&self.a),
6671 b: Clone::clone(&self.b),
6676 /// Creates a new tuple which has the same data as `orig`
6677 /// but with all dynamically-allocated buffers duplicated in new buffers.
6678 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6679 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6681 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6682 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6686 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6687 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6689 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6690 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6691 /// A pointer to the contents in the success state.
6692 /// Reading from this pointer when `result_ok` is not set is undefined.
6693 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6694 /// Note that this value is always NULL, as there are no contents in the Err variant
6695 pub err: *mut core::ffi::c_void,
6698 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6699 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6701 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6702 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6703 /// `err` or `result` depending on the state of `result_ok`.
6704 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6705 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6706 pub result_ok: bool,
6709 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6710 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6711 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6712 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6713 result: Box::into_raw(Box::new(o)),
6719 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6720 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6721 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6722 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6723 err: core::ptr::null_mut(),
6728 /// Checks if the given object is currently in the success state
6730 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6734 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6735 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6736 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6737 fn drop(&mut self) {
6739 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6740 let _ = unsafe { Box::from_raw(self.contents.result) };
6746 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6747 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> 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_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6753 let _ = unsafe { Box::from_raw(o.contents.err) };
6754 o.contents.err = core::ptr::null_mut();
6755 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6759 result_ok: o.result_ok,
6763 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6764 fn clone(&self) -> Self {
6766 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6767 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6770 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6771 err: core::ptr::null_mut()
6777 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6778 /// but with all dynamically-allocated buffers duplicated in new buffers.
6779 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6781 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6782 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
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::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
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::util::errors::APIError,
6791 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6792 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6794 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6795 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6796 /// `err` or `result` depending on the state of `result_ok`.
6797 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6798 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6799 pub result_ok: bool,
6802 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6803 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6804 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6805 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6806 result: Box::into_raw(Box::new(o)),
6812 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6813 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6814 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6815 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
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_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6827 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6828 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6829 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
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::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6843 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> 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_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6849 let err = unsafe { o.contents.err };
6850 unsafe { o.contents.err = core::ptr::null_mut(); }
6851 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6855 result_ok: o.result_ok,
6859 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6860 fn clone(&self) -> Self {
6862 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6863 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6866 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6867 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6873 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6874 /// but with all dynamically-allocated buffers duplicated in new buffers.
6875 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6877 /// The contents of CResult_PaymentSecretNoneZ
6878 pub union CResult_PaymentSecretNoneZPtr {
6879 /// A pointer to the contents in the success state.
6880 /// Reading from this pointer when `result_ok` is not set is undefined.
6881 pub result: *mut crate::c_types::ThirtyTwoBytes,
6882 /// Note that this value is always NULL, as there are no contents in the Err variant
6883 pub err: *mut core::ffi::c_void,
6886 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6887 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6889 pub struct CResult_PaymentSecretNoneZ {
6890 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6891 /// `err` or `result` depending on the state of `result_ok`.
6892 pub contents: CResult_PaymentSecretNoneZPtr,
6893 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6894 pub result_ok: bool,
6897 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6898 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6899 CResult_PaymentSecretNoneZ {
6900 contents: CResult_PaymentSecretNoneZPtr {
6901 result: Box::into_raw(Box::new(o)),
6907 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6908 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6909 CResult_PaymentSecretNoneZ {
6910 contents: CResult_PaymentSecretNoneZPtr {
6911 err: core::ptr::null_mut(),
6916 /// Checks if the given object is currently in the success state
6918 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6922 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6923 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6924 impl Drop for CResult_PaymentSecretNoneZ {
6925 fn drop(&mut self) {
6927 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6928 let _ = unsafe { Box::from_raw(self.contents.result) };
6934 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6935 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6936 let contents = if o.result_ok {
6937 let result = unsafe { o.contents.result };
6938 unsafe { o.contents.result = core::ptr::null_mut() };
6939 CResult_PaymentSecretNoneZPtr { result }
6941 let _ = unsafe { Box::from_raw(o.contents.err) };
6942 o.contents.err = core::ptr::null_mut();
6943 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
6947 result_ok: o.result_ok,
6951 impl Clone for CResult_PaymentSecretNoneZ {
6952 fn clone(&self) -> Self {
6954 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
6955 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6958 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
6959 err: core::ptr::null_mut()
6965 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
6966 /// but with all dynamically-allocated buffers duplicated in new buffers.
6967 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
6969 /// The contents of CResult_PaymentSecretAPIErrorZ
6970 pub union CResult_PaymentSecretAPIErrorZPtr {
6971 /// A pointer to the contents in the success state.
6972 /// Reading from this pointer when `result_ok` is not set is undefined.
6973 pub result: *mut crate::c_types::ThirtyTwoBytes,
6974 /// A pointer to the contents in the error state.
6975 /// Reading from this pointer when `result_ok` is set is undefined.
6976 pub err: *mut crate::lightning::util::errors::APIError,
6979 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6980 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6982 pub struct CResult_PaymentSecretAPIErrorZ {
6983 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6984 /// `err` or `result` depending on the state of `result_ok`.
6985 pub contents: CResult_PaymentSecretAPIErrorZPtr,
6986 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6987 pub result_ok: bool,
6990 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
6991 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
6992 CResult_PaymentSecretAPIErrorZ {
6993 contents: CResult_PaymentSecretAPIErrorZPtr {
6994 result: Box::into_raw(Box::new(o)),
7000 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
7001 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
7002 CResult_PaymentSecretAPIErrorZ {
7003 contents: CResult_PaymentSecretAPIErrorZPtr {
7004 err: Box::into_raw(Box::new(e)),
7009 /// Checks if the given object is currently in the success state
7011 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
7015 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
7016 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
7017 impl Drop for CResult_PaymentSecretAPIErrorZ {
7018 fn drop(&mut self) {
7020 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7021 let _ = unsafe { Box::from_raw(self.contents.result) };
7024 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7025 let _ = unsafe { Box::from_raw(self.contents.err) };
7030 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
7031 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7032 let contents = if o.result_ok {
7033 let result = unsafe { o.contents.result };
7034 unsafe { o.contents.result = core::ptr::null_mut() };
7035 CResult_PaymentSecretAPIErrorZPtr { result }
7037 let err = unsafe { o.contents.err };
7038 unsafe { o.contents.err = core::ptr::null_mut(); }
7039 CResult_PaymentSecretAPIErrorZPtr { err }
7043 result_ok: o.result_ok,
7047 impl Clone for CResult_PaymentSecretAPIErrorZ {
7048 fn clone(&self) -> Self {
7050 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7051 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7054 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7055 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7061 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7062 /// but with all dynamically-allocated buffers duplicated in new buffers.
7063 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7065 /// The contents of CResult_PaymentPreimageAPIErrorZ
7066 pub union CResult_PaymentPreimageAPIErrorZPtr {
7067 /// A pointer to the contents in the success state.
7068 /// Reading from this pointer when `result_ok` is not set is undefined.
7069 pub result: *mut crate::c_types::ThirtyTwoBytes,
7070 /// A pointer to the contents in the error state.
7071 /// Reading from this pointer when `result_ok` is set is undefined.
7072 pub err: *mut crate::lightning::util::errors::APIError,
7075 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7076 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7078 pub struct CResult_PaymentPreimageAPIErrorZ {
7079 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7080 /// `err` or `result` depending on the state of `result_ok`.
7081 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7082 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7083 pub result_ok: bool,
7086 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7087 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7088 CResult_PaymentPreimageAPIErrorZ {
7089 contents: CResult_PaymentPreimageAPIErrorZPtr {
7090 result: Box::into_raw(Box::new(o)),
7096 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7097 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7098 CResult_PaymentPreimageAPIErrorZ {
7099 contents: CResult_PaymentPreimageAPIErrorZPtr {
7100 err: Box::into_raw(Box::new(e)),
7105 /// Checks if the given object is currently in the success state
7107 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7111 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7112 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7113 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7114 fn drop(&mut self) {
7116 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7117 let _ = unsafe { Box::from_raw(self.contents.result) };
7120 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7121 let _ = unsafe { Box::from_raw(self.contents.err) };
7126 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7127 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7128 let contents = if o.result_ok {
7129 let result = unsafe { o.contents.result };
7130 unsafe { o.contents.result = core::ptr::null_mut() };
7131 CResult_PaymentPreimageAPIErrorZPtr { result }
7133 let err = unsafe { o.contents.err };
7134 unsafe { o.contents.err = core::ptr::null_mut(); }
7135 CResult_PaymentPreimageAPIErrorZPtr { err }
7139 result_ok: o.result_ok,
7143 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7144 fn clone(&self) -> Self {
7146 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7147 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7150 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7151 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7157 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7158 /// but with all dynamically-allocated buffers duplicated in new buffers.
7159 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7161 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7162 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7163 /// A pointer to the contents in the success state.
7164 /// Reading from this pointer when `result_ok` is not set is undefined.
7165 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7166 /// A pointer to the contents in the error state.
7167 /// Reading from this pointer when `result_ok` is set is undefined.
7168 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7171 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7172 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7174 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7175 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7176 /// `err` or `result` depending on the state of `result_ok`.
7177 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7178 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7179 pub result_ok: bool,
7182 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7183 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7184 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7185 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7186 result: Box::into_raw(Box::new(o)),
7192 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7193 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7194 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7195 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7196 err: Box::into_raw(Box::new(e)),
7201 /// Checks if the given object is currently in the success state
7203 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7207 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7208 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7209 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7210 fn drop(&mut self) {
7212 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7213 let _ = unsafe { Box::from_raw(self.contents.result) };
7216 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7217 let _ = unsafe { Box::from_raw(self.contents.err) };
7222 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7223 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7224 let contents = if o.result_ok {
7225 let result = unsafe { o.contents.result };
7226 unsafe { o.contents.result = core::ptr::null_mut() };
7227 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7229 let err = unsafe { o.contents.err };
7230 unsafe { o.contents.err = core::ptr::null_mut(); }
7231 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7235 result_ok: o.result_ok,
7239 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7240 fn clone(&self) -> Self {
7242 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7243 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7246 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7247 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7253 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7254 /// but with all dynamically-allocated buffers duplicated in new buffers.
7255 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7257 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7258 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7259 /// A pointer to the contents in the success state.
7260 /// Reading from this pointer when `result_ok` is not set is undefined.
7261 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7262 /// A pointer to the contents in the error state.
7263 /// Reading from this pointer when `result_ok` is set is undefined.
7264 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7267 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7268 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7270 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7271 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7272 /// `err` or `result` depending on the state of `result_ok`.
7273 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7274 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7275 pub result_ok: bool,
7278 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7279 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7280 CResult_ChannelCounterpartyDecodeErrorZ {
7281 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7282 result: Box::into_raw(Box::new(o)),
7288 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7289 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7290 CResult_ChannelCounterpartyDecodeErrorZ {
7291 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7292 err: Box::into_raw(Box::new(e)),
7297 /// Checks if the given object is currently in the success state
7299 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7303 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7304 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7305 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7306 fn drop(&mut self) {
7308 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7309 let _ = unsafe { Box::from_raw(self.contents.result) };
7312 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7313 let _ = unsafe { Box::from_raw(self.contents.err) };
7318 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7319 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7320 let contents = if o.result_ok {
7321 let result = unsafe { o.contents.result };
7322 unsafe { o.contents.result = core::ptr::null_mut() };
7323 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7325 let err = unsafe { o.contents.err };
7326 unsafe { o.contents.err = core::ptr::null_mut(); }
7327 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7331 result_ok: o.result_ok,
7335 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7336 fn clone(&self) -> Self {
7338 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7339 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7342 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7343 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7349 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7350 /// but with all dynamically-allocated buffers duplicated in new buffers.
7351 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7353 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7354 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7355 /// A pointer to the contents in the success state.
7356 /// Reading from this pointer when `result_ok` is not set is undefined.
7357 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7358 /// A pointer to the contents in the error state.
7359 /// Reading from this pointer when `result_ok` is set is undefined.
7360 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7363 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7364 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7366 pub struct CResult_ChannelDetailsDecodeErrorZ {
7367 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7368 /// `err` or `result` depending on the state of `result_ok`.
7369 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7370 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7371 pub result_ok: bool,
7374 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7375 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7376 CResult_ChannelDetailsDecodeErrorZ {
7377 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7378 result: Box::into_raw(Box::new(o)),
7384 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7385 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7386 CResult_ChannelDetailsDecodeErrorZ {
7387 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7388 err: Box::into_raw(Box::new(e)),
7393 /// Checks if the given object is currently in the success state
7395 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7399 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7400 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7401 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7402 fn drop(&mut self) {
7404 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7405 let _ = unsafe { Box::from_raw(self.contents.result) };
7408 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7409 let _ = unsafe { Box::from_raw(self.contents.err) };
7414 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7415 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7416 let contents = if o.result_ok {
7417 let result = unsafe { o.contents.result };
7418 unsafe { o.contents.result = core::ptr::null_mut() };
7419 CResult_ChannelDetailsDecodeErrorZPtr { result }
7421 let err = unsafe { o.contents.err };
7422 unsafe { o.contents.err = core::ptr::null_mut(); }
7423 CResult_ChannelDetailsDecodeErrorZPtr { err }
7427 result_ok: o.result_ok,
7431 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7432 fn clone(&self) -> Self {
7434 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7435 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7438 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7439 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7445 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7446 /// but with all dynamically-allocated buffers duplicated in new buffers.
7447 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7449 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7450 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7451 /// A pointer to the contents in the success state.
7452 /// Reading from this pointer when `result_ok` is not set is undefined.
7453 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7454 /// A pointer to the contents in the error state.
7455 /// Reading from this pointer when `result_ok` is set is undefined.
7456 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7459 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7460 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7462 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7463 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7464 /// `err` or `result` depending on the state of `result_ok`.
7465 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7466 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7467 pub result_ok: bool,
7470 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7471 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7472 CResult_PhantomRouteHintsDecodeErrorZ {
7473 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7474 result: Box::into_raw(Box::new(o)),
7480 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7481 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7482 CResult_PhantomRouteHintsDecodeErrorZ {
7483 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7484 err: Box::into_raw(Box::new(e)),
7489 /// Checks if the given object is currently in the success state
7491 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7495 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7496 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7497 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7498 fn drop(&mut self) {
7500 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7501 let _ = unsafe { Box::from_raw(self.contents.result) };
7504 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7505 let _ = unsafe { Box::from_raw(self.contents.err) };
7510 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7511 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7512 let contents = if o.result_ok {
7513 let result = unsafe { o.contents.result };
7514 unsafe { o.contents.result = core::ptr::null_mut() };
7515 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7517 let err = unsafe { o.contents.err };
7518 unsafe { o.contents.err = core::ptr::null_mut(); }
7519 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7523 result_ok: o.result_ok,
7527 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
7528 fn clone(&self) -> Self {
7530 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7531 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
7534 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7535 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7541 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
7542 /// but with all dynamically-allocated buffers duplicated in new buffers.
7543 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
7545 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7546 /// This corresponds to std::vector in C++
7547 pub struct CVec_ChannelMonitorZ {
7548 /// The elements in the array.
7549 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7550 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7551 /// The number of elements pointed to by `data`.
7554 impl CVec_ChannelMonitorZ {
7555 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7556 if self.datalen == 0 { return Vec::new(); }
7557 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7558 self.data = core::ptr::null_mut();
7562 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7563 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7566 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7567 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7568 let datalen = v.len();
7569 let data = Box::into_raw(v.into_boxed_slice());
7570 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7574 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7575 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7576 impl Drop for CVec_ChannelMonitorZ {
7577 fn drop(&mut self) {
7578 if self.datalen == 0 { return; }
7579 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7583 /// A tuple of 2 elements. See the individual fields for the types contained.
7584 pub struct C2Tuple_BlockHashChannelManagerZ {
7585 /// The element at position 0
7586 pub a: crate::c_types::ThirtyTwoBytes,
7587 /// The element at position 1
7588 pub b: crate::lightning::ln::channelmanager::ChannelManager,
7590 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7591 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7598 impl C2Tuple_BlockHashChannelManagerZ {
7599 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7603 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7605 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7606 C2Tuple_BlockHashChannelManagerZ { a, b, }
7610 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7611 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7613 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7614 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7615 /// A pointer to the contents in the success state.
7616 /// Reading from this pointer when `result_ok` is not set is undefined.
7617 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7618 /// A pointer to the contents in the error state.
7619 /// Reading from this pointer when `result_ok` is set is undefined.
7620 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7623 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7624 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7625 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7626 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7627 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7628 /// `err` or `result` depending on the state of `result_ok`.
7629 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7630 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7631 pub result_ok: bool,
7634 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7635 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7636 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7637 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7638 result: Box::into_raw(Box::new(o)),
7644 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7645 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7646 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7647 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7648 err: Box::into_raw(Box::new(e)),
7653 /// Checks if the given object is currently in the success state
7655 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7659 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7660 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7661 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7662 fn drop(&mut self) {
7664 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7665 let _ = unsafe { Box::from_raw(self.contents.result) };
7668 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7669 let _ = unsafe { Box::from_raw(self.contents.err) };
7674 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7675 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7676 let contents = if o.result_ok {
7677 let result = unsafe { o.contents.result };
7678 unsafe { o.contents.result = core::ptr::null_mut() };
7679 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7681 let err = unsafe { o.contents.err };
7682 unsafe { o.contents.err = core::ptr::null_mut(); }
7683 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7687 result_ok: o.result_ok,
7692 /// The contents of CResult_ChannelConfigDecodeErrorZ
7693 pub union CResult_ChannelConfigDecodeErrorZPtr {
7694 /// A pointer to the contents in the success state.
7695 /// Reading from this pointer when `result_ok` is not set is undefined.
7696 pub result: *mut crate::lightning::util::config::ChannelConfig,
7697 /// A pointer to the contents in the error state.
7698 /// Reading from this pointer when `result_ok` is set is undefined.
7699 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7702 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7703 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7704 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7705 pub struct CResult_ChannelConfigDecodeErrorZ {
7706 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7707 /// `err` or `result` depending on the state of `result_ok`.
7708 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7709 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7710 pub result_ok: bool,
7713 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7714 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7715 CResult_ChannelConfigDecodeErrorZ {
7716 contents: CResult_ChannelConfigDecodeErrorZPtr {
7717 result: Box::into_raw(Box::new(o)),
7723 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7724 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7725 CResult_ChannelConfigDecodeErrorZ {
7726 contents: CResult_ChannelConfigDecodeErrorZPtr {
7727 err: Box::into_raw(Box::new(e)),
7732 /// Checks if the given object is currently in the success state
7734 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7738 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7739 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7740 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7741 fn drop(&mut self) {
7743 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7744 let _ = unsafe { Box::from_raw(self.contents.result) };
7747 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7748 let _ = unsafe { Box::from_raw(self.contents.err) };
7753 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7754 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7755 let contents = if o.result_ok {
7756 let result = unsafe { o.contents.result };
7757 unsafe { o.contents.result = core::ptr::null_mut() };
7758 CResult_ChannelConfigDecodeErrorZPtr { result }
7760 let err = unsafe { o.contents.err };
7761 unsafe { o.contents.err = core::ptr::null_mut(); }
7762 CResult_ChannelConfigDecodeErrorZPtr { err }
7766 result_ok: o.result_ok,
7770 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7771 fn clone(&self) -> Self {
7773 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7774 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7777 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7778 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7784 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7785 /// but with all dynamically-allocated buffers duplicated in new buffers.
7786 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7788 /// The contents of CResult_OutPointDecodeErrorZ
7789 pub union CResult_OutPointDecodeErrorZPtr {
7790 /// A pointer to the contents in the success state.
7791 /// Reading from this pointer when `result_ok` is not set is undefined.
7792 pub result: *mut crate::lightning::chain::transaction::OutPoint,
7793 /// A pointer to the contents in the error state.
7794 /// Reading from this pointer when `result_ok` is set is undefined.
7795 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7798 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7799 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7801 pub struct CResult_OutPointDecodeErrorZ {
7802 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7803 /// `err` or `result` depending on the state of `result_ok`.
7804 pub contents: CResult_OutPointDecodeErrorZPtr,
7805 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7806 pub result_ok: bool,
7809 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7810 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7811 CResult_OutPointDecodeErrorZ {
7812 contents: CResult_OutPointDecodeErrorZPtr {
7813 result: Box::into_raw(Box::new(o)),
7819 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7820 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7821 CResult_OutPointDecodeErrorZ {
7822 contents: CResult_OutPointDecodeErrorZPtr {
7823 err: Box::into_raw(Box::new(e)),
7828 /// Checks if the given object is currently in the success state
7830 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7834 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7835 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7836 impl Drop for CResult_OutPointDecodeErrorZ {
7837 fn drop(&mut self) {
7839 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7840 let _ = unsafe { Box::from_raw(self.contents.result) };
7843 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7844 let _ = unsafe { Box::from_raw(self.contents.err) };
7849 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7850 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7851 let contents = if o.result_ok {
7852 let result = unsafe { o.contents.result };
7853 unsafe { o.contents.result = core::ptr::null_mut() };
7854 CResult_OutPointDecodeErrorZPtr { result }
7856 let err = unsafe { o.contents.err };
7857 unsafe { o.contents.err = core::ptr::null_mut(); }
7858 CResult_OutPointDecodeErrorZPtr { err }
7862 result_ok: o.result_ok,
7866 impl Clone for CResult_OutPointDecodeErrorZ {
7867 fn clone(&self) -> Self {
7869 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7870 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7873 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7874 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7880 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7881 /// but with all dynamically-allocated buffers duplicated in new buffers.
7882 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7884 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7885 pub enum COption_TypeZ {
7886 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7887 Some(crate::lightning::ln::wire::Type),
7888 /// When we're in this state, this COption_TypeZ contains nothing
7891 impl COption_TypeZ {
7892 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7893 if let Self::None = self { false } else { true }
7895 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7898 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7899 if let Self::Some(v) = self { v } else { unreachable!() }
7903 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7904 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7905 COption_TypeZ::Some(o)
7908 /// Constructs a new COption_TypeZ containing nothing
7909 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7913 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
7914 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
7916 /// The contents of CResult_COption_TypeZDecodeErrorZ
7917 pub union CResult_COption_TypeZDecodeErrorZPtr {
7918 /// A pointer to the contents in the success state.
7919 /// Reading from this pointer when `result_ok` is not set is undefined.
7920 pub result: *mut crate::c_types::derived::COption_TypeZ,
7921 /// A pointer to the contents in the error state.
7922 /// Reading from this pointer when `result_ok` is set is undefined.
7923 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7926 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7927 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7929 pub struct CResult_COption_TypeZDecodeErrorZ {
7930 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7931 /// `err` or `result` depending on the state of `result_ok`.
7932 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
7933 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7934 pub result_ok: bool,
7937 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
7938 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
7939 CResult_COption_TypeZDecodeErrorZ {
7940 contents: CResult_COption_TypeZDecodeErrorZPtr {
7941 result: Box::into_raw(Box::new(o)),
7947 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
7948 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
7949 CResult_COption_TypeZDecodeErrorZ {
7950 contents: CResult_COption_TypeZDecodeErrorZPtr {
7951 err: Box::into_raw(Box::new(e)),
7956 /// Checks if the given object is currently in the success state
7958 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
7962 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
7963 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
7964 impl Drop for CResult_COption_TypeZDecodeErrorZ {
7965 fn drop(&mut self) {
7967 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7968 let _ = unsafe { Box::from_raw(self.contents.result) };
7971 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7972 let _ = unsafe { Box::from_raw(self.contents.err) };
7977 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
7978 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7979 let contents = if o.result_ok {
7980 let result = unsafe { o.contents.result };
7981 unsafe { o.contents.result = core::ptr::null_mut() };
7982 CResult_COption_TypeZDecodeErrorZPtr { result }
7984 let err = unsafe { o.contents.err };
7985 unsafe { o.contents.err = core::ptr::null_mut(); }
7986 CResult_COption_TypeZDecodeErrorZPtr { err }
7990 result_ok: o.result_ok,
7995 /// The contents of CResult_PaymentIdPaymentErrorZ
7996 pub union CResult_PaymentIdPaymentErrorZPtr {
7997 /// A pointer to the contents in the success state.
7998 /// Reading from this pointer when `result_ok` is not set is undefined.
7999 pub result: *mut crate::c_types::ThirtyTwoBytes,
8000 /// A pointer to the contents in the error state.
8001 /// Reading from this pointer when `result_ok` is set is undefined.
8002 pub err: *mut crate::lightning_invoice::payment::PaymentError,
8005 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8006 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8007 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8008 pub struct CResult_PaymentIdPaymentErrorZ {
8009 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8010 /// `err` or `result` depending on the state of `result_ok`.
8011 pub contents: CResult_PaymentIdPaymentErrorZPtr,
8012 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8013 pub result_ok: bool,
8016 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
8017 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
8018 CResult_PaymentIdPaymentErrorZ {
8019 contents: CResult_PaymentIdPaymentErrorZPtr {
8020 result: Box::into_raw(Box::new(o)),
8026 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
8027 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
8028 CResult_PaymentIdPaymentErrorZ {
8029 contents: CResult_PaymentIdPaymentErrorZPtr {
8030 err: Box::into_raw(Box::new(e)),
8035 /// Checks if the given object is currently in the success state
8037 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
8041 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
8042 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
8043 impl Drop for CResult_PaymentIdPaymentErrorZ {
8044 fn drop(&mut self) {
8046 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8047 let _ = unsafe { Box::from_raw(self.contents.result) };
8050 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8051 let _ = unsafe { Box::from_raw(self.contents.err) };
8056 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
8057 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
8058 let contents = if o.result_ok {
8059 let result = unsafe { o.contents.result };
8060 unsafe { o.contents.result = core::ptr::null_mut() };
8061 CResult_PaymentIdPaymentErrorZPtr { result }
8063 let err = unsafe { o.contents.err };
8064 unsafe { o.contents.err = core::ptr::null_mut(); }
8065 CResult_PaymentIdPaymentErrorZPtr { err }
8069 result_ok: o.result_ok,
8073 impl Clone for CResult_PaymentIdPaymentErrorZ {
8074 fn clone(&self) -> Self {
8076 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8077 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8080 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8081 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8087 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8088 /// but with all dynamically-allocated buffers duplicated in new buffers.
8089 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8091 /// The contents of CResult_SiPrefixParseErrorZ
8092 pub union CResult_SiPrefixParseErrorZPtr {
8093 /// A pointer to the contents in the success state.
8094 /// Reading from this pointer when `result_ok` is not set is undefined.
8095 pub result: *mut crate::lightning_invoice::SiPrefix,
8096 /// A pointer to the contents in the error state.
8097 /// Reading from this pointer when `result_ok` is set is undefined.
8098 pub err: *mut crate::lightning_invoice::ParseError,
8101 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
8102 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
8103 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8104 pub struct CResult_SiPrefixParseErrorZ {
8105 /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
8106 /// `err` or `result` depending on the state of `result_ok`.
8107 pub contents: CResult_SiPrefixParseErrorZPtr,
8108 /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
8109 pub result_ok: bool,
8112 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
8113 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
8114 CResult_SiPrefixParseErrorZ {
8115 contents: CResult_SiPrefixParseErrorZPtr {
8116 result: Box::into_raw(Box::new(o)),
8122 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
8123 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
8124 CResult_SiPrefixParseErrorZ {
8125 contents: CResult_SiPrefixParseErrorZPtr {
8126 err: Box::into_raw(Box::new(e)),
8131 /// Checks if the given object is currently in the success state
8133 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
8137 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
8138 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
8139 impl Drop for CResult_SiPrefixParseErrorZ {
8140 fn drop(&mut self) {
8142 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8143 let _ = unsafe { Box::from_raw(self.contents.result) };
8146 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8147 let _ = unsafe { Box::from_raw(self.contents.err) };
8152 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
8153 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
8154 let contents = if o.result_ok {
8155 let result = unsafe { o.contents.result };
8156 unsafe { o.contents.result = core::ptr::null_mut() };
8157 CResult_SiPrefixParseErrorZPtr { result }
8159 let err = unsafe { o.contents.err };
8160 unsafe { o.contents.err = core::ptr::null_mut(); }
8161 CResult_SiPrefixParseErrorZPtr { err }
8165 result_ok: o.result_ok,
8169 impl Clone for CResult_SiPrefixParseErrorZ {
8170 fn clone(&self) -> Self {
8172 Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
8173 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8176 Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
8177 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
8183 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
8184 /// but with all dynamically-allocated buffers duplicated in new buffers.
8185 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
8187 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
8188 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
8189 /// A pointer to the contents in the success state.
8190 /// Reading from this pointer when `result_ok` is not set is undefined.
8191 pub result: *mut crate::lightning_invoice::Invoice,
8192 /// A pointer to the contents in the error state.
8193 /// Reading from this pointer when `result_ok` is set is undefined.
8194 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
8197 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
8198 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
8199 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8200 pub struct CResult_InvoiceParseOrSemanticErrorZ {
8201 /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
8202 /// `err` or `result` depending on the state of `result_ok`.
8203 pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
8204 /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
8205 pub result_ok: bool,
8208 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
8209 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
8210 CResult_InvoiceParseOrSemanticErrorZ {
8211 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
8212 result: Box::into_raw(Box::new(o)),
8218 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
8219 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
8220 CResult_InvoiceParseOrSemanticErrorZ {
8221 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
8222 err: Box::into_raw(Box::new(e)),
8227 /// Checks if the given object is currently in the success state
8229 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
8233 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
8234 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
8235 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
8236 fn drop(&mut self) {
8238 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8239 let _ = unsafe { Box::from_raw(self.contents.result) };
8242 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8243 let _ = unsafe { Box::from_raw(self.contents.err) };
8248 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
8249 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
8250 let contents = if o.result_ok {
8251 let result = unsafe { o.contents.result };
8252 unsafe { o.contents.result = core::ptr::null_mut() };
8253 CResult_InvoiceParseOrSemanticErrorZPtr { result }
8255 let err = unsafe { o.contents.err };
8256 unsafe { o.contents.err = core::ptr::null_mut(); }
8257 CResult_InvoiceParseOrSemanticErrorZPtr { err }
8261 result_ok: o.result_ok,
8265 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
8266 fn clone(&self) -> Self {
8268 Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
8269 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8272 Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
8273 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
8279 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
8280 /// but with all dynamically-allocated buffers duplicated in new buffers.
8281 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
8283 /// The contents of CResult_SignedRawInvoiceParseErrorZ
8284 pub union CResult_SignedRawInvoiceParseErrorZPtr {
8285 /// A pointer to the contents in the success state.
8286 /// Reading from this pointer when `result_ok` is not set is undefined.
8287 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8288 /// A pointer to the contents in the error state.
8289 /// Reading from this pointer when `result_ok` is set is undefined.
8290 pub err: *mut crate::lightning_invoice::ParseError,
8293 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
8294 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
8295 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8296 pub struct CResult_SignedRawInvoiceParseErrorZ {
8297 /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
8298 /// `err` or `result` depending on the state of `result_ok`.
8299 pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
8300 /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
8301 pub result_ok: bool,
8304 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
8305 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
8306 CResult_SignedRawInvoiceParseErrorZ {
8307 contents: CResult_SignedRawInvoiceParseErrorZPtr {
8308 result: Box::into_raw(Box::new(o)),
8314 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
8315 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
8316 CResult_SignedRawInvoiceParseErrorZ {
8317 contents: CResult_SignedRawInvoiceParseErrorZPtr {
8318 err: Box::into_raw(Box::new(e)),
8323 /// Checks if the given object is currently in the success state
8325 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
8329 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
8330 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
8331 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
8332 fn drop(&mut self) {
8334 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8335 let _ = unsafe { Box::from_raw(self.contents.result) };
8338 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8339 let _ = unsafe { Box::from_raw(self.contents.err) };
8344 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
8345 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
8346 let contents = if o.result_ok {
8347 let result = unsafe { o.contents.result };
8348 unsafe { o.contents.result = core::ptr::null_mut() };
8349 CResult_SignedRawInvoiceParseErrorZPtr { result }
8351 let err = unsafe { o.contents.err };
8352 unsafe { o.contents.err = core::ptr::null_mut(); }
8353 CResult_SignedRawInvoiceParseErrorZPtr { err }
8357 result_ok: o.result_ok,
8361 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
8362 fn clone(&self) -> Self {
8364 Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
8365 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8368 Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
8369 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
8375 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
8376 /// but with all dynamically-allocated buffers duplicated in new buffers.
8377 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
8379 /// A tuple of 3 elements. See the individual fields for the types contained.
8380 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8381 /// The element at position 0
8382 pub a: crate::lightning_invoice::RawInvoice,
8383 /// The element at position 1
8384 pub b: crate::c_types::ThirtyTwoBytes,
8385 /// The element at position 2
8386 pub c: crate::lightning_invoice::InvoiceSignature,
8388 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8389 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8397 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8398 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8399 (self.a, self.b, self.c)
8402 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8403 fn clone(&self) -> Self {
8405 a: Clone::clone(&self.a),
8406 b: Clone::clone(&self.b),
8407 c: Clone::clone(&self.c),
8412 /// Creates a new tuple which has the same data as `orig`
8413 /// but with all dynamically-allocated buffers duplicated in new buffers.
8414 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8415 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8417 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 {
8418 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8422 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8423 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8425 /// The contents of CResult_PayeePubKeyErrorZ
8426 pub union CResult_PayeePubKeyErrorZPtr {
8427 /// A pointer to the contents in the success state.
8428 /// Reading from this pointer when `result_ok` is not set is undefined.
8429 pub result: *mut crate::lightning_invoice::PayeePubKey,
8430 /// A pointer to the contents in the error state.
8431 /// Reading from this pointer when `result_ok` is set is undefined.
8432 pub err: *mut crate::c_types::Secp256k1Error,
8435 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8436 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8437 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8438 pub struct CResult_PayeePubKeyErrorZ {
8439 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8440 /// `err` or `result` depending on the state of `result_ok`.
8441 pub contents: CResult_PayeePubKeyErrorZPtr,
8442 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8443 pub result_ok: bool,
8446 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8447 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8448 CResult_PayeePubKeyErrorZ {
8449 contents: CResult_PayeePubKeyErrorZPtr {
8450 result: Box::into_raw(Box::new(o)),
8456 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8457 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8458 CResult_PayeePubKeyErrorZ {
8459 contents: CResult_PayeePubKeyErrorZPtr {
8460 err: Box::into_raw(Box::new(e)),
8465 /// Checks if the given object is currently in the success state
8467 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8471 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8472 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8473 impl Drop for CResult_PayeePubKeyErrorZ {
8474 fn drop(&mut self) {
8476 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8477 let _ = unsafe { Box::from_raw(self.contents.result) };
8480 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8481 let _ = unsafe { Box::from_raw(self.contents.err) };
8486 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8487 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8488 let contents = if o.result_ok {
8489 let result = unsafe { o.contents.result };
8490 unsafe { o.contents.result = core::ptr::null_mut() };
8491 CResult_PayeePubKeyErrorZPtr { result }
8493 let err = unsafe { o.contents.err };
8494 unsafe { o.contents.err = core::ptr::null_mut(); }
8495 CResult_PayeePubKeyErrorZPtr { err }
8499 result_ok: o.result_ok,
8503 impl Clone for CResult_PayeePubKeyErrorZ {
8504 fn clone(&self) -> Self {
8506 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8507 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8510 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8511 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8517 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8518 /// but with all dynamically-allocated buffers duplicated in new buffers.
8519 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8521 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8522 /// This corresponds to std::vector in C++
8523 pub struct CVec_PrivateRouteZ {
8524 /// The elements in the array.
8525 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8526 pub data: *mut crate::lightning_invoice::PrivateRoute,
8527 /// The number of elements pointed to by `data`.
8530 impl CVec_PrivateRouteZ {
8531 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8532 if self.datalen == 0 { return Vec::new(); }
8533 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8534 self.data = core::ptr::null_mut();
8538 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8539 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8542 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8543 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8544 let datalen = v.len();
8545 let data = Box::into_raw(v.into_boxed_slice());
8546 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8550 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8551 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8552 impl Drop for CVec_PrivateRouteZ {
8553 fn drop(&mut self) {
8554 if self.datalen == 0 { return; }
8555 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8558 impl Clone for CVec_PrivateRouteZ {
8559 fn clone(&self) -> Self {
8560 let mut res = Vec::new();
8561 if self.datalen == 0 { return Self::from(res); }
8562 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8567 /// The contents of CResult_PositiveTimestampCreationErrorZ
8568 pub union CResult_PositiveTimestampCreationErrorZPtr {
8569 /// A pointer to the contents in the success state.
8570 /// Reading from this pointer when `result_ok` is not set is undefined.
8571 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8572 /// A pointer to the contents in the error state.
8573 /// Reading from this pointer when `result_ok` is set is undefined.
8574 pub err: *mut crate::lightning_invoice::CreationError,
8577 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8578 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8579 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8580 pub struct CResult_PositiveTimestampCreationErrorZ {
8581 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8582 /// `err` or `result` depending on the state of `result_ok`.
8583 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8584 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8585 pub result_ok: bool,
8588 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8589 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8590 CResult_PositiveTimestampCreationErrorZ {
8591 contents: CResult_PositiveTimestampCreationErrorZPtr {
8592 result: Box::into_raw(Box::new(o)),
8598 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8599 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8600 CResult_PositiveTimestampCreationErrorZ {
8601 contents: CResult_PositiveTimestampCreationErrorZPtr {
8602 err: Box::into_raw(Box::new(e)),
8607 /// Checks if the given object is currently in the success state
8609 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8613 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8614 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8615 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8616 fn drop(&mut self) {
8618 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8619 let _ = unsafe { Box::from_raw(self.contents.result) };
8622 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8623 let _ = unsafe { Box::from_raw(self.contents.err) };
8628 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8629 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8630 let contents = if o.result_ok {
8631 let result = unsafe { o.contents.result };
8632 unsafe { o.contents.result = core::ptr::null_mut() };
8633 CResult_PositiveTimestampCreationErrorZPtr { result }
8635 let err = unsafe { o.contents.err };
8636 unsafe { o.contents.err = core::ptr::null_mut(); }
8637 CResult_PositiveTimestampCreationErrorZPtr { err }
8641 result_ok: o.result_ok,
8645 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8646 fn clone(&self) -> Self {
8648 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8649 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8652 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8653 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8659 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8660 /// but with all dynamically-allocated buffers duplicated in new buffers.
8661 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8663 /// The contents of CResult_NoneSemanticErrorZ
8664 pub union CResult_NoneSemanticErrorZPtr {
8665 /// Note that this value is always NULL, as there are no contents in the OK variant
8666 pub result: *mut core::ffi::c_void,
8667 /// A pointer to the contents in the error state.
8668 /// Reading from this pointer when `result_ok` is set is undefined.
8669 pub err: *mut crate::lightning_invoice::SemanticError,
8672 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8673 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8674 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8675 pub struct CResult_NoneSemanticErrorZ {
8676 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8677 /// `err` or `result` depending on the state of `result_ok`.
8678 pub contents: CResult_NoneSemanticErrorZPtr,
8679 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8680 pub result_ok: bool,
8683 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8684 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8685 CResult_NoneSemanticErrorZ {
8686 contents: CResult_NoneSemanticErrorZPtr {
8687 result: core::ptr::null_mut(),
8693 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8694 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8695 CResult_NoneSemanticErrorZ {
8696 contents: CResult_NoneSemanticErrorZPtr {
8697 err: Box::into_raw(Box::new(e)),
8702 /// Checks if the given object is currently in the success state
8704 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8708 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8709 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8710 impl Drop for CResult_NoneSemanticErrorZ {
8711 fn drop(&mut self) {
8714 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8715 let _ = unsafe { Box::from_raw(self.contents.err) };
8720 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8721 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8722 let contents = if o.result_ok {
8723 let _ = unsafe { Box::from_raw(o.contents.result) };
8724 o.contents.result = core::ptr::null_mut();
8725 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8727 let err = unsafe { o.contents.err };
8728 unsafe { o.contents.err = core::ptr::null_mut(); }
8729 CResult_NoneSemanticErrorZPtr { err }
8733 result_ok: o.result_ok,
8737 impl Clone for CResult_NoneSemanticErrorZ {
8738 fn clone(&self) -> Self {
8740 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8741 result: core::ptr::null_mut()
8744 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8745 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8751 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8752 /// but with all dynamically-allocated buffers duplicated in new buffers.
8753 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8755 /// The contents of CResult_InvoiceSemanticErrorZ
8756 pub union CResult_InvoiceSemanticErrorZPtr {
8757 /// A pointer to the contents in the success state.
8758 /// Reading from this pointer when `result_ok` is not set is undefined.
8759 pub result: *mut crate::lightning_invoice::Invoice,
8760 /// A pointer to the contents in the error state.
8761 /// Reading from this pointer when `result_ok` is set is undefined.
8762 pub err: *mut crate::lightning_invoice::SemanticError,
8765 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8766 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8767 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8768 pub struct CResult_InvoiceSemanticErrorZ {
8769 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8770 /// `err` or `result` depending on the state of `result_ok`.
8771 pub contents: CResult_InvoiceSemanticErrorZPtr,
8772 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8773 pub result_ok: bool,
8776 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8777 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8778 CResult_InvoiceSemanticErrorZ {
8779 contents: CResult_InvoiceSemanticErrorZPtr {
8780 result: Box::into_raw(Box::new(o)),
8786 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8787 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8788 CResult_InvoiceSemanticErrorZ {
8789 contents: CResult_InvoiceSemanticErrorZPtr {
8790 err: Box::into_raw(Box::new(e)),
8795 /// Checks if the given object is currently in the success state
8797 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8801 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8802 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8803 impl Drop for CResult_InvoiceSemanticErrorZ {
8804 fn drop(&mut self) {
8806 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8807 let _ = unsafe { Box::from_raw(self.contents.result) };
8810 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8811 let _ = unsafe { Box::from_raw(self.contents.err) };
8816 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8817 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8818 let contents = if o.result_ok {
8819 let result = unsafe { o.contents.result };
8820 unsafe { o.contents.result = core::ptr::null_mut() };
8821 CResult_InvoiceSemanticErrorZPtr { result }
8823 let err = unsafe { o.contents.err };
8824 unsafe { o.contents.err = core::ptr::null_mut(); }
8825 CResult_InvoiceSemanticErrorZPtr { err }
8829 result_ok: o.result_ok,
8833 impl Clone for CResult_InvoiceSemanticErrorZ {
8834 fn clone(&self) -> Self {
8836 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8837 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8840 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8841 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8847 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8848 /// but with all dynamically-allocated buffers duplicated in new buffers.
8849 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8851 /// The contents of CResult_DescriptionCreationErrorZ
8852 pub union CResult_DescriptionCreationErrorZPtr {
8853 /// A pointer to the contents in the success state.
8854 /// Reading from this pointer when `result_ok` is not set is undefined.
8855 pub result: *mut crate::lightning_invoice::Description,
8856 /// A pointer to the contents in the error state.
8857 /// Reading from this pointer when `result_ok` is set is undefined.
8858 pub err: *mut crate::lightning_invoice::CreationError,
8861 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8862 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8864 pub struct CResult_DescriptionCreationErrorZ {
8865 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8866 /// `err` or `result` depending on the state of `result_ok`.
8867 pub contents: CResult_DescriptionCreationErrorZPtr,
8868 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8869 pub result_ok: bool,
8872 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8873 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8874 CResult_DescriptionCreationErrorZ {
8875 contents: CResult_DescriptionCreationErrorZPtr {
8876 result: Box::into_raw(Box::new(o)),
8882 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8883 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8884 CResult_DescriptionCreationErrorZ {
8885 contents: CResult_DescriptionCreationErrorZPtr {
8886 err: Box::into_raw(Box::new(e)),
8891 /// Checks if the given object is currently in the success state
8893 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8897 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8898 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8899 impl Drop for CResult_DescriptionCreationErrorZ {
8900 fn drop(&mut self) {
8902 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8903 let _ = unsafe { Box::from_raw(self.contents.result) };
8906 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8907 let _ = unsafe { Box::from_raw(self.contents.err) };
8912 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8913 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8914 let contents = if o.result_ok {
8915 let result = unsafe { o.contents.result };
8916 unsafe { o.contents.result = core::ptr::null_mut() };
8917 CResult_DescriptionCreationErrorZPtr { result }
8919 let err = unsafe { o.contents.err };
8920 unsafe { o.contents.err = core::ptr::null_mut(); }
8921 CResult_DescriptionCreationErrorZPtr { err }
8925 result_ok: o.result_ok,
8929 impl Clone for CResult_DescriptionCreationErrorZ {
8930 fn clone(&self) -> Self {
8932 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
8933 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
8936 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
8937 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8943 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
8944 /// but with all dynamically-allocated buffers duplicated in new buffers.
8945 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
8947 /// The contents of CResult_PrivateRouteCreationErrorZ
8948 pub union CResult_PrivateRouteCreationErrorZPtr {
8949 /// A pointer to the contents in the success state.
8950 /// Reading from this pointer when `result_ok` is not set is undefined.
8951 pub result: *mut crate::lightning_invoice::PrivateRoute,
8952 /// A pointer to the contents in the error state.
8953 /// Reading from this pointer when `result_ok` is set is undefined.
8954 pub err: *mut crate::lightning_invoice::CreationError,
8957 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8958 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8959 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8960 pub struct CResult_PrivateRouteCreationErrorZ {
8961 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8962 /// `err` or `result` depending on the state of `result_ok`.
8963 pub contents: CResult_PrivateRouteCreationErrorZPtr,
8964 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8965 pub result_ok: bool,
8968 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
8969 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
8970 CResult_PrivateRouteCreationErrorZ {
8971 contents: CResult_PrivateRouteCreationErrorZPtr {
8972 result: Box::into_raw(Box::new(o)),
8978 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
8979 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
8980 CResult_PrivateRouteCreationErrorZ {
8981 contents: CResult_PrivateRouteCreationErrorZPtr {
8982 err: Box::into_raw(Box::new(e)),
8987 /// Checks if the given object is currently in the success state
8989 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
8993 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
8994 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
8995 impl Drop for CResult_PrivateRouteCreationErrorZ {
8996 fn drop(&mut self) {
8998 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8999 let _ = unsafe { Box::from_raw(self.contents.result) };
9002 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9003 let _ = unsafe { Box::from_raw(self.contents.err) };
9008 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
9009 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
9010 let contents = if o.result_ok {
9011 let result = unsafe { o.contents.result };
9012 unsafe { o.contents.result = core::ptr::null_mut() };
9013 CResult_PrivateRouteCreationErrorZPtr { result }
9015 let err = unsafe { o.contents.err };
9016 unsafe { o.contents.err = core::ptr::null_mut(); }
9017 CResult_PrivateRouteCreationErrorZPtr { err }
9021 result_ok: o.result_ok,
9025 impl Clone for CResult_PrivateRouteCreationErrorZ {
9026 fn clone(&self) -> Self {
9028 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
9029 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
9032 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
9033 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9039 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
9040 /// but with all dynamically-allocated buffers duplicated in new buffers.
9041 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
9043 /// The contents of CResult_StringErrorZ
9044 pub union CResult_StringErrorZPtr {
9045 /// A pointer to the contents in the success state.
9046 /// Reading from this pointer when `result_ok` is not set is undefined.
9047 pub result: *mut crate::c_types::Str,
9048 /// A pointer to the contents in the error state.
9049 /// Reading from this pointer when `result_ok` is set is undefined.
9050 pub err: *mut crate::c_types::Secp256k1Error,
9053 /// A CResult_StringErrorZ represents the result of a fallible operation,
9054 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9056 pub struct CResult_StringErrorZ {
9057 /// The contents of this CResult_StringErrorZ, accessible via either
9058 /// `err` or `result` depending on the state of `result_ok`.
9059 pub contents: CResult_StringErrorZPtr,
9060 /// Whether this CResult_StringErrorZ represents a success state.
9061 pub result_ok: bool,
9064 /// Creates a new CResult_StringErrorZ in the success state.
9065 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
9066 CResult_StringErrorZ {
9067 contents: CResult_StringErrorZPtr {
9068 result: Box::into_raw(Box::new(o)),
9074 /// Creates a new CResult_StringErrorZ in the error state.
9075 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
9076 CResult_StringErrorZ {
9077 contents: CResult_StringErrorZPtr {
9078 err: Box::into_raw(Box::new(e)),
9083 /// Checks if the given object is currently in the success state
9085 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9089 /// Frees any resources used by the CResult_StringErrorZ.
9090 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9091 impl Drop for CResult_StringErrorZ {
9092 fn drop(&mut self) {
9094 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9095 let _ = unsafe { Box::from_raw(self.contents.result) };
9098 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9099 let _ = unsafe { Box::from_raw(self.contents.err) };
9104 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9105 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9106 let contents = if o.result_ok {
9107 let result = unsafe { o.contents.result };
9108 unsafe { o.contents.result = core::ptr::null_mut() };
9109 CResult_StringErrorZPtr { result }
9111 let err = unsafe { o.contents.err };
9112 unsafe { o.contents.err = core::ptr::null_mut(); }
9113 CResult_StringErrorZPtr { err }
9117 result_ok: o.result_ok,
9122 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9123 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9124 /// A pointer to the contents in the success state.
9125 /// Reading from this pointer when `result_ok` is not set is undefined.
9126 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9127 /// A pointer to the contents in the error state.
9128 /// Reading from this pointer when `result_ok` is set is undefined.
9129 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9132 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9133 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9135 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9136 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9137 /// `err` or `result` depending on the state of `result_ok`.
9138 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9139 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9140 pub result_ok: bool,
9143 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9144 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9145 CResult_ChannelMonitorUpdateDecodeErrorZ {
9146 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9147 result: Box::into_raw(Box::new(o)),
9153 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9154 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9155 CResult_ChannelMonitorUpdateDecodeErrorZ {
9156 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9157 err: Box::into_raw(Box::new(e)),
9162 /// Checks if the given object is currently in the success state
9164 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9168 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9169 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9170 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9171 fn drop(&mut self) {
9173 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9174 let _ = unsafe { Box::from_raw(self.contents.result) };
9177 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9178 let _ = unsafe { Box::from_raw(self.contents.err) };
9183 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9184 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9185 let contents = if o.result_ok {
9186 let result = unsafe { o.contents.result };
9187 unsafe { o.contents.result = core::ptr::null_mut() };
9188 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9190 let err = unsafe { o.contents.err };
9191 unsafe { o.contents.err = core::ptr::null_mut(); }
9192 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9196 result_ok: o.result_ok,
9200 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9201 fn clone(&self) -> Self {
9203 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9204 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9207 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9208 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9214 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9215 /// but with all dynamically-allocated buffers duplicated in new buffers.
9216 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9219 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9220 pub enum COption_MonitorEventZ {
9221 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9222 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9223 /// When we're in this state, this COption_MonitorEventZ contains nothing
9226 impl COption_MonitorEventZ {
9227 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9228 if let Self::None = self { false } else { true }
9230 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9233 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9234 if let Self::Some(v) = self { v } else { unreachable!() }
9238 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9239 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9240 COption_MonitorEventZ::Some(o)
9243 /// Constructs a new COption_MonitorEventZ containing nothing
9244 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9245 COption_MonitorEventZ::None
9248 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9249 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9251 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9252 /// but with all dynamically-allocated buffers duplicated in new buffers.
9253 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9255 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9256 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9257 /// A pointer to the contents in the success state.
9258 /// Reading from this pointer when `result_ok` is not set is undefined.
9259 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9260 /// A pointer to the contents in the error state.
9261 /// Reading from this pointer when `result_ok` is set is undefined.
9262 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9265 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9266 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9268 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9269 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9270 /// `err` or `result` depending on the state of `result_ok`.
9271 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9272 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9273 pub result_ok: bool,
9276 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9277 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9278 CResult_COption_MonitorEventZDecodeErrorZ {
9279 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9280 result: Box::into_raw(Box::new(o)),
9286 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9287 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9288 CResult_COption_MonitorEventZDecodeErrorZ {
9289 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9290 err: Box::into_raw(Box::new(e)),
9295 /// Checks if the given object is currently in the success state
9297 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9301 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9302 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9303 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9304 fn drop(&mut self) {
9306 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9307 let _ = unsafe { Box::from_raw(self.contents.result) };
9310 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9311 let _ = unsafe { Box::from_raw(self.contents.err) };
9316 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9317 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9318 let contents = if o.result_ok {
9319 let result = unsafe { o.contents.result };
9320 unsafe { o.contents.result = core::ptr::null_mut() };
9321 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9323 let err = unsafe { o.contents.err };
9324 unsafe { o.contents.err = core::ptr::null_mut(); }
9325 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9329 result_ok: o.result_ok,
9333 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9334 fn clone(&self) -> Self {
9336 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9337 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9340 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9341 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9347 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9348 /// but with all dynamically-allocated buffers duplicated in new buffers.
9349 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9351 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9352 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9353 /// A pointer to the contents in the success state.
9354 /// Reading from this pointer when `result_ok` is not set is undefined.
9355 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9356 /// A pointer to the contents in the error state.
9357 /// Reading from this pointer when `result_ok` is set is undefined.
9358 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9361 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9362 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9364 pub struct CResult_HTLCUpdateDecodeErrorZ {
9365 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9366 /// `err` or `result` depending on the state of `result_ok`.
9367 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9368 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9369 pub result_ok: bool,
9372 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9373 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9374 CResult_HTLCUpdateDecodeErrorZ {
9375 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9376 result: Box::into_raw(Box::new(o)),
9382 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9383 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9384 CResult_HTLCUpdateDecodeErrorZ {
9385 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9386 err: Box::into_raw(Box::new(e)),
9391 /// Checks if the given object is currently in the success state
9393 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9397 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9398 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9399 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9400 fn drop(&mut self) {
9402 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9403 let _ = unsafe { Box::from_raw(self.contents.result) };
9406 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9407 let _ = unsafe { Box::from_raw(self.contents.err) };
9412 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9413 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9414 let contents = if o.result_ok {
9415 let result = unsafe { o.contents.result };
9416 unsafe { o.contents.result = core::ptr::null_mut() };
9417 CResult_HTLCUpdateDecodeErrorZPtr { result }
9419 let err = unsafe { o.contents.err };
9420 unsafe { o.contents.err = core::ptr::null_mut(); }
9421 CResult_HTLCUpdateDecodeErrorZPtr { err }
9425 result_ok: o.result_ok,
9429 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9430 fn clone(&self) -> Self {
9432 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9433 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9436 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9437 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9443 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9444 /// but with all dynamically-allocated buffers duplicated in new buffers.
9445 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9447 /// A tuple of 2 elements. See the individual fields for the types contained.
9448 pub struct C2Tuple_OutPointScriptZ {
9449 /// The element at position 0
9450 pub a: crate::lightning::chain::transaction::OutPoint,
9451 /// The element at position 1
9452 pub b: crate::c_types::derived::CVec_u8Z,
9454 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9455 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9462 impl C2Tuple_OutPointScriptZ {
9463 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9467 impl Clone for C2Tuple_OutPointScriptZ {
9468 fn clone(&self) -> Self {
9470 a: Clone::clone(&self.a),
9471 b: Clone::clone(&self.b),
9476 /// Creates a new tuple which has the same data as `orig`
9477 /// but with all dynamically-allocated buffers duplicated in new buffers.
9478 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9479 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9481 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9482 C2Tuple_OutPointScriptZ { a, b, }
9486 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9487 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9489 /// A tuple of 2 elements. See the individual fields for the types contained.
9490 pub struct C2Tuple_u32ScriptZ {
9491 /// The element at position 0
9493 /// The element at position 1
9494 pub b: crate::c_types::derived::CVec_u8Z,
9496 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9497 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9504 impl C2Tuple_u32ScriptZ {
9505 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9509 impl Clone for C2Tuple_u32ScriptZ {
9510 fn clone(&self) -> Self {
9512 a: Clone::clone(&self.a),
9513 b: Clone::clone(&self.b),
9518 /// Creates a new tuple which has the same data as `orig`
9519 /// but with all dynamically-allocated buffers duplicated in new buffers.
9520 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9521 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9523 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9524 C2Tuple_u32ScriptZ { a, b, }
9528 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9529 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9531 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9532 /// This corresponds to std::vector in C++
9533 pub struct CVec_C2Tuple_u32ScriptZZ {
9534 /// The elements in the array.
9535 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9536 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9537 /// The number of elements pointed to by `data`.
9540 impl CVec_C2Tuple_u32ScriptZZ {
9541 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9542 if self.datalen == 0 { return Vec::new(); }
9543 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9544 self.data = core::ptr::null_mut();
9548 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9549 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9552 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9553 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9554 let datalen = v.len();
9555 let data = Box::into_raw(v.into_boxed_slice());
9556 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9560 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9561 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9562 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9563 fn drop(&mut self) {
9564 if self.datalen == 0 { return; }
9565 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9568 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9569 fn clone(&self) -> Self {
9570 let mut res = Vec::new();
9571 if self.datalen == 0 { return Self::from(res); }
9572 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9577 /// A tuple of 2 elements. See the individual fields for the types contained.
9578 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9579 /// The element at position 0
9580 pub a: crate::c_types::ThirtyTwoBytes,
9581 /// The element at position 1
9582 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9584 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9585 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9592 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9593 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9597 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9598 fn clone(&self) -> Self {
9600 a: Clone::clone(&self.a),
9601 b: Clone::clone(&self.b),
9606 /// Creates a new tuple which has the same data as `orig`
9607 /// but with all dynamically-allocated buffers duplicated in new buffers.
9608 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9609 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9611 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 {
9612 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9616 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9617 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9619 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9620 /// This corresponds to std::vector in C++
9621 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9622 /// The elements in the array.
9623 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9624 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9625 /// The number of elements pointed to by `data`.
9628 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9629 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9630 if self.datalen == 0 { return Vec::new(); }
9631 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9632 self.data = core::ptr::null_mut();
9636 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9637 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9640 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9641 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9642 let datalen = v.len();
9643 let data = Box::into_raw(v.into_boxed_slice());
9644 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9648 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9649 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9650 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9651 fn drop(&mut self) {
9652 if self.datalen == 0 { return; }
9653 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9656 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9657 fn clone(&self) -> Self {
9658 let mut res = Vec::new();
9659 if self.datalen == 0 { return Self::from(res); }
9660 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9665 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9666 /// This corresponds to std::vector in C++
9667 pub struct CVec_EventZ {
9668 /// The elements in the array.
9669 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9670 pub data: *mut crate::lightning::util::events::Event,
9671 /// The number of elements pointed to by `data`.
9675 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9676 if self.datalen == 0 { return Vec::new(); }
9677 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9678 self.data = core::ptr::null_mut();
9682 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9683 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9686 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9687 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9688 let datalen = v.len();
9689 let data = Box::into_raw(v.into_boxed_slice());
9690 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9694 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9695 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9696 impl Drop for CVec_EventZ {
9697 fn drop(&mut self) {
9698 if self.datalen == 0 { return; }
9699 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9702 impl Clone for CVec_EventZ {
9703 fn clone(&self) -> Self {
9704 let mut res = Vec::new();
9705 if self.datalen == 0 { return Self::from(res); }
9706 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9711 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9712 /// This corresponds to std::vector in C++
9713 pub struct CVec_TransactionZ {
9714 /// The elements in the array.
9715 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9716 pub data: *mut crate::c_types::Transaction,
9717 /// The number of elements pointed to by `data`.
9720 impl CVec_TransactionZ {
9721 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9722 if self.datalen == 0 { return Vec::new(); }
9723 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9724 self.data = core::ptr::null_mut();
9728 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9729 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9732 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9733 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9734 let datalen = v.len();
9735 let data = Box::into_raw(v.into_boxed_slice());
9736 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9740 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9741 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9742 impl Drop for CVec_TransactionZ {
9743 fn drop(&mut self) {
9744 if self.datalen == 0 { return; }
9745 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9748 impl Clone for CVec_TransactionZ {
9749 fn clone(&self) -> Self {
9750 let mut res = Vec::new();
9751 if self.datalen == 0 { return Self::from(res); }
9752 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9757 /// A tuple of 2 elements. See the individual fields for the types contained.
9758 pub struct C2Tuple_u32TxOutZ {
9759 /// The element at position 0
9761 /// The element at position 1
9762 pub b: crate::c_types::TxOut,
9764 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9765 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9772 impl C2Tuple_u32TxOutZ {
9773 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9777 impl Clone for C2Tuple_u32TxOutZ {
9778 fn clone(&self) -> Self {
9780 a: Clone::clone(&self.a),
9781 b: Clone::clone(&self.b),
9786 /// Creates a new tuple which has the same data as `orig`
9787 /// but with all dynamically-allocated buffers duplicated in new buffers.
9788 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9789 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9791 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9792 C2Tuple_u32TxOutZ { a, b, }
9796 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9797 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9799 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9800 /// This corresponds to std::vector in C++
9801 pub struct CVec_C2Tuple_u32TxOutZZ {
9802 /// The elements in the array.
9803 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9804 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9805 /// The number of elements pointed to by `data`.
9808 impl CVec_C2Tuple_u32TxOutZZ {
9809 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9810 if self.datalen == 0 { return Vec::new(); }
9811 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9812 self.data = core::ptr::null_mut();
9816 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9817 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9820 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9821 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9822 let datalen = v.len();
9823 let data = Box::into_raw(v.into_boxed_slice());
9824 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9828 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9829 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9830 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9831 fn drop(&mut self) {
9832 if self.datalen == 0 { return; }
9833 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9836 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9837 fn clone(&self) -> Self {
9838 let mut res = Vec::new();
9839 if self.datalen == 0 { return Self::from(res); }
9840 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9845 /// A tuple of 2 elements. See the individual fields for the types contained.
9846 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9847 /// The element at position 0
9848 pub a: crate::c_types::ThirtyTwoBytes,
9849 /// The element at position 1
9850 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9852 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9853 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9860 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9861 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9865 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9866 fn clone(&self) -> Self {
9868 a: Clone::clone(&self.a),
9869 b: Clone::clone(&self.b),
9874 /// Creates a new tuple which has the same data as `orig`
9875 /// but with all dynamically-allocated buffers duplicated in new buffers.
9876 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9877 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9879 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 {
9880 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9884 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9885 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9887 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9888 /// This corresponds to std::vector in C++
9889 pub struct CVec_TransactionOutputsZ {
9890 /// The elements in the array.
9891 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9892 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9893 /// The number of elements pointed to by `data`.
9896 impl CVec_TransactionOutputsZ {
9897 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9898 if self.datalen == 0 { return Vec::new(); }
9899 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9900 self.data = core::ptr::null_mut();
9904 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9905 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9908 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9909 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9910 let datalen = v.len();
9911 let data = Box::into_raw(v.into_boxed_slice());
9912 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9916 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9917 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9918 impl Drop for CVec_TransactionOutputsZ {
9919 fn drop(&mut self) {
9920 if self.datalen == 0 { return; }
9921 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9924 impl Clone for CVec_TransactionOutputsZ {
9925 fn clone(&self) -> Self {
9926 let mut res = Vec::new();
9927 if self.datalen == 0 { return Self::from(res); }
9928 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9933 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9934 /// This corresponds to std::vector in C++
9935 pub struct CVec_BalanceZ {
9936 /// The elements in the array.
9937 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9938 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9939 /// The number of elements pointed to by `data`.
9942 impl CVec_BalanceZ {
9943 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9944 if self.datalen == 0 { return Vec::new(); }
9945 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9946 self.data = core::ptr::null_mut();
9950 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9951 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9954 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9955 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9956 let datalen = v.len();
9957 let data = Box::into_raw(v.into_boxed_slice());
9958 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9962 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9963 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9964 impl Drop for CVec_BalanceZ {
9965 fn drop(&mut self) {
9966 if self.datalen == 0 { return; }
9967 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9970 impl Clone for CVec_BalanceZ {
9971 fn clone(&self) -> Self {
9972 let mut res = Vec::new();
9973 if self.datalen == 0 { return Self::from(res); }
9974 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9979 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9980 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9981 /// A pointer to the contents in the success state.
9982 /// Reading from this pointer when `result_ok` is not set is undefined.
9983 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9984 /// A pointer to the contents in the error state.
9985 /// Reading from this pointer when `result_ok` is set is undefined.
9986 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9989 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9990 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9991 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9992 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9993 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9994 /// `err` or `result` depending on the state of `result_ok`.
9995 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
9996 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9997 pub result_ok: bool,
10000 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10001 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10002 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10003 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10004 result: Box::into_raw(Box::new(o)),
10010 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10011 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10012 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10013 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10014 err: Box::into_raw(Box::new(e)),
10019 /// Checks if the given object is currently in the success state
10021 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10025 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10026 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10027 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10028 fn drop(&mut self) {
10029 if self.result_ok {
10030 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10031 let _ = unsafe { Box::from_raw(self.contents.result) };
10034 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10035 let _ = unsafe { Box::from_raw(self.contents.err) };
10040 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10041 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10042 let contents = if o.result_ok {
10043 let result = unsafe { o.contents.result };
10044 unsafe { o.contents.result = core::ptr::null_mut() };
10045 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10047 let err = unsafe { o.contents.err };
10048 unsafe { o.contents.err = core::ptr::null_mut(); }
10049 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10053 result_ok: o.result_ok,
10058 /// The contents of CResult_NoneLightningErrorZ
10059 pub union CResult_NoneLightningErrorZPtr {
10060 /// Note that this value is always NULL, as there are no contents in the OK variant
10061 pub result: *mut core::ffi::c_void,
10062 /// A pointer to the contents in the error state.
10063 /// Reading from this pointer when `result_ok` is set is undefined.
10064 pub err: *mut crate::lightning::ln::msgs::LightningError,
10067 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
10068 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
10069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10070 pub struct CResult_NoneLightningErrorZ {
10071 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
10072 /// `err` or `result` depending on the state of `result_ok`.
10073 pub contents: CResult_NoneLightningErrorZPtr,
10074 /// Whether this CResult_NoneLightningErrorZ represents a success state.
10075 pub result_ok: bool,
10078 /// Creates a new CResult_NoneLightningErrorZ in the success state.
10079 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10080 CResult_NoneLightningErrorZ {
10081 contents: CResult_NoneLightningErrorZPtr {
10082 result: core::ptr::null_mut(),
10088 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10089 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10090 CResult_NoneLightningErrorZ {
10091 contents: CResult_NoneLightningErrorZPtr {
10092 err: Box::into_raw(Box::new(e)),
10097 /// Checks if the given object is currently in the success state
10099 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10103 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10104 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10105 impl Drop for CResult_NoneLightningErrorZ {
10106 fn drop(&mut self) {
10107 if self.result_ok {
10109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10110 let _ = unsafe { Box::from_raw(self.contents.err) };
10115 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10116 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10117 let contents = if o.result_ok {
10118 let _ = unsafe { Box::from_raw(o.contents.result) };
10119 o.contents.result = core::ptr::null_mut();
10120 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10122 let err = unsafe { o.contents.err };
10123 unsafe { o.contents.err = core::ptr::null_mut(); }
10124 CResult_NoneLightningErrorZPtr { err }
10128 result_ok: o.result_ok,
10132 impl Clone for CResult_NoneLightningErrorZ {
10133 fn clone(&self) -> Self {
10134 if self.result_ok {
10135 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10136 result: core::ptr::null_mut()
10139 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10140 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10146 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10147 /// but with all dynamically-allocated buffers duplicated in new buffers.
10148 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10150 /// A tuple of 2 elements. See the individual fields for the types contained.
10151 pub struct C2Tuple_PublicKeyTypeZ {
10152 /// The element at position 0
10153 pub a: crate::c_types::PublicKey,
10154 /// The element at position 1
10155 pub b: crate::lightning::ln::wire::Type,
10157 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10158 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10165 impl C2Tuple_PublicKeyTypeZ {
10166 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10170 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10172 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10173 C2Tuple_PublicKeyTypeZ { a, b, }
10177 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10178 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10180 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10181 /// This corresponds to std::vector in C++
10182 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10183 /// The elements in the array.
10184 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10185 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10186 /// The number of elements pointed to by `data`.
10189 impl CVec_C2Tuple_PublicKeyTypeZZ {
10190 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10191 if self.datalen == 0 { return Vec::new(); }
10192 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10193 self.data = core::ptr::null_mut();
10197 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10198 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10201 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10202 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10203 let datalen = v.len();
10204 let data = Box::into_raw(v.into_boxed_slice());
10205 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10209 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10210 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10211 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10212 fn drop(&mut self) {
10213 if self.datalen == 0 { return; }
10214 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10218 /// The contents of CResult_boolLightningErrorZ
10219 pub union CResult_boolLightningErrorZPtr {
10220 /// A pointer to the contents in the success state.
10221 /// Reading from this pointer when `result_ok` is not set is undefined.
10222 pub result: *mut bool,
10223 /// A pointer to the contents in the error state.
10224 /// Reading from this pointer when `result_ok` is set is undefined.
10225 pub err: *mut crate::lightning::ln::msgs::LightningError,
10228 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10229 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10231 pub struct CResult_boolLightningErrorZ {
10232 /// The contents of this CResult_boolLightningErrorZ, accessible via either
10233 /// `err` or `result` depending on the state of `result_ok`.
10234 pub contents: CResult_boolLightningErrorZPtr,
10235 /// Whether this CResult_boolLightningErrorZ represents a success state.
10236 pub result_ok: bool,
10239 /// Creates a new CResult_boolLightningErrorZ in the success state.
10240 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10241 CResult_boolLightningErrorZ {
10242 contents: CResult_boolLightningErrorZPtr {
10243 result: Box::into_raw(Box::new(o)),
10249 /// Creates a new CResult_boolLightningErrorZ in the error state.
10250 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10251 CResult_boolLightningErrorZ {
10252 contents: CResult_boolLightningErrorZPtr {
10253 err: Box::into_raw(Box::new(e)),
10258 /// Checks if the given object is currently in the success state
10260 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10264 /// Frees any resources used by the CResult_boolLightningErrorZ.
10265 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10266 impl Drop for CResult_boolLightningErrorZ {
10267 fn drop(&mut self) {
10268 if self.result_ok {
10269 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10270 let _ = unsafe { Box::from_raw(self.contents.result) };
10273 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10274 let _ = unsafe { Box::from_raw(self.contents.err) };
10279 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10280 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10281 let contents = if o.result_ok {
10282 let result = unsafe { o.contents.result };
10283 unsafe { o.contents.result = core::ptr::null_mut() };
10284 CResult_boolLightningErrorZPtr { result }
10286 let err = unsafe { o.contents.err };
10287 unsafe { o.contents.err = core::ptr::null_mut(); }
10288 CResult_boolLightningErrorZPtr { err }
10292 result_ok: o.result_ok,
10296 impl Clone for CResult_boolLightningErrorZ {
10297 fn clone(&self) -> Self {
10298 if self.result_ok {
10299 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10300 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10303 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10304 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10310 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10311 /// but with all dynamically-allocated buffers duplicated in new buffers.
10312 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10314 /// A tuple of 3 elements. See the individual fields for the types contained.
10315 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10316 /// The element at position 0
10317 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10318 /// The element at position 1
10319 pub b: crate::lightning::ln::msgs::ChannelUpdate,
10320 /// The element at position 2
10321 pub c: crate::lightning::ln::msgs::ChannelUpdate,
10323 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10324 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10332 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10333 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10334 (self.a, self.b, self.c)
10337 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10338 fn clone(&self) -> Self {
10340 a: Clone::clone(&self.a),
10341 b: Clone::clone(&self.b),
10342 c: Clone::clone(&self.c),
10347 /// Creates a new tuple which has the same data as `orig`
10348 /// but with all dynamically-allocated buffers duplicated in new buffers.
10349 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10350 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10352 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 {
10353 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10357 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10358 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10360 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10361 /// This corresponds to std::vector in C++
10362 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10363 /// The elements in the array.
10364 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10365 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10366 /// The number of elements pointed to by `data`.
10369 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10370 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10371 if self.datalen == 0 { return Vec::new(); }
10372 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10373 self.data = core::ptr::null_mut();
10377 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10378 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10381 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10382 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10383 let datalen = v.len();
10384 let data = Box::into_raw(v.into_boxed_slice());
10385 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10389 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10390 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10391 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10392 fn drop(&mut self) {
10393 if self.datalen == 0 { return; }
10394 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10397 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10398 fn clone(&self) -> Self {
10399 let mut res = Vec::new();
10400 if self.datalen == 0 { return Self::from(res); }
10401 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10406 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10407 /// This corresponds to std::vector in C++
10408 pub struct CVec_NodeAnnouncementZ {
10409 /// The elements in the array.
10410 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10411 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10412 /// The number of elements pointed to by `data`.
10415 impl CVec_NodeAnnouncementZ {
10416 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10417 if self.datalen == 0 { return Vec::new(); }
10418 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10419 self.data = core::ptr::null_mut();
10423 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10424 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10427 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10428 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10429 let datalen = v.len();
10430 let data = Box::into_raw(v.into_boxed_slice());
10431 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10435 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10436 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10437 impl Drop for CVec_NodeAnnouncementZ {
10438 fn drop(&mut self) {
10439 if self.datalen == 0 { return; }
10440 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10443 impl Clone for CVec_NodeAnnouncementZ {
10444 fn clone(&self) -> Self {
10445 let mut res = Vec::new();
10446 if self.datalen == 0 { return Self::from(res); }
10447 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10452 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10453 /// This corresponds to std::vector in C++
10454 pub struct CVec_PublicKeyZ {
10455 /// The elements in the array.
10456 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10457 pub data: *mut crate::c_types::PublicKey,
10458 /// The number of elements pointed to by `data`.
10461 impl CVec_PublicKeyZ {
10462 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10463 if self.datalen == 0 { return Vec::new(); }
10464 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10465 self.data = core::ptr::null_mut();
10469 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10470 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10473 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10474 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10475 let datalen = v.len();
10476 let data = Box::into_raw(v.into_boxed_slice());
10477 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10481 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10482 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10483 impl Drop for CVec_PublicKeyZ {
10484 fn drop(&mut self) {
10485 if self.datalen == 0 { return; }
10486 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10489 impl Clone for CVec_PublicKeyZ {
10490 fn clone(&self) -> Self {
10491 let mut res = Vec::new();
10492 if self.datalen == 0 { return Self::from(res); }
10493 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10499 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
10500 pub enum COption_NetAddressZ {
10501 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
10502 Some(crate::lightning::ln::msgs::NetAddress),
10503 /// When we're in this state, this COption_NetAddressZ contains nothing
10506 impl COption_NetAddressZ {
10507 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10508 if let Self::None = self { false } else { true }
10510 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10513 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
10514 if let Self::Some(v) = self { v } else { unreachable!() }
10518 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
10519 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
10520 COption_NetAddressZ::Some(o)
10523 /// Constructs a new COption_NetAddressZ containing nothing
10524 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
10525 COption_NetAddressZ::None
10528 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
10529 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
10531 /// Creates a new COption_NetAddressZ which has the same data as `orig`
10532 /// but with all dynamically-allocated buffers duplicated in new buffers.
10533 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
10535 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10536 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10537 /// A pointer to the contents in the success state.
10538 /// Reading from this pointer when `result_ok` is not set is undefined.
10539 pub result: *mut crate::c_types::derived::CVec_u8Z,
10540 /// A pointer to the contents in the error state.
10541 /// Reading from this pointer when `result_ok` is set is undefined.
10542 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10545 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10546 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10548 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10549 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10550 /// `err` or `result` depending on the state of `result_ok`.
10551 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10552 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10553 pub result_ok: bool,
10556 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10557 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10558 CResult_CVec_u8ZPeerHandleErrorZ {
10559 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10560 result: Box::into_raw(Box::new(o)),
10566 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10567 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10568 CResult_CVec_u8ZPeerHandleErrorZ {
10569 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10570 err: Box::into_raw(Box::new(e)),
10575 /// Checks if the given object is currently in the success state
10577 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10581 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10582 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10583 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10584 fn drop(&mut self) {
10585 if self.result_ok {
10586 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10587 let _ = unsafe { Box::from_raw(self.contents.result) };
10590 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10591 let _ = unsafe { Box::from_raw(self.contents.err) };
10596 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10597 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10598 let contents = if o.result_ok {
10599 let result = unsafe { o.contents.result };
10600 unsafe { o.contents.result = core::ptr::null_mut() };
10601 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10603 let err = unsafe { o.contents.err };
10604 unsafe { o.contents.err = core::ptr::null_mut(); }
10605 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10609 result_ok: o.result_ok,
10613 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10614 fn clone(&self) -> Self {
10615 if self.result_ok {
10616 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10617 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10620 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10621 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10627 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10628 /// but with all dynamically-allocated buffers duplicated in new buffers.
10629 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10631 /// The contents of CResult_NonePeerHandleErrorZ
10632 pub union CResult_NonePeerHandleErrorZPtr {
10633 /// Note that this value is always NULL, as there are no contents in the OK variant
10634 pub result: *mut core::ffi::c_void,
10635 /// A pointer to the contents in the error state.
10636 /// Reading from this pointer when `result_ok` is set is undefined.
10637 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10640 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10641 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10642 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10643 pub struct CResult_NonePeerHandleErrorZ {
10644 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10645 /// `err` or `result` depending on the state of `result_ok`.
10646 pub contents: CResult_NonePeerHandleErrorZPtr,
10647 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10648 pub result_ok: bool,
10651 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10652 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10653 CResult_NonePeerHandleErrorZ {
10654 contents: CResult_NonePeerHandleErrorZPtr {
10655 result: core::ptr::null_mut(),
10661 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10662 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10663 CResult_NonePeerHandleErrorZ {
10664 contents: CResult_NonePeerHandleErrorZPtr {
10665 err: Box::into_raw(Box::new(e)),
10670 /// Checks if the given object is currently in the success state
10672 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10676 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10677 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10678 impl Drop for CResult_NonePeerHandleErrorZ {
10679 fn drop(&mut self) {
10680 if self.result_ok {
10682 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10683 let _ = unsafe { Box::from_raw(self.contents.err) };
10688 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10689 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10690 let contents = if o.result_ok {
10691 let _ = unsafe { Box::from_raw(o.contents.result) };
10692 o.contents.result = core::ptr::null_mut();
10693 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10695 let err = unsafe { o.contents.err };
10696 unsafe { o.contents.err = core::ptr::null_mut(); }
10697 CResult_NonePeerHandleErrorZPtr { err }
10701 result_ok: o.result_ok,
10705 impl Clone for CResult_NonePeerHandleErrorZ {
10706 fn clone(&self) -> Self {
10707 if self.result_ok {
10708 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10709 result: core::ptr::null_mut()
10712 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10713 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10719 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10720 /// but with all dynamically-allocated buffers duplicated in new buffers.
10721 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10723 /// The contents of CResult_boolPeerHandleErrorZ
10724 pub union CResult_boolPeerHandleErrorZPtr {
10725 /// A pointer to the contents in the success state.
10726 /// Reading from this pointer when `result_ok` is not set is undefined.
10727 pub result: *mut bool,
10728 /// A pointer to the contents in the error state.
10729 /// Reading from this pointer when `result_ok` is set is undefined.
10730 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10733 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10734 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10736 pub struct CResult_boolPeerHandleErrorZ {
10737 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10738 /// `err` or `result` depending on the state of `result_ok`.
10739 pub contents: CResult_boolPeerHandleErrorZPtr,
10740 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10741 pub result_ok: bool,
10744 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10745 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10746 CResult_boolPeerHandleErrorZ {
10747 contents: CResult_boolPeerHandleErrorZPtr {
10748 result: Box::into_raw(Box::new(o)),
10754 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10755 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10756 CResult_boolPeerHandleErrorZ {
10757 contents: CResult_boolPeerHandleErrorZPtr {
10758 err: Box::into_raw(Box::new(e)),
10763 /// Checks if the given object is currently in the success state
10765 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10769 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10770 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10771 impl Drop for CResult_boolPeerHandleErrorZ {
10772 fn drop(&mut self) {
10773 if self.result_ok {
10774 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10775 let _ = unsafe { Box::from_raw(self.contents.result) };
10778 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10779 let _ = unsafe { Box::from_raw(self.contents.err) };
10784 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10785 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10786 let contents = if o.result_ok {
10787 let result = unsafe { o.contents.result };
10788 unsafe { o.contents.result = core::ptr::null_mut() };
10789 CResult_boolPeerHandleErrorZPtr { result }
10791 let err = unsafe { o.contents.err };
10792 unsafe { o.contents.err = core::ptr::null_mut(); }
10793 CResult_boolPeerHandleErrorZPtr { err }
10797 result_ok: o.result_ok,
10801 impl Clone for CResult_boolPeerHandleErrorZ {
10802 fn clone(&self) -> Self {
10803 if self.result_ok {
10804 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10805 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10808 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10809 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10815 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10816 /// but with all dynamically-allocated buffers duplicated in new buffers.
10817 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10819 /// The contents of CResult_NodeIdDecodeErrorZ
10820 pub union CResult_NodeIdDecodeErrorZPtr {
10821 /// A pointer to the contents in the success state.
10822 /// Reading from this pointer when `result_ok` is not set is undefined.
10823 pub result: *mut crate::lightning::routing::network_graph::NodeId,
10824 /// A pointer to the contents in the error state.
10825 /// Reading from this pointer when `result_ok` is set is undefined.
10826 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10829 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10830 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10832 pub struct CResult_NodeIdDecodeErrorZ {
10833 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10834 /// `err` or `result` depending on the state of `result_ok`.
10835 pub contents: CResult_NodeIdDecodeErrorZPtr,
10836 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10837 pub result_ok: bool,
10840 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10841 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10842 CResult_NodeIdDecodeErrorZ {
10843 contents: CResult_NodeIdDecodeErrorZPtr {
10844 result: Box::into_raw(Box::new(o)),
10850 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10851 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10852 CResult_NodeIdDecodeErrorZ {
10853 contents: CResult_NodeIdDecodeErrorZPtr {
10854 err: Box::into_raw(Box::new(e)),
10859 /// Checks if the given object is currently in the success state
10861 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10865 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10866 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10867 impl Drop for CResult_NodeIdDecodeErrorZ {
10868 fn drop(&mut self) {
10869 if self.result_ok {
10870 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10871 let _ = unsafe { Box::from_raw(self.contents.result) };
10874 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10875 let _ = unsafe { Box::from_raw(self.contents.err) };
10880 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10881 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10882 let contents = if o.result_ok {
10883 let result = unsafe { o.contents.result };
10884 unsafe { o.contents.result = core::ptr::null_mut() };
10885 CResult_NodeIdDecodeErrorZPtr { result }
10887 let err = unsafe { o.contents.err };
10888 unsafe { o.contents.err = core::ptr::null_mut(); }
10889 CResult_NodeIdDecodeErrorZPtr { err }
10893 result_ok: o.result_ok,
10897 impl Clone for CResult_NodeIdDecodeErrorZ {
10898 fn clone(&self) -> Self {
10899 if self.result_ok {
10900 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10901 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10904 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10905 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10911 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10912 /// but with all dynamically-allocated buffers duplicated in new buffers.
10913 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10915 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10916 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10917 /// A pointer to the contents in the success state.
10918 /// Reading from this pointer when `result_ok` is not set is undefined.
10919 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10920 /// A pointer to the contents in the error state.
10921 /// Reading from this pointer when `result_ok` is set is undefined.
10922 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10925 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10926 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10928 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10929 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10930 /// `err` or `result` depending on the state of `result_ok`.
10931 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10932 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10933 pub result_ok: bool,
10936 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10937 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10938 CResult_COption_NetworkUpdateZDecodeErrorZ {
10939 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10940 result: Box::into_raw(Box::new(o)),
10946 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10947 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10948 CResult_COption_NetworkUpdateZDecodeErrorZ {
10949 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10950 err: Box::into_raw(Box::new(e)),
10955 /// Checks if the given object is currently in the success state
10957 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10961 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10962 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10963 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10964 fn drop(&mut self) {
10965 if self.result_ok {
10966 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10967 let _ = unsafe { Box::from_raw(self.contents.result) };
10970 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10971 let _ = unsafe { Box::from_raw(self.contents.err) };
10976 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10977 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10978 let contents = if o.result_ok {
10979 let result = unsafe { o.contents.result };
10980 unsafe { o.contents.result = core::ptr::null_mut() };
10981 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10983 let err = unsafe { o.contents.err };
10984 unsafe { o.contents.err = core::ptr::null_mut(); }
10985 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10989 result_ok: o.result_ok,
10993 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10994 fn clone(&self) -> Self {
10995 if self.result_ok {
10996 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10997 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
11000 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
11001 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11007 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
11008 /// but with all dynamically-allocated buffers duplicated in new buffers.
11009 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
11011 /// An enum which can either contain a crate::lightning::chain::Access or not
11012 pub enum COption_AccessZ {
11013 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
11014 Some(crate::lightning::chain::Access),
11015 /// When we're in this state, this COption_AccessZ contains nothing
11018 impl COption_AccessZ {
11019 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11020 if let Self::None = self { false } else { true }
11022 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11025 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
11026 if let Self::Some(v) = self { v } else { unreachable!() }
11030 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11031 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
11032 COption_AccessZ::Some(o)
11035 /// Constructs a new COption_AccessZ containing nothing
11036 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
11037 COption_AccessZ::None
11040 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11041 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
11043 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
11044 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
11045 /// A pointer to the contents in the success state.
11046 /// Reading from this pointer when `result_ok` is not set is undefined.
11047 pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
11048 /// A pointer to the contents in the error state.
11049 /// Reading from this pointer when `result_ok` is set is undefined.
11050 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11053 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
11054 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11056 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
11057 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
11058 /// `err` or `result` depending on the state of `result_ok`.
11059 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
11060 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
11061 pub result_ok: bool,
11064 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
11065 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11066 CResult_ChannelUpdateInfoDecodeErrorZ {
11067 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11068 result: Box::into_raw(Box::new(o)),
11074 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
11075 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11076 CResult_ChannelUpdateInfoDecodeErrorZ {
11077 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11078 err: Box::into_raw(Box::new(e)),
11083 /// Checks if the given object is currently in the success state
11085 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
11089 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
11090 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
11091 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
11092 fn drop(&mut self) {
11093 if self.result_ok {
11094 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11095 let _ = unsafe { Box::from_raw(self.contents.result) };
11098 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11099 let _ = unsafe { Box::from_raw(self.contents.err) };
11104 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
11105 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11106 let contents = if o.result_ok {
11107 let result = unsafe { o.contents.result };
11108 unsafe { o.contents.result = core::ptr::null_mut() };
11109 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
11111 let err = unsafe { o.contents.err };
11112 unsafe { o.contents.err = core::ptr::null_mut(); }
11113 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11117 result_ok: o.result_ok,
11121 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11122 fn clone(&self) -> Self {
11123 if self.result_ok {
11124 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11125 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11128 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11129 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11135 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11136 /// but with all dynamically-allocated buffers duplicated in new buffers.
11137 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11139 /// The contents of CResult_ChannelInfoDecodeErrorZ
11140 pub union CResult_ChannelInfoDecodeErrorZPtr {
11141 /// A pointer to the contents in the success state.
11142 /// Reading from this pointer when `result_ok` is not set is undefined.
11143 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11144 /// A pointer to the contents in the error state.
11145 /// Reading from this pointer when `result_ok` is set is undefined.
11146 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11149 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11150 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11151 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11152 pub struct CResult_ChannelInfoDecodeErrorZ {
11153 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11154 /// `err` or `result` depending on the state of `result_ok`.
11155 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11156 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11157 pub result_ok: bool,
11160 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11161 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11162 CResult_ChannelInfoDecodeErrorZ {
11163 contents: CResult_ChannelInfoDecodeErrorZPtr {
11164 result: Box::into_raw(Box::new(o)),
11170 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11171 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11172 CResult_ChannelInfoDecodeErrorZ {
11173 contents: CResult_ChannelInfoDecodeErrorZPtr {
11174 err: Box::into_raw(Box::new(e)),
11179 /// Checks if the given object is currently in the success state
11181 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11185 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11186 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11187 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11188 fn drop(&mut self) {
11189 if self.result_ok {
11190 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11191 let _ = unsafe { Box::from_raw(self.contents.result) };
11194 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11195 let _ = unsafe { Box::from_raw(self.contents.err) };
11200 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11201 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11202 let contents = if o.result_ok {
11203 let result = unsafe { o.contents.result };
11204 unsafe { o.contents.result = core::ptr::null_mut() };
11205 CResult_ChannelInfoDecodeErrorZPtr { result }
11207 let err = unsafe { o.contents.err };
11208 unsafe { o.contents.err = core::ptr::null_mut(); }
11209 CResult_ChannelInfoDecodeErrorZPtr { err }
11213 result_ok: o.result_ok,
11217 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11218 fn clone(&self) -> Self {
11219 if self.result_ok {
11220 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11221 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11224 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11225 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11231 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11232 /// but with all dynamically-allocated buffers duplicated in new buffers.
11233 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11235 /// The contents of CResult_RoutingFeesDecodeErrorZ
11236 pub union CResult_RoutingFeesDecodeErrorZPtr {
11237 /// A pointer to the contents in the success state.
11238 /// Reading from this pointer when `result_ok` is not set is undefined.
11239 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11240 /// A pointer to the contents in the error state.
11241 /// Reading from this pointer when `result_ok` is set is undefined.
11242 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11245 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11246 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11248 pub struct CResult_RoutingFeesDecodeErrorZ {
11249 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11250 /// `err` or `result` depending on the state of `result_ok`.
11251 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11252 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11253 pub result_ok: bool,
11256 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11257 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11258 CResult_RoutingFeesDecodeErrorZ {
11259 contents: CResult_RoutingFeesDecodeErrorZPtr {
11260 result: Box::into_raw(Box::new(o)),
11266 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11267 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11268 CResult_RoutingFeesDecodeErrorZ {
11269 contents: CResult_RoutingFeesDecodeErrorZPtr {
11270 err: Box::into_raw(Box::new(e)),
11275 /// Checks if the given object is currently in the success state
11277 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11281 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11282 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11283 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11284 fn drop(&mut self) {
11285 if self.result_ok {
11286 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11287 let _ = unsafe { Box::from_raw(self.contents.result) };
11290 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11291 let _ = unsafe { Box::from_raw(self.contents.err) };
11296 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11297 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11298 let contents = if o.result_ok {
11299 let result = unsafe { o.contents.result };
11300 unsafe { o.contents.result = core::ptr::null_mut() };
11301 CResult_RoutingFeesDecodeErrorZPtr { result }
11303 let err = unsafe { o.contents.err };
11304 unsafe { o.contents.err = core::ptr::null_mut(); }
11305 CResult_RoutingFeesDecodeErrorZPtr { err }
11309 result_ok: o.result_ok,
11313 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11314 fn clone(&self) -> Self {
11315 if self.result_ok {
11316 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11317 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11320 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11321 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11327 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11328 /// but with all dynamically-allocated buffers duplicated in new buffers.
11329 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11331 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11332 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11333 /// A pointer to the contents in the success state.
11334 /// Reading from this pointer when `result_ok` is not set is undefined.
11335 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11336 /// A pointer to the contents in the error state.
11337 /// Reading from this pointer when `result_ok` is set is undefined.
11338 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11341 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11342 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11344 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11345 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11346 /// `err` or `result` depending on the state of `result_ok`.
11347 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11348 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11349 pub result_ok: bool,
11352 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11353 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11354 CResult_NodeAnnouncementInfoDecodeErrorZ {
11355 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11356 result: Box::into_raw(Box::new(o)),
11362 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11363 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11364 CResult_NodeAnnouncementInfoDecodeErrorZ {
11365 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11366 err: Box::into_raw(Box::new(e)),
11371 /// Checks if the given object is currently in the success state
11373 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11377 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11378 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11379 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11380 fn drop(&mut self) {
11381 if self.result_ok {
11382 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11383 let _ = unsafe { Box::from_raw(self.contents.result) };
11386 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11387 let _ = unsafe { Box::from_raw(self.contents.err) };
11392 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11393 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11394 let contents = if o.result_ok {
11395 let result = unsafe { o.contents.result };
11396 unsafe { o.contents.result = core::ptr::null_mut() };
11397 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11399 let err = unsafe { o.contents.err };
11400 unsafe { o.contents.err = core::ptr::null_mut(); }
11401 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11405 result_ok: o.result_ok,
11409 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11410 fn clone(&self) -> Self {
11411 if self.result_ok {
11412 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11413 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11416 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11417 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11423 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11424 /// but with all dynamically-allocated buffers duplicated in new buffers.
11425 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11427 /// A dynamically-allocated array of u64s of arbitrary size.
11428 /// This corresponds to std::vector in C++
11429 pub struct CVec_u64Z {
11430 /// The elements in the array.
11431 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11432 pub data: *mut u64,
11433 /// The number of elements pointed to by `data`.
11437 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11438 if self.datalen == 0 { return Vec::new(); }
11439 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11440 self.data = core::ptr::null_mut();
11444 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11445 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11448 impl From<Vec<u64>> for CVec_u64Z {
11449 fn from(v: Vec<u64>) -> Self {
11450 let datalen = v.len();
11451 let data = Box::into_raw(v.into_boxed_slice());
11452 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11456 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11457 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11458 impl Drop for CVec_u64Z {
11459 fn drop(&mut self) {
11460 if self.datalen == 0 { return; }
11461 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11464 impl Clone for CVec_u64Z {
11465 fn clone(&self) -> Self {
11466 let mut res = Vec::new();
11467 if self.datalen == 0 { return Self::from(res); }
11468 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11473 /// The contents of CResult_NodeInfoDecodeErrorZ
11474 pub union CResult_NodeInfoDecodeErrorZPtr {
11475 /// A pointer to the contents in the success state.
11476 /// Reading from this pointer when `result_ok` is not set is undefined.
11477 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11478 /// A pointer to the contents in the error state.
11479 /// Reading from this pointer when `result_ok` is set is undefined.
11480 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11483 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11484 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11485 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11486 pub struct CResult_NodeInfoDecodeErrorZ {
11487 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11488 /// `err` or `result` depending on the state of `result_ok`.
11489 pub contents: CResult_NodeInfoDecodeErrorZPtr,
11490 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11491 pub result_ok: bool,
11494 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11495 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11496 CResult_NodeInfoDecodeErrorZ {
11497 contents: CResult_NodeInfoDecodeErrorZPtr {
11498 result: Box::into_raw(Box::new(o)),
11504 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11505 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11506 CResult_NodeInfoDecodeErrorZ {
11507 contents: CResult_NodeInfoDecodeErrorZPtr {
11508 err: Box::into_raw(Box::new(e)),
11513 /// Checks if the given object is currently in the success state
11515 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11519 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11520 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11521 impl Drop for CResult_NodeInfoDecodeErrorZ {
11522 fn drop(&mut self) {
11523 if self.result_ok {
11524 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11525 let _ = unsafe { Box::from_raw(self.contents.result) };
11528 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11529 let _ = unsafe { Box::from_raw(self.contents.err) };
11534 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11535 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11536 let contents = if o.result_ok {
11537 let result = unsafe { o.contents.result };
11538 unsafe { o.contents.result = core::ptr::null_mut() };
11539 CResult_NodeInfoDecodeErrorZPtr { result }
11541 let err = unsafe { o.contents.err };
11542 unsafe { o.contents.err = core::ptr::null_mut(); }
11543 CResult_NodeInfoDecodeErrorZPtr { err }
11547 result_ok: o.result_ok,
11551 impl Clone for CResult_NodeInfoDecodeErrorZ {
11552 fn clone(&self) -> Self {
11553 if self.result_ok {
11554 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11555 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11558 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11559 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11565 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11566 /// but with all dynamically-allocated buffers duplicated in new buffers.
11567 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11569 /// The contents of CResult_NetworkGraphDecodeErrorZ
11570 pub union CResult_NetworkGraphDecodeErrorZPtr {
11571 /// A pointer to the contents in the success state.
11572 /// Reading from this pointer when `result_ok` is not set is undefined.
11573 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11574 /// A pointer to the contents in the error state.
11575 /// Reading from this pointer when `result_ok` is set is undefined.
11576 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11579 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11580 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11582 pub struct CResult_NetworkGraphDecodeErrorZ {
11583 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11584 /// `err` or `result` depending on the state of `result_ok`.
11585 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11586 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11587 pub result_ok: bool,
11590 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11591 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11592 CResult_NetworkGraphDecodeErrorZ {
11593 contents: CResult_NetworkGraphDecodeErrorZPtr {
11594 result: Box::into_raw(Box::new(o)),
11600 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11601 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11602 CResult_NetworkGraphDecodeErrorZ {
11603 contents: CResult_NetworkGraphDecodeErrorZPtr {
11604 err: Box::into_raw(Box::new(e)),
11609 /// Checks if the given object is currently in the success state
11611 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11615 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11616 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11617 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11618 fn drop(&mut self) {
11619 if self.result_ok {
11620 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11621 let _ = unsafe { Box::from_raw(self.contents.result) };
11624 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11625 let _ = unsafe { Box::from_raw(self.contents.err) };
11630 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11631 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11632 let contents = if o.result_ok {
11633 let result = unsafe { o.contents.result };
11634 unsafe { o.contents.result = core::ptr::null_mut() };
11635 CResult_NetworkGraphDecodeErrorZPtr { result }
11637 let err = unsafe { o.contents.err };
11638 unsafe { o.contents.err = core::ptr::null_mut(); }
11639 CResult_NetworkGraphDecodeErrorZPtr { err }
11643 result_ok: o.result_ok,
11647 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11648 fn clone(&self) -> Self {
11649 if self.result_ok {
11650 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11651 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11654 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11655 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11661 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11662 /// but with all dynamically-allocated buffers duplicated in new buffers.
11663 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11666 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11667 pub enum COption_CVec_NetAddressZZ {
11668 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11669 Some(crate::c_types::derived::CVec_NetAddressZ),
11670 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11673 impl COption_CVec_NetAddressZZ {
11674 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11675 if let Self::None = self { false } else { true }
11677 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11680 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11681 if let Self::Some(v) = self { v } else { unreachable!() }
11685 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11686 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11687 COption_CVec_NetAddressZZ::Some(o)
11690 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11691 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11692 COption_CVec_NetAddressZZ::None
11695 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11696 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11698 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11699 /// but with all dynamically-allocated buffers duplicated in new buffers.
11700 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11702 /// The contents of CResult_NetAddressDecodeErrorZ
11703 pub union CResult_NetAddressDecodeErrorZPtr {
11704 /// A pointer to the contents in the success state.
11705 /// Reading from this pointer when `result_ok` is not set is undefined.
11706 pub result: *mut crate::lightning::ln::msgs::NetAddress,
11707 /// A pointer to the contents in the error state.
11708 /// Reading from this pointer when `result_ok` is set is undefined.
11709 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11712 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11713 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11714 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11715 pub struct CResult_NetAddressDecodeErrorZ {
11716 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11717 /// `err` or `result` depending on the state of `result_ok`.
11718 pub contents: CResult_NetAddressDecodeErrorZPtr,
11719 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11720 pub result_ok: bool,
11723 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11724 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11725 CResult_NetAddressDecodeErrorZ {
11726 contents: CResult_NetAddressDecodeErrorZPtr {
11727 result: Box::into_raw(Box::new(o)),
11733 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11734 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11735 CResult_NetAddressDecodeErrorZ {
11736 contents: CResult_NetAddressDecodeErrorZPtr {
11737 err: Box::into_raw(Box::new(e)),
11742 /// Checks if the given object is currently in the success state
11744 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11748 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11749 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11750 impl Drop for CResult_NetAddressDecodeErrorZ {
11751 fn drop(&mut self) {
11752 if self.result_ok {
11753 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11754 let _ = unsafe { Box::from_raw(self.contents.result) };
11757 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11758 let _ = unsafe { Box::from_raw(self.contents.err) };
11763 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11764 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11765 let contents = if o.result_ok {
11766 let result = unsafe { o.contents.result };
11767 unsafe { o.contents.result = core::ptr::null_mut() };
11768 CResult_NetAddressDecodeErrorZPtr { result }
11770 let err = unsafe { o.contents.err };
11771 unsafe { o.contents.err = core::ptr::null_mut(); }
11772 CResult_NetAddressDecodeErrorZPtr { err }
11776 result_ok: o.result_ok,
11780 impl Clone for CResult_NetAddressDecodeErrorZ {
11781 fn clone(&self) -> Self {
11782 if self.result_ok {
11783 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11784 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11787 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11788 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11794 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11795 /// but with all dynamically-allocated buffers duplicated in new buffers.
11796 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11798 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11799 /// This corresponds to std::vector in C++
11800 pub struct CVec_UpdateAddHTLCZ {
11801 /// The elements in the array.
11802 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11803 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11804 /// The number of elements pointed to by `data`.
11807 impl CVec_UpdateAddHTLCZ {
11808 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11809 if self.datalen == 0 { return Vec::new(); }
11810 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11811 self.data = core::ptr::null_mut();
11815 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11816 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11819 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11820 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11821 let datalen = v.len();
11822 let data = Box::into_raw(v.into_boxed_slice());
11823 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11827 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11828 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11829 impl Drop for CVec_UpdateAddHTLCZ {
11830 fn drop(&mut self) {
11831 if self.datalen == 0 { return; }
11832 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11835 impl Clone for CVec_UpdateAddHTLCZ {
11836 fn clone(&self) -> Self {
11837 let mut res = Vec::new();
11838 if self.datalen == 0 { return Self::from(res); }
11839 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11844 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11845 /// This corresponds to std::vector in C++
11846 pub struct CVec_UpdateFulfillHTLCZ {
11847 /// The elements in the array.
11848 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11849 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11850 /// The number of elements pointed to by `data`.
11853 impl CVec_UpdateFulfillHTLCZ {
11854 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11855 if self.datalen == 0 { return Vec::new(); }
11856 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11857 self.data = core::ptr::null_mut();
11861 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11862 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11865 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11866 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11867 let datalen = v.len();
11868 let data = Box::into_raw(v.into_boxed_slice());
11869 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11873 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11874 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11875 impl Drop for CVec_UpdateFulfillHTLCZ {
11876 fn drop(&mut self) {
11877 if self.datalen == 0 { return; }
11878 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11881 impl Clone for CVec_UpdateFulfillHTLCZ {
11882 fn clone(&self) -> Self {
11883 let mut res = Vec::new();
11884 if self.datalen == 0 { return Self::from(res); }
11885 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11890 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11891 /// This corresponds to std::vector in C++
11892 pub struct CVec_UpdateFailHTLCZ {
11893 /// The elements in the array.
11894 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11895 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11896 /// The number of elements pointed to by `data`.
11899 impl CVec_UpdateFailHTLCZ {
11900 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11901 if self.datalen == 0 { return Vec::new(); }
11902 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11903 self.data = core::ptr::null_mut();
11907 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11908 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11911 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11912 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11913 let datalen = v.len();
11914 let data = Box::into_raw(v.into_boxed_slice());
11915 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11919 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11920 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11921 impl Drop for CVec_UpdateFailHTLCZ {
11922 fn drop(&mut self) {
11923 if self.datalen == 0 { return; }
11924 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11927 impl Clone for CVec_UpdateFailHTLCZ {
11928 fn clone(&self) -> Self {
11929 let mut res = Vec::new();
11930 if self.datalen == 0 { return Self::from(res); }
11931 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11936 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11937 /// This corresponds to std::vector in C++
11938 pub struct CVec_UpdateFailMalformedHTLCZ {
11939 /// The elements in the array.
11940 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11941 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11942 /// The number of elements pointed to by `data`.
11945 impl CVec_UpdateFailMalformedHTLCZ {
11946 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11947 if self.datalen == 0 { return Vec::new(); }
11948 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11949 self.data = core::ptr::null_mut();
11953 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11954 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11957 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11958 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11959 let datalen = v.len();
11960 let data = Box::into_raw(v.into_boxed_slice());
11961 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11965 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11966 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11967 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11968 fn drop(&mut self) {
11969 if self.datalen == 0 { return; }
11970 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11973 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11974 fn clone(&self) -> Self {
11975 let mut res = Vec::new();
11976 if self.datalen == 0 { return Self::from(res); }
11977 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11982 /// The contents of CResult_AcceptChannelDecodeErrorZ
11983 pub union CResult_AcceptChannelDecodeErrorZPtr {
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::AcceptChannel,
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_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11993 /// containing a crate::lightning::ln::msgs::AcceptChannel 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_AcceptChannelDecodeErrorZ {
11996 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11997 /// `err` or `result` depending on the state of `result_ok`.
11998 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11999 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12000 pub result_ok: bool,
12003 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12004 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12005 CResult_AcceptChannelDecodeErrorZ {
12006 contents: CResult_AcceptChannelDecodeErrorZPtr {
12007 result: Box::into_raw(Box::new(o)),
12013 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12014 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12015 CResult_AcceptChannelDecodeErrorZ {
12016 contents: CResult_AcceptChannelDecodeErrorZPtr {
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_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12028 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12029 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12030 impl Drop for CResult_AcceptChannelDecodeErrorZ {
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::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12044 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, 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_AcceptChannelDecodeErrorZPtr { result }
12050 let err = unsafe { o.contents.err };
12051 unsafe { o.contents.err = core::ptr::null_mut(); }
12052 CResult_AcceptChannelDecodeErrorZPtr { err }
12056 result_ok: o.result_ok,
12060 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12061 fn clone(&self) -> Self {
12062 if self.result_ok {
12063 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12064 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12067 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12068 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12074 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12075 /// but with all dynamically-allocated buffers duplicated in new buffers.
12076 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12078 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12079 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
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::AnnouncementSignatures,
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_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12089 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures 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_AnnouncementSignaturesDecodeErrorZ {
12092 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12093 /// `err` or `result` depending on the state of `result_ok`.
12094 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12095 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12096 pub result_ok: bool,
12099 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12100 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12101 CResult_AnnouncementSignaturesDecodeErrorZ {
12102 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12103 result: Box::into_raw(Box::new(o)),
12109 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12110 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12111 CResult_AnnouncementSignaturesDecodeErrorZ {
12112 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
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_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12124 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12125 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12126 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
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::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12140 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, 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_AnnouncementSignaturesDecodeErrorZPtr { result }
12146 let err = unsafe { o.contents.err };
12147 unsafe { o.contents.err = core::ptr::null_mut(); }
12148 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12152 result_ok: o.result_ok,
12156 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12157 fn clone(&self) -> Self {
12158 if self.result_ok {
12159 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12160 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12163 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12164 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12170 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12171 /// but with all dynamically-allocated buffers duplicated in new buffers.
12172 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12174 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12175 pub union CResult_ChannelReestablishDecodeErrorZPtr {
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::ChannelReestablish,
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_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12185 /// containing a crate::lightning::ln::msgs::ChannelReestablish 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_ChannelReestablishDecodeErrorZ {
12188 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12189 /// `err` or `result` depending on the state of `result_ok`.
12190 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12191 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12192 pub result_ok: bool,
12195 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12196 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12197 CResult_ChannelReestablishDecodeErrorZ {
12198 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12199 result: Box::into_raw(Box::new(o)),
12205 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12206 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12207 CResult_ChannelReestablishDecodeErrorZ {
12208 contents: CResult_ChannelReestablishDecodeErrorZPtr {
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_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12220 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12221 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12222 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
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::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12236 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, 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_ChannelReestablishDecodeErrorZPtr { result }
12242 let err = unsafe { o.contents.err };
12243 unsafe { o.contents.err = core::ptr::null_mut(); }
12244 CResult_ChannelReestablishDecodeErrorZPtr { err }
12248 result_ok: o.result_ok,
12252 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12253 fn clone(&self) -> Self {
12254 if self.result_ok {
12255 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12256 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12259 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12260 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12266 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12267 /// but with all dynamically-allocated buffers duplicated in new buffers.
12268 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12270 /// The contents of CResult_ClosingSignedDecodeErrorZ
12271 pub union CResult_ClosingSignedDecodeErrorZPtr {
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::ClosingSigned,
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_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12281 /// containing a crate::lightning::ln::msgs::ClosingSigned 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_ClosingSignedDecodeErrorZ {
12284 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12285 /// `err` or `result` depending on the state of `result_ok`.
12286 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12287 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12288 pub result_ok: bool,
12291 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12292 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12293 CResult_ClosingSignedDecodeErrorZ {
12294 contents: CResult_ClosingSignedDecodeErrorZPtr {
12295 result: Box::into_raw(Box::new(o)),
12301 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12302 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12303 CResult_ClosingSignedDecodeErrorZ {
12304 contents: CResult_ClosingSignedDecodeErrorZPtr {
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_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12316 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12317 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12318 impl Drop for CResult_ClosingSignedDecodeErrorZ {
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::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12332 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, 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_ClosingSignedDecodeErrorZPtr { result }
12338 let err = unsafe { o.contents.err };
12339 unsafe { o.contents.err = core::ptr::null_mut(); }
12340 CResult_ClosingSignedDecodeErrorZPtr { err }
12344 result_ok: o.result_ok,
12348 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12349 fn clone(&self) -> Self {
12350 if self.result_ok {
12351 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12352 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12355 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12356 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12362 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12363 /// but with all dynamically-allocated buffers duplicated in new buffers.
12364 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12366 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12367 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
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::ClosingSignedFeeRange,
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_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12377 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange 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_ClosingSignedFeeRangeDecodeErrorZ {
12380 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12381 /// `err` or `result` depending on the state of `result_ok`.
12382 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12383 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12384 pub result_ok: bool,
12387 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12388 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12389 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12390 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12391 result: Box::into_raw(Box::new(o)),
12397 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12398 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12399 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12400 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
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_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12412 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12413 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12414 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
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::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12428 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, 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_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12434 let err = unsafe { o.contents.err };
12435 unsafe { o.contents.err = core::ptr::null_mut(); }
12436 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12440 result_ok: o.result_ok,
12444 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12445 fn clone(&self) -> Self {
12446 if self.result_ok {
12447 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12448 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12451 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12452 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12458 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12459 /// but with all dynamically-allocated buffers duplicated in new buffers.
12460 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12462 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12463 pub union CResult_CommitmentSignedDecodeErrorZPtr {
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::CommitmentSigned,
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_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12473 /// containing a crate::lightning::ln::msgs::CommitmentSigned 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_CommitmentSignedDecodeErrorZ {
12476 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12477 /// `err` or `result` depending on the state of `result_ok`.
12478 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12479 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12480 pub result_ok: bool,
12483 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12484 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12485 CResult_CommitmentSignedDecodeErrorZ {
12486 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12487 result: Box::into_raw(Box::new(o)),
12493 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12494 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12495 CResult_CommitmentSignedDecodeErrorZ {
12496 contents: CResult_CommitmentSignedDecodeErrorZPtr {
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_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12508 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12509 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12510 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
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::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12524 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, 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_CommitmentSignedDecodeErrorZPtr { result }
12530 let err = unsafe { o.contents.err };
12531 unsafe { o.contents.err = core::ptr::null_mut(); }
12532 CResult_CommitmentSignedDecodeErrorZPtr { err }
12536 result_ok: o.result_ok,
12540 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12541 fn clone(&self) -> Self {
12542 if self.result_ok {
12543 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12544 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12547 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12548 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12554 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12555 /// but with all dynamically-allocated buffers duplicated in new buffers.
12556 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12558 /// The contents of CResult_FundingCreatedDecodeErrorZ
12559 pub union CResult_FundingCreatedDecodeErrorZPtr {
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::FundingCreated,
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_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12569 /// containing a crate::lightning::ln::msgs::FundingCreated 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_FundingCreatedDecodeErrorZ {
12572 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12573 /// `err` or `result` depending on the state of `result_ok`.
12574 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12575 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12576 pub result_ok: bool,
12579 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12580 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12581 CResult_FundingCreatedDecodeErrorZ {
12582 contents: CResult_FundingCreatedDecodeErrorZPtr {
12583 result: Box::into_raw(Box::new(o)),
12589 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12590 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12591 CResult_FundingCreatedDecodeErrorZ {
12592 contents: CResult_FundingCreatedDecodeErrorZPtr {
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_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12604 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12605 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12606 impl Drop for CResult_FundingCreatedDecodeErrorZ {
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::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12620 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, 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_FundingCreatedDecodeErrorZPtr { result }
12626 let err = unsafe { o.contents.err };
12627 unsafe { o.contents.err = core::ptr::null_mut(); }
12628 CResult_FundingCreatedDecodeErrorZPtr { err }
12632 result_ok: o.result_ok,
12636 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12637 fn clone(&self) -> Self {
12638 if self.result_ok {
12639 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12640 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12643 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12644 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12650 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12651 /// but with all dynamically-allocated buffers duplicated in new buffers.
12652 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12654 /// The contents of CResult_FundingSignedDecodeErrorZ
12655 pub union CResult_FundingSignedDecodeErrorZPtr {
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::FundingSigned,
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_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12665 /// containing a crate::lightning::ln::msgs::FundingSigned 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_FundingSignedDecodeErrorZ {
12668 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12669 /// `err` or `result` depending on the state of `result_ok`.
12670 pub contents: CResult_FundingSignedDecodeErrorZPtr,
12671 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12672 pub result_ok: bool,
12675 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12676 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12677 CResult_FundingSignedDecodeErrorZ {
12678 contents: CResult_FundingSignedDecodeErrorZPtr {
12679 result: Box::into_raw(Box::new(o)),
12685 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12686 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12687 CResult_FundingSignedDecodeErrorZ {
12688 contents: CResult_FundingSignedDecodeErrorZPtr {
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_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12700 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12701 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12702 impl Drop for CResult_FundingSignedDecodeErrorZ {
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::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12716 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, 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_FundingSignedDecodeErrorZPtr { result }
12722 let err = unsafe { o.contents.err };
12723 unsafe { o.contents.err = core::ptr::null_mut(); }
12724 CResult_FundingSignedDecodeErrorZPtr { err }
12728 result_ok: o.result_ok,
12732 impl Clone for CResult_FundingSignedDecodeErrorZ {
12733 fn clone(&self) -> Self {
12734 if self.result_ok {
12735 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12736 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12739 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12740 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12746 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12747 /// but with all dynamically-allocated buffers duplicated in new buffers.
12748 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12750 /// The contents of CResult_FundingLockedDecodeErrorZ
12751 pub union CResult_FundingLockedDecodeErrorZPtr {
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::FundingLocked,
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_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12761 /// containing a crate::lightning::ln::msgs::FundingLocked 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_FundingLockedDecodeErrorZ {
12764 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12765 /// `err` or `result` depending on the state of `result_ok`.
12766 pub contents: CResult_FundingLockedDecodeErrorZPtr,
12767 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12768 pub result_ok: bool,
12771 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12772 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12773 CResult_FundingLockedDecodeErrorZ {
12774 contents: CResult_FundingLockedDecodeErrorZPtr {
12775 result: Box::into_raw(Box::new(o)),
12781 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12782 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12783 CResult_FundingLockedDecodeErrorZ {
12784 contents: CResult_FundingLockedDecodeErrorZPtr {
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_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12796 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12797 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12798 impl Drop for CResult_FundingLockedDecodeErrorZ {
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::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12812 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, 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_FundingLockedDecodeErrorZPtr { result }
12818 let err = unsafe { o.contents.err };
12819 unsafe { o.contents.err = core::ptr::null_mut(); }
12820 CResult_FundingLockedDecodeErrorZPtr { err }
12824 result_ok: o.result_ok,
12828 impl Clone for CResult_FundingLockedDecodeErrorZ {
12829 fn clone(&self) -> Self {
12830 if self.result_ok {
12831 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12832 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12835 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12836 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12842 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12843 /// but with all dynamically-allocated buffers duplicated in new buffers.
12844 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12846 /// The contents of CResult_InitDecodeErrorZ
12847 pub union CResult_InitDecodeErrorZPtr {
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::Init,
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_InitDecodeErrorZ represents the result of a fallible operation,
12857 /// containing a crate::lightning::ln::msgs::Init 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_InitDecodeErrorZ {
12860 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12861 /// `err` or `result` depending on the state of `result_ok`.
12862 pub contents: CResult_InitDecodeErrorZPtr,
12863 /// Whether this CResult_InitDecodeErrorZ represents a success state.
12864 pub result_ok: bool,
12867 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12868 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12869 CResult_InitDecodeErrorZ {
12870 contents: CResult_InitDecodeErrorZPtr {
12871 result: Box::into_raw(Box::new(o)),
12877 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12878 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12879 CResult_InitDecodeErrorZ {
12880 contents: CResult_InitDecodeErrorZPtr {
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_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12892 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12893 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12894 impl Drop for CResult_InitDecodeErrorZ {
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::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12908 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, 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_InitDecodeErrorZPtr { result }
12914 let err = unsafe { o.contents.err };
12915 unsafe { o.contents.err = core::ptr::null_mut(); }
12916 CResult_InitDecodeErrorZPtr { err }
12920 result_ok: o.result_ok,
12924 impl Clone for CResult_InitDecodeErrorZ {
12925 fn clone(&self) -> Self {
12926 if self.result_ok {
12927 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12928 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12931 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12932 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12938 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12939 /// but with all dynamically-allocated buffers duplicated in new buffers.
12940 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12942 /// The contents of CResult_OpenChannelDecodeErrorZ
12943 pub union CResult_OpenChannelDecodeErrorZPtr {
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::OpenChannel,
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_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12953 /// containing a crate::lightning::ln::msgs::OpenChannel 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_OpenChannelDecodeErrorZ {
12956 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12957 /// `err` or `result` depending on the state of `result_ok`.
12958 pub contents: CResult_OpenChannelDecodeErrorZPtr,
12959 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12960 pub result_ok: bool,
12963 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12964 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12965 CResult_OpenChannelDecodeErrorZ {
12966 contents: CResult_OpenChannelDecodeErrorZPtr {
12967 result: Box::into_raw(Box::new(o)),
12973 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12974 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12975 CResult_OpenChannelDecodeErrorZ {
12976 contents: CResult_OpenChannelDecodeErrorZPtr {
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_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12988 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12989 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12990 impl Drop for CResult_OpenChannelDecodeErrorZ {
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::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13004 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, 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_OpenChannelDecodeErrorZPtr { result }
13010 let err = unsafe { o.contents.err };
13011 unsafe { o.contents.err = core::ptr::null_mut(); }
13012 CResult_OpenChannelDecodeErrorZPtr { err }
13016 result_ok: o.result_ok,
13020 impl Clone for CResult_OpenChannelDecodeErrorZ {
13021 fn clone(&self) -> Self {
13022 if self.result_ok {
13023 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13024 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13027 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13028 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13034 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13035 /// but with all dynamically-allocated buffers duplicated in new buffers.
13036 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13038 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13039 pub union CResult_RevokeAndACKDecodeErrorZPtr {
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::RevokeAndACK,
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_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13049 /// containing a crate::lightning::ln::msgs::RevokeAndACK 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_RevokeAndACKDecodeErrorZ {
13052 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13053 /// `err` or `result` depending on the state of `result_ok`.
13054 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13055 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13056 pub result_ok: bool,
13059 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13060 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13061 CResult_RevokeAndACKDecodeErrorZ {
13062 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13063 result: Box::into_raw(Box::new(o)),
13069 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13070 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13071 CResult_RevokeAndACKDecodeErrorZ {
13072 contents: CResult_RevokeAndACKDecodeErrorZPtr {
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_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13084 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13085 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13086 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
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::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13100 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, 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_RevokeAndACKDecodeErrorZPtr { result }
13106 let err = unsafe { o.contents.err };
13107 unsafe { o.contents.err = core::ptr::null_mut(); }
13108 CResult_RevokeAndACKDecodeErrorZPtr { err }
13112 result_ok: o.result_ok,
13116 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13117 fn clone(&self) -> Self {
13118 if self.result_ok {
13119 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13120 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13123 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13124 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13130 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13131 /// but with all dynamically-allocated buffers duplicated in new buffers.
13132 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13134 /// The contents of CResult_ShutdownDecodeErrorZ
13135 pub union CResult_ShutdownDecodeErrorZPtr {
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::Shutdown,
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_ShutdownDecodeErrorZ represents the result of a fallible operation,
13145 /// containing a crate::lightning::ln::msgs::Shutdown 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_ShutdownDecodeErrorZ {
13148 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13149 /// `err` or `result` depending on the state of `result_ok`.
13150 pub contents: CResult_ShutdownDecodeErrorZPtr,
13151 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13152 pub result_ok: bool,
13155 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13156 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13157 CResult_ShutdownDecodeErrorZ {
13158 contents: CResult_ShutdownDecodeErrorZPtr {
13159 result: Box::into_raw(Box::new(o)),
13165 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13166 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13167 CResult_ShutdownDecodeErrorZ {
13168 contents: CResult_ShutdownDecodeErrorZPtr {
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_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13180 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13181 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13182 impl Drop for CResult_ShutdownDecodeErrorZ {
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::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13196 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, 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_ShutdownDecodeErrorZPtr { result }
13202 let err = unsafe { o.contents.err };
13203 unsafe { o.contents.err = core::ptr::null_mut(); }
13204 CResult_ShutdownDecodeErrorZPtr { err }
13208 result_ok: o.result_ok,
13212 impl Clone for CResult_ShutdownDecodeErrorZ {
13213 fn clone(&self) -> Self {
13214 if self.result_ok {
13215 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13216 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13219 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13220 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13226 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13227 /// but with all dynamically-allocated buffers duplicated in new buffers.
13228 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13230 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13231 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
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::UpdateFailHTLC,
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_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13241 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC 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_UpdateFailHTLCDecodeErrorZ {
13244 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13245 /// `err` or `result` depending on the state of `result_ok`.
13246 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13247 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13248 pub result_ok: bool,
13251 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13252 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13253 CResult_UpdateFailHTLCDecodeErrorZ {
13254 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13255 result: Box::into_raw(Box::new(o)),
13261 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13262 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13263 CResult_UpdateFailHTLCDecodeErrorZ {
13264 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
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_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13276 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13277 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13278 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
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::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13292 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, 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_UpdateFailHTLCDecodeErrorZPtr { result }
13298 let err = unsafe { o.contents.err };
13299 unsafe { o.contents.err = core::ptr::null_mut(); }
13300 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13304 result_ok: o.result_ok,
13308 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13309 fn clone(&self) -> Self {
13310 if self.result_ok {
13311 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13312 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13315 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13316 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13322 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13323 /// but with all dynamically-allocated buffers duplicated in new buffers.
13324 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13326 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13327 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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::UpdateFailMalformedHTLC,
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_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13337 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC 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_UpdateFailMalformedHTLCDecodeErrorZ {
13340 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13341 /// `err` or `result` depending on the state of `result_ok`.
13342 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13343 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13344 pub result_ok: bool,
13347 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13348 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13349 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13350 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13351 result: Box::into_raw(Box::new(o)),
13357 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13358 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13359 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13360 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13372 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13373 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13374 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
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::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13388 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, 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_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13394 let err = unsafe { o.contents.err };
13395 unsafe { o.contents.err = core::ptr::null_mut(); }
13396 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13400 result_ok: o.result_ok,
13404 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13405 fn clone(&self) -> Self {
13406 if self.result_ok {
13407 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13408 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13411 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13412 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13418 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13419 /// but with all dynamically-allocated buffers duplicated in new buffers.
13420 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13422 /// The contents of CResult_UpdateFeeDecodeErrorZ
13423 pub union CResult_UpdateFeeDecodeErrorZPtr {
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::UpdateFee,
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_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13433 /// containing a crate::lightning::ln::msgs::UpdateFee 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_UpdateFeeDecodeErrorZ {
13436 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13437 /// `err` or `result` depending on the state of `result_ok`.
13438 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13439 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13440 pub result_ok: bool,
13443 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13444 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13445 CResult_UpdateFeeDecodeErrorZ {
13446 contents: CResult_UpdateFeeDecodeErrorZPtr {
13447 result: Box::into_raw(Box::new(o)),
13453 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13454 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13455 CResult_UpdateFeeDecodeErrorZ {
13456 contents: CResult_UpdateFeeDecodeErrorZPtr {
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_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13468 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13469 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13470 impl Drop for CResult_UpdateFeeDecodeErrorZ {
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::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13484 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, 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_UpdateFeeDecodeErrorZPtr { result }
13490 let err = unsafe { o.contents.err };
13491 unsafe { o.contents.err = core::ptr::null_mut(); }
13492 CResult_UpdateFeeDecodeErrorZPtr { err }
13496 result_ok: o.result_ok,
13500 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13501 fn clone(&self) -> Self {
13502 if self.result_ok {
13503 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13504 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13507 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13508 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13514 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13515 /// but with all dynamically-allocated buffers duplicated in new buffers.
13516 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13518 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13519 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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::UpdateFulfillHTLC,
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_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13529 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC 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_UpdateFulfillHTLCDecodeErrorZ {
13532 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13533 /// `err` or `result` depending on the state of `result_ok`.
13534 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13535 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13536 pub result_ok: bool,
13539 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13540 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13541 CResult_UpdateFulfillHTLCDecodeErrorZ {
13542 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13543 result: Box::into_raw(Box::new(o)),
13549 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13550 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13551 CResult_UpdateFulfillHTLCDecodeErrorZ {
13552 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
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_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13564 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13565 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13566 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
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::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13580 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, 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_UpdateFulfillHTLCDecodeErrorZPtr { result }
13586 let err = unsafe { o.contents.err };
13587 unsafe { o.contents.err = core::ptr::null_mut(); }
13588 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13592 result_ok: o.result_ok,
13596 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13597 fn clone(&self) -> Self {
13598 if self.result_ok {
13599 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13600 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13603 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13604 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13610 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13611 /// but with all dynamically-allocated buffers duplicated in new buffers.
13612 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13614 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13615 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
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::UpdateAddHTLC,
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_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13625 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC 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_UpdateAddHTLCDecodeErrorZ {
13628 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13629 /// `err` or `result` depending on the state of `result_ok`.
13630 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13631 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13632 pub result_ok: bool,
13635 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13636 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13637 CResult_UpdateAddHTLCDecodeErrorZ {
13638 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13639 result: Box::into_raw(Box::new(o)),
13645 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13646 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13647 CResult_UpdateAddHTLCDecodeErrorZ {
13648 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
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_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13660 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13661 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13662 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
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::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13676 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, 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_UpdateAddHTLCDecodeErrorZPtr { result }
13682 let err = unsafe { o.contents.err };
13683 unsafe { o.contents.err = core::ptr::null_mut(); }
13684 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13688 result_ok: o.result_ok,
13692 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13693 fn clone(&self) -> Self {
13694 if self.result_ok {
13695 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13696 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13699 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13700 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13706 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13707 /// but with all dynamically-allocated buffers duplicated in new buffers.
13708 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13710 /// The contents of CResult_PingDecodeErrorZ
13711 pub union CResult_PingDecodeErrorZPtr {
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::Ping,
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_PingDecodeErrorZ represents the result of a fallible operation,
13721 /// containing a crate::lightning::ln::msgs::Ping 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_PingDecodeErrorZ {
13724 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13725 /// `err` or `result` depending on the state of `result_ok`.
13726 pub contents: CResult_PingDecodeErrorZPtr,
13727 /// Whether this CResult_PingDecodeErrorZ represents a success state.
13728 pub result_ok: bool,
13731 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13732 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13733 CResult_PingDecodeErrorZ {
13734 contents: CResult_PingDecodeErrorZPtr {
13735 result: Box::into_raw(Box::new(o)),
13741 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13742 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13743 CResult_PingDecodeErrorZ {
13744 contents: CResult_PingDecodeErrorZPtr {
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_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13756 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13757 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13758 impl Drop for CResult_PingDecodeErrorZ {
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::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13772 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, 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_PingDecodeErrorZPtr { result }
13778 let err = unsafe { o.contents.err };
13779 unsafe { o.contents.err = core::ptr::null_mut(); }
13780 CResult_PingDecodeErrorZPtr { err }
13784 result_ok: o.result_ok,
13788 impl Clone for CResult_PingDecodeErrorZ {
13789 fn clone(&self) -> Self {
13790 if self.result_ok {
13791 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13792 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13795 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13796 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13802 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13803 /// but with all dynamically-allocated buffers duplicated in new buffers.
13804 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13806 /// The contents of CResult_PongDecodeErrorZ
13807 pub union CResult_PongDecodeErrorZPtr {
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::Pong,
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_PongDecodeErrorZ represents the result of a fallible operation,
13817 /// containing a crate::lightning::ln::msgs::Pong 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_PongDecodeErrorZ {
13820 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13821 /// `err` or `result` depending on the state of `result_ok`.
13822 pub contents: CResult_PongDecodeErrorZPtr,
13823 /// Whether this CResult_PongDecodeErrorZ represents a success state.
13824 pub result_ok: bool,
13827 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13828 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13829 CResult_PongDecodeErrorZ {
13830 contents: CResult_PongDecodeErrorZPtr {
13831 result: Box::into_raw(Box::new(o)),
13837 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13838 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13839 CResult_PongDecodeErrorZ {
13840 contents: CResult_PongDecodeErrorZPtr {
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_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13852 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13853 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13854 impl Drop for CResult_PongDecodeErrorZ {
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::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13868 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, 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_PongDecodeErrorZPtr { result }
13874 let err = unsafe { o.contents.err };
13875 unsafe { o.contents.err = core::ptr::null_mut(); }
13876 CResult_PongDecodeErrorZPtr { err }
13880 result_ok: o.result_ok,
13884 impl Clone for CResult_PongDecodeErrorZ {
13885 fn clone(&self) -> Self {
13886 if self.result_ok {
13887 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13888 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13891 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13892 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13898 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13899 /// but with all dynamically-allocated buffers duplicated in new buffers.
13900 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13902 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13903 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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::UnsignedChannelAnnouncement,
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_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13913 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement 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_UnsignedChannelAnnouncementDecodeErrorZ {
13916 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13917 /// `err` or `result` depending on the state of `result_ok`.
13918 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13919 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13920 pub result_ok: bool,
13923 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13924 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13925 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13926 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13927 result: Box::into_raw(Box::new(o)),
13933 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13934 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13935 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13936 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
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_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13948 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13949 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13950 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
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::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13964 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, 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_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13970 let err = unsafe { o.contents.err };
13971 unsafe { o.contents.err = core::ptr::null_mut(); }
13972 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13976 result_ok: o.result_ok,
13980 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13981 fn clone(&self) -> Self {
13982 if self.result_ok {
13983 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13984 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13987 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13988 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13994 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13995 /// but with all dynamically-allocated buffers duplicated in new buffers.
13996 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13998 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13999 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
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::ChannelAnnouncement,
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_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14009 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement 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_ChannelAnnouncementDecodeErrorZ {
14012 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14013 /// `err` or `result` depending on the state of `result_ok`.
14014 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14015 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14016 pub result_ok: bool,
14019 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14020 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14021 CResult_ChannelAnnouncementDecodeErrorZ {
14022 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14023 result: Box::into_raw(Box::new(o)),
14029 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14030 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14031 CResult_ChannelAnnouncementDecodeErrorZ {
14032 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
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_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14044 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14045 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14046 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
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::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14060 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, 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_ChannelAnnouncementDecodeErrorZPtr { result }
14066 let err = unsafe { o.contents.err };
14067 unsafe { o.contents.err = core::ptr::null_mut(); }
14068 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14072 result_ok: o.result_ok,
14076 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14077 fn clone(&self) -> Self {
14078 if self.result_ok {
14079 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14080 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14083 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14084 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14090 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14091 /// but with all dynamically-allocated buffers duplicated in new buffers.
14092 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14094 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14095 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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::ln::msgs::UnsignedChannelUpdate,
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::ln::msgs::DecodeError,
14104 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14105 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14107 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14108 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14109 /// `err` or `result` depending on the state of `result_ok`.
14110 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14111 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14112 pub result_ok: bool,
14115 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14116 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14117 CResult_UnsignedChannelUpdateDecodeErrorZ {
14118 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14119 result: Box::into_raw(Box::new(o)),
14125 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14126 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14127 CResult_UnsignedChannelUpdateDecodeErrorZ {
14128 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
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_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14140 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14141 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14142 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
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::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14156 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> 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_UnsignedChannelUpdateDecodeErrorZPtr { result }
14162 let err = unsafe { o.contents.err };
14163 unsafe { o.contents.err = core::ptr::null_mut(); }
14164 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14168 result_ok: o.result_ok,
14172 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14173 fn clone(&self) -> Self {
14174 if self.result_ok {
14175 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14176 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14179 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14180 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14186 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14187 /// but with all dynamically-allocated buffers duplicated in new buffers.
14188 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14190 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14191 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14192 /// A pointer to the contents in the success state.
14193 /// Reading from this pointer when `result_ok` is not set is undefined.
14194 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14195 /// A pointer to the contents in the error state.
14196 /// Reading from this pointer when `result_ok` is set is undefined.
14197 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14200 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14201 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14203 pub struct CResult_ChannelUpdateDecodeErrorZ {
14204 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14205 /// `err` or `result` depending on the state of `result_ok`.
14206 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14207 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14208 pub result_ok: bool,
14211 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14212 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14213 CResult_ChannelUpdateDecodeErrorZ {
14214 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14215 result: Box::into_raw(Box::new(o)),
14221 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14222 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14223 CResult_ChannelUpdateDecodeErrorZ {
14224 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14225 err: Box::into_raw(Box::new(e)),
14230 /// Checks if the given object is currently in the success state
14232 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14236 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14237 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14238 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14239 fn drop(&mut self) {
14240 if self.result_ok {
14241 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14242 let _ = unsafe { Box::from_raw(self.contents.result) };
14245 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14246 let _ = unsafe { Box::from_raw(self.contents.err) };
14251 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14252 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14253 let contents = if o.result_ok {
14254 let result = unsafe { o.contents.result };
14255 unsafe { o.contents.result = core::ptr::null_mut() };
14256 CResult_ChannelUpdateDecodeErrorZPtr { result }
14258 let err = unsafe { o.contents.err };
14259 unsafe { o.contents.err = core::ptr::null_mut(); }
14260 CResult_ChannelUpdateDecodeErrorZPtr { err }
14264 result_ok: o.result_ok,
14268 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14269 fn clone(&self) -> Self {
14270 if self.result_ok {
14271 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14272 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14275 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14276 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14282 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14283 /// but with all dynamically-allocated buffers duplicated in new buffers.
14284 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14286 /// The contents of CResult_ErrorMessageDecodeErrorZ
14287 pub union CResult_ErrorMessageDecodeErrorZPtr {
14288 /// A pointer to the contents in the success state.
14289 /// Reading from this pointer when `result_ok` is not set is undefined.
14290 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14291 /// A pointer to the contents in the error state.
14292 /// Reading from this pointer when `result_ok` is set is undefined.
14293 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14296 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14297 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14299 pub struct CResult_ErrorMessageDecodeErrorZ {
14300 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14301 /// `err` or `result` depending on the state of `result_ok`.
14302 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14303 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14304 pub result_ok: bool,
14307 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14308 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14309 CResult_ErrorMessageDecodeErrorZ {
14310 contents: CResult_ErrorMessageDecodeErrorZPtr {
14311 result: Box::into_raw(Box::new(o)),
14317 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14318 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14319 CResult_ErrorMessageDecodeErrorZ {
14320 contents: CResult_ErrorMessageDecodeErrorZPtr {
14321 err: Box::into_raw(Box::new(e)),
14326 /// Checks if the given object is currently in the success state
14328 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14332 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14333 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14334 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14335 fn drop(&mut self) {
14336 if self.result_ok {
14337 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14338 let _ = unsafe { Box::from_raw(self.contents.result) };
14341 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14342 let _ = unsafe { Box::from_raw(self.contents.err) };
14347 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14348 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14349 let contents = if o.result_ok {
14350 let result = unsafe { o.contents.result };
14351 unsafe { o.contents.result = core::ptr::null_mut() };
14352 CResult_ErrorMessageDecodeErrorZPtr { result }
14354 let err = unsafe { o.contents.err };
14355 unsafe { o.contents.err = core::ptr::null_mut(); }
14356 CResult_ErrorMessageDecodeErrorZPtr { err }
14360 result_ok: o.result_ok,
14364 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14365 fn clone(&self) -> Self {
14366 if self.result_ok {
14367 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14368 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14371 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14372 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14378 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14379 /// but with all dynamically-allocated buffers duplicated in new buffers.
14380 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14382 /// The contents of CResult_WarningMessageDecodeErrorZ
14383 pub union CResult_WarningMessageDecodeErrorZPtr {
14384 /// A pointer to the contents in the success state.
14385 /// Reading from this pointer when `result_ok` is not set is undefined.
14386 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14387 /// A pointer to the contents in the error state.
14388 /// Reading from this pointer when `result_ok` is set is undefined.
14389 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14392 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14393 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14395 pub struct CResult_WarningMessageDecodeErrorZ {
14396 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14397 /// `err` or `result` depending on the state of `result_ok`.
14398 pub contents: CResult_WarningMessageDecodeErrorZPtr,
14399 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14400 pub result_ok: bool,
14403 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14404 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14405 CResult_WarningMessageDecodeErrorZ {
14406 contents: CResult_WarningMessageDecodeErrorZPtr {
14407 result: Box::into_raw(Box::new(o)),
14413 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14414 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14415 CResult_WarningMessageDecodeErrorZ {
14416 contents: CResult_WarningMessageDecodeErrorZPtr {
14417 err: Box::into_raw(Box::new(e)),
14422 /// Checks if the given object is currently in the success state
14424 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14428 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14429 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14430 impl Drop for CResult_WarningMessageDecodeErrorZ {
14431 fn drop(&mut self) {
14432 if self.result_ok {
14433 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14434 let _ = unsafe { Box::from_raw(self.contents.result) };
14437 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14438 let _ = unsafe { Box::from_raw(self.contents.err) };
14443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14444 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14445 let contents = if o.result_ok {
14446 let result = unsafe { o.contents.result };
14447 unsafe { o.contents.result = core::ptr::null_mut() };
14448 CResult_WarningMessageDecodeErrorZPtr { result }
14450 let err = unsafe { o.contents.err };
14451 unsafe { o.contents.err = core::ptr::null_mut(); }
14452 CResult_WarningMessageDecodeErrorZPtr { err }
14456 result_ok: o.result_ok,
14460 impl Clone for CResult_WarningMessageDecodeErrorZ {
14461 fn clone(&self) -> Self {
14462 if self.result_ok {
14463 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14464 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14467 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14468 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14474 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14475 /// but with all dynamically-allocated buffers duplicated in new buffers.
14476 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14478 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14479 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14480 /// A pointer to the contents in the success state.
14481 /// Reading from this pointer when `result_ok` is not set is undefined.
14482 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14483 /// A pointer to the contents in the error state.
14484 /// Reading from this pointer when `result_ok` is set is undefined.
14485 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14488 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14489 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14491 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14492 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14493 /// `err` or `result` depending on the state of `result_ok`.
14494 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14495 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14496 pub result_ok: bool,
14499 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14500 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14501 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14502 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14503 result: Box::into_raw(Box::new(o)),
14509 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14510 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14511 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14512 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14513 err: Box::into_raw(Box::new(e)),
14518 /// Checks if the given object is currently in the success state
14520 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14524 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14525 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14526 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14527 fn drop(&mut self) {
14528 if self.result_ok {
14529 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14530 let _ = unsafe { Box::from_raw(self.contents.result) };
14533 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14534 let _ = unsafe { Box::from_raw(self.contents.err) };
14539 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14540 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14541 let contents = if o.result_ok {
14542 let result = unsafe { o.contents.result };
14543 unsafe { o.contents.result = core::ptr::null_mut() };
14544 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14546 let err = unsafe { o.contents.err };
14547 unsafe { o.contents.err = core::ptr::null_mut(); }
14548 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14552 result_ok: o.result_ok,
14556 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14557 fn clone(&self) -> Self {
14558 if self.result_ok {
14559 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14560 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14563 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14564 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14570 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14571 /// but with all dynamically-allocated buffers duplicated in new buffers.
14572 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14574 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14575 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14576 /// A pointer to the contents in the success state.
14577 /// Reading from this pointer when `result_ok` is not set is undefined.
14578 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14579 /// A pointer to the contents in the error state.
14580 /// Reading from this pointer when `result_ok` is set is undefined.
14581 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14584 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14585 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14586 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14587 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14588 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14589 /// `err` or `result` depending on the state of `result_ok`.
14590 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14591 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14592 pub result_ok: bool,
14595 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14596 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14597 CResult_NodeAnnouncementDecodeErrorZ {
14598 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14599 result: Box::into_raw(Box::new(o)),
14605 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14606 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14607 CResult_NodeAnnouncementDecodeErrorZ {
14608 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14609 err: Box::into_raw(Box::new(e)),
14614 /// Checks if the given object is currently in the success state
14616 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14620 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14621 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14622 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14623 fn drop(&mut self) {
14624 if self.result_ok {
14625 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14626 let _ = unsafe { Box::from_raw(self.contents.result) };
14629 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14630 let _ = unsafe { Box::from_raw(self.contents.err) };
14635 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14636 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14637 let contents = if o.result_ok {
14638 let result = unsafe { o.contents.result };
14639 unsafe { o.contents.result = core::ptr::null_mut() };
14640 CResult_NodeAnnouncementDecodeErrorZPtr { result }
14642 let err = unsafe { o.contents.err };
14643 unsafe { o.contents.err = core::ptr::null_mut(); }
14644 CResult_NodeAnnouncementDecodeErrorZPtr { err }
14648 result_ok: o.result_ok,
14652 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14653 fn clone(&self) -> Self {
14654 if self.result_ok {
14655 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14656 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14659 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14660 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14666 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14667 /// but with all dynamically-allocated buffers duplicated in new buffers.
14668 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14670 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14671 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14672 /// A pointer to the contents in the success state.
14673 /// Reading from this pointer when `result_ok` is not set is undefined.
14674 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14675 /// A pointer to the contents in the error state.
14676 /// Reading from this pointer when `result_ok` is set is undefined.
14677 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14680 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14681 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14683 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14684 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14685 /// `err` or `result` depending on the state of `result_ok`.
14686 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14687 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14688 pub result_ok: bool,
14691 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14692 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14693 CResult_QueryShortChannelIdsDecodeErrorZ {
14694 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14695 result: Box::into_raw(Box::new(o)),
14701 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14702 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14703 CResult_QueryShortChannelIdsDecodeErrorZ {
14704 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14705 err: Box::into_raw(Box::new(e)),
14710 /// Checks if the given object is currently in the success state
14712 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14716 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14717 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14718 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14719 fn drop(&mut self) {
14720 if self.result_ok {
14721 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14722 let _ = unsafe { Box::from_raw(self.contents.result) };
14725 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14726 let _ = unsafe { Box::from_raw(self.contents.err) };
14731 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14732 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14733 let contents = if o.result_ok {
14734 let result = unsafe { o.contents.result };
14735 unsafe { o.contents.result = core::ptr::null_mut() };
14736 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14738 let err = unsafe { o.contents.err };
14739 unsafe { o.contents.err = core::ptr::null_mut(); }
14740 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14744 result_ok: o.result_ok,
14748 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14749 fn clone(&self) -> Self {
14750 if self.result_ok {
14751 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14752 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14755 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14756 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14762 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14763 /// but with all dynamically-allocated buffers duplicated in new buffers.
14764 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14766 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14767 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14768 /// A pointer to the contents in the success state.
14769 /// Reading from this pointer when `result_ok` is not set is undefined.
14770 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14771 /// A pointer to the contents in the error state.
14772 /// Reading from this pointer when `result_ok` is set is undefined.
14773 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14776 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14777 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14778 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14779 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14780 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14781 /// `err` or `result` depending on the state of `result_ok`.
14782 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14783 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14784 pub result_ok: bool,
14787 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14788 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14789 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14790 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14791 result: Box::into_raw(Box::new(o)),
14797 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14798 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14799 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14800 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14801 err: Box::into_raw(Box::new(e)),
14806 /// Checks if the given object is currently in the success state
14808 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14812 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14813 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14814 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14815 fn drop(&mut self) {
14816 if self.result_ok {
14817 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14818 let _ = unsafe { Box::from_raw(self.contents.result) };
14821 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14822 let _ = unsafe { Box::from_raw(self.contents.err) };
14827 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14828 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14829 let contents = if o.result_ok {
14830 let result = unsafe { o.contents.result };
14831 unsafe { o.contents.result = core::ptr::null_mut() };
14832 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14834 let err = unsafe { o.contents.err };
14835 unsafe { o.contents.err = core::ptr::null_mut(); }
14836 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14840 result_ok: o.result_ok,
14844 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14845 fn clone(&self) -> Self {
14846 if self.result_ok {
14847 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14848 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14851 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14852 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14858 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14859 /// but with all dynamically-allocated buffers duplicated in new buffers.
14860 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14862 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14863 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14864 /// A pointer to the contents in the success state.
14865 /// Reading from this pointer when `result_ok` is not set is undefined.
14866 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14867 /// A pointer to the contents in the error state.
14868 /// Reading from this pointer when `result_ok` is set is undefined.
14869 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14872 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14873 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14875 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14876 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14877 /// `err` or `result` depending on the state of `result_ok`.
14878 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14879 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14880 pub result_ok: bool,
14883 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14884 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14885 CResult_QueryChannelRangeDecodeErrorZ {
14886 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14887 result: Box::into_raw(Box::new(o)),
14893 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14894 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14895 CResult_QueryChannelRangeDecodeErrorZ {
14896 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14897 err: Box::into_raw(Box::new(e)),
14902 /// Checks if the given object is currently in the success state
14904 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14908 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14909 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14910 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14911 fn drop(&mut self) {
14912 if self.result_ok {
14913 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14914 let _ = unsafe { Box::from_raw(self.contents.result) };
14917 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14918 let _ = unsafe { Box::from_raw(self.contents.err) };
14923 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14924 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14925 let contents = if o.result_ok {
14926 let result = unsafe { o.contents.result };
14927 unsafe { o.contents.result = core::ptr::null_mut() };
14928 CResult_QueryChannelRangeDecodeErrorZPtr { result }
14930 let err = unsafe { o.contents.err };
14931 unsafe { o.contents.err = core::ptr::null_mut(); }
14932 CResult_QueryChannelRangeDecodeErrorZPtr { err }
14936 result_ok: o.result_ok,
14940 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14941 fn clone(&self) -> Self {
14942 if self.result_ok {
14943 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14944 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14947 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14948 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14954 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14955 /// but with all dynamically-allocated buffers duplicated in new buffers.
14956 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14958 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14959 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14960 /// A pointer to the contents in the success state.
14961 /// Reading from this pointer when `result_ok` is not set is undefined.
14962 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
14963 /// A pointer to the contents in the error state.
14964 /// Reading from this pointer when `result_ok` is set is undefined.
14965 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14968 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
14969 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14970 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14971 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
14972 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
14973 /// `err` or `result` depending on the state of `result_ok`.
14974 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
14975 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
14976 pub result_ok: bool,
14979 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
14980 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
14981 CResult_ReplyChannelRangeDecodeErrorZ {
14982 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14983 result: Box::into_raw(Box::new(o)),
14989 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
14990 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
14991 CResult_ReplyChannelRangeDecodeErrorZ {
14992 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14993 err: Box::into_raw(Box::new(e)),
14998 /// Checks if the given object is currently in the success state
15000 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15004 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15005 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15006 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15007 fn drop(&mut self) {
15008 if self.result_ok {
15009 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15010 let _ = unsafe { Box::from_raw(self.contents.result) };
15013 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15014 let _ = unsafe { Box::from_raw(self.contents.err) };
15019 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15020 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15021 let contents = if o.result_ok {
15022 let result = unsafe { o.contents.result };
15023 unsafe { o.contents.result = core::ptr::null_mut() };
15024 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15026 let err = unsafe { o.contents.err };
15027 unsafe { o.contents.err = core::ptr::null_mut(); }
15028 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15032 result_ok: o.result_ok,
15036 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15037 fn clone(&self) -> Self {
15038 if self.result_ok {
15039 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15040 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15043 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15044 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15050 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15051 /// but with all dynamically-allocated buffers duplicated in new buffers.
15052 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15054 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15055 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15056 /// A pointer to the contents in the success state.
15057 /// Reading from this pointer when `result_ok` is not set is undefined.
15058 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15059 /// A pointer to the contents in the error state.
15060 /// Reading from this pointer when `result_ok` is set is undefined.
15061 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15064 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15065 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15066 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15067 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15068 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15069 /// `err` or `result` depending on the state of `result_ok`.
15070 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15071 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15072 pub result_ok: bool,
15075 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15076 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15077 CResult_GossipTimestampFilterDecodeErrorZ {
15078 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15079 result: Box::into_raw(Box::new(o)),
15085 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15086 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15087 CResult_GossipTimestampFilterDecodeErrorZ {
15088 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15089 err: Box::into_raw(Box::new(e)),
15094 /// Checks if the given object is currently in the success state
15096 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15100 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15101 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15102 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15103 fn drop(&mut self) {
15104 if self.result_ok {
15105 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15106 let _ = unsafe { Box::from_raw(self.contents.result) };
15109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15110 let _ = unsafe { Box::from_raw(self.contents.err) };
15115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15116 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15117 let contents = if o.result_ok {
15118 let result = unsafe { o.contents.result };
15119 unsafe { o.contents.result = core::ptr::null_mut() };
15120 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15122 let err = unsafe { o.contents.err };
15123 unsafe { o.contents.err = core::ptr::null_mut(); }
15124 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15128 result_ok: o.result_ok,
15132 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15133 fn clone(&self) -> Self {
15134 if self.result_ok {
15135 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15136 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15139 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15140 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15146 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15147 /// but with all dynamically-allocated buffers duplicated in new buffers.
15148 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15150 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15151 /// This corresponds to std::vector in C++
15152 pub struct CVec_PhantomRouteHintsZ {
15153 /// The elements in the array.
15154 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15155 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15156 /// The number of elements pointed to by `data`.
15159 impl CVec_PhantomRouteHintsZ {
15160 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15161 if self.datalen == 0 { return Vec::new(); }
15162 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15163 self.data = core::ptr::null_mut();
15167 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15168 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15171 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15172 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15173 let datalen = v.len();
15174 let data = Box::into_raw(v.into_boxed_slice());
15175 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15180 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15181 impl Drop for CVec_PhantomRouteHintsZ {
15182 fn drop(&mut self) {
15183 if self.datalen == 0 { return; }
15184 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15187 impl Clone for CVec_PhantomRouteHintsZ {
15188 fn clone(&self) -> Self {
15189 let mut res = Vec::new();
15190 if self.datalen == 0 { return Self::from(res); }
15191 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15196 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15197 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15198 /// A pointer to the contents in the success state.
15199 /// Reading from this pointer when `result_ok` is not set is undefined.
15200 pub result: *mut crate::lightning_invoice::Invoice,
15201 /// A pointer to the contents in the error state.
15202 /// Reading from this pointer when `result_ok` is set is undefined.
15203 pub err: *mut crate::lightning_invoice::SignOrCreationError,
15206 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15207 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15208 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15209 pub struct CResult_InvoiceSignOrCreationErrorZ {
15210 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15211 /// `err` or `result` depending on the state of `result_ok`.
15212 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15213 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15214 pub result_ok: bool,
15217 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15218 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15219 CResult_InvoiceSignOrCreationErrorZ {
15220 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15221 result: Box::into_raw(Box::new(o)),
15227 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15228 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15229 CResult_InvoiceSignOrCreationErrorZ {
15230 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15231 err: Box::into_raw(Box::new(e)),
15236 /// Checks if the given object is currently in the success state
15238 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15242 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15243 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15244 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15245 fn drop(&mut self) {
15246 if self.result_ok {
15247 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15248 let _ = unsafe { Box::from_raw(self.contents.result) };
15251 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15252 let _ = unsafe { Box::from_raw(self.contents.err) };
15257 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15258 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15259 let contents = if o.result_ok {
15260 let result = unsafe { o.contents.result };
15261 unsafe { o.contents.result = core::ptr::null_mut() };
15262 CResult_InvoiceSignOrCreationErrorZPtr { result }
15264 let err = unsafe { o.contents.err };
15265 unsafe { o.contents.err = core::ptr::null_mut(); }
15266 CResult_InvoiceSignOrCreationErrorZPtr { err }
15270 result_ok: o.result_ok,
15274 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15275 fn clone(&self) -> Self {
15276 if self.result_ok {
15277 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15278 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15281 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15282 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15288 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15289 /// but with all dynamically-allocated buffers duplicated in new buffers.
15290 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15292 /// An enum which can either contain a crate::lightning::chain::Filter or not
15293 pub enum COption_FilterZ {
15294 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15295 Some(crate::lightning::chain::Filter),
15296 /// When we're in this state, this COption_FilterZ contains nothing
15299 impl COption_FilterZ {
15300 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15301 if let Self::None = self { false } else { true }
15303 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15306 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15307 if let Self::Some(v) = self { v } else { unreachable!() }
15311 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15312 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15313 COption_FilterZ::Some(o)
15316 /// Constructs a new COption_FilterZ containing nothing
15317 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15318 COption_FilterZ::None
15321 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15322 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15324 /// The contents of CResult_LockedChannelMonitorNoneZ
15325 pub union CResult_LockedChannelMonitorNoneZPtr {
15326 /// A pointer to the contents in the success state.
15327 /// Reading from this pointer when `result_ok` is not set is undefined.
15328 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15329 /// Note that this value is always NULL, as there are no contents in the Err variant
15330 pub err: *mut core::ffi::c_void,
15333 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15334 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15336 pub struct CResult_LockedChannelMonitorNoneZ {
15337 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15338 /// `err` or `result` depending on the state of `result_ok`.
15339 pub contents: CResult_LockedChannelMonitorNoneZPtr,
15340 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15341 pub result_ok: bool,
15344 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15345 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15346 CResult_LockedChannelMonitorNoneZ {
15347 contents: CResult_LockedChannelMonitorNoneZPtr {
15348 result: Box::into_raw(Box::new(o)),
15354 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15355 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15356 CResult_LockedChannelMonitorNoneZ {
15357 contents: CResult_LockedChannelMonitorNoneZPtr {
15358 err: core::ptr::null_mut(),
15363 /// Checks if the given object is currently in the success state
15365 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15369 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15370 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15371 impl Drop for CResult_LockedChannelMonitorNoneZ {
15372 fn drop(&mut self) {
15373 if self.result_ok {
15374 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15375 let _ = unsafe { Box::from_raw(self.contents.result) };
15381 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15382 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15383 let contents = if o.result_ok {
15384 let result = unsafe { o.contents.result };
15385 unsafe { o.contents.result = core::ptr::null_mut() };
15386 CResult_LockedChannelMonitorNoneZPtr { result }
15388 let _ = unsafe { Box::from_raw(o.contents.err) };
15389 o.contents.err = core::ptr::null_mut();
15390 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15394 result_ok: o.result_ok,
15399 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15400 /// This corresponds to std::vector in C++
15401 pub struct CVec_OutPointZ {
15402 /// The elements in the array.
15403 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15404 pub data: *mut crate::lightning::chain::transaction::OutPoint,
15405 /// The number of elements pointed to by `data`.
15408 impl CVec_OutPointZ {
15409 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15410 if self.datalen == 0 { return Vec::new(); }
15411 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15412 self.data = core::ptr::null_mut();
15416 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15417 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15420 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15421 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15422 let datalen = v.len();
15423 let data = Box::into_raw(v.into_boxed_slice());
15424 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15428 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15429 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15430 impl Drop for CVec_OutPointZ {
15431 fn drop(&mut self) {
15432 if self.datalen == 0 { return; }
15433 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15436 impl Clone for CVec_OutPointZ {
15437 fn clone(&self) -> Self {
15438 let mut res = Vec::new();
15439 if self.datalen == 0 { return Self::from(res); }
15440 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });