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,
3707 /// The contents of CResult_ScoringParametersDecodeErrorZ
3708 pub union CResult_ScoringParametersDecodeErrorZPtr {
3709 /// A pointer to the contents in the success state.
3710 /// Reading from this pointer when `result_ok` is not set is undefined.
3711 pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3712 /// A pointer to the contents in the error state.
3713 /// Reading from this pointer when `result_ok` is set is undefined.
3714 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3717 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3718 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3720 pub struct CResult_ScoringParametersDecodeErrorZ {
3721 /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3722 /// `err` or `result` depending on the state of `result_ok`.
3723 pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3724 /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3725 pub result_ok: bool,
3728 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3729 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3730 CResult_ScoringParametersDecodeErrorZ {
3731 contents: CResult_ScoringParametersDecodeErrorZPtr {
3732 result: Box::into_raw(Box::new(o)),
3738 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3739 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3740 CResult_ScoringParametersDecodeErrorZ {
3741 contents: CResult_ScoringParametersDecodeErrorZPtr {
3742 err: Box::into_raw(Box::new(e)),
3747 /// Checks if the given object is currently in the success state
3749 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3753 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3754 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3755 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3756 fn drop(&mut self) {
3758 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3759 let _ = unsafe { Box::from_raw(self.contents.result) };
3762 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3763 let _ = unsafe { Box::from_raw(self.contents.err) };
3768 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3769 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3770 let contents = if o.result_ok {
3771 let result = unsafe { o.contents.result };
3772 unsafe { o.contents.result = core::ptr::null_mut() };
3773 CResult_ScoringParametersDecodeErrorZPtr { result }
3775 let err = unsafe { o.contents.err };
3776 unsafe { o.contents.err = core::ptr::null_mut(); }
3777 CResult_ScoringParametersDecodeErrorZPtr { err }
3781 result_ok: o.result_ok,
3786 /// The contents of CResult_ScorerDecodeErrorZ
3787 pub union CResult_ScorerDecodeErrorZPtr {
3788 /// A pointer to the contents in the success state.
3789 /// Reading from this pointer when `result_ok` is not set is undefined.
3790 pub result: *mut crate::lightning::routing::scoring::Scorer,
3791 /// A pointer to the contents in the error state.
3792 /// Reading from this pointer when `result_ok` is set is undefined.
3793 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3796 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3797 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3799 pub struct CResult_ScorerDecodeErrorZ {
3800 /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3801 /// `err` or `result` depending on the state of `result_ok`.
3802 pub contents: CResult_ScorerDecodeErrorZPtr,
3803 /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3804 pub result_ok: bool,
3807 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3808 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3809 CResult_ScorerDecodeErrorZ {
3810 contents: CResult_ScorerDecodeErrorZPtr {
3811 result: Box::into_raw(Box::new(o)),
3817 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3818 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3819 CResult_ScorerDecodeErrorZ {
3820 contents: CResult_ScorerDecodeErrorZPtr {
3821 err: Box::into_raw(Box::new(e)),
3826 /// Checks if the given object is currently in the success state
3828 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3832 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3833 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3834 impl Drop for CResult_ScorerDecodeErrorZ {
3835 fn drop(&mut self) {
3837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3838 let _ = unsafe { Box::from_raw(self.contents.result) };
3841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3842 let _ = unsafe { Box::from_raw(self.contents.err) };
3847 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3848 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3849 let contents = if o.result_ok {
3850 let result = unsafe { o.contents.result };
3851 unsafe { o.contents.result = core::ptr::null_mut() };
3852 CResult_ScorerDecodeErrorZPtr { result }
3854 let err = unsafe { o.contents.err };
3855 unsafe { o.contents.err = core::ptr::null_mut(); }
3856 CResult_ScorerDecodeErrorZPtr { err }
3860 result_ok: o.result_ok,
3865 /// The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
3866 pub union CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3867 /// A pointer to the contents in the success state.
3868 /// Reading from this pointer when `result_ok` is not set is undefined.
3869 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3870 /// A pointer to the contents in the error state.
3871 /// Reading from this pointer when `result_ok` is set is undefined.
3872 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3875 /// A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
3876 /// containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3878 pub struct CResult_ProbabilisticScoringParametersDecodeErrorZ {
3879 /// The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
3880 /// `err` or `result` depending on the state of `result_ok`.
3881 pub contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr,
3882 /// Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
3883 pub result_ok: bool,
3886 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
3887 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScoringParameters) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3888 CResult_ProbabilisticScoringParametersDecodeErrorZ {
3889 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3890 result: Box::into_raw(Box::new(o)),
3896 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
3897 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3898 CResult_ProbabilisticScoringParametersDecodeErrorZ {
3899 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3900 err: Box::into_raw(Box::new(e)),
3905 /// Checks if the given object is currently in the success state
3907 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> bool {
3911 /// Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
3912 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res: CResult_ProbabilisticScoringParametersDecodeErrorZ) { }
3913 impl Drop for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3914 fn drop(&mut self) {
3916 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3917 let _ = unsafe { Box::from_raw(self.contents.result) };
3920 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3921 let _ = unsafe { Box::from_raw(self.contents.err) };
3926 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3927 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3928 let contents = if o.result_ok {
3929 let result = unsafe { o.contents.result };
3930 unsafe { o.contents.result = core::ptr::null_mut() };
3931 CResult_ProbabilisticScoringParametersDecodeErrorZPtr { result }
3933 let err = unsafe { o.contents.err };
3934 unsafe { o.contents.err = core::ptr::null_mut(); }
3935 CResult_ProbabilisticScoringParametersDecodeErrorZPtr { err }
3939 result_ok: o.result_ok,
3943 impl Clone for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3944 fn clone(&self) -> Self {
3946 Self { result_ok: true, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3947 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ProbabilisticScoringParameters>::clone(unsafe { &*self.contents.result })))
3950 Self { result_ok: false, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3951 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3957 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
3958 /// but with all dynamically-allocated buffers duplicated in new buffers.
3959 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> CResult_ProbabilisticScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3961 /// A tuple of 2 elements. See the individual fields for the types contained.
3962 pub struct C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3963 /// The element at position 0
3964 pub a: crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3965 /// The element at position 1
3966 pub b: crate::lightning::routing::network_graph::NetworkGraph,
3968 impl From<(crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::routing::network_graph::NetworkGraph)> for C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3969 fn from (tup: (crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::routing::network_graph::NetworkGraph)) -> Self {
3976 impl C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3977 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::routing::network_graph::NetworkGraph) {
3981 impl Clone for C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3982 fn clone(&self) -> Self {
3984 a: Clone::clone(&self.a),
3985 b: crate::lightning::routing::network_graph::NetworkGraph { inner: self.b.inner, is_owned: false}, }
3989 /// Creates a new tuple which has the same data as `orig`
3990 /// but with all dynamically-allocated buffers duplicated in new buffers.
3991 pub extern "C" fn C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(orig: &C2Tuple_ProbabilisticScoringParametersNetworkGraphZ) -> C2Tuple_ProbabilisticScoringParametersNetworkGraphZ { Clone::clone(&orig) }
3992 /// Creates a new C2Tuple_ProbabilisticScoringParametersNetworkGraphZ from the contained elements.
3994 pub extern "C" fn C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a: crate::lightning::routing::scoring::ProbabilisticScoringParameters, b: &'static crate::lightning::routing::network_graph::NetworkGraph) -> C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3995 C2Tuple_ProbabilisticScoringParametersNetworkGraphZ { a, b: crate::lightning::routing::network_graph::NetworkGraph { inner: b.inner, is_owned: false}, }
3999 /// Frees any resources used by the C2Tuple_ProbabilisticScoringParametersNetworkGraphZ.
4000 pub extern "C" fn C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(_res: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ) { }
4002 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4003 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4004 /// A pointer to the contents in the success state.
4005 /// Reading from this pointer when `result_ok` is not set is undefined.
4006 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4007 /// A pointer to the contents in the error state.
4008 /// Reading from this pointer when `result_ok` is set is undefined.
4009 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4012 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4013 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4015 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4016 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4017 /// `err` or `result` depending on the state of `result_ok`.
4018 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4019 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4020 pub result_ok: bool,
4023 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4024 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4025 CResult_ProbabilisticScorerDecodeErrorZ {
4026 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4027 result: Box::into_raw(Box::new(o)),
4033 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4034 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4035 CResult_ProbabilisticScorerDecodeErrorZ {
4036 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4037 err: Box::into_raw(Box::new(e)),
4042 /// Checks if the given object is currently in the success state
4044 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4048 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4049 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4050 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4051 fn drop(&mut self) {
4053 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4054 let _ = unsafe { Box::from_raw(self.contents.result) };
4057 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4058 let _ = unsafe { Box::from_raw(self.contents.err) };
4063 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4064 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4065 let contents = if o.result_ok {
4066 let result = unsafe { o.contents.result };
4067 unsafe { o.contents.result = core::ptr::null_mut() };
4068 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4070 let err = unsafe { o.contents.err };
4071 unsafe { o.contents.err = core::ptr::null_mut(); }
4072 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4076 result_ok: o.result_ok,
4081 /// The contents of CResult_InitFeaturesDecodeErrorZ
4082 pub union CResult_InitFeaturesDecodeErrorZPtr {
4083 /// A pointer to the contents in the success state.
4084 /// Reading from this pointer when `result_ok` is not set is undefined.
4085 pub result: *mut crate::lightning::ln::features::InitFeatures,
4086 /// A pointer to the contents in the error state.
4087 /// Reading from this pointer when `result_ok` is set is undefined.
4088 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4091 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4092 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4094 pub struct CResult_InitFeaturesDecodeErrorZ {
4095 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4096 /// `err` or `result` depending on the state of `result_ok`.
4097 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4098 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4099 pub result_ok: bool,
4102 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4103 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4104 CResult_InitFeaturesDecodeErrorZ {
4105 contents: CResult_InitFeaturesDecodeErrorZPtr {
4106 result: Box::into_raw(Box::new(o)),
4112 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4113 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4114 CResult_InitFeaturesDecodeErrorZ {
4115 contents: CResult_InitFeaturesDecodeErrorZPtr {
4116 err: Box::into_raw(Box::new(e)),
4121 /// Checks if the given object is currently in the success state
4123 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4127 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4128 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4129 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4130 fn drop(&mut self) {
4132 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4133 let _ = unsafe { Box::from_raw(self.contents.result) };
4136 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4137 let _ = unsafe { Box::from_raw(self.contents.err) };
4142 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4143 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4144 let contents = if o.result_ok {
4145 let result = unsafe { o.contents.result };
4146 unsafe { o.contents.result = core::ptr::null_mut() };
4147 CResult_InitFeaturesDecodeErrorZPtr { result }
4149 let err = unsafe { o.contents.err };
4150 unsafe { o.contents.err = core::ptr::null_mut(); }
4151 CResult_InitFeaturesDecodeErrorZPtr { err }
4155 result_ok: o.result_ok,
4160 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4161 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4162 /// A pointer to the contents in the success state.
4163 /// Reading from this pointer when `result_ok` is not set is undefined.
4164 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4165 /// A pointer to the contents in the error state.
4166 /// Reading from this pointer when `result_ok` is set is undefined.
4167 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4170 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4171 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4173 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4174 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4175 /// `err` or `result` depending on the state of `result_ok`.
4176 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4177 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4178 pub result_ok: bool,
4181 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4182 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4183 CResult_ChannelFeaturesDecodeErrorZ {
4184 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4185 result: Box::into_raw(Box::new(o)),
4191 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4192 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4193 CResult_ChannelFeaturesDecodeErrorZ {
4194 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4195 err: Box::into_raw(Box::new(e)),
4200 /// Checks if the given object is currently in the success state
4202 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4206 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4207 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4208 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4209 fn drop(&mut self) {
4211 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4212 let _ = unsafe { Box::from_raw(self.contents.result) };
4215 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4216 let _ = unsafe { Box::from_raw(self.contents.err) };
4221 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4222 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4223 let contents = if o.result_ok {
4224 let result = unsafe { o.contents.result };
4225 unsafe { o.contents.result = core::ptr::null_mut() };
4226 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4228 let err = unsafe { o.contents.err };
4229 unsafe { o.contents.err = core::ptr::null_mut(); }
4230 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4234 result_ok: o.result_ok,
4239 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4240 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4241 /// A pointer to the contents in the success state.
4242 /// Reading from this pointer when `result_ok` is not set is undefined.
4243 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4244 /// A pointer to the contents in the error state.
4245 /// Reading from this pointer when `result_ok` is set is undefined.
4246 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4249 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4250 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4252 pub struct CResult_NodeFeaturesDecodeErrorZ {
4253 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4254 /// `err` or `result` depending on the state of `result_ok`.
4255 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4256 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4257 pub result_ok: bool,
4260 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4261 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4262 CResult_NodeFeaturesDecodeErrorZ {
4263 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4264 result: Box::into_raw(Box::new(o)),
4270 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4271 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4272 CResult_NodeFeaturesDecodeErrorZ {
4273 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4274 err: Box::into_raw(Box::new(e)),
4279 /// Checks if the given object is currently in the success state
4281 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4285 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4286 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4287 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4288 fn drop(&mut self) {
4290 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4291 let _ = unsafe { Box::from_raw(self.contents.result) };
4294 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4295 let _ = unsafe { Box::from_raw(self.contents.err) };
4300 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4301 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4302 let contents = if o.result_ok {
4303 let result = unsafe { o.contents.result };
4304 unsafe { o.contents.result = core::ptr::null_mut() };
4305 CResult_NodeFeaturesDecodeErrorZPtr { result }
4307 let err = unsafe { o.contents.err };
4308 unsafe { o.contents.err = core::ptr::null_mut(); }
4309 CResult_NodeFeaturesDecodeErrorZPtr { err }
4313 result_ok: o.result_ok,
4318 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4319 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4320 /// A pointer to the contents in the success state.
4321 /// Reading from this pointer when `result_ok` is not set is undefined.
4322 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4323 /// A pointer to the contents in the error state.
4324 /// Reading from this pointer when `result_ok` is set is undefined.
4325 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4328 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4329 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4331 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4332 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4333 /// `err` or `result` depending on the state of `result_ok`.
4334 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4335 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4336 pub result_ok: bool,
4339 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4340 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4341 CResult_InvoiceFeaturesDecodeErrorZ {
4342 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4343 result: Box::into_raw(Box::new(o)),
4349 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4350 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4351 CResult_InvoiceFeaturesDecodeErrorZ {
4352 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4353 err: Box::into_raw(Box::new(e)),
4358 /// Checks if the given object is currently in the success state
4360 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4364 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4365 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4366 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4367 fn drop(&mut self) {
4369 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4370 let _ = unsafe { Box::from_raw(self.contents.result) };
4373 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4374 let _ = unsafe { Box::from_raw(self.contents.err) };
4379 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4380 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4381 let contents = if o.result_ok {
4382 let result = unsafe { o.contents.result };
4383 unsafe { o.contents.result = core::ptr::null_mut() };
4384 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4386 let err = unsafe { o.contents.err };
4387 unsafe { o.contents.err = core::ptr::null_mut(); }
4388 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4392 result_ok: o.result_ok,
4397 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4398 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4399 /// A pointer to the contents in the success state.
4400 /// Reading from this pointer when `result_ok` is not set is undefined.
4401 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4402 /// A pointer to the contents in the error state.
4403 /// Reading from this pointer when `result_ok` is set is undefined.
4404 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4407 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4408 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4410 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4411 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4412 /// `err` or `result` depending on the state of `result_ok`.
4413 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4414 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4415 pub result_ok: bool,
4418 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4419 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4420 CResult_ChannelTypeFeaturesDecodeErrorZ {
4421 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4422 result: Box::into_raw(Box::new(o)),
4428 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4429 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4430 CResult_ChannelTypeFeaturesDecodeErrorZ {
4431 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4432 err: Box::into_raw(Box::new(e)),
4437 /// Checks if the given object is currently in the success state
4439 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4443 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4444 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4445 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4446 fn drop(&mut self) {
4448 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4449 let _ = unsafe { Box::from_raw(self.contents.result) };
4452 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4453 let _ = unsafe { Box::from_raw(self.contents.err) };
4458 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4459 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4460 let contents = if o.result_ok {
4461 let result = unsafe { o.contents.result };
4462 unsafe { o.contents.result = core::ptr::null_mut() };
4463 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4465 let err = unsafe { o.contents.err };
4466 unsafe { o.contents.err = core::ptr::null_mut(); }
4467 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4471 result_ok: o.result_ok,
4476 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4477 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4478 /// A pointer to the contents in the success state.
4479 /// Reading from this pointer when `result_ok` is not set is undefined.
4480 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4481 /// A pointer to the contents in the error state.
4482 /// Reading from this pointer when `result_ok` is set is undefined.
4483 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4486 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4487 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4488 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4489 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4490 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4491 /// `err` or `result` depending on the state of `result_ok`.
4492 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4493 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4494 pub result_ok: bool,
4497 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4498 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4499 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4500 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4501 result: Box::into_raw(Box::new(o)),
4507 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4508 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4509 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4510 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4511 err: Box::into_raw(Box::new(e)),
4516 /// Checks if the given object is currently in the success state
4518 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4522 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4523 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4524 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4525 fn drop(&mut self) {
4527 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4528 let _ = unsafe { Box::from_raw(self.contents.result) };
4531 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4532 let _ = unsafe { Box::from_raw(self.contents.err) };
4537 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4538 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4539 let contents = if o.result_ok {
4540 let result = unsafe { o.contents.result };
4541 unsafe { o.contents.result = core::ptr::null_mut() };
4542 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4544 let err = unsafe { o.contents.err };
4545 unsafe { o.contents.err = core::ptr::null_mut(); }
4546 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4550 result_ok: o.result_ok,
4554 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4555 fn clone(&self) -> Self {
4557 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4558 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4561 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4562 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4568 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4569 /// but with all dynamically-allocated buffers duplicated in new buffers.
4570 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4572 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4573 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4574 /// A pointer to the contents in the success state.
4575 /// Reading from this pointer when `result_ok` is not set is undefined.
4576 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4577 /// A pointer to the contents in the error state.
4578 /// Reading from this pointer when `result_ok` is set is undefined.
4579 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4582 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4583 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4584 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4585 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4586 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4587 /// `err` or `result` depending on the state of `result_ok`.
4588 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4589 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4590 pub result_ok: bool,
4593 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4594 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4595 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4596 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4597 result: Box::into_raw(Box::new(o)),
4603 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4604 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4605 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4606 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4607 err: Box::into_raw(Box::new(e)),
4612 /// Checks if the given object is currently in the success state
4614 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4618 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4619 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4620 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4621 fn drop(&mut self) {
4623 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4624 let _ = unsafe { Box::from_raw(self.contents.result) };
4627 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4628 let _ = unsafe { Box::from_raw(self.contents.err) };
4633 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4634 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4635 let contents = if o.result_ok {
4636 let result = unsafe { o.contents.result };
4637 unsafe { o.contents.result = core::ptr::null_mut() };
4638 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4640 let err = unsafe { o.contents.err };
4641 unsafe { o.contents.err = core::ptr::null_mut(); }
4642 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4646 result_ok: o.result_ok,
4650 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4651 fn clone(&self) -> Self {
4653 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4654 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4657 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4658 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4664 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4665 /// but with all dynamically-allocated buffers duplicated in new buffers.
4666 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4668 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4669 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4670 /// A pointer to the contents in the success state.
4671 /// Reading from this pointer when `result_ok` is not set is undefined.
4672 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4673 /// A pointer to the contents in the error state.
4674 /// Reading from this pointer when `result_ok` is set is undefined.
4675 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4678 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4679 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4680 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4681 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4682 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4683 /// `err` or `result` depending on the state of `result_ok`.
4684 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4685 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4686 pub result_ok: bool,
4689 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4690 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4691 CResult_SpendableOutputDescriptorDecodeErrorZ {
4692 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4693 result: Box::into_raw(Box::new(o)),
4699 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4700 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4701 CResult_SpendableOutputDescriptorDecodeErrorZ {
4702 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4703 err: Box::into_raw(Box::new(e)),
4708 /// Checks if the given object is currently in the success state
4710 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4714 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4715 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4716 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4717 fn drop(&mut self) {
4719 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4720 let _ = unsafe { Box::from_raw(self.contents.result) };
4723 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4724 let _ = unsafe { Box::from_raw(self.contents.err) };
4729 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4730 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4731 let contents = if o.result_ok {
4732 let result = unsafe { o.contents.result };
4733 unsafe { o.contents.result = core::ptr::null_mut() };
4734 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4736 let err = unsafe { o.contents.err };
4737 unsafe { o.contents.err = core::ptr::null_mut(); }
4738 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4742 result_ok: o.result_ok,
4746 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4747 fn clone(&self) -> Self {
4749 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4750 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4753 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4754 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4760 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4761 /// but with all dynamically-allocated buffers duplicated in new buffers.
4762 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4764 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4765 /// This corresponds to std::vector in C++
4766 pub struct CVec_PaymentPreimageZ {
4767 /// The elements in the array.
4768 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4769 pub data: *mut crate::c_types::ThirtyTwoBytes,
4770 /// The number of elements pointed to by `data`.
4773 impl CVec_PaymentPreimageZ {
4774 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4775 if self.datalen == 0 { return Vec::new(); }
4776 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4777 self.data = core::ptr::null_mut();
4781 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4782 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4785 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4786 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4787 let datalen = v.len();
4788 let data = Box::into_raw(v.into_boxed_slice());
4789 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4793 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4794 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4795 impl Drop for CVec_PaymentPreimageZ {
4796 fn drop(&mut self) {
4797 if self.datalen == 0 { return; }
4798 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4801 impl Clone for CVec_PaymentPreimageZ {
4802 fn clone(&self) -> Self {
4803 let mut res = Vec::new();
4804 if self.datalen == 0 { return Self::from(res); }
4805 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4810 /// A tuple of 2 elements. See the individual fields for the types contained.
4811 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4812 /// The element at position 0
4813 pub a: crate::c_types::Signature,
4814 /// The element at position 1
4815 pub b: crate::c_types::derived::CVec_SignatureZ,
4817 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4818 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4825 impl C2Tuple_SignatureCVec_SignatureZZ {
4826 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4830 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4831 fn clone(&self) -> Self {
4833 a: Clone::clone(&self.a),
4834 b: Clone::clone(&self.b),
4839 /// Creates a new tuple which has the same data as `orig`
4840 /// but with all dynamically-allocated buffers duplicated in new buffers.
4841 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4842 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4844 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4845 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4849 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4850 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4852 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4853 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4854 /// A pointer to the contents in the success state.
4855 /// Reading from this pointer when `result_ok` is not set is undefined.
4856 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4857 /// Note that this value is always NULL, as there are no contents in the Err variant
4858 pub err: *mut core::ffi::c_void,
4861 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4862 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4864 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4865 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4866 /// `err` or `result` depending on the state of `result_ok`.
4867 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4868 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4869 pub result_ok: bool,
4872 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4873 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4874 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4875 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4876 result: Box::into_raw(Box::new(o)),
4882 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4883 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4884 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4885 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4886 err: core::ptr::null_mut(),
4891 /// Checks if the given object is currently in the success state
4893 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4897 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4898 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4899 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4900 fn drop(&mut self) {
4902 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4903 let _ = unsafe { Box::from_raw(self.contents.result) };
4909 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4910 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4911 let contents = if o.result_ok {
4912 let result = unsafe { o.contents.result };
4913 unsafe { o.contents.result = core::ptr::null_mut() };
4914 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4916 let _ = unsafe { Box::from_raw(o.contents.err) };
4917 o.contents.err = core::ptr::null_mut();
4918 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4922 result_ok: o.result_ok,
4926 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4927 fn clone(&self) -> Self {
4929 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4930 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4933 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4934 err: core::ptr::null_mut()
4940 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4941 /// but with all dynamically-allocated buffers duplicated in new buffers.
4942 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4944 /// The contents of CResult_SignatureNoneZ
4945 pub union CResult_SignatureNoneZPtr {
4946 /// A pointer to the contents in the success state.
4947 /// Reading from this pointer when `result_ok` is not set is undefined.
4948 pub result: *mut crate::c_types::Signature,
4949 /// Note that this value is always NULL, as there are no contents in the Err variant
4950 pub err: *mut core::ffi::c_void,
4953 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4954 /// containing a crate::c_types::Signature on success and a () on failure.
4955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4956 pub struct CResult_SignatureNoneZ {
4957 /// The contents of this CResult_SignatureNoneZ, accessible via either
4958 /// `err` or `result` depending on the state of `result_ok`.
4959 pub contents: CResult_SignatureNoneZPtr,
4960 /// Whether this CResult_SignatureNoneZ represents a success state.
4961 pub result_ok: bool,
4964 /// Creates a new CResult_SignatureNoneZ in the success state.
4965 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4966 CResult_SignatureNoneZ {
4967 contents: CResult_SignatureNoneZPtr {
4968 result: Box::into_raw(Box::new(o)),
4974 /// Creates a new CResult_SignatureNoneZ in the error state.
4975 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4976 CResult_SignatureNoneZ {
4977 contents: CResult_SignatureNoneZPtr {
4978 err: core::ptr::null_mut(),
4983 /// Checks if the given object is currently in the success state
4985 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4989 /// Frees any resources used by the CResult_SignatureNoneZ.
4990 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4991 impl Drop for CResult_SignatureNoneZ {
4992 fn drop(&mut self) {
4994 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4995 let _ = unsafe { Box::from_raw(self.contents.result) };
5001 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
5002 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
5003 let contents = if o.result_ok {
5004 let result = unsafe { o.contents.result };
5005 unsafe { o.contents.result = core::ptr::null_mut() };
5006 CResult_SignatureNoneZPtr { result }
5008 let _ = unsafe { Box::from_raw(o.contents.err) };
5009 o.contents.err = core::ptr::null_mut();
5010 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
5014 result_ok: o.result_ok,
5018 impl Clone for CResult_SignatureNoneZ {
5019 fn clone(&self) -> Self {
5021 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
5022 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
5025 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
5026 err: core::ptr::null_mut()
5032 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
5033 /// but with all dynamically-allocated buffers duplicated in new buffers.
5034 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
5036 /// A tuple of 2 elements. See the individual fields for the types contained.
5037 pub struct C2Tuple_SignatureSignatureZ {
5038 /// The element at position 0
5039 pub a: crate::c_types::Signature,
5040 /// The element at position 1
5041 pub b: crate::c_types::Signature,
5043 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
5044 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
5051 impl C2Tuple_SignatureSignatureZ {
5052 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
5056 impl Clone for C2Tuple_SignatureSignatureZ {
5057 fn clone(&self) -> Self {
5059 a: Clone::clone(&self.a),
5060 b: Clone::clone(&self.b),
5065 /// Creates a new tuple which has the same data as `orig`
5066 /// but with all dynamically-allocated buffers duplicated in new buffers.
5067 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
5068 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
5070 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
5071 C2Tuple_SignatureSignatureZ { a, b, }
5075 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
5076 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
5078 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
5079 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5080 /// A pointer to the contents in the success state.
5081 /// Reading from this pointer when `result_ok` is not set is undefined.
5082 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
5083 /// Note that this value is always NULL, as there are no contents in the Err variant
5084 pub err: *mut core::ffi::c_void,
5087 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
5088 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
5089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5090 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
5091 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
5092 /// `err` or `result` depending on the state of `result_ok`.
5093 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
5094 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
5095 pub result_ok: bool,
5098 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
5099 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5100 CResult_C2Tuple_SignatureSignatureZNoneZ {
5101 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5102 result: Box::into_raw(Box::new(o)),
5108 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
5109 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5110 CResult_C2Tuple_SignatureSignatureZNoneZ {
5111 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5112 err: core::ptr::null_mut(),
5117 /// Checks if the given object is currently in the success state
5119 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
5123 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
5124 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
5125 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
5126 fn drop(&mut self) {
5128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5129 let _ = unsafe { Box::from_raw(self.contents.result) };
5135 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
5136 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5137 let contents = if o.result_ok {
5138 let result = unsafe { o.contents.result };
5139 unsafe { o.contents.result = core::ptr::null_mut() };
5140 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5142 let _ = unsafe { Box::from_raw(o.contents.err) };
5143 o.contents.err = core::ptr::null_mut();
5144 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5148 result_ok: o.result_ok,
5152 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5153 fn clone(&self) -> Self {
5155 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5156 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5159 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5160 err: core::ptr::null_mut()
5166 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5167 /// but with all dynamically-allocated buffers duplicated in new buffers.
5168 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5170 /// The contents of CResult_SecretKeyNoneZ
5171 pub union CResult_SecretKeyNoneZPtr {
5172 /// A pointer to the contents in the success state.
5173 /// Reading from this pointer when `result_ok` is not set is undefined.
5174 pub result: *mut crate::c_types::SecretKey,
5175 /// Note that this value is always NULL, as there are no contents in the Err variant
5176 pub err: *mut core::ffi::c_void,
5179 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5180 /// containing a crate::c_types::SecretKey on success and a () on failure.
5181 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5182 pub struct CResult_SecretKeyNoneZ {
5183 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5184 /// `err` or `result` depending on the state of `result_ok`.
5185 pub contents: CResult_SecretKeyNoneZPtr,
5186 /// Whether this CResult_SecretKeyNoneZ represents a success state.
5187 pub result_ok: bool,
5190 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5191 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5192 CResult_SecretKeyNoneZ {
5193 contents: CResult_SecretKeyNoneZPtr {
5194 result: Box::into_raw(Box::new(o)),
5200 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5201 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5202 CResult_SecretKeyNoneZ {
5203 contents: CResult_SecretKeyNoneZPtr {
5204 err: core::ptr::null_mut(),
5209 /// Checks if the given object is currently in the success state
5211 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5215 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5216 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5217 impl Drop for CResult_SecretKeyNoneZ {
5218 fn drop(&mut self) {
5220 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5221 let _ = unsafe { Box::from_raw(self.contents.result) };
5227 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5228 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5229 let contents = if o.result_ok {
5230 let result = unsafe { o.contents.result };
5231 unsafe { o.contents.result = core::ptr::null_mut() };
5232 CResult_SecretKeyNoneZPtr { result }
5234 let _ = unsafe { Box::from_raw(o.contents.err) };
5235 o.contents.err = core::ptr::null_mut();
5236 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5240 result_ok: o.result_ok,
5244 impl Clone for CResult_SecretKeyNoneZ {
5245 fn clone(&self) -> Self {
5247 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
5248 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
5251 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
5252 err: core::ptr::null_mut()
5258 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
5259 /// but with all dynamically-allocated buffers duplicated in new buffers.
5260 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
5262 /// The contents of CResult_SignDecodeErrorZ
5263 pub union CResult_SignDecodeErrorZPtr {
5264 /// A pointer to the contents in the success state.
5265 /// Reading from this pointer when `result_ok` is not set is undefined.
5266 pub result: *mut crate::lightning::chain::keysinterface::Sign,
5267 /// A pointer to the contents in the error state.
5268 /// Reading from this pointer when `result_ok` is set is undefined.
5269 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5272 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5273 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5274 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5275 pub struct CResult_SignDecodeErrorZ {
5276 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5277 /// `err` or `result` depending on the state of `result_ok`.
5278 pub contents: CResult_SignDecodeErrorZPtr,
5279 /// Whether this CResult_SignDecodeErrorZ represents a success state.
5280 pub result_ok: bool,
5283 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5284 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5285 CResult_SignDecodeErrorZ {
5286 contents: CResult_SignDecodeErrorZPtr {
5287 result: Box::into_raw(Box::new(o)),
5293 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5294 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5295 CResult_SignDecodeErrorZ {
5296 contents: CResult_SignDecodeErrorZPtr {
5297 err: Box::into_raw(Box::new(e)),
5302 /// Checks if the given object is currently in the success state
5304 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5308 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5309 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5310 impl Drop for CResult_SignDecodeErrorZ {
5311 fn drop(&mut self) {
5313 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5314 let _ = unsafe { Box::from_raw(self.contents.result) };
5317 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5318 let _ = unsafe { Box::from_raw(self.contents.err) };
5323 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5324 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5325 let contents = if o.result_ok {
5326 let result = unsafe { o.contents.result };
5327 unsafe { o.contents.result = core::ptr::null_mut() };
5328 CResult_SignDecodeErrorZPtr { result }
5330 let err = unsafe { o.contents.err };
5331 unsafe { o.contents.err = core::ptr::null_mut(); }
5332 CResult_SignDecodeErrorZPtr { err }
5336 result_ok: o.result_ok,
5340 impl Clone for CResult_SignDecodeErrorZ {
5341 fn clone(&self) -> Self {
5343 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5344 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5347 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5348 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5354 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5355 /// but with all dynamically-allocated buffers duplicated in new buffers.
5356 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5358 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5359 /// This corresponds to std::vector in C++
5360 pub struct CVec_u5Z {
5361 /// The elements in the array.
5362 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5363 pub data: *mut crate::c_types::u5,
5364 /// The number of elements pointed to by `data`.
5368 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5369 if self.datalen == 0 { return Vec::new(); }
5370 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5371 self.data = core::ptr::null_mut();
5375 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5376 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5379 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5380 fn from(v: Vec<crate::c_types::u5>) -> Self {
5381 let datalen = v.len();
5382 let data = Box::into_raw(v.into_boxed_slice());
5383 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5387 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5388 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5389 impl Drop for CVec_u5Z {
5390 fn drop(&mut self) {
5391 if self.datalen == 0 { return; }
5392 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5395 impl Clone for CVec_u5Z {
5396 fn clone(&self) -> Self {
5397 let mut res = Vec::new();
5398 if self.datalen == 0 { return Self::from(res); }
5399 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5404 /// The contents of CResult_RecoverableSignatureNoneZ
5405 pub union CResult_RecoverableSignatureNoneZPtr {
5406 /// A pointer to the contents in the success state.
5407 /// Reading from this pointer when `result_ok` is not set is undefined.
5408 pub result: *mut crate::c_types::RecoverableSignature,
5409 /// Note that this value is always NULL, as there are no contents in the Err variant
5410 pub err: *mut core::ffi::c_void,
5413 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5414 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5415 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5416 pub struct CResult_RecoverableSignatureNoneZ {
5417 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5418 /// `err` or `result` depending on the state of `result_ok`.
5419 pub contents: CResult_RecoverableSignatureNoneZPtr,
5420 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5421 pub result_ok: bool,
5424 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5425 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5426 CResult_RecoverableSignatureNoneZ {
5427 contents: CResult_RecoverableSignatureNoneZPtr {
5428 result: Box::into_raw(Box::new(o)),
5434 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5435 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5436 CResult_RecoverableSignatureNoneZ {
5437 contents: CResult_RecoverableSignatureNoneZPtr {
5438 err: core::ptr::null_mut(),
5443 /// Checks if the given object is currently in the success state
5445 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5449 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5450 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5451 impl Drop for CResult_RecoverableSignatureNoneZ {
5452 fn drop(&mut self) {
5454 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5455 let _ = unsafe { Box::from_raw(self.contents.result) };
5461 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5462 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5463 let contents = if o.result_ok {
5464 let result = unsafe { o.contents.result };
5465 unsafe { o.contents.result = core::ptr::null_mut() };
5466 CResult_RecoverableSignatureNoneZPtr { result }
5468 let _ = unsafe { Box::from_raw(o.contents.err) };
5469 o.contents.err = core::ptr::null_mut();
5470 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5474 result_ok: o.result_ok,
5478 impl Clone for CResult_RecoverableSignatureNoneZ {
5479 fn clone(&self) -> Self {
5481 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5482 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5485 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5486 err: core::ptr::null_mut()
5492 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5493 /// but with all dynamically-allocated buffers duplicated in new buffers.
5494 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5496 /// A dynamically-allocated array of u8s of arbitrary size.
5497 /// This corresponds to std::vector in C++
5498 pub struct CVec_u8Z {
5499 /// The elements in the array.
5500 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5502 /// The number of elements pointed to by `data`.
5506 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5507 if self.datalen == 0 { return Vec::new(); }
5508 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5509 self.data = core::ptr::null_mut();
5513 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5514 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5517 impl From<Vec<u8>> for CVec_u8Z {
5518 fn from(v: Vec<u8>) -> Self {
5519 let datalen = v.len();
5520 let data = Box::into_raw(v.into_boxed_slice());
5521 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5525 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5526 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5527 impl Drop for CVec_u8Z {
5528 fn drop(&mut self) {
5529 if self.datalen == 0 { return; }
5530 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5533 impl Clone for CVec_u8Z {
5534 fn clone(&self) -> Self {
5535 let mut res = Vec::new();
5536 if self.datalen == 0 { return Self::from(res); }
5537 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5542 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5543 /// This corresponds to std::vector in C++
5544 pub struct CVec_CVec_u8ZZ {
5545 /// The elements in the array.
5546 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5547 pub data: *mut crate::c_types::derived::CVec_u8Z,
5548 /// The number of elements pointed to by `data`.
5551 impl CVec_CVec_u8ZZ {
5552 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5553 if self.datalen == 0 { return Vec::new(); }
5554 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5555 self.data = core::ptr::null_mut();
5559 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5560 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5563 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5564 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5565 let datalen = v.len();
5566 let data = Box::into_raw(v.into_boxed_slice());
5567 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5571 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5572 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5573 impl Drop for CVec_CVec_u8ZZ {
5574 fn drop(&mut self) {
5575 if self.datalen == 0 { return; }
5576 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5579 impl Clone for CVec_CVec_u8ZZ {
5580 fn clone(&self) -> Self {
5581 let mut res = Vec::new();
5582 if self.datalen == 0 { return Self::from(res); }
5583 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5588 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5589 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5590 /// A pointer to the contents in the success state.
5591 /// Reading from this pointer when `result_ok` is not set is undefined.
5592 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5593 /// Note that this value is always NULL, as there are no contents in the Err variant
5594 pub err: *mut core::ffi::c_void,
5597 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5598 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5600 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5601 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5602 /// `err` or `result` depending on the state of `result_ok`.
5603 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5604 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5605 pub result_ok: bool,
5608 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5609 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5610 CResult_CVec_CVec_u8ZZNoneZ {
5611 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5612 result: Box::into_raw(Box::new(o)),
5618 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5619 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5620 CResult_CVec_CVec_u8ZZNoneZ {
5621 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5622 err: core::ptr::null_mut(),
5627 /// Checks if the given object is currently in the success state
5629 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5633 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5634 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5635 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5636 fn drop(&mut self) {
5638 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5639 let _ = unsafe { Box::from_raw(self.contents.result) };
5645 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5646 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5647 let contents = if o.result_ok {
5648 let result = unsafe { o.contents.result };
5649 unsafe { o.contents.result = core::ptr::null_mut() };
5650 CResult_CVec_CVec_u8ZZNoneZPtr { result }
5652 let _ = unsafe { Box::from_raw(o.contents.err) };
5653 o.contents.err = core::ptr::null_mut();
5654 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5658 result_ok: o.result_ok,
5662 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5663 fn clone(&self) -> Self {
5665 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5666 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5669 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5670 err: core::ptr::null_mut()
5676 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5677 /// but with all dynamically-allocated buffers duplicated in new buffers.
5678 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5680 /// The contents of CResult_InMemorySignerDecodeErrorZ
5681 pub union CResult_InMemorySignerDecodeErrorZPtr {
5682 /// A pointer to the contents in the success state.
5683 /// Reading from this pointer when `result_ok` is not set is undefined.
5684 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5685 /// A pointer to the contents in the error state.
5686 /// Reading from this pointer when `result_ok` is set is undefined.
5687 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5690 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5691 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5692 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5693 pub struct CResult_InMemorySignerDecodeErrorZ {
5694 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5695 /// `err` or `result` depending on the state of `result_ok`.
5696 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5697 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5698 pub result_ok: bool,
5701 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5702 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5703 CResult_InMemorySignerDecodeErrorZ {
5704 contents: CResult_InMemorySignerDecodeErrorZPtr {
5705 result: Box::into_raw(Box::new(o)),
5711 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5712 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5713 CResult_InMemorySignerDecodeErrorZ {
5714 contents: CResult_InMemorySignerDecodeErrorZPtr {
5715 err: Box::into_raw(Box::new(e)),
5720 /// Checks if the given object is currently in the success state
5722 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5726 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5727 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5728 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5729 fn drop(&mut self) {
5731 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5732 let _ = unsafe { Box::from_raw(self.contents.result) };
5735 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5736 let _ = unsafe { Box::from_raw(self.contents.err) };
5741 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5742 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5743 let contents = if o.result_ok {
5744 let result = unsafe { o.contents.result };
5745 unsafe { o.contents.result = core::ptr::null_mut() };
5746 CResult_InMemorySignerDecodeErrorZPtr { result }
5748 let err = unsafe { o.contents.err };
5749 unsafe { o.contents.err = core::ptr::null_mut(); }
5750 CResult_InMemorySignerDecodeErrorZPtr { err }
5754 result_ok: o.result_ok,
5758 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5759 fn clone(&self) -> Self {
5761 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5762 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5765 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5766 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5772 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5773 /// but with all dynamically-allocated buffers duplicated in new buffers.
5774 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5776 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5777 /// This corresponds to std::vector in C++
5778 pub struct CVec_TxOutZ {
5779 /// The elements in the array.
5780 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5781 pub data: *mut crate::c_types::TxOut,
5782 /// The number of elements pointed to by `data`.
5786 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5787 if self.datalen == 0 { return Vec::new(); }
5788 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5789 self.data = core::ptr::null_mut();
5793 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5794 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5797 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5798 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5799 let datalen = v.len();
5800 let data = Box::into_raw(v.into_boxed_slice());
5801 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5805 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5806 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5807 impl Drop for CVec_TxOutZ {
5808 fn drop(&mut self) {
5809 if self.datalen == 0 { return; }
5810 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5813 impl Clone for CVec_TxOutZ {
5814 fn clone(&self) -> Self {
5815 let mut res = Vec::new();
5816 if self.datalen == 0 { return Self::from(res); }
5817 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5822 /// The contents of CResult_TransactionNoneZ
5823 pub union CResult_TransactionNoneZPtr {
5824 /// A pointer to the contents in the success state.
5825 /// Reading from this pointer when `result_ok` is not set is undefined.
5826 pub result: *mut crate::c_types::Transaction,
5827 /// Note that this value is always NULL, as there are no contents in the Err variant
5828 pub err: *mut core::ffi::c_void,
5831 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5832 /// containing a crate::c_types::Transaction on success and a () on failure.
5833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5834 pub struct CResult_TransactionNoneZ {
5835 /// The contents of this CResult_TransactionNoneZ, accessible via either
5836 /// `err` or `result` depending on the state of `result_ok`.
5837 pub contents: CResult_TransactionNoneZPtr,
5838 /// Whether this CResult_TransactionNoneZ represents a success state.
5839 pub result_ok: bool,
5842 /// Creates a new CResult_TransactionNoneZ in the success state.
5843 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5844 CResult_TransactionNoneZ {
5845 contents: CResult_TransactionNoneZPtr {
5846 result: Box::into_raw(Box::new(o)),
5852 /// Creates a new CResult_TransactionNoneZ in the error state.
5853 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5854 CResult_TransactionNoneZ {
5855 contents: CResult_TransactionNoneZPtr {
5856 err: core::ptr::null_mut(),
5861 /// Checks if the given object is currently in the success state
5863 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5867 /// Frees any resources used by the CResult_TransactionNoneZ.
5868 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5869 impl Drop for CResult_TransactionNoneZ {
5870 fn drop(&mut self) {
5872 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5873 let _ = unsafe { Box::from_raw(self.contents.result) };
5879 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5880 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5881 let contents = if o.result_ok {
5882 let result = unsafe { o.contents.result };
5883 unsafe { o.contents.result = core::ptr::null_mut() };
5884 CResult_TransactionNoneZPtr { result }
5886 let _ = unsafe { Box::from_raw(o.contents.err) };
5887 o.contents.err = core::ptr::null_mut();
5888 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5892 result_ok: o.result_ok,
5896 impl Clone for CResult_TransactionNoneZ {
5897 fn clone(&self) -> Self {
5899 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5900 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5903 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5904 err: core::ptr::null_mut()
5910 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5911 /// but with all dynamically-allocated buffers duplicated in new buffers.
5912 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5914 /// A tuple of 2 elements. See the individual fields for the types contained.
5915 pub struct C2Tuple_BlockHashChannelMonitorZ {
5916 /// The element at position 0
5917 pub a: crate::c_types::ThirtyTwoBytes,
5918 /// The element at position 1
5919 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5921 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5922 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5929 impl C2Tuple_BlockHashChannelMonitorZ {
5930 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5934 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5936 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5937 C2Tuple_BlockHashChannelMonitorZ { a, b, }
5941 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5942 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5944 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5945 /// This corresponds to std::vector in C++
5946 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5947 /// The elements in the array.
5948 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5949 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5950 /// The number of elements pointed to by `data`.
5953 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5954 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5955 if self.datalen == 0 { return Vec::new(); }
5956 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5957 self.data = core::ptr::null_mut();
5961 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5962 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5965 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5966 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5967 let datalen = v.len();
5968 let data = Box::into_raw(v.into_boxed_slice());
5969 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5973 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5974 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5975 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5976 fn drop(&mut self) {
5977 if self.datalen == 0 { return; }
5978 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5982 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5983 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5984 /// A pointer to the contents in the success state.
5985 /// Reading from this pointer when `result_ok` is not set is undefined.
5986 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5987 /// A pointer to the contents in the error state.
5988 /// Reading from this pointer when `result_ok` is set is undefined.
5989 pub err: *mut crate::c_types::IOError,
5992 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5993 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5994 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5995 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5996 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5997 /// `err` or `result` depending on the state of `result_ok`.
5998 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5999 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6000 pub result_ok: bool,
6003 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
6004 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6005 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6006 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6007 result: Box::into_raw(Box::new(o)),
6013 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
6014 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6015 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6016 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6017 err: Box::into_raw(Box::new(e)),
6022 /// Checks if the given object is currently in the success state
6024 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
6028 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
6029 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
6030 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6031 fn drop(&mut self) {
6033 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6034 let _ = unsafe { Box::from_raw(self.contents.result) };
6037 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6038 let _ = unsafe { Box::from_raw(self.contents.err) };
6043 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6044 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
6045 let contents = if o.result_ok {
6046 let result = unsafe { o.contents.result };
6047 unsafe { o.contents.result = core::ptr::null_mut() };
6048 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
6050 let err = unsafe { o.contents.err };
6051 unsafe { o.contents.err = core::ptr::null_mut(); }
6052 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
6056 result_ok: o.result_ok,
6062 /// An enum which can either contain a u16 or not
6063 pub enum COption_u16Z {
6064 /// When we're in this state, this COption_u16Z contains a u16
6066 /// When we're in this state, this COption_u16Z contains nothing
6070 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6071 if let Self::None = self { false } else { true }
6073 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6076 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
6077 if let Self::Some(v) = self { v } else { unreachable!() }
6081 /// Constructs a new COption_u16Z containing a u16
6082 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
6083 COption_u16Z::Some(o)
6086 /// Constructs a new COption_u16Z containing nothing
6087 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
6091 /// Frees any resources associated with the u16, if we are in the Some state
6092 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
6094 /// Creates a new COption_u16Z which has the same data as `orig`
6095 /// but with all dynamically-allocated buffers duplicated in new buffers.
6096 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
6098 /// The contents of CResult_NoneAPIErrorZ
6099 pub union CResult_NoneAPIErrorZPtr {
6100 /// Note that this value is always NULL, as there are no contents in the OK variant
6101 pub result: *mut core::ffi::c_void,
6102 /// A pointer to the contents in the error state.
6103 /// Reading from this pointer when `result_ok` is set is undefined.
6104 pub err: *mut crate::lightning::util::errors::APIError,
6107 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6108 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
6109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6110 pub struct CResult_NoneAPIErrorZ {
6111 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
6112 /// `err` or `result` depending on the state of `result_ok`.
6113 pub contents: CResult_NoneAPIErrorZPtr,
6114 /// Whether this CResult_NoneAPIErrorZ represents a success state.
6115 pub result_ok: bool,
6118 /// Creates a new CResult_NoneAPIErrorZ in the success state.
6119 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
6120 CResult_NoneAPIErrorZ {
6121 contents: CResult_NoneAPIErrorZPtr {
6122 result: core::ptr::null_mut(),
6128 /// Creates a new CResult_NoneAPIErrorZ in the error state.
6129 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
6130 CResult_NoneAPIErrorZ {
6131 contents: CResult_NoneAPIErrorZPtr {
6132 err: Box::into_raw(Box::new(e)),
6137 /// Checks if the given object is currently in the success state
6139 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
6143 /// Frees any resources used by the CResult_NoneAPIErrorZ.
6144 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
6145 impl Drop for CResult_NoneAPIErrorZ {
6146 fn drop(&mut self) {
6149 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6150 let _ = unsafe { Box::from_raw(self.contents.err) };
6155 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6156 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6157 let contents = if o.result_ok {
6158 let _ = unsafe { Box::from_raw(o.contents.result) };
6159 o.contents.result = core::ptr::null_mut();
6160 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6162 let err = unsafe { o.contents.err };
6163 unsafe { o.contents.err = core::ptr::null_mut(); }
6164 CResult_NoneAPIErrorZPtr { err }
6168 result_ok: o.result_ok,
6172 impl Clone for CResult_NoneAPIErrorZ {
6173 fn clone(&self) -> Self {
6175 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6176 result: core::ptr::null_mut()
6179 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6180 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6186 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6187 /// but with all dynamically-allocated buffers duplicated in new buffers.
6188 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6190 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6191 /// This corresponds to std::vector in C++
6192 pub struct CVec_CResult_NoneAPIErrorZZ {
6193 /// The elements in the array.
6194 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6195 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6196 /// The number of elements pointed to by `data`.
6199 impl CVec_CResult_NoneAPIErrorZZ {
6200 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6201 if self.datalen == 0 { return Vec::new(); }
6202 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6203 self.data = core::ptr::null_mut();
6207 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6208 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6211 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6212 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6213 let datalen = v.len();
6214 let data = Box::into_raw(v.into_boxed_slice());
6215 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6219 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6220 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6221 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6222 fn drop(&mut self) {
6223 if self.datalen == 0 { return; }
6224 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6227 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6228 fn clone(&self) -> Self {
6229 let mut res = Vec::new();
6230 if self.datalen == 0 { return Self::from(res); }
6231 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6236 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6237 /// This corresponds to std::vector in C++
6238 pub struct CVec_APIErrorZ {
6239 /// The elements in the array.
6240 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6241 pub data: *mut crate::lightning::util::errors::APIError,
6242 /// The number of elements pointed to by `data`.
6245 impl CVec_APIErrorZ {
6246 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6247 if self.datalen == 0 { return Vec::new(); }
6248 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6249 self.data = core::ptr::null_mut();
6253 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6254 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6257 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6258 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6259 let datalen = v.len();
6260 let data = Box::into_raw(v.into_boxed_slice());
6261 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6265 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6266 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6267 impl Drop for CVec_APIErrorZ {
6268 fn drop(&mut self) {
6269 if self.datalen == 0 { return; }
6270 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6273 impl Clone for CVec_APIErrorZ {
6274 fn clone(&self) -> Self {
6275 let mut res = Vec::new();
6276 if self.datalen == 0 { return Self::from(res); }
6277 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6282 /// The contents of CResult__u832APIErrorZ
6283 pub union CResult__u832APIErrorZPtr {
6284 /// A pointer to the contents in the success state.
6285 /// Reading from this pointer when `result_ok` is not set is undefined.
6286 pub result: *mut crate::c_types::ThirtyTwoBytes,
6287 /// A pointer to the contents in the error state.
6288 /// Reading from this pointer when `result_ok` is set is undefined.
6289 pub err: *mut crate::lightning::util::errors::APIError,
6292 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6293 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6295 pub struct CResult__u832APIErrorZ {
6296 /// The contents of this CResult__u832APIErrorZ, accessible via either
6297 /// `err` or `result` depending on the state of `result_ok`.
6298 pub contents: CResult__u832APIErrorZPtr,
6299 /// Whether this CResult__u832APIErrorZ represents a success state.
6300 pub result_ok: bool,
6303 /// Creates a new CResult__u832APIErrorZ in the success state.
6304 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6305 CResult__u832APIErrorZ {
6306 contents: CResult__u832APIErrorZPtr {
6307 result: Box::into_raw(Box::new(o)),
6313 /// Creates a new CResult__u832APIErrorZ in the error state.
6314 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6315 CResult__u832APIErrorZ {
6316 contents: CResult__u832APIErrorZPtr {
6317 err: Box::into_raw(Box::new(e)),
6322 /// Checks if the given object is currently in the success state
6324 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6328 /// Frees any resources used by the CResult__u832APIErrorZ.
6329 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6330 impl Drop for CResult__u832APIErrorZ {
6331 fn drop(&mut self) {
6333 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6334 let _ = unsafe { Box::from_raw(self.contents.result) };
6337 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6338 let _ = unsafe { Box::from_raw(self.contents.err) };
6343 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6344 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6345 let contents = if o.result_ok {
6346 let result = unsafe { o.contents.result };
6347 unsafe { o.contents.result = core::ptr::null_mut() };
6348 CResult__u832APIErrorZPtr { result }
6350 let err = unsafe { o.contents.err };
6351 unsafe { o.contents.err = core::ptr::null_mut(); }
6352 CResult__u832APIErrorZPtr { err }
6356 result_ok: o.result_ok,
6360 impl Clone for CResult__u832APIErrorZ {
6361 fn clone(&self) -> Self {
6363 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6364 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6367 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6368 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6374 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6375 /// but with all dynamically-allocated buffers duplicated in new buffers.
6376 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6378 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6379 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6380 /// A pointer to the contents in the success state.
6381 /// Reading from this pointer when `result_ok` is not set is undefined.
6382 pub result: *mut crate::c_types::ThirtyTwoBytes,
6383 /// A pointer to the contents in the error state.
6384 /// Reading from this pointer when `result_ok` is set is undefined.
6385 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6388 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6389 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6391 pub struct CResult_PaymentIdPaymentSendFailureZ {
6392 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6393 /// `err` or `result` depending on the state of `result_ok`.
6394 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6395 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6396 pub result_ok: bool,
6399 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6400 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6401 CResult_PaymentIdPaymentSendFailureZ {
6402 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6403 result: Box::into_raw(Box::new(o)),
6409 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6410 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6411 CResult_PaymentIdPaymentSendFailureZ {
6412 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6413 err: Box::into_raw(Box::new(e)),
6418 /// Checks if the given object is currently in the success state
6420 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6424 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6425 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6426 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6427 fn drop(&mut self) {
6429 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6430 let _ = unsafe { Box::from_raw(self.contents.result) };
6433 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6434 let _ = unsafe { Box::from_raw(self.contents.err) };
6439 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6440 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6441 let contents = if o.result_ok {
6442 let result = unsafe { o.contents.result };
6443 unsafe { o.contents.result = core::ptr::null_mut() };
6444 CResult_PaymentIdPaymentSendFailureZPtr { result }
6446 let err = unsafe { o.contents.err };
6447 unsafe { o.contents.err = core::ptr::null_mut(); }
6448 CResult_PaymentIdPaymentSendFailureZPtr { err }
6452 result_ok: o.result_ok,
6456 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6457 fn clone(&self) -> Self {
6459 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6460 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6463 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6464 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6470 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6471 /// but with all dynamically-allocated buffers duplicated in new buffers.
6472 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6474 /// The contents of CResult_NonePaymentSendFailureZ
6475 pub union CResult_NonePaymentSendFailureZPtr {
6476 /// Note that this value is always NULL, as there are no contents in the OK variant
6477 pub result: *mut core::ffi::c_void,
6478 /// A pointer to the contents in the error state.
6479 /// Reading from this pointer when `result_ok` is set is undefined.
6480 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6483 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6484 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6485 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6486 pub struct CResult_NonePaymentSendFailureZ {
6487 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6488 /// `err` or `result` depending on the state of `result_ok`.
6489 pub contents: CResult_NonePaymentSendFailureZPtr,
6490 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6491 pub result_ok: bool,
6494 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6495 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6496 CResult_NonePaymentSendFailureZ {
6497 contents: CResult_NonePaymentSendFailureZPtr {
6498 result: core::ptr::null_mut(),
6504 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6505 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6506 CResult_NonePaymentSendFailureZ {
6507 contents: CResult_NonePaymentSendFailureZPtr {
6508 err: Box::into_raw(Box::new(e)),
6513 /// Checks if the given object is currently in the success state
6515 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6519 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6520 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6521 impl Drop for CResult_NonePaymentSendFailureZ {
6522 fn drop(&mut self) {
6525 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6526 let _ = unsafe { Box::from_raw(self.contents.err) };
6531 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6532 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6533 let contents = if o.result_ok {
6534 let _ = unsafe { Box::from_raw(o.contents.result) };
6535 o.contents.result = core::ptr::null_mut();
6536 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6538 let err = unsafe { o.contents.err };
6539 unsafe { o.contents.err = core::ptr::null_mut(); }
6540 CResult_NonePaymentSendFailureZPtr { err }
6544 result_ok: o.result_ok,
6548 impl Clone for CResult_NonePaymentSendFailureZ {
6549 fn clone(&self) -> Self {
6551 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6552 result: core::ptr::null_mut()
6555 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6556 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6562 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6563 /// but with all dynamically-allocated buffers duplicated in new buffers.
6564 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6566 /// A tuple of 2 elements. See the individual fields for the types contained.
6567 pub struct C2Tuple_PaymentHashPaymentIdZ {
6568 /// The element at position 0
6569 pub a: crate::c_types::ThirtyTwoBytes,
6570 /// The element at position 1
6571 pub b: crate::c_types::ThirtyTwoBytes,
6573 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6574 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6581 impl C2Tuple_PaymentHashPaymentIdZ {
6582 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6586 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6587 fn clone(&self) -> Self {
6589 a: Clone::clone(&self.a),
6590 b: Clone::clone(&self.b),
6595 /// Creates a new tuple which has the same data as `orig`
6596 /// but with all dynamically-allocated buffers duplicated in new buffers.
6597 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6598 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6600 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6601 C2Tuple_PaymentHashPaymentIdZ { a, b, }
6605 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6606 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6608 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6609 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6610 /// A pointer to the contents in the success state.
6611 /// Reading from this pointer when `result_ok` is not set is undefined.
6612 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6613 /// A pointer to the contents in the error state.
6614 /// Reading from this pointer when `result_ok` is set is undefined.
6615 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6618 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6619 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6620 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6621 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6622 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6623 /// `err` or `result` depending on the state of `result_ok`.
6624 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6625 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6626 pub result_ok: bool,
6629 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6630 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6631 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6632 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6633 result: Box::into_raw(Box::new(o)),
6639 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6640 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6641 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6642 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6643 err: Box::into_raw(Box::new(e)),
6648 /// Checks if the given object is currently in the success state
6650 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6654 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6655 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6656 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6657 fn drop(&mut self) {
6659 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6660 let _ = unsafe { Box::from_raw(self.contents.result) };
6663 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6664 let _ = unsafe { Box::from_raw(self.contents.err) };
6669 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6670 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6671 let contents = if o.result_ok {
6672 let result = unsafe { o.contents.result };
6673 unsafe { o.contents.result = core::ptr::null_mut() };
6674 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6676 let err = unsafe { o.contents.err };
6677 unsafe { o.contents.err = core::ptr::null_mut(); }
6678 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6682 result_ok: o.result_ok,
6686 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6687 fn clone(&self) -> Self {
6689 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6690 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6693 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6694 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6700 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6701 /// but with all dynamically-allocated buffers duplicated in new buffers.
6702 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6704 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6705 /// This corresponds to std::vector in C++
6706 pub struct CVec_NetAddressZ {
6707 /// The elements in the array.
6708 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6709 pub data: *mut crate::lightning::ln::msgs::NetAddress,
6710 /// The number of elements pointed to by `data`.
6713 impl CVec_NetAddressZ {
6714 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6715 if self.datalen == 0 { return Vec::new(); }
6716 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6717 self.data = core::ptr::null_mut();
6721 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6722 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6725 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6726 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6727 let datalen = v.len();
6728 let data = Box::into_raw(v.into_boxed_slice());
6729 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6733 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6734 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6735 impl Drop for CVec_NetAddressZ {
6736 fn drop(&mut self) {
6737 if self.datalen == 0 { return; }
6738 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6741 impl Clone for CVec_NetAddressZ {
6742 fn clone(&self) -> Self {
6743 let mut res = Vec::new();
6744 if self.datalen == 0 { return Self::from(res); }
6745 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6750 /// A tuple of 2 elements. See the individual fields for the types contained.
6751 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6752 /// The element at position 0
6753 pub a: crate::c_types::ThirtyTwoBytes,
6754 /// The element at position 1
6755 pub b: crate::c_types::ThirtyTwoBytes,
6757 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6758 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6765 impl C2Tuple_PaymentHashPaymentSecretZ {
6766 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6770 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6771 fn clone(&self) -> Self {
6773 a: Clone::clone(&self.a),
6774 b: Clone::clone(&self.b),
6779 /// Creates a new tuple which has the same data as `orig`
6780 /// but with all dynamically-allocated buffers duplicated in new buffers.
6781 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6782 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6784 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6785 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6789 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6790 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6792 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6793 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6794 /// A pointer to the contents in the success state.
6795 /// Reading from this pointer when `result_ok` is not set is undefined.
6796 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6797 /// Note that this value is always NULL, as there are no contents in the Err variant
6798 pub err: *mut core::ffi::c_void,
6801 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6802 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6804 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6805 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6806 /// `err` or `result` depending on the state of `result_ok`.
6807 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6808 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6809 pub result_ok: bool,
6812 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6813 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6814 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6815 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6816 result: Box::into_raw(Box::new(o)),
6822 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6823 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6824 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6825 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6826 err: core::ptr::null_mut(),
6831 /// Checks if the given object is currently in the success state
6833 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6837 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6838 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6839 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6840 fn drop(&mut self) {
6842 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6843 let _ = unsafe { Box::from_raw(self.contents.result) };
6849 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6850 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6851 let contents = if o.result_ok {
6852 let result = unsafe { o.contents.result };
6853 unsafe { o.contents.result = core::ptr::null_mut() };
6854 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6856 let _ = unsafe { Box::from_raw(o.contents.err) };
6857 o.contents.err = core::ptr::null_mut();
6858 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6862 result_ok: o.result_ok,
6866 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6867 fn clone(&self) -> Self {
6869 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6870 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6873 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6874 err: core::ptr::null_mut()
6880 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6881 /// but with all dynamically-allocated buffers duplicated in new buffers.
6882 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6884 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6885 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6886 /// A pointer to the contents in the success state.
6887 /// Reading from this pointer when `result_ok` is not set is undefined.
6888 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6889 /// A pointer to the contents in the error state.
6890 /// Reading from this pointer when `result_ok` is set is undefined.
6891 pub err: *mut crate::lightning::util::errors::APIError,
6894 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6895 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6897 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6898 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6899 /// `err` or `result` depending on the state of `result_ok`.
6900 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6901 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6902 pub result_ok: bool,
6905 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6906 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6907 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6908 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6909 result: Box::into_raw(Box::new(o)),
6915 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6916 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6917 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6918 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6919 err: Box::into_raw(Box::new(e)),
6924 /// Checks if the given object is currently in the success state
6926 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6930 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6931 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6932 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6933 fn drop(&mut self) {
6935 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6936 let _ = unsafe { Box::from_raw(self.contents.result) };
6939 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6940 let _ = unsafe { Box::from_raw(self.contents.err) };
6945 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6946 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6947 let contents = if o.result_ok {
6948 let result = unsafe { o.contents.result };
6949 unsafe { o.contents.result = core::ptr::null_mut() };
6950 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6952 let err = unsafe { o.contents.err };
6953 unsafe { o.contents.err = core::ptr::null_mut(); }
6954 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6958 result_ok: o.result_ok,
6962 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6963 fn clone(&self) -> Self {
6965 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6966 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6969 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6970 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6976 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6977 /// but with all dynamically-allocated buffers duplicated in new buffers.
6978 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6980 /// The contents of CResult_PaymentSecretNoneZ
6981 pub union CResult_PaymentSecretNoneZPtr {
6982 /// A pointer to the contents in the success state.
6983 /// Reading from this pointer when `result_ok` is not set is undefined.
6984 pub result: *mut crate::c_types::ThirtyTwoBytes,
6985 /// Note that this value is always NULL, as there are no contents in the Err variant
6986 pub err: *mut core::ffi::c_void,
6989 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6990 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6991 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6992 pub struct CResult_PaymentSecretNoneZ {
6993 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6994 /// `err` or `result` depending on the state of `result_ok`.
6995 pub contents: CResult_PaymentSecretNoneZPtr,
6996 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6997 pub result_ok: bool,
7000 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
7001 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
7002 CResult_PaymentSecretNoneZ {
7003 contents: CResult_PaymentSecretNoneZPtr {
7004 result: Box::into_raw(Box::new(o)),
7010 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
7011 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
7012 CResult_PaymentSecretNoneZ {
7013 contents: CResult_PaymentSecretNoneZPtr {
7014 err: core::ptr::null_mut(),
7019 /// Checks if the given object is currently in the success state
7021 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
7025 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
7026 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
7027 impl Drop for CResult_PaymentSecretNoneZ {
7028 fn drop(&mut self) {
7030 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7031 let _ = unsafe { Box::from_raw(self.contents.result) };
7037 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
7038 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7039 let contents = if o.result_ok {
7040 let result = unsafe { o.contents.result };
7041 unsafe { o.contents.result = core::ptr::null_mut() };
7042 CResult_PaymentSecretNoneZPtr { result }
7044 let _ = unsafe { Box::from_raw(o.contents.err) };
7045 o.contents.err = core::ptr::null_mut();
7046 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
7050 result_ok: o.result_ok,
7054 impl Clone for CResult_PaymentSecretNoneZ {
7055 fn clone(&self) -> Self {
7057 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
7058 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7061 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
7062 err: core::ptr::null_mut()
7068 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
7069 /// but with all dynamically-allocated buffers duplicated in new buffers.
7070 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
7072 /// The contents of CResult_PaymentSecretAPIErrorZ
7073 pub union CResult_PaymentSecretAPIErrorZPtr {
7074 /// A pointer to the contents in the success state.
7075 /// Reading from this pointer when `result_ok` is not set is undefined.
7076 pub result: *mut crate::c_types::ThirtyTwoBytes,
7077 /// A pointer to the contents in the error state.
7078 /// Reading from this pointer when `result_ok` is set is undefined.
7079 pub err: *mut crate::lightning::util::errors::APIError,
7082 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7083 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7084 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7085 pub struct CResult_PaymentSecretAPIErrorZ {
7086 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7087 /// `err` or `result` depending on the state of `result_ok`.
7088 pub contents: CResult_PaymentSecretAPIErrorZPtr,
7089 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7090 pub result_ok: bool,
7093 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
7094 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
7095 CResult_PaymentSecretAPIErrorZ {
7096 contents: CResult_PaymentSecretAPIErrorZPtr {
7097 result: Box::into_raw(Box::new(o)),
7103 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
7104 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
7105 CResult_PaymentSecretAPIErrorZ {
7106 contents: CResult_PaymentSecretAPIErrorZPtr {
7107 err: Box::into_raw(Box::new(e)),
7112 /// Checks if the given object is currently in the success state
7114 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
7118 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
7119 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
7120 impl Drop for CResult_PaymentSecretAPIErrorZ {
7121 fn drop(&mut self) {
7123 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7124 let _ = unsafe { Box::from_raw(self.contents.result) };
7127 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7128 let _ = unsafe { Box::from_raw(self.contents.err) };
7133 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
7134 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7135 let contents = if o.result_ok {
7136 let result = unsafe { o.contents.result };
7137 unsafe { o.contents.result = core::ptr::null_mut() };
7138 CResult_PaymentSecretAPIErrorZPtr { result }
7140 let err = unsafe { o.contents.err };
7141 unsafe { o.contents.err = core::ptr::null_mut(); }
7142 CResult_PaymentSecretAPIErrorZPtr { err }
7146 result_ok: o.result_ok,
7150 impl Clone for CResult_PaymentSecretAPIErrorZ {
7151 fn clone(&self) -> Self {
7153 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7154 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7157 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7158 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7164 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7165 /// but with all dynamically-allocated buffers duplicated in new buffers.
7166 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7168 /// The contents of CResult_PaymentPreimageAPIErrorZ
7169 pub union CResult_PaymentPreimageAPIErrorZPtr {
7170 /// A pointer to the contents in the success state.
7171 /// Reading from this pointer when `result_ok` is not set is undefined.
7172 pub result: *mut crate::c_types::ThirtyTwoBytes,
7173 /// A pointer to the contents in the error state.
7174 /// Reading from this pointer when `result_ok` is set is undefined.
7175 pub err: *mut crate::lightning::util::errors::APIError,
7178 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7179 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7180 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7181 pub struct CResult_PaymentPreimageAPIErrorZ {
7182 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7183 /// `err` or `result` depending on the state of `result_ok`.
7184 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7185 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7186 pub result_ok: bool,
7189 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7190 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7191 CResult_PaymentPreimageAPIErrorZ {
7192 contents: CResult_PaymentPreimageAPIErrorZPtr {
7193 result: Box::into_raw(Box::new(o)),
7199 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7200 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7201 CResult_PaymentPreimageAPIErrorZ {
7202 contents: CResult_PaymentPreimageAPIErrorZPtr {
7203 err: Box::into_raw(Box::new(e)),
7208 /// Checks if the given object is currently in the success state
7210 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7214 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7215 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7216 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7217 fn drop(&mut self) {
7219 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7220 let _ = unsafe { Box::from_raw(self.contents.result) };
7223 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7224 let _ = unsafe { Box::from_raw(self.contents.err) };
7229 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7230 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7231 let contents = if o.result_ok {
7232 let result = unsafe { o.contents.result };
7233 unsafe { o.contents.result = core::ptr::null_mut() };
7234 CResult_PaymentPreimageAPIErrorZPtr { result }
7236 let err = unsafe { o.contents.err };
7237 unsafe { o.contents.err = core::ptr::null_mut(); }
7238 CResult_PaymentPreimageAPIErrorZPtr { err }
7242 result_ok: o.result_ok,
7246 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7247 fn clone(&self) -> Self {
7249 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7250 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7253 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7254 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7260 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7261 /// but with all dynamically-allocated buffers duplicated in new buffers.
7262 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7264 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7265 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7266 /// A pointer to the contents in the success state.
7267 /// Reading from this pointer when `result_ok` is not set is undefined.
7268 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7269 /// A pointer to the contents in the error state.
7270 /// Reading from this pointer when `result_ok` is set is undefined.
7271 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7274 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7275 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7276 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7277 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7278 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7279 /// `err` or `result` depending on the state of `result_ok`.
7280 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7281 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7282 pub result_ok: bool,
7285 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7286 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7287 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7288 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7289 result: Box::into_raw(Box::new(o)),
7295 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7296 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7297 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7298 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7299 err: Box::into_raw(Box::new(e)),
7304 /// Checks if the given object is currently in the success state
7306 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7310 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7311 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7312 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7313 fn drop(&mut self) {
7315 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7316 let _ = unsafe { Box::from_raw(self.contents.result) };
7319 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7320 let _ = unsafe { Box::from_raw(self.contents.err) };
7325 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7326 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7327 let contents = if o.result_ok {
7328 let result = unsafe { o.contents.result };
7329 unsafe { o.contents.result = core::ptr::null_mut() };
7330 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7332 let err = unsafe { o.contents.err };
7333 unsafe { o.contents.err = core::ptr::null_mut(); }
7334 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7338 result_ok: o.result_ok,
7342 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7343 fn clone(&self) -> Self {
7345 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7346 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7349 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7350 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7356 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7357 /// but with all dynamically-allocated buffers duplicated in new buffers.
7358 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7360 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7361 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7362 /// A pointer to the contents in the success state.
7363 /// Reading from this pointer when `result_ok` is not set is undefined.
7364 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7365 /// A pointer to the contents in the error state.
7366 /// Reading from this pointer when `result_ok` is set is undefined.
7367 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7370 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7371 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7372 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7373 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7374 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7375 /// `err` or `result` depending on the state of `result_ok`.
7376 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7377 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7378 pub result_ok: bool,
7381 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7382 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7383 CResult_ChannelCounterpartyDecodeErrorZ {
7384 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7385 result: Box::into_raw(Box::new(o)),
7391 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7392 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7393 CResult_ChannelCounterpartyDecodeErrorZ {
7394 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7395 err: Box::into_raw(Box::new(e)),
7400 /// Checks if the given object is currently in the success state
7402 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7406 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7407 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7408 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7409 fn drop(&mut self) {
7411 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7412 let _ = unsafe { Box::from_raw(self.contents.result) };
7415 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7416 let _ = unsafe { Box::from_raw(self.contents.err) };
7421 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7422 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7423 let contents = if o.result_ok {
7424 let result = unsafe { o.contents.result };
7425 unsafe { o.contents.result = core::ptr::null_mut() };
7426 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7428 let err = unsafe { o.contents.err };
7429 unsafe { o.contents.err = core::ptr::null_mut(); }
7430 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7434 result_ok: o.result_ok,
7438 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7439 fn clone(&self) -> Self {
7441 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7442 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7445 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7446 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7452 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7453 /// but with all dynamically-allocated buffers duplicated in new buffers.
7454 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7456 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7457 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7458 /// A pointer to the contents in the success state.
7459 /// Reading from this pointer when `result_ok` is not set is undefined.
7460 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7461 /// A pointer to the contents in the error state.
7462 /// Reading from this pointer when `result_ok` is set is undefined.
7463 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7466 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7467 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7469 pub struct CResult_ChannelDetailsDecodeErrorZ {
7470 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7471 /// `err` or `result` depending on the state of `result_ok`.
7472 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7473 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7474 pub result_ok: bool,
7477 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7478 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7479 CResult_ChannelDetailsDecodeErrorZ {
7480 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7481 result: Box::into_raw(Box::new(o)),
7487 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7488 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7489 CResult_ChannelDetailsDecodeErrorZ {
7490 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7491 err: Box::into_raw(Box::new(e)),
7496 /// Checks if the given object is currently in the success state
7498 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7502 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7503 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7504 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7505 fn drop(&mut self) {
7507 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7508 let _ = unsafe { Box::from_raw(self.contents.result) };
7511 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7512 let _ = unsafe { Box::from_raw(self.contents.err) };
7517 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7518 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7519 let contents = if o.result_ok {
7520 let result = unsafe { o.contents.result };
7521 unsafe { o.contents.result = core::ptr::null_mut() };
7522 CResult_ChannelDetailsDecodeErrorZPtr { result }
7524 let err = unsafe { o.contents.err };
7525 unsafe { o.contents.err = core::ptr::null_mut(); }
7526 CResult_ChannelDetailsDecodeErrorZPtr { err }
7530 result_ok: o.result_ok,
7534 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7535 fn clone(&self) -> Self {
7537 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7538 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7541 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7542 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7548 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7549 /// but with all dynamically-allocated buffers duplicated in new buffers.
7550 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7552 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7553 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7554 /// A pointer to the contents in the success state.
7555 /// Reading from this pointer when `result_ok` is not set is undefined.
7556 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7557 /// A pointer to the contents in the error state.
7558 /// Reading from this pointer when `result_ok` is set is undefined.
7559 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7562 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7563 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7564 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7565 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7566 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7567 /// `err` or `result` depending on the state of `result_ok`.
7568 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7569 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7570 pub result_ok: bool,
7573 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7574 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7575 CResult_PhantomRouteHintsDecodeErrorZ {
7576 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7577 result: Box::into_raw(Box::new(o)),
7583 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7584 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7585 CResult_PhantomRouteHintsDecodeErrorZ {
7586 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7587 err: Box::into_raw(Box::new(e)),
7592 /// Checks if the given object is currently in the success state
7594 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7598 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7599 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7600 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7601 fn drop(&mut self) {
7603 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7604 let _ = unsafe { Box::from_raw(self.contents.result) };
7607 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7608 let _ = unsafe { Box::from_raw(self.contents.err) };
7613 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7614 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7615 let contents = if o.result_ok {
7616 let result = unsafe { o.contents.result };
7617 unsafe { o.contents.result = core::ptr::null_mut() };
7618 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7620 let err = unsafe { o.contents.err };
7621 unsafe { o.contents.err = core::ptr::null_mut(); }
7622 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7626 result_ok: o.result_ok,
7631 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7632 /// This corresponds to std::vector in C++
7633 pub struct CVec_ChannelMonitorZ {
7634 /// The elements in the array.
7635 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7636 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7637 /// The number of elements pointed to by `data`.
7640 impl CVec_ChannelMonitorZ {
7641 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7642 if self.datalen == 0 { return Vec::new(); }
7643 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7644 self.data = core::ptr::null_mut();
7648 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7649 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7652 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7653 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7654 let datalen = v.len();
7655 let data = Box::into_raw(v.into_boxed_slice());
7656 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7660 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7661 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7662 impl Drop for CVec_ChannelMonitorZ {
7663 fn drop(&mut self) {
7664 if self.datalen == 0 { return; }
7665 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7669 /// A tuple of 2 elements. See the individual fields for the types contained.
7670 pub struct C2Tuple_BlockHashChannelManagerZ {
7671 /// The element at position 0
7672 pub a: crate::c_types::ThirtyTwoBytes,
7673 /// The element at position 1
7674 pub b: crate::lightning::ln::channelmanager::ChannelManager,
7676 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7677 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7684 impl C2Tuple_BlockHashChannelManagerZ {
7685 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7689 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7691 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7692 C2Tuple_BlockHashChannelManagerZ { a, b, }
7696 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7697 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7699 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7700 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7701 /// A pointer to the contents in the success state.
7702 /// Reading from this pointer when `result_ok` is not set is undefined.
7703 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7704 /// A pointer to the contents in the error state.
7705 /// Reading from this pointer when `result_ok` is set is undefined.
7706 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7709 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7710 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7711 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7712 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7713 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7714 /// `err` or `result` depending on the state of `result_ok`.
7715 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7716 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7717 pub result_ok: bool,
7720 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7721 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7722 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7723 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7724 result: Box::into_raw(Box::new(o)),
7730 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7731 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7732 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7733 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7734 err: Box::into_raw(Box::new(e)),
7739 /// Checks if the given object is currently in the success state
7741 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7745 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7746 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7747 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7748 fn drop(&mut self) {
7750 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7751 let _ = unsafe { Box::from_raw(self.contents.result) };
7754 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7755 let _ = unsafe { Box::from_raw(self.contents.err) };
7760 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7761 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7762 let contents = if o.result_ok {
7763 let result = unsafe { o.contents.result };
7764 unsafe { o.contents.result = core::ptr::null_mut() };
7765 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7767 let err = unsafe { o.contents.err };
7768 unsafe { o.contents.err = core::ptr::null_mut(); }
7769 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7773 result_ok: o.result_ok,
7778 /// The contents of CResult_ChannelConfigDecodeErrorZ
7779 pub union CResult_ChannelConfigDecodeErrorZPtr {
7780 /// A pointer to the contents in the success state.
7781 /// Reading from this pointer when `result_ok` is not set is undefined.
7782 pub result: *mut crate::lightning::util::config::ChannelConfig,
7783 /// A pointer to the contents in the error state.
7784 /// Reading from this pointer when `result_ok` is set is undefined.
7785 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7788 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7789 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7790 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7791 pub struct CResult_ChannelConfigDecodeErrorZ {
7792 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7793 /// `err` or `result` depending on the state of `result_ok`.
7794 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7795 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7796 pub result_ok: bool,
7799 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7800 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7801 CResult_ChannelConfigDecodeErrorZ {
7802 contents: CResult_ChannelConfigDecodeErrorZPtr {
7803 result: Box::into_raw(Box::new(o)),
7809 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7810 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7811 CResult_ChannelConfigDecodeErrorZ {
7812 contents: CResult_ChannelConfigDecodeErrorZPtr {
7813 err: Box::into_raw(Box::new(e)),
7818 /// Checks if the given object is currently in the success state
7820 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7824 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7825 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7826 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7827 fn drop(&mut self) {
7829 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7830 let _ = unsafe { Box::from_raw(self.contents.result) };
7833 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7834 let _ = unsafe { Box::from_raw(self.contents.err) };
7839 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7840 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7841 let contents = if o.result_ok {
7842 let result = unsafe { o.contents.result };
7843 unsafe { o.contents.result = core::ptr::null_mut() };
7844 CResult_ChannelConfigDecodeErrorZPtr { result }
7846 let err = unsafe { o.contents.err };
7847 unsafe { o.contents.err = core::ptr::null_mut(); }
7848 CResult_ChannelConfigDecodeErrorZPtr { err }
7852 result_ok: o.result_ok,
7856 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7857 fn clone(&self) -> Self {
7859 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7860 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7863 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7864 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7870 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7871 /// but with all dynamically-allocated buffers duplicated in new buffers.
7872 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7874 /// The contents of CResult_OutPointDecodeErrorZ
7875 pub union CResult_OutPointDecodeErrorZPtr {
7876 /// A pointer to the contents in the success state.
7877 /// Reading from this pointer when `result_ok` is not set is undefined.
7878 pub result: *mut crate::lightning::chain::transaction::OutPoint,
7879 /// A pointer to the contents in the error state.
7880 /// Reading from this pointer when `result_ok` is set is undefined.
7881 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7884 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7885 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7887 pub struct CResult_OutPointDecodeErrorZ {
7888 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7889 /// `err` or `result` depending on the state of `result_ok`.
7890 pub contents: CResult_OutPointDecodeErrorZPtr,
7891 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7892 pub result_ok: bool,
7895 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7896 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7897 CResult_OutPointDecodeErrorZ {
7898 contents: CResult_OutPointDecodeErrorZPtr {
7899 result: Box::into_raw(Box::new(o)),
7905 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7906 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7907 CResult_OutPointDecodeErrorZ {
7908 contents: CResult_OutPointDecodeErrorZPtr {
7909 err: Box::into_raw(Box::new(e)),
7914 /// Checks if the given object is currently in the success state
7916 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7920 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7921 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7922 impl Drop for CResult_OutPointDecodeErrorZ {
7923 fn drop(&mut self) {
7925 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7926 let _ = unsafe { Box::from_raw(self.contents.result) };
7929 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7930 let _ = unsafe { Box::from_raw(self.contents.err) };
7935 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7936 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7937 let contents = if o.result_ok {
7938 let result = unsafe { o.contents.result };
7939 unsafe { o.contents.result = core::ptr::null_mut() };
7940 CResult_OutPointDecodeErrorZPtr { result }
7942 let err = unsafe { o.contents.err };
7943 unsafe { o.contents.err = core::ptr::null_mut(); }
7944 CResult_OutPointDecodeErrorZPtr { err }
7948 result_ok: o.result_ok,
7952 impl Clone for CResult_OutPointDecodeErrorZ {
7953 fn clone(&self) -> Self {
7955 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7956 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7959 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7960 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7966 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7967 /// but with all dynamically-allocated buffers duplicated in new buffers.
7968 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7970 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7971 pub enum COption_TypeZ {
7972 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7973 Some(crate::lightning::ln::wire::Type),
7974 /// When we're in this state, this COption_TypeZ contains nothing
7977 impl COption_TypeZ {
7978 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7979 if let Self::None = self { false } else { true }
7981 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7984 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7985 if let Self::Some(v) = self { v } else { unreachable!() }
7989 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7990 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7991 COption_TypeZ::Some(o)
7994 /// Constructs a new COption_TypeZ containing nothing
7995 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7999 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
8000 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
8002 /// The contents of CResult_COption_TypeZDecodeErrorZ
8003 pub union CResult_COption_TypeZDecodeErrorZPtr {
8004 /// A pointer to the contents in the success state.
8005 /// Reading from this pointer when `result_ok` is not set is undefined.
8006 pub result: *mut crate::c_types::derived::COption_TypeZ,
8007 /// A pointer to the contents in the error state.
8008 /// Reading from this pointer when `result_ok` is set is undefined.
8009 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8012 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
8013 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8015 pub struct CResult_COption_TypeZDecodeErrorZ {
8016 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
8017 /// `err` or `result` depending on the state of `result_ok`.
8018 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
8019 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
8020 pub result_ok: bool,
8023 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
8024 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
8025 CResult_COption_TypeZDecodeErrorZ {
8026 contents: CResult_COption_TypeZDecodeErrorZPtr {
8027 result: Box::into_raw(Box::new(o)),
8033 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
8034 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
8035 CResult_COption_TypeZDecodeErrorZ {
8036 contents: CResult_COption_TypeZDecodeErrorZPtr {
8037 err: Box::into_raw(Box::new(e)),
8042 /// Checks if the given object is currently in the success state
8044 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
8048 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
8049 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
8050 impl Drop for CResult_COption_TypeZDecodeErrorZ {
8051 fn drop(&mut self) {
8053 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8054 let _ = unsafe { Box::from_raw(self.contents.result) };
8057 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8058 let _ = unsafe { Box::from_raw(self.contents.err) };
8063 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
8064 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8065 let contents = if o.result_ok {
8066 let result = unsafe { o.contents.result };
8067 unsafe { o.contents.result = core::ptr::null_mut() };
8068 CResult_COption_TypeZDecodeErrorZPtr { result }
8070 let err = unsafe { o.contents.err };
8071 unsafe { o.contents.err = core::ptr::null_mut(); }
8072 CResult_COption_TypeZDecodeErrorZPtr { err }
8076 result_ok: o.result_ok,
8081 /// The contents of CResult_PaymentIdPaymentErrorZ
8082 pub union CResult_PaymentIdPaymentErrorZPtr {
8083 /// A pointer to the contents in the success state.
8084 /// Reading from this pointer when `result_ok` is not set is undefined.
8085 pub result: *mut crate::c_types::ThirtyTwoBytes,
8086 /// A pointer to the contents in the error state.
8087 /// Reading from this pointer when `result_ok` is set is undefined.
8088 pub err: *mut crate::lightning_invoice::payment::PaymentError,
8091 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8092 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8094 pub struct CResult_PaymentIdPaymentErrorZ {
8095 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8096 /// `err` or `result` depending on the state of `result_ok`.
8097 pub contents: CResult_PaymentIdPaymentErrorZPtr,
8098 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8099 pub result_ok: bool,
8102 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
8103 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
8104 CResult_PaymentIdPaymentErrorZ {
8105 contents: CResult_PaymentIdPaymentErrorZPtr {
8106 result: Box::into_raw(Box::new(o)),
8112 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
8113 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
8114 CResult_PaymentIdPaymentErrorZ {
8115 contents: CResult_PaymentIdPaymentErrorZPtr {
8116 err: Box::into_raw(Box::new(e)),
8121 /// Checks if the given object is currently in the success state
8123 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
8127 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
8128 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
8129 impl Drop for CResult_PaymentIdPaymentErrorZ {
8130 fn drop(&mut self) {
8132 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8133 let _ = unsafe { Box::from_raw(self.contents.result) };
8136 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8137 let _ = unsafe { Box::from_raw(self.contents.err) };
8142 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
8143 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
8144 let contents = if o.result_ok {
8145 let result = unsafe { o.contents.result };
8146 unsafe { o.contents.result = core::ptr::null_mut() };
8147 CResult_PaymentIdPaymentErrorZPtr { result }
8149 let err = unsafe { o.contents.err };
8150 unsafe { o.contents.err = core::ptr::null_mut(); }
8151 CResult_PaymentIdPaymentErrorZPtr { err }
8155 result_ok: o.result_ok,
8159 impl Clone for CResult_PaymentIdPaymentErrorZ {
8160 fn clone(&self) -> Self {
8162 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8163 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8166 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8167 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8173 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8174 /// but with all dynamically-allocated buffers duplicated in new buffers.
8175 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8177 /// The contents of CResult_SiPrefixNoneZ
8178 pub union CResult_SiPrefixNoneZPtr {
8179 /// A pointer to the contents in the success state.
8180 /// Reading from this pointer when `result_ok` is not set is undefined.
8181 pub result: *mut crate::lightning_invoice::SiPrefix,
8182 /// Note that this value is always NULL, as there are no contents in the Err variant
8183 pub err: *mut core::ffi::c_void,
8186 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
8187 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
8188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8189 pub struct CResult_SiPrefixNoneZ {
8190 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
8191 /// `err` or `result` depending on the state of `result_ok`.
8192 pub contents: CResult_SiPrefixNoneZPtr,
8193 /// Whether this CResult_SiPrefixNoneZ represents a success state.
8194 pub result_ok: bool,
8197 /// Creates a new CResult_SiPrefixNoneZ in the success state.
8198 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
8199 CResult_SiPrefixNoneZ {
8200 contents: CResult_SiPrefixNoneZPtr {
8201 result: Box::into_raw(Box::new(o)),
8207 /// Creates a new CResult_SiPrefixNoneZ in the error state.
8208 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
8209 CResult_SiPrefixNoneZ {
8210 contents: CResult_SiPrefixNoneZPtr {
8211 err: core::ptr::null_mut(),
8216 /// Checks if the given object is currently in the success state
8218 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
8222 /// Frees any resources used by the CResult_SiPrefixNoneZ.
8223 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
8224 impl Drop for CResult_SiPrefixNoneZ {
8225 fn drop(&mut self) {
8227 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8228 let _ = unsafe { Box::from_raw(self.contents.result) };
8234 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
8235 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
8236 let contents = if o.result_ok {
8237 let result = unsafe { o.contents.result };
8238 unsafe { o.contents.result = core::ptr::null_mut() };
8239 CResult_SiPrefixNoneZPtr { result }
8241 let _ = unsafe { Box::from_raw(o.contents.err) };
8242 o.contents.err = core::ptr::null_mut();
8243 CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
8247 result_ok: o.result_ok,
8251 impl Clone for CResult_SiPrefixNoneZ {
8252 fn clone(&self) -> Self {
8254 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
8255 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8258 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
8259 err: core::ptr::null_mut()
8265 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
8266 /// but with all dynamically-allocated buffers duplicated in new buffers.
8267 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
8269 /// The contents of CResult_InvoiceNoneZ
8270 pub union CResult_InvoiceNoneZPtr {
8271 /// A pointer to the contents in the success state.
8272 /// Reading from this pointer when `result_ok` is not set is undefined.
8273 pub result: *mut crate::lightning_invoice::Invoice,
8274 /// Note that this value is always NULL, as there are no contents in the Err variant
8275 pub err: *mut core::ffi::c_void,
8278 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
8279 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
8280 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8281 pub struct CResult_InvoiceNoneZ {
8282 /// The contents of this CResult_InvoiceNoneZ, accessible via either
8283 /// `err` or `result` depending on the state of `result_ok`.
8284 pub contents: CResult_InvoiceNoneZPtr,
8285 /// Whether this CResult_InvoiceNoneZ represents a success state.
8286 pub result_ok: bool,
8289 /// Creates a new CResult_InvoiceNoneZ in the success state.
8290 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
8291 CResult_InvoiceNoneZ {
8292 contents: CResult_InvoiceNoneZPtr {
8293 result: Box::into_raw(Box::new(o)),
8299 /// Creates a new CResult_InvoiceNoneZ in the error state.
8300 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
8301 CResult_InvoiceNoneZ {
8302 contents: CResult_InvoiceNoneZPtr {
8303 err: core::ptr::null_mut(),
8308 /// Checks if the given object is currently in the success state
8310 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
8314 /// Frees any resources used by the CResult_InvoiceNoneZ.
8315 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
8316 impl Drop for CResult_InvoiceNoneZ {
8317 fn drop(&mut self) {
8319 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8320 let _ = unsafe { Box::from_raw(self.contents.result) };
8326 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
8327 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
8328 let contents = if o.result_ok {
8329 let result = unsafe { o.contents.result };
8330 unsafe { o.contents.result = core::ptr::null_mut() };
8331 CResult_InvoiceNoneZPtr { result }
8333 let _ = unsafe { Box::from_raw(o.contents.err) };
8334 o.contents.err = core::ptr::null_mut();
8335 CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
8339 result_ok: o.result_ok,
8343 impl Clone for CResult_InvoiceNoneZ {
8344 fn clone(&self) -> Self {
8346 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
8347 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8350 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
8351 err: core::ptr::null_mut()
8357 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
8358 /// but with all dynamically-allocated buffers duplicated in new buffers.
8359 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
8361 /// The contents of CResult_SignedRawInvoiceNoneZ
8362 pub union CResult_SignedRawInvoiceNoneZPtr {
8363 /// A pointer to the contents in the success state.
8364 /// Reading from this pointer when `result_ok` is not set is undefined.
8365 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8366 /// Note that this value is always NULL, as there are no contents in the Err variant
8367 pub err: *mut core::ffi::c_void,
8370 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
8371 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
8372 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8373 pub struct CResult_SignedRawInvoiceNoneZ {
8374 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
8375 /// `err` or `result` depending on the state of `result_ok`.
8376 pub contents: CResult_SignedRawInvoiceNoneZPtr,
8377 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
8378 pub result_ok: bool,
8381 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
8382 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
8383 CResult_SignedRawInvoiceNoneZ {
8384 contents: CResult_SignedRawInvoiceNoneZPtr {
8385 result: Box::into_raw(Box::new(o)),
8391 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
8392 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
8393 CResult_SignedRawInvoiceNoneZ {
8394 contents: CResult_SignedRawInvoiceNoneZPtr {
8395 err: core::ptr::null_mut(),
8400 /// Checks if the given object is currently in the success state
8402 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
8406 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
8407 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
8408 impl Drop for CResult_SignedRawInvoiceNoneZ {
8409 fn drop(&mut self) {
8411 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8412 let _ = unsafe { Box::from_raw(self.contents.result) };
8418 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
8419 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
8420 let contents = if o.result_ok {
8421 let result = unsafe { o.contents.result };
8422 unsafe { o.contents.result = core::ptr::null_mut() };
8423 CResult_SignedRawInvoiceNoneZPtr { result }
8425 let _ = unsafe { Box::from_raw(o.contents.err) };
8426 o.contents.err = core::ptr::null_mut();
8427 CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
8431 result_ok: o.result_ok,
8435 impl Clone for CResult_SignedRawInvoiceNoneZ {
8436 fn clone(&self) -> Self {
8438 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
8439 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8442 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
8443 err: core::ptr::null_mut()
8449 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
8450 /// but with all dynamically-allocated buffers duplicated in new buffers.
8451 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
8453 /// A tuple of 3 elements. See the individual fields for the types contained.
8454 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8455 /// The element at position 0
8456 pub a: crate::lightning_invoice::RawInvoice,
8457 /// The element at position 1
8458 pub b: crate::c_types::ThirtyTwoBytes,
8459 /// The element at position 2
8460 pub c: crate::lightning_invoice::InvoiceSignature,
8462 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8463 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8471 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8472 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8473 (self.a, self.b, self.c)
8476 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8477 fn clone(&self) -> Self {
8479 a: Clone::clone(&self.a),
8480 b: Clone::clone(&self.b),
8481 c: Clone::clone(&self.c),
8486 /// Creates a new tuple which has the same data as `orig`
8487 /// but with all dynamically-allocated buffers duplicated in new buffers.
8488 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8489 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8491 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 {
8492 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8496 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8497 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8499 /// The contents of CResult_PayeePubKeyErrorZ
8500 pub union CResult_PayeePubKeyErrorZPtr {
8501 /// A pointer to the contents in the success state.
8502 /// Reading from this pointer when `result_ok` is not set is undefined.
8503 pub result: *mut crate::lightning_invoice::PayeePubKey,
8504 /// A pointer to the contents in the error state.
8505 /// Reading from this pointer when `result_ok` is set is undefined.
8506 pub err: *mut crate::c_types::Secp256k1Error,
8509 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8510 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8512 pub struct CResult_PayeePubKeyErrorZ {
8513 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8514 /// `err` or `result` depending on the state of `result_ok`.
8515 pub contents: CResult_PayeePubKeyErrorZPtr,
8516 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8517 pub result_ok: bool,
8520 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8521 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8522 CResult_PayeePubKeyErrorZ {
8523 contents: CResult_PayeePubKeyErrorZPtr {
8524 result: Box::into_raw(Box::new(o)),
8530 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8531 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8532 CResult_PayeePubKeyErrorZ {
8533 contents: CResult_PayeePubKeyErrorZPtr {
8534 err: Box::into_raw(Box::new(e)),
8539 /// Checks if the given object is currently in the success state
8541 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8545 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8546 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8547 impl Drop for CResult_PayeePubKeyErrorZ {
8548 fn drop(&mut self) {
8550 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8551 let _ = unsafe { Box::from_raw(self.contents.result) };
8554 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8555 let _ = unsafe { Box::from_raw(self.contents.err) };
8560 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8561 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8562 let contents = if o.result_ok {
8563 let result = unsafe { o.contents.result };
8564 unsafe { o.contents.result = core::ptr::null_mut() };
8565 CResult_PayeePubKeyErrorZPtr { result }
8567 let err = unsafe { o.contents.err };
8568 unsafe { o.contents.err = core::ptr::null_mut(); }
8569 CResult_PayeePubKeyErrorZPtr { err }
8573 result_ok: o.result_ok,
8577 impl Clone for CResult_PayeePubKeyErrorZ {
8578 fn clone(&self) -> Self {
8580 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8581 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8584 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8585 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8591 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8592 /// but with all dynamically-allocated buffers duplicated in new buffers.
8593 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8595 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8596 /// This corresponds to std::vector in C++
8597 pub struct CVec_PrivateRouteZ {
8598 /// The elements in the array.
8599 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8600 pub data: *mut crate::lightning_invoice::PrivateRoute,
8601 /// The number of elements pointed to by `data`.
8604 impl CVec_PrivateRouteZ {
8605 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8606 if self.datalen == 0 { return Vec::new(); }
8607 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8608 self.data = core::ptr::null_mut();
8612 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8613 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8616 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8617 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8618 let datalen = v.len();
8619 let data = Box::into_raw(v.into_boxed_slice());
8620 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8624 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8625 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8626 impl Drop for CVec_PrivateRouteZ {
8627 fn drop(&mut self) {
8628 if self.datalen == 0 { return; }
8629 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8632 impl Clone for CVec_PrivateRouteZ {
8633 fn clone(&self) -> Self {
8634 let mut res = Vec::new();
8635 if self.datalen == 0 { return Self::from(res); }
8636 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8641 /// The contents of CResult_PositiveTimestampCreationErrorZ
8642 pub union CResult_PositiveTimestampCreationErrorZPtr {
8643 /// A pointer to the contents in the success state.
8644 /// Reading from this pointer when `result_ok` is not set is undefined.
8645 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8646 /// A pointer to the contents in the error state.
8647 /// Reading from this pointer when `result_ok` is set is undefined.
8648 pub err: *mut crate::lightning_invoice::CreationError,
8651 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8652 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8653 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8654 pub struct CResult_PositiveTimestampCreationErrorZ {
8655 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8656 /// `err` or `result` depending on the state of `result_ok`.
8657 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8658 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8659 pub result_ok: bool,
8662 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8663 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8664 CResult_PositiveTimestampCreationErrorZ {
8665 contents: CResult_PositiveTimestampCreationErrorZPtr {
8666 result: Box::into_raw(Box::new(o)),
8672 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8673 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8674 CResult_PositiveTimestampCreationErrorZ {
8675 contents: CResult_PositiveTimestampCreationErrorZPtr {
8676 err: Box::into_raw(Box::new(e)),
8681 /// Checks if the given object is currently in the success state
8683 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8687 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8688 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8689 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8690 fn drop(&mut self) {
8692 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8693 let _ = unsafe { Box::from_raw(self.contents.result) };
8696 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8697 let _ = unsafe { Box::from_raw(self.contents.err) };
8702 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8703 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8704 let contents = if o.result_ok {
8705 let result = unsafe { o.contents.result };
8706 unsafe { o.contents.result = core::ptr::null_mut() };
8707 CResult_PositiveTimestampCreationErrorZPtr { result }
8709 let err = unsafe { o.contents.err };
8710 unsafe { o.contents.err = core::ptr::null_mut(); }
8711 CResult_PositiveTimestampCreationErrorZPtr { err }
8715 result_ok: o.result_ok,
8719 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8720 fn clone(&self) -> Self {
8722 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8723 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8726 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8727 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8733 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8734 /// but with all dynamically-allocated buffers duplicated in new buffers.
8735 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8737 /// The contents of CResult_NoneSemanticErrorZ
8738 pub union CResult_NoneSemanticErrorZPtr {
8739 /// Note that this value is always NULL, as there are no contents in the OK variant
8740 pub result: *mut core::ffi::c_void,
8741 /// A pointer to the contents in the error state.
8742 /// Reading from this pointer when `result_ok` is set is undefined.
8743 pub err: *mut crate::lightning_invoice::SemanticError,
8746 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8747 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8749 pub struct CResult_NoneSemanticErrorZ {
8750 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8751 /// `err` or `result` depending on the state of `result_ok`.
8752 pub contents: CResult_NoneSemanticErrorZPtr,
8753 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8754 pub result_ok: bool,
8757 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8758 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8759 CResult_NoneSemanticErrorZ {
8760 contents: CResult_NoneSemanticErrorZPtr {
8761 result: core::ptr::null_mut(),
8767 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8768 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8769 CResult_NoneSemanticErrorZ {
8770 contents: CResult_NoneSemanticErrorZPtr {
8771 err: Box::into_raw(Box::new(e)),
8776 /// Checks if the given object is currently in the success state
8778 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8782 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8783 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8784 impl Drop for CResult_NoneSemanticErrorZ {
8785 fn drop(&mut self) {
8788 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8789 let _ = unsafe { Box::from_raw(self.contents.err) };
8794 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8795 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8796 let contents = if o.result_ok {
8797 let _ = unsafe { Box::from_raw(o.contents.result) };
8798 o.contents.result = core::ptr::null_mut();
8799 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8801 let err = unsafe { o.contents.err };
8802 unsafe { o.contents.err = core::ptr::null_mut(); }
8803 CResult_NoneSemanticErrorZPtr { err }
8807 result_ok: o.result_ok,
8811 impl Clone for CResult_NoneSemanticErrorZ {
8812 fn clone(&self) -> Self {
8814 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8815 result: core::ptr::null_mut()
8818 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8819 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8825 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8826 /// but with all dynamically-allocated buffers duplicated in new buffers.
8827 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8829 /// The contents of CResult_InvoiceSemanticErrorZ
8830 pub union CResult_InvoiceSemanticErrorZPtr {
8831 /// A pointer to the contents in the success state.
8832 /// Reading from this pointer when `result_ok` is not set is undefined.
8833 pub result: *mut crate::lightning_invoice::Invoice,
8834 /// A pointer to the contents in the error state.
8835 /// Reading from this pointer when `result_ok` is set is undefined.
8836 pub err: *mut crate::lightning_invoice::SemanticError,
8839 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8840 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8841 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8842 pub struct CResult_InvoiceSemanticErrorZ {
8843 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8844 /// `err` or `result` depending on the state of `result_ok`.
8845 pub contents: CResult_InvoiceSemanticErrorZPtr,
8846 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8847 pub result_ok: bool,
8850 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8851 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8852 CResult_InvoiceSemanticErrorZ {
8853 contents: CResult_InvoiceSemanticErrorZPtr {
8854 result: Box::into_raw(Box::new(o)),
8860 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8861 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8862 CResult_InvoiceSemanticErrorZ {
8863 contents: CResult_InvoiceSemanticErrorZPtr {
8864 err: Box::into_raw(Box::new(e)),
8869 /// Checks if the given object is currently in the success state
8871 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8875 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8876 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8877 impl Drop for CResult_InvoiceSemanticErrorZ {
8878 fn drop(&mut self) {
8880 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8881 let _ = unsafe { Box::from_raw(self.contents.result) };
8884 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8885 let _ = unsafe { Box::from_raw(self.contents.err) };
8890 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8891 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8892 let contents = if o.result_ok {
8893 let result = unsafe { o.contents.result };
8894 unsafe { o.contents.result = core::ptr::null_mut() };
8895 CResult_InvoiceSemanticErrorZPtr { result }
8897 let err = unsafe { o.contents.err };
8898 unsafe { o.contents.err = core::ptr::null_mut(); }
8899 CResult_InvoiceSemanticErrorZPtr { err }
8903 result_ok: o.result_ok,
8907 impl Clone for CResult_InvoiceSemanticErrorZ {
8908 fn clone(&self) -> Self {
8910 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8911 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8914 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8915 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8921 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8922 /// but with all dynamically-allocated buffers duplicated in new buffers.
8923 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8925 /// The contents of CResult_DescriptionCreationErrorZ
8926 pub union CResult_DescriptionCreationErrorZPtr {
8927 /// A pointer to the contents in the success state.
8928 /// Reading from this pointer when `result_ok` is not set is undefined.
8929 pub result: *mut crate::lightning_invoice::Description,
8930 /// A pointer to the contents in the error state.
8931 /// Reading from this pointer when `result_ok` is set is undefined.
8932 pub err: *mut crate::lightning_invoice::CreationError,
8935 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8936 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8937 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8938 pub struct CResult_DescriptionCreationErrorZ {
8939 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8940 /// `err` or `result` depending on the state of `result_ok`.
8941 pub contents: CResult_DescriptionCreationErrorZPtr,
8942 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8943 pub result_ok: bool,
8946 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8947 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8948 CResult_DescriptionCreationErrorZ {
8949 contents: CResult_DescriptionCreationErrorZPtr {
8950 result: Box::into_raw(Box::new(o)),
8956 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8957 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8958 CResult_DescriptionCreationErrorZ {
8959 contents: CResult_DescriptionCreationErrorZPtr {
8960 err: Box::into_raw(Box::new(e)),
8965 /// Checks if the given object is currently in the success state
8967 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8971 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8972 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8973 impl Drop for CResult_DescriptionCreationErrorZ {
8974 fn drop(&mut self) {
8976 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8977 let _ = unsafe { Box::from_raw(self.contents.result) };
8980 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8981 let _ = unsafe { Box::from_raw(self.contents.err) };
8986 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8987 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8988 let contents = if o.result_ok {
8989 let result = unsafe { o.contents.result };
8990 unsafe { o.contents.result = core::ptr::null_mut() };
8991 CResult_DescriptionCreationErrorZPtr { result }
8993 let err = unsafe { o.contents.err };
8994 unsafe { o.contents.err = core::ptr::null_mut(); }
8995 CResult_DescriptionCreationErrorZPtr { err }
8999 result_ok: o.result_ok,
9003 impl Clone for CResult_DescriptionCreationErrorZ {
9004 fn clone(&self) -> Self {
9006 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
9007 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
9010 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
9011 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9017 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
9018 /// but with all dynamically-allocated buffers duplicated in new buffers.
9019 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
9021 /// The contents of CResult_PrivateRouteCreationErrorZ
9022 pub union CResult_PrivateRouteCreationErrorZPtr {
9023 /// A pointer to the contents in the success state.
9024 /// Reading from this pointer when `result_ok` is not set is undefined.
9025 pub result: *mut crate::lightning_invoice::PrivateRoute,
9026 /// A pointer to the contents in the error state.
9027 /// Reading from this pointer when `result_ok` is set is undefined.
9028 pub err: *mut crate::lightning_invoice::CreationError,
9031 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
9032 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
9033 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9034 pub struct CResult_PrivateRouteCreationErrorZ {
9035 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
9036 /// `err` or `result` depending on the state of `result_ok`.
9037 pub contents: CResult_PrivateRouteCreationErrorZPtr,
9038 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
9039 pub result_ok: bool,
9042 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
9043 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
9044 CResult_PrivateRouteCreationErrorZ {
9045 contents: CResult_PrivateRouteCreationErrorZPtr {
9046 result: Box::into_raw(Box::new(o)),
9052 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
9053 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
9054 CResult_PrivateRouteCreationErrorZ {
9055 contents: CResult_PrivateRouteCreationErrorZPtr {
9056 err: Box::into_raw(Box::new(e)),
9061 /// Checks if the given object is currently in the success state
9063 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
9067 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
9068 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
9069 impl Drop for CResult_PrivateRouteCreationErrorZ {
9070 fn drop(&mut self) {
9072 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9073 let _ = unsafe { Box::from_raw(self.contents.result) };
9076 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9077 let _ = unsafe { Box::from_raw(self.contents.err) };
9082 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
9083 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
9084 let contents = if o.result_ok {
9085 let result = unsafe { o.contents.result };
9086 unsafe { o.contents.result = core::ptr::null_mut() };
9087 CResult_PrivateRouteCreationErrorZPtr { result }
9089 let err = unsafe { o.contents.err };
9090 unsafe { o.contents.err = core::ptr::null_mut(); }
9091 CResult_PrivateRouteCreationErrorZPtr { err }
9095 result_ok: o.result_ok,
9099 impl Clone for CResult_PrivateRouteCreationErrorZ {
9100 fn clone(&self) -> Self {
9102 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
9103 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
9106 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
9107 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9113 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
9114 /// but with all dynamically-allocated buffers duplicated in new buffers.
9115 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
9117 /// The contents of CResult_StringErrorZ
9118 pub union CResult_StringErrorZPtr {
9119 /// A pointer to the contents in the success state.
9120 /// Reading from this pointer when `result_ok` is not set is undefined.
9121 pub result: *mut crate::c_types::Str,
9122 /// A pointer to the contents in the error state.
9123 /// Reading from this pointer when `result_ok` is set is undefined.
9124 pub err: *mut crate::c_types::Secp256k1Error,
9127 /// A CResult_StringErrorZ represents the result of a fallible operation,
9128 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9129 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9130 pub struct CResult_StringErrorZ {
9131 /// The contents of this CResult_StringErrorZ, accessible via either
9132 /// `err` or `result` depending on the state of `result_ok`.
9133 pub contents: CResult_StringErrorZPtr,
9134 /// Whether this CResult_StringErrorZ represents a success state.
9135 pub result_ok: bool,
9138 /// Creates a new CResult_StringErrorZ in the success state.
9139 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
9140 CResult_StringErrorZ {
9141 contents: CResult_StringErrorZPtr {
9142 result: Box::into_raw(Box::new(o)),
9148 /// Creates a new CResult_StringErrorZ in the error state.
9149 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
9150 CResult_StringErrorZ {
9151 contents: CResult_StringErrorZPtr {
9152 err: Box::into_raw(Box::new(e)),
9157 /// Checks if the given object is currently in the success state
9159 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9163 /// Frees any resources used by the CResult_StringErrorZ.
9164 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9165 impl Drop for CResult_StringErrorZ {
9166 fn drop(&mut self) {
9168 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9169 let _ = unsafe { Box::from_raw(self.contents.result) };
9172 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9173 let _ = unsafe { Box::from_raw(self.contents.err) };
9178 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9179 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9180 let contents = if o.result_ok {
9181 let result = unsafe { o.contents.result };
9182 unsafe { o.contents.result = core::ptr::null_mut() };
9183 CResult_StringErrorZPtr { result }
9185 let err = unsafe { o.contents.err };
9186 unsafe { o.contents.err = core::ptr::null_mut(); }
9187 CResult_StringErrorZPtr { err }
9191 result_ok: o.result_ok,
9196 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9197 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9198 /// A pointer to the contents in the success state.
9199 /// Reading from this pointer when `result_ok` is not set is undefined.
9200 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9201 /// A pointer to the contents in the error state.
9202 /// Reading from this pointer when `result_ok` is set is undefined.
9203 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9206 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9207 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9208 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9209 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9210 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9211 /// `err` or `result` depending on the state of `result_ok`.
9212 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9213 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9214 pub result_ok: bool,
9217 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9218 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9219 CResult_ChannelMonitorUpdateDecodeErrorZ {
9220 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9221 result: Box::into_raw(Box::new(o)),
9227 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9228 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9229 CResult_ChannelMonitorUpdateDecodeErrorZ {
9230 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9231 err: Box::into_raw(Box::new(e)),
9236 /// Checks if the given object is currently in the success state
9238 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9242 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9243 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9244 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9245 fn drop(&mut self) {
9247 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9248 let _ = unsafe { Box::from_raw(self.contents.result) };
9251 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9252 let _ = unsafe { Box::from_raw(self.contents.err) };
9257 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9258 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9259 let contents = if o.result_ok {
9260 let result = unsafe { o.contents.result };
9261 unsafe { o.contents.result = core::ptr::null_mut() };
9262 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9264 let err = unsafe { o.contents.err };
9265 unsafe { o.contents.err = core::ptr::null_mut(); }
9266 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9270 result_ok: o.result_ok,
9274 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9275 fn clone(&self) -> Self {
9277 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9278 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9281 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9282 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9288 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9289 /// but with all dynamically-allocated buffers duplicated in new buffers.
9290 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9293 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9294 pub enum COption_MonitorEventZ {
9295 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9296 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9297 /// When we're in this state, this COption_MonitorEventZ contains nothing
9300 impl COption_MonitorEventZ {
9301 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9302 if let Self::None = self { false } else { true }
9304 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9307 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9308 if let Self::Some(v) = self { v } else { unreachable!() }
9312 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9313 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9314 COption_MonitorEventZ::Some(o)
9317 /// Constructs a new COption_MonitorEventZ containing nothing
9318 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9319 COption_MonitorEventZ::None
9322 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9323 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9325 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9326 /// but with all dynamically-allocated buffers duplicated in new buffers.
9327 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9329 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9330 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9331 /// A pointer to the contents in the success state.
9332 /// Reading from this pointer when `result_ok` is not set is undefined.
9333 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9334 /// A pointer to the contents in the error state.
9335 /// Reading from this pointer when `result_ok` is set is undefined.
9336 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9339 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9340 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9341 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9342 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9343 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9344 /// `err` or `result` depending on the state of `result_ok`.
9345 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9346 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9347 pub result_ok: bool,
9350 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9351 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9352 CResult_COption_MonitorEventZDecodeErrorZ {
9353 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9354 result: Box::into_raw(Box::new(o)),
9360 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9361 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9362 CResult_COption_MonitorEventZDecodeErrorZ {
9363 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9364 err: Box::into_raw(Box::new(e)),
9369 /// Checks if the given object is currently in the success state
9371 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9375 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9376 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9377 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9378 fn drop(&mut self) {
9380 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9381 let _ = unsafe { Box::from_raw(self.contents.result) };
9384 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9385 let _ = unsafe { Box::from_raw(self.contents.err) };
9390 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9391 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9392 let contents = if o.result_ok {
9393 let result = unsafe { o.contents.result };
9394 unsafe { o.contents.result = core::ptr::null_mut() };
9395 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9397 let err = unsafe { o.contents.err };
9398 unsafe { o.contents.err = core::ptr::null_mut(); }
9399 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9403 result_ok: o.result_ok,
9407 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9408 fn clone(&self) -> Self {
9410 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9411 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9414 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9415 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9421 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9422 /// but with all dynamically-allocated buffers duplicated in new buffers.
9423 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9425 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9426 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9427 /// A pointer to the contents in the success state.
9428 /// Reading from this pointer when `result_ok` is not set is undefined.
9429 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9430 /// A pointer to the contents in the error state.
9431 /// Reading from this pointer when `result_ok` is set is undefined.
9432 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9435 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9436 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9437 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9438 pub struct CResult_HTLCUpdateDecodeErrorZ {
9439 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9440 /// `err` or `result` depending on the state of `result_ok`.
9441 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9442 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9443 pub result_ok: bool,
9446 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9447 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9448 CResult_HTLCUpdateDecodeErrorZ {
9449 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9450 result: Box::into_raw(Box::new(o)),
9456 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9457 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9458 CResult_HTLCUpdateDecodeErrorZ {
9459 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9460 err: Box::into_raw(Box::new(e)),
9465 /// Checks if the given object is currently in the success state
9467 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9471 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9472 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9473 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9474 fn drop(&mut self) {
9476 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9477 let _ = unsafe { Box::from_raw(self.contents.result) };
9480 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9481 let _ = unsafe { Box::from_raw(self.contents.err) };
9486 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9487 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9488 let contents = if o.result_ok {
9489 let result = unsafe { o.contents.result };
9490 unsafe { o.contents.result = core::ptr::null_mut() };
9491 CResult_HTLCUpdateDecodeErrorZPtr { result }
9493 let err = unsafe { o.contents.err };
9494 unsafe { o.contents.err = core::ptr::null_mut(); }
9495 CResult_HTLCUpdateDecodeErrorZPtr { err }
9499 result_ok: o.result_ok,
9503 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9504 fn clone(&self) -> Self {
9506 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9507 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9510 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9511 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9517 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9518 /// but with all dynamically-allocated buffers duplicated in new buffers.
9519 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9521 /// A tuple of 2 elements. See the individual fields for the types contained.
9522 pub struct C2Tuple_OutPointScriptZ {
9523 /// The element at position 0
9524 pub a: crate::lightning::chain::transaction::OutPoint,
9525 /// The element at position 1
9526 pub b: crate::c_types::derived::CVec_u8Z,
9528 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9529 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9536 impl C2Tuple_OutPointScriptZ {
9537 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9541 impl Clone for C2Tuple_OutPointScriptZ {
9542 fn clone(&self) -> Self {
9544 a: Clone::clone(&self.a),
9545 b: Clone::clone(&self.b),
9550 /// Creates a new tuple which has the same data as `orig`
9551 /// but with all dynamically-allocated buffers duplicated in new buffers.
9552 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9553 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9555 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9556 C2Tuple_OutPointScriptZ { a, b, }
9560 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9561 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9563 /// A tuple of 2 elements. See the individual fields for the types contained.
9564 pub struct C2Tuple_u32ScriptZ {
9565 /// The element at position 0
9567 /// The element at position 1
9568 pub b: crate::c_types::derived::CVec_u8Z,
9570 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9571 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9578 impl C2Tuple_u32ScriptZ {
9579 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9583 impl Clone for C2Tuple_u32ScriptZ {
9584 fn clone(&self) -> Self {
9586 a: Clone::clone(&self.a),
9587 b: Clone::clone(&self.b),
9592 /// Creates a new tuple which has the same data as `orig`
9593 /// but with all dynamically-allocated buffers duplicated in new buffers.
9594 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9595 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9597 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9598 C2Tuple_u32ScriptZ { a, b, }
9602 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9603 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9605 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9606 /// This corresponds to std::vector in C++
9607 pub struct CVec_C2Tuple_u32ScriptZZ {
9608 /// The elements in the array.
9609 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9610 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9611 /// The number of elements pointed to by `data`.
9614 impl CVec_C2Tuple_u32ScriptZZ {
9615 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9616 if self.datalen == 0 { return Vec::new(); }
9617 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9618 self.data = core::ptr::null_mut();
9622 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9623 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9626 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9627 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9628 let datalen = v.len();
9629 let data = Box::into_raw(v.into_boxed_slice());
9630 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9634 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9635 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9636 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9637 fn drop(&mut self) {
9638 if self.datalen == 0 { return; }
9639 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9642 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9643 fn clone(&self) -> Self {
9644 let mut res = Vec::new();
9645 if self.datalen == 0 { return Self::from(res); }
9646 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9651 /// A tuple of 2 elements. See the individual fields for the types contained.
9652 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9653 /// The element at position 0
9654 pub a: crate::c_types::ThirtyTwoBytes,
9655 /// The element at position 1
9656 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9658 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9659 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9666 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9667 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9671 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9672 fn clone(&self) -> Self {
9674 a: Clone::clone(&self.a),
9675 b: Clone::clone(&self.b),
9680 /// Creates a new tuple which has the same data as `orig`
9681 /// but with all dynamically-allocated buffers duplicated in new buffers.
9682 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9683 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9685 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 {
9686 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9690 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9691 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9693 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9694 /// This corresponds to std::vector in C++
9695 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9696 /// The elements in the array.
9697 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9698 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9699 /// The number of elements pointed to by `data`.
9702 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9703 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9704 if self.datalen == 0 { return Vec::new(); }
9705 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9706 self.data = core::ptr::null_mut();
9710 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9711 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9714 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9715 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9716 let datalen = v.len();
9717 let data = Box::into_raw(v.into_boxed_slice());
9718 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9722 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9723 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9724 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9725 fn drop(&mut self) {
9726 if self.datalen == 0 { return; }
9727 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9730 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9731 fn clone(&self) -> Self {
9732 let mut res = Vec::new();
9733 if self.datalen == 0 { return Self::from(res); }
9734 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9739 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9740 /// This corresponds to std::vector in C++
9741 pub struct CVec_EventZ {
9742 /// The elements in the array.
9743 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9744 pub data: *mut crate::lightning::util::events::Event,
9745 /// The number of elements pointed to by `data`.
9749 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9750 if self.datalen == 0 { return Vec::new(); }
9751 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9752 self.data = core::ptr::null_mut();
9756 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9757 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9760 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9761 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9762 let datalen = v.len();
9763 let data = Box::into_raw(v.into_boxed_slice());
9764 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9768 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9769 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9770 impl Drop for CVec_EventZ {
9771 fn drop(&mut self) {
9772 if self.datalen == 0 { return; }
9773 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9776 impl Clone for CVec_EventZ {
9777 fn clone(&self) -> Self {
9778 let mut res = Vec::new();
9779 if self.datalen == 0 { return Self::from(res); }
9780 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9785 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9786 /// This corresponds to std::vector in C++
9787 pub struct CVec_TransactionZ {
9788 /// The elements in the array.
9789 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9790 pub data: *mut crate::c_types::Transaction,
9791 /// The number of elements pointed to by `data`.
9794 impl CVec_TransactionZ {
9795 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9796 if self.datalen == 0 { return Vec::new(); }
9797 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9798 self.data = core::ptr::null_mut();
9802 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9803 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9806 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9807 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9808 let datalen = v.len();
9809 let data = Box::into_raw(v.into_boxed_slice());
9810 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9814 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9815 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9816 impl Drop for CVec_TransactionZ {
9817 fn drop(&mut self) {
9818 if self.datalen == 0 { return; }
9819 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9822 impl Clone for CVec_TransactionZ {
9823 fn clone(&self) -> Self {
9824 let mut res = Vec::new();
9825 if self.datalen == 0 { return Self::from(res); }
9826 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9831 /// A tuple of 2 elements. See the individual fields for the types contained.
9832 pub struct C2Tuple_u32TxOutZ {
9833 /// The element at position 0
9835 /// The element at position 1
9836 pub b: crate::c_types::TxOut,
9838 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9839 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9846 impl C2Tuple_u32TxOutZ {
9847 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9851 impl Clone for C2Tuple_u32TxOutZ {
9852 fn clone(&self) -> Self {
9854 a: Clone::clone(&self.a),
9855 b: Clone::clone(&self.b),
9860 /// Creates a new tuple which has the same data as `orig`
9861 /// but with all dynamically-allocated buffers duplicated in new buffers.
9862 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9863 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9865 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9866 C2Tuple_u32TxOutZ { a, b, }
9870 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9871 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9873 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9874 /// This corresponds to std::vector in C++
9875 pub struct CVec_C2Tuple_u32TxOutZZ {
9876 /// The elements in the array.
9877 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9878 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9879 /// The number of elements pointed to by `data`.
9882 impl CVec_C2Tuple_u32TxOutZZ {
9883 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9884 if self.datalen == 0 { return Vec::new(); }
9885 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9886 self.data = core::ptr::null_mut();
9890 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9891 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9894 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9895 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9896 let datalen = v.len();
9897 let data = Box::into_raw(v.into_boxed_slice());
9898 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9902 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9903 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9904 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9905 fn drop(&mut self) {
9906 if self.datalen == 0 { return; }
9907 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9910 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9911 fn clone(&self) -> Self {
9912 let mut res = Vec::new();
9913 if self.datalen == 0 { return Self::from(res); }
9914 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9919 /// A tuple of 2 elements. See the individual fields for the types contained.
9920 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9921 /// The element at position 0
9922 pub a: crate::c_types::ThirtyTwoBytes,
9923 /// The element at position 1
9924 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9926 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9927 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9934 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9935 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9939 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9940 fn clone(&self) -> Self {
9942 a: Clone::clone(&self.a),
9943 b: Clone::clone(&self.b),
9948 /// Creates a new tuple which has the same data as `orig`
9949 /// but with all dynamically-allocated buffers duplicated in new buffers.
9950 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9951 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9953 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 {
9954 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9958 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9959 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9961 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9962 /// This corresponds to std::vector in C++
9963 pub struct CVec_TransactionOutputsZ {
9964 /// The elements in the array.
9965 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9966 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9967 /// The number of elements pointed to by `data`.
9970 impl CVec_TransactionOutputsZ {
9971 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9972 if self.datalen == 0 { return Vec::new(); }
9973 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9974 self.data = core::ptr::null_mut();
9978 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9979 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9982 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9983 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9984 let datalen = v.len();
9985 let data = Box::into_raw(v.into_boxed_slice());
9986 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9990 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9991 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9992 impl Drop for CVec_TransactionOutputsZ {
9993 fn drop(&mut self) {
9994 if self.datalen == 0 { return; }
9995 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9998 impl Clone for CVec_TransactionOutputsZ {
9999 fn clone(&self) -> Self {
10000 let mut res = Vec::new();
10001 if self.datalen == 0 { return Self::from(res); }
10002 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10007 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
10008 /// This corresponds to std::vector in C++
10009 pub struct CVec_BalanceZ {
10010 /// The elements in the array.
10011 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10012 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
10013 /// The number of elements pointed to by `data`.
10016 impl CVec_BalanceZ {
10017 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
10018 if self.datalen == 0 { return Vec::new(); }
10019 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10020 self.data = core::ptr::null_mut();
10024 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
10025 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10028 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
10029 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
10030 let datalen = v.len();
10031 let data = Box::into_raw(v.into_boxed_slice());
10032 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10036 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10037 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
10038 impl Drop for CVec_BalanceZ {
10039 fn drop(&mut self) {
10040 if self.datalen == 0 { return; }
10041 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10044 impl Clone for CVec_BalanceZ {
10045 fn clone(&self) -> Self {
10046 let mut res = Vec::new();
10047 if self.datalen == 0 { return Self::from(res); }
10048 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10053 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
10054 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10055 /// A pointer to the contents in the success state.
10056 /// Reading from this pointer when `result_ok` is not set is undefined.
10057 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
10058 /// A pointer to the contents in the error state.
10059 /// Reading from this pointer when `result_ok` is set is undefined.
10060 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10063 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
10064 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10065 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10066 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10067 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
10068 /// `err` or `result` depending on the state of `result_ok`.
10069 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
10070 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
10071 pub result_ok: bool,
10074 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10075 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10076 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10077 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10078 result: Box::into_raw(Box::new(o)),
10084 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10085 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10086 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10087 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10088 err: Box::into_raw(Box::new(e)),
10093 /// Checks if the given object is currently in the success state
10095 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10099 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10100 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10101 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10102 fn drop(&mut self) {
10103 if self.result_ok {
10104 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10105 let _ = unsafe { Box::from_raw(self.contents.result) };
10108 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10109 let _ = unsafe { Box::from_raw(self.contents.err) };
10114 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10115 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10116 let contents = if o.result_ok {
10117 let result = unsafe { o.contents.result };
10118 unsafe { o.contents.result = core::ptr::null_mut() };
10119 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10121 let err = unsafe { o.contents.err };
10122 unsafe { o.contents.err = core::ptr::null_mut(); }
10123 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10127 result_ok: o.result_ok,
10132 /// The contents of CResult_NoneLightningErrorZ
10133 pub union CResult_NoneLightningErrorZPtr {
10134 /// Note that this value is always NULL, as there are no contents in the OK variant
10135 pub result: *mut core::ffi::c_void,
10136 /// A pointer to the contents in the error state.
10137 /// Reading from this pointer when `result_ok` is set is undefined.
10138 pub err: *mut crate::lightning::ln::msgs::LightningError,
10141 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
10142 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
10143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10144 pub struct CResult_NoneLightningErrorZ {
10145 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
10146 /// `err` or `result` depending on the state of `result_ok`.
10147 pub contents: CResult_NoneLightningErrorZPtr,
10148 /// Whether this CResult_NoneLightningErrorZ represents a success state.
10149 pub result_ok: bool,
10152 /// Creates a new CResult_NoneLightningErrorZ in the success state.
10153 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10154 CResult_NoneLightningErrorZ {
10155 contents: CResult_NoneLightningErrorZPtr {
10156 result: core::ptr::null_mut(),
10162 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10163 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10164 CResult_NoneLightningErrorZ {
10165 contents: CResult_NoneLightningErrorZPtr {
10166 err: Box::into_raw(Box::new(e)),
10171 /// Checks if the given object is currently in the success state
10173 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10177 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10178 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10179 impl Drop for CResult_NoneLightningErrorZ {
10180 fn drop(&mut self) {
10181 if self.result_ok {
10183 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10184 let _ = unsafe { Box::from_raw(self.contents.err) };
10189 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10190 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10191 let contents = if o.result_ok {
10192 let _ = unsafe { Box::from_raw(o.contents.result) };
10193 o.contents.result = core::ptr::null_mut();
10194 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10196 let err = unsafe { o.contents.err };
10197 unsafe { o.contents.err = core::ptr::null_mut(); }
10198 CResult_NoneLightningErrorZPtr { err }
10202 result_ok: o.result_ok,
10206 impl Clone for CResult_NoneLightningErrorZ {
10207 fn clone(&self) -> Self {
10208 if self.result_ok {
10209 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10210 result: core::ptr::null_mut()
10213 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10214 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10220 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10221 /// but with all dynamically-allocated buffers duplicated in new buffers.
10222 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10224 /// A tuple of 2 elements. See the individual fields for the types contained.
10225 pub struct C2Tuple_PublicKeyTypeZ {
10226 /// The element at position 0
10227 pub a: crate::c_types::PublicKey,
10228 /// The element at position 1
10229 pub b: crate::lightning::ln::wire::Type,
10231 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10232 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10239 impl C2Tuple_PublicKeyTypeZ {
10240 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10244 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10246 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10247 C2Tuple_PublicKeyTypeZ { a, b, }
10251 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10252 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10254 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10255 /// This corresponds to std::vector in C++
10256 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10257 /// The elements in the array.
10258 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10259 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10260 /// The number of elements pointed to by `data`.
10263 impl CVec_C2Tuple_PublicKeyTypeZZ {
10264 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10265 if self.datalen == 0 { return Vec::new(); }
10266 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10267 self.data = core::ptr::null_mut();
10271 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10272 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10275 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10276 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10277 let datalen = v.len();
10278 let data = Box::into_raw(v.into_boxed_slice());
10279 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10283 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10284 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10285 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10286 fn drop(&mut self) {
10287 if self.datalen == 0 { return; }
10288 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10292 /// The contents of CResult_boolLightningErrorZ
10293 pub union CResult_boolLightningErrorZPtr {
10294 /// A pointer to the contents in the success state.
10295 /// Reading from this pointer when `result_ok` is not set is undefined.
10296 pub result: *mut bool,
10297 /// A pointer to the contents in the error state.
10298 /// Reading from this pointer when `result_ok` is set is undefined.
10299 pub err: *mut crate::lightning::ln::msgs::LightningError,
10302 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10303 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10305 pub struct CResult_boolLightningErrorZ {
10306 /// The contents of this CResult_boolLightningErrorZ, accessible via either
10307 /// `err` or `result` depending on the state of `result_ok`.
10308 pub contents: CResult_boolLightningErrorZPtr,
10309 /// Whether this CResult_boolLightningErrorZ represents a success state.
10310 pub result_ok: bool,
10313 /// Creates a new CResult_boolLightningErrorZ in the success state.
10314 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10315 CResult_boolLightningErrorZ {
10316 contents: CResult_boolLightningErrorZPtr {
10317 result: Box::into_raw(Box::new(o)),
10323 /// Creates a new CResult_boolLightningErrorZ in the error state.
10324 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10325 CResult_boolLightningErrorZ {
10326 contents: CResult_boolLightningErrorZPtr {
10327 err: Box::into_raw(Box::new(e)),
10332 /// Checks if the given object is currently in the success state
10334 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10338 /// Frees any resources used by the CResult_boolLightningErrorZ.
10339 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10340 impl Drop for CResult_boolLightningErrorZ {
10341 fn drop(&mut self) {
10342 if self.result_ok {
10343 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10344 let _ = unsafe { Box::from_raw(self.contents.result) };
10347 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10348 let _ = unsafe { Box::from_raw(self.contents.err) };
10353 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10354 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10355 let contents = if o.result_ok {
10356 let result = unsafe { o.contents.result };
10357 unsafe { o.contents.result = core::ptr::null_mut() };
10358 CResult_boolLightningErrorZPtr { result }
10360 let err = unsafe { o.contents.err };
10361 unsafe { o.contents.err = core::ptr::null_mut(); }
10362 CResult_boolLightningErrorZPtr { err }
10366 result_ok: o.result_ok,
10370 impl Clone for CResult_boolLightningErrorZ {
10371 fn clone(&self) -> Self {
10372 if self.result_ok {
10373 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10374 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10377 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10378 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10384 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10385 /// but with all dynamically-allocated buffers duplicated in new buffers.
10386 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10388 /// A tuple of 3 elements. See the individual fields for the types contained.
10389 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10390 /// The element at position 0
10391 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10392 /// The element at position 1
10393 pub b: crate::lightning::ln::msgs::ChannelUpdate,
10394 /// The element at position 2
10395 pub c: crate::lightning::ln::msgs::ChannelUpdate,
10397 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10398 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10406 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10407 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10408 (self.a, self.b, self.c)
10411 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10412 fn clone(&self) -> Self {
10414 a: Clone::clone(&self.a),
10415 b: Clone::clone(&self.b),
10416 c: Clone::clone(&self.c),
10421 /// Creates a new tuple which has the same data as `orig`
10422 /// but with all dynamically-allocated buffers duplicated in new buffers.
10423 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10424 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10426 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 {
10427 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10431 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10432 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10434 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10435 /// This corresponds to std::vector in C++
10436 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10437 /// The elements in the array.
10438 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10439 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10440 /// The number of elements pointed to by `data`.
10443 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10444 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10445 if self.datalen == 0 { return Vec::new(); }
10446 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10447 self.data = core::ptr::null_mut();
10451 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10452 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10455 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10456 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10457 let datalen = v.len();
10458 let data = Box::into_raw(v.into_boxed_slice());
10459 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10463 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10464 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10465 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10466 fn drop(&mut self) {
10467 if self.datalen == 0 { return; }
10468 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10471 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10472 fn clone(&self) -> Self {
10473 let mut res = Vec::new();
10474 if self.datalen == 0 { return Self::from(res); }
10475 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10480 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10481 /// This corresponds to std::vector in C++
10482 pub struct CVec_NodeAnnouncementZ {
10483 /// The elements in the array.
10484 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10485 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10486 /// The number of elements pointed to by `data`.
10489 impl CVec_NodeAnnouncementZ {
10490 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10491 if self.datalen == 0 { return Vec::new(); }
10492 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10493 self.data = core::ptr::null_mut();
10497 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10498 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10501 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10502 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10503 let datalen = v.len();
10504 let data = Box::into_raw(v.into_boxed_slice());
10505 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10509 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10510 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10511 impl Drop for CVec_NodeAnnouncementZ {
10512 fn drop(&mut self) {
10513 if self.datalen == 0 { return; }
10514 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10517 impl Clone for CVec_NodeAnnouncementZ {
10518 fn clone(&self) -> Self {
10519 let mut res = Vec::new();
10520 if self.datalen == 0 { return Self::from(res); }
10521 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10526 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10527 /// This corresponds to std::vector in C++
10528 pub struct CVec_PublicKeyZ {
10529 /// The elements in the array.
10530 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10531 pub data: *mut crate::c_types::PublicKey,
10532 /// The number of elements pointed to by `data`.
10535 impl CVec_PublicKeyZ {
10536 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10537 if self.datalen == 0 { return Vec::new(); }
10538 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10539 self.data = core::ptr::null_mut();
10543 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10544 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10547 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10548 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10549 let datalen = v.len();
10550 let data = Box::into_raw(v.into_boxed_slice());
10551 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10555 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10556 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10557 impl Drop for CVec_PublicKeyZ {
10558 fn drop(&mut self) {
10559 if self.datalen == 0 { return; }
10560 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10563 impl Clone for CVec_PublicKeyZ {
10564 fn clone(&self) -> Self {
10565 let mut res = Vec::new();
10566 if self.datalen == 0 { return Self::from(res); }
10567 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10572 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10573 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10574 /// A pointer to the contents in the success state.
10575 /// Reading from this pointer when `result_ok` is not set is undefined.
10576 pub result: *mut crate::c_types::derived::CVec_u8Z,
10577 /// A pointer to the contents in the error state.
10578 /// Reading from this pointer when `result_ok` is set is undefined.
10579 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10582 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10583 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10584 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10585 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10586 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10587 /// `err` or `result` depending on the state of `result_ok`.
10588 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10589 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10590 pub result_ok: bool,
10593 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10594 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10595 CResult_CVec_u8ZPeerHandleErrorZ {
10596 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10597 result: Box::into_raw(Box::new(o)),
10603 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10604 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10605 CResult_CVec_u8ZPeerHandleErrorZ {
10606 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10607 err: Box::into_raw(Box::new(e)),
10612 /// Checks if the given object is currently in the success state
10614 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10618 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10619 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10620 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10621 fn drop(&mut self) {
10622 if self.result_ok {
10623 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10624 let _ = unsafe { Box::from_raw(self.contents.result) };
10627 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10628 let _ = unsafe { Box::from_raw(self.contents.err) };
10633 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10634 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10635 let contents = if o.result_ok {
10636 let result = unsafe { o.contents.result };
10637 unsafe { o.contents.result = core::ptr::null_mut() };
10638 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10640 let err = unsafe { o.contents.err };
10641 unsafe { o.contents.err = core::ptr::null_mut(); }
10642 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10646 result_ok: o.result_ok,
10650 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10651 fn clone(&self) -> Self {
10652 if self.result_ok {
10653 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10654 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10657 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10658 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10664 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10665 /// but with all dynamically-allocated buffers duplicated in new buffers.
10666 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10668 /// The contents of CResult_NonePeerHandleErrorZ
10669 pub union CResult_NonePeerHandleErrorZPtr {
10670 /// Note that this value is always NULL, as there are no contents in the OK variant
10671 pub result: *mut core::ffi::c_void,
10672 /// A pointer to the contents in the error state.
10673 /// Reading from this pointer when `result_ok` is set is undefined.
10674 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10677 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10678 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10680 pub struct CResult_NonePeerHandleErrorZ {
10681 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10682 /// `err` or `result` depending on the state of `result_ok`.
10683 pub contents: CResult_NonePeerHandleErrorZPtr,
10684 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10685 pub result_ok: bool,
10688 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10689 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10690 CResult_NonePeerHandleErrorZ {
10691 contents: CResult_NonePeerHandleErrorZPtr {
10692 result: core::ptr::null_mut(),
10698 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10699 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10700 CResult_NonePeerHandleErrorZ {
10701 contents: CResult_NonePeerHandleErrorZPtr {
10702 err: Box::into_raw(Box::new(e)),
10707 /// Checks if the given object is currently in the success state
10709 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10713 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10714 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10715 impl Drop for CResult_NonePeerHandleErrorZ {
10716 fn drop(&mut self) {
10717 if self.result_ok {
10719 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10720 let _ = unsafe { Box::from_raw(self.contents.err) };
10725 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10726 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10727 let contents = if o.result_ok {
10728 let _ = unsafe { Box::from_raw(o.contents.result) };
10729 o.contents.result = core::ptr::null_mut();
10730 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10732 let err = unsafe { o.contents.err };
10733 unsafe { o.contents.err = core::ptr::null_mut(); }
10734 CResult_NonePeerHandleErrorZPtr { err }
10738 result_ok: o.result_ok,
10742 impl Clone for CResult_NonePeerHandleErrorZ {
10743 fn clone(&self) -> Self {
10744 if self.result_ok {
10745 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10746 result: core::ptr::null_mut()
10749 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10750 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10756 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10757 /// but with all dynamically-allocated buffers duplicated in new buffers.
10758 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10760 /// The contents of CResult_boolPeerHandleErrorZ
10761 pub union CResult_boolPeerHandleErrorZPtr {
10762 /// A pointer to the contents in the success state.
10763 /// Reading from this pointer when `result_ok` is not set is undefined.
10764 pub result: *mut bool,
10765 /// A pointer to the contents in the error state.
10766 /// Reading from this pointer when `result_ok` is set is undefined.
10767 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10770 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10771 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10773 pub struct CResult_boolPeerHandleErrorZ {
10774 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10775 /// `err` or `result` depending on the state of `result_ok`.
10776 pub contents: CResult_boolPeerHandleErrorZPtr,
10777 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10778 pub result_ok: bool,
10781 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10782 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10783 CResult_boolPeerHandleErrorZ {
10784 contents: CResult_boolPeerHandleErrorZPtr {
10785 result: Box::into_raw(Box::new(o)),
10791 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10792 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10793 CResult_boolPeerHandleErrorZ {
10794 contents: CResult_boolPeerHandleErrorZPtr {
10795 err: Box::into_raw(Box::new(e)),
10800 /// Checks if the given object is currently in the success state
10802 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10806 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10807 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10808 impl Drop for CResult_boolPeerHandleErrorZ {
10809 fn drop(&mut self) {
10810 if self.result_ok {
10811 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10812 let _ = unsafe { Box::from_raw(self.contents.result) };
10815 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10816 let _ = unsafe { Box::from_raw(self.contents.err) };
10821 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10822 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10823 let contents = if o.result_ok {
10824 let result = unsafe { o.contents.result };
10825 unsafe { o.contents.result = core::ptr::null_mut() };
10826 CResult_boolPeerHandleErrorZPtr { result }
10828 let err = unsafe { o.contents.err };
10829 unsafe { o.contents.err = core::ptr::null_mut(); }
10830 CResult_boolPeerHandleErrorZPtr { err }
10834 result_ok: o.result_ok,
10838 impl Clone for CResult_boolPeerHandleErrorZ {
10839 fn clone(&self) -> Self {
10840 if self.result_ok {
10841 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10842 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10845 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10846 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10852 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10853 /// but with all dynamically-allocated buffers duplicated in new buffers.
10854 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10856 /// The contents of CResult_NodeIdDecodeErrorZ
10857 pub union CResult_NodeIdDecodeErrorZPtr {
10858 /// A pointer to the contents in the success state.
10859 /// Reading from this pointer when `result_ok` is not set is undefined.
10860 pub result: *mut crate::lightning::routing::network_graph::NodeId,
10861 /// A pointer to the contents in the error state.
10862 /// Reading from this pointer when `result_ok` is set is undefined.
10863 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10866 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10867 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10869 pub struct CResult_NodeIdDecodeErrorZ {
10870 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10871 /// `err` or `result` depending on the state of `result_ok`.
10872 pub contents: CResult_NodeIdDecodeErrorZPtr,
10873 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10874 pub result_ok: bool,
10877 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10878 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10879 CResult_NodeIdDecodeErrorZ {
10880 contents: CResult_NodeIdDecodeErrorZPtr {
10881 result: Box::into_raw(Box::new(o)),
10887 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10888 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10889 CResult_NodeIdDecodeErrorZ {
10890 contents: CResult_NodeIdDecodeErrorZPtr {
10891 err: Box::into_raw(Box::new(e)),
10896 /// Checks if the given object is currently in the success state
10898 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10902 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10903 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10904 impl Drop for CResult_NodeIdDecodeErrorZ {
10905 fn drop(&mut self) {
10906 if self.result_ok {
10907 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10908 let _ = unsafe { Box::from_raw(self.contents.result) };
10911 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10912 let _ = unsafe { Box::from_raw(self.contents.err) };
10917 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10918 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10919 let contents = if o.result_ok {
10920 let result = unsafe { o.contents.result };
10921 unsafe { o.contents.result = core::ptr::null_mut() };
10922 CResult_NodeIdDecodeErrorZPtr { result }
10924 let err = unsafe { o.contents.err };
10925 unsafe { o.contents.err = core::ptr::null_mut(); }
10926 CResult_NodeIdDecodeErrorZPtr { err }
10930 result_ok: o.result_ok,
10934 impl Clone for CResult_NodeIdDecodeErrorZ {
10935 fn clone(&self) -> Self {
10936 if self.result_ok {
10937 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10938 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10941 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10942 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10948 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10949 /// but with all dynamically-allocated buffers duplicated in new buffers.
10950 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10952 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10953 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10954 /// A pointer to the contents in the success state.
10955 /// Reading from this pointer when `result_ok` is not set is undefined.
10956 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10957 /// A pointer to the contents in the error state.
10958 /// Reading from this pointer when `result_ok` is set is undefined.
10959 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10962 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10963 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10965 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10966 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10967 /// `err` or `result` depending on the state of `result_ok`.
10968 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10969 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10970 pub result_ok: bool,
10973 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10974 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10975 CResult_COption_NetworkUpdateZDecodeErrorZ {
10976 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10977 result: Box::into_raw(Box::new(o)),
10983 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10984 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10985 CResult_COption_NetworkUpdateZDecodeErrorZ {
10986 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10987 err: Box::into_raw(Box::new(e)),
10992 /// Checks if the given object is currently in the success state
10994 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10998 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10999 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
11000 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
11001 fn drop(&mut self) {
11002 if self.result_ok {
11003 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11004 let _ = unsafe { Box::from_raw(self.contents.result) };
11007 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11008 let _ = unsafe { Box::from_raw(self.contents.err) };
11013 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
11014 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11015 let contents = if o.result_ok {
11016 let result = unsafe { o.contents.result };
11017 unsafe { o.contents.result = core::ptr::null_mut() };
11018 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
11020 let err = unsafe { o.contents.err };
11021 unsafe { o.contents.err = core::ptr::null_mut(); }
11022 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
11026 result_ok: o.result_ok,
11030 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
11031 fn clone(&self) -> Self {
11032 if self.result_ok {
11033 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
11034 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
11037 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
11038 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11044 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
11045 /// but with all dynamically-allocated buffers duplicated in new buffers.
11046 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
11048 /// An enum which can either contain a crate::lightning::chain::Access or not
11049 pub enum COption_AccessZ {
11050 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
11051 Some(crate::lightning::chain::Access),
11052 /// When we're in this state, this COption_AccessZ contains nothing
11055 impl COption_AccessZ {
11056 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11057 if let Self::None = self { false } else { true }
11059 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11062 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
11063 if let Self::Some(v) = self { v } else { unreachable!() }
11067 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11068 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
11069 COption_AccessZ::Some(o)
11072 /// Constructs a new COption_AccessZ containing nothing
11073 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
11074 COption_AccessZ::None
11077 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11078 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
11080 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
11081 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
11082 /// A pointer to the contents in the success state.
11083 /// Reading from this pointer when `result_ok` is not set is undefined.
11084 pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
11085 /// A pointer to the contents in the error state.
11086 /// Reading from this pointer when `result_ok` is set is undefined.
11087 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11090 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
11091 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11092 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11093 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
11094 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
11095 /// `err` or `result` depending on the state of `result_ok`.
11096 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
11097 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
11098 pub result_ok: bool,
11101 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
11102 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11103 CResult_ChannelUpdateInfoDecodeErrorZ {
11104 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11105 result: Box::into_raw(Box::new(o)),
11111 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
11112 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11113 CResult_ChannelUpdateInfoDecodeErrorZ {
11114 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11115 err: Box::into_raw(Box::new(e)),
11120 /// Checks if the given object is currently in the success state
11122 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
11126 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
11127 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
11128 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
11129 fn drop(&mut self) {
11130 if self.result_ok {
11131 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11132 let _ = unsafe { Box::from_raw(self.contents.result) };
11135 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11136 let _ = unsafe { Box::from_raw(self.contents.err) };
11141 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
11142 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11143 let contents = if o.result_ok {
11144 let result = unsafe { o.contents.result };
11145 unsafe { o.contents.result = core::ptr::null_mut() };
11146 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
11148 let err = unsafe { o.contents.err };
11149 unsafe { o.contents.err = core::ptr::null_mut(); }
11150 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11154 result_ok: o.result_ok,
11158 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11159 fn clone(&self) -> Self {
11160 if self.result_ok {
11161 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11162 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11165 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11166 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11172 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11173 /// but with all dynamically-allocated buffers duplicated in new buffers.
11174 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11176 /// The contents of CResult_ChannelInfoDecodeErrorZ
11177 pub union CResult_ChannelInfoDecodeErrorZPtr {
11178 /// A pointer to the contents in the success state.
11179 /// Reading from this pointer when `result_ok` is not set is undefined.
11180 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11181 /// A pointer to the contents in the error state.
11182 /// Reading from this pointer when `result_ok` is set is undefined.
11183 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11186 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11187 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11189 pub struct CResult_ChannelInfoDecodeErrorZ {
11190 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11191 /// `err` or `result` depending on the state of `result_ok`.
11192 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11193 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11194 pub result_ok: bool,
11197 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11198 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11199 CResult_ChannelInfoDecodeErrorZ {
11200 contents: CResult_ChannelInfoDecodeErrorZPtr {
11201 result: Box::into_raw(Box::new(o)),
11207 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11208 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11209 CResult_ChannelInfoDecodeErrorZ {
11210 contents: CResult_ChannelInfoDecodeErrorZPtr {
11211 err: Box::into_raw(Box::new(e)),
11216 /// Checks if the given object is currently in the success state
11218 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11222 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11223 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11224 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11225 fn drop(&mut self) {
11226 if self.result_ok {
11227 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11228 let _ = unsafe { Box::from_raw(self.contents.result) };
11231 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11232 let _ = unsafe { Box::from_raw(self.contents.err) };
11237 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11238 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11239 let contents = if o.result_ok {
11240 let result = unsafe { o.contents.result };
11241 unsafe { o.contents.result = core::ptr::null_mut() };
11242 CResult_ChannelInfoDecodeErrorZPtr { result }
11244 let err = unsafe { o.contents.err };
11245 unsafe { o.contents.err = core::ptr::null_mut(); }
11246 CResult_ChannelInfoDecodeErrorZPtr { err }
11250 result_ok: o.result_ok,
11254 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11255 fn clone(&self) -> Self {
11256 if self.result_ok {
11257 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11258 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11261 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11262 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11268 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11269 /// but with all dynamically-allocated buffers duplicated in new buffers.
11270 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11272 /// The contents of CResult_RoutingFeesDecodeErrorZ
11273 pub union CResult_RoutingFeesDecodeErrorZPtr {
11274 /// A pointer to the contents in the success state.
11275 /// Reading from this pointer when `result_ok` is not set is undefined.
11276 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11277 /// A pointer to the contents in the error state.
11278 /// Reading from this pointer when `result_ok` is set is undefined.
11279 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11282 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11283 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11285 pub struct CResult_RoutingFeesDecodeErrorZ {
11286 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11287 /// `err` or `result` depending on the state of `result_ok`.
11288 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11289 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11290 pub result_ok: bool,
11293 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11294 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11295 CResult_RoutingFeesDecodeErrorZ {
11296 contents: CResult_RoutingFeesDecodeErrorZPtr {
11297 result: Box::into_raw(Box::new(o)),
11303 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11304 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11305 CResult_RoutingFeesDecodeErrorZ {
11306 contents: CResult_RoutingFeesDecodeErrorZPtr {
11307 err: Box::into_raw(Box::new(e)),
11312 /// Checks if the given object is currently in the success state
11314 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11318 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11319 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11320 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11321 fn drop(&mut self) {
11322 if self.result_ok {
11323 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11324 let _ = unsafe { Box::from_raw(self.contents.result) };
11327 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11328 let _ = unsafe { Box::from_raw(self.contents.err) };
11333 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11334 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11335 let contents = if o.result_ok {
11336 let result = unsafe { o.contents.result };
11337 unsafe { o.contents.result = core::ptr::null_mut() };
11338 CResult_RoutingFeesDecodeErrorZPtr { result }
11340 let err = unsafe { o.contents.err };
11341 unsafe { o.contents.err = core::ptr::null_mut(); }
11342 CResult_RoutingFeesDecodeErrorZPtr { err }
11346 result_ok: o.result_ok,
11350 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11351 fn clone(&self) -> Self {
11352 if self.result_ok {
11353 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11354 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11357 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11358 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11364 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11365 /// but with all dynamically-allocated buffers duplicated in new buffers.
11366 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11368 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11369 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11370 /// A pointer to the contents in the success state.
11371 /// Reading from this pointer when `result_ok` is not set is undefined.
11372 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11373 /// A pointer to the contents in the error state.
11374 /// Reading from this pointer when `result_ok` is set is undefined.
11375 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11378 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11379 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11381 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11382 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11383 /// `err` or `result` depending on the state of `result_ok`.
11384 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11385 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11386 pub result_ok: bool,
11389 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11390 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11391 CResult_NodeAnnouncementInfoDecodeErrorZ {
11392 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11393 result: Box::into_raw(Box::new(o)),
11399 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11400 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11401 CResult_NodeAnnouncementInfoDecodeErrorZ {
11402 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11403 err: Box::into_raw(Box::new(e)),
11408 /// Checks if the given object is currently in the success state
11410 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11414 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11415 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11416 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11417 fn drop(&mut self) {
11418 if self.result_ok {
11419 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11420 let _ = unsafe { Box::from_raw(self.contents.result) };
11423 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11424 let _ = unsafe { Box::from_raw(self.contents.err) };
11429 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11430 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11431 let contents = if o.result_ok {
11432 let result = unsafe { o.contents.result };
11433 unsafe { o.contents.result = core::ptr::null_mut() };
11434 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11436 let err = unsafe { o.contents.err };
11437 unsafe { o.contents.err = core::ptr::null_mut(); }
11438 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11442 result_ok: o.result_ok,
11446 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11447 fn clone(&self) -> Self {
11448 if self.result_ok {
11449 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11450 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11453 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11454 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11460 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11461 /// but with all dynamically-allocated buffers duplicated in new buffers.
11462 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11464 /// A dynamically-allocated array of u64s of arbitrary size.
11465 /// This corresponds to std::vector in C++
11466 pub struct CVec_u64Z {
11467 /// The elements in the array.
11468 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11469 pub data: *mut u64,
11470 /// The number of elements pointed to by `data`.
11474 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11475 if self.datalen == 0 { return Vec::new(); }
11476 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11477 self.data = core::ptr::null_mut();
11481 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11482 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11485 impl From<Vec<u64>> for CVec_u64Z {
11486 fn from(v: Vec<u64>) -> Self {
11487 let datalen = v.len();
11488 let data = Box::into_raw(v.into_boxed_slice());
11489 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11493 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11494 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11495 impl Drop for CVec_u64Z {
11496 fn drop(&mut self) {
11497 if self.datalen == 0 { return; }
11498 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11501 impl Clone for CVec_u64Z {
11502 fn clone(&self) -> Self {
11503 let mut res = Vec::new();
11504 if self.datalen == 0 { return Self::from(res); }
11505 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11510 /// The contents of CResult_NodeInfoDecodeErrorZ
11511 pub union CResult_NodeInfoDecodeErrorZPtr {
11512 /// A pointer to the contents in the success state.
11513 /// Reading from this pointer when `result_ok` is not set is undefined.
11514 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11515 /// A pointer to the contents in the error state.
11516 /// Reading from this pointer when `result_ok` is set is undefined.
11517 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11520 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11521 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11522 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11523 pub struct CResult_NodeInfoDecodeErrorZ {
11524 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11525 /// `err` or `result` depending on the state of `result_ok`.
11526 pub contents: CResult_NodeInfoDecodeErrorZPtr,
11527 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11528 pub result_ok: bool,
11531 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11532 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11533 CResult_NodeInfoDecodeErrorZ {
11534 contents: CResult_NodeInfoDecodeErrorZPtr {
11535 result: Box::into_raw(Box::new(o)),
11541 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11542 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11543 CResult_NodeInfoDecodeErrorZ {
11544 contents: CResult_NodeInfoDecodeErrorZPtr {
11545 err: Box::into_raw(Box::new(e)),
11550 /// Checks if the given object is currently in the success state
11552 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11556 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11557 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11558 impl Drop for CResult_NodeInfoDecodeErrorZ {
11559 fn drop(&mut self) {
11560 if self.result_ok {
11561 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11562 let _ = unsafe { Box::from_raw(self.contents.result) };
11565 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11566 let _ = unsafe { Box::from_raw(self.contents.err) };
11571 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11572 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11573 let contents = if o.result_ok {
11574 let result = unsafe { o.contents.result };
11575 unsafe { o.contents.result = core::ptr::null_mut() };
11576 CResult_NodeInfoDecodeErrorZPtr { result }
11578 let err = unsafe { o.contents.err };
11579 unsafe { o.contents.err = core::ptr::null_mut(); }
11580 CResult_NodeInfoDecodeErrorZPtr { err }
11584 result_ok: o.result_ok,
11588 impl Clone for CResult_NodeInfoDecodeErrorZ {
11589 fn clone(&self) -> Self {
11590 if self.result_ok {
11591 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11592 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11595 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11596 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11602 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11603 /// but with all dynamically-allocated buffers duplicated in new buffers.
11604 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11606 /// The contents of CResult_NetworkGraphDecodeErrorZ
11607 pub union CResult_NetworkGraphDecodeErrorZPtr {
11608 /// A pointer to the contents in the success state.
11609 /// Reading from this pointer when `result_ok` is not set is undefined.
11610 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11611 /// A pointer to the contents in the error state.
11612 /// Reading from this pointer when `result_ok` is set is undefined.
11613 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11616 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11617 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11619 pub struct CResult_NetworkGraphDecodeErrorZ {
11620 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11621 /// `err` or `result` depending on the state of `result_ok`.
11622 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11623 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11624 pub result_ok: bool,
11627 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11628 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11629 CResult_NetworkGraphDecodeErrorZ {
11630 contents: CResult_NetworkGraphDecodeErrorZPtr {
11631 result: Box::into_raw(Box::new(o)),
11637 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11638 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11639 CResult_NetworkGraphDecodeErrorZ {
11640 contents: CResult_NetworkGraphDecodeErrorZPtr {
11641 err: Box::into_raw(Box::new(e)),
11646 /// Checks if the given object is currently in the success state
11648 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11652 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11653 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11654 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11655 fn drop(&mut self) {
11656 if self.result_ok {
11657 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11658 let _ = unsafe { Box::from_raw(self.contents.result) };
11661 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11662 let _ = unsafe { Box::from_raw(self.contents.err) };
11667 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11668 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11669 let contents = if o.result_ok {
11670 let result = unsafe { o.contents.result };
11671 unsafe { o.contents.result = core::ptr::null_mut() };
11672 CResult_NetworkGraphDecodeErrorZPtr { result }
11674 let err = unsafe { o.contents.err };
11675 unsafe { o.contents.err = core::ptr::null_mut(); }
11676 CResult_NetworkGraphDecodeErrorZPtr { err }
11680 result_ok: o.result_ok,
11684 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11685 fn clone(&self) -> Self {
11686 if self.result_ok {
11687 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11688 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11691 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11692 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11698 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11699 /// but with all dynamically-allocated buffers duplicated in new buffers.
11700 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11703 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11704 pub enum COption_CVec_NetAddressZZ {
11705 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11706 Some(crate::c_types::derived::CVec_NetAddressZ),
11707 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11710 impl COption_CVec_NetAddressZZ {
11711 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11712 if let Self::None = self { false } else { true }
11714 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11717 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11718 if let Self::Some(v) = self { v } else { unreachable!() }
11722 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11723 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11724 COption_CVec_NetAddressZZ::Some(o)
11727 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11728 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11729 COption_CVec_NetAddressZZ::None
11732 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11733 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11735 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11736 /// but with all dynamically-allocated buffers duplicated in new buffers.
11737 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11739 /// The contents of CResult_NetAddressDecodeErrorZ
11740 pub union CResult_NetAddressDecodeErrorZPtr {
11741 /// A pointer to the contents in the success state.
11742 /// Reading from this pointer when `result_ok` is not set is undefined.
11743 pub result: *mut crate::lightning::ln::msgs::NetAddress,
11744 /// A pointer to the contents in the error state.
11745 /// Reading from this pointer when `result_ok` is set is undefined.
11746 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11749 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11750 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11751 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11752 pub struct CResult_NetAddressDecodeErrorZ {
11753 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11754 /// `err` or `result` depending on the state of `result_ok`.
11755 pub contents: CResult_NetAddressDecodeErrorZPtr,
11756 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11757 pub result_ok: bool,
11760 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11761 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11762 CResult_NetAddressDecodeErrorZ {
11763 contents: CResult_NetAddressDecodeErrorZPtr {
11764 result: Box::into_raw(Box::new(o)),
11770 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11771 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11772 CResult_NetAddressDecodeErrorZ {
11773 contents: CResult_NetAddressDecodeErrorZPtr {
11774 err: Box::into_raw(Box::new(e)),
11779 /// Checks if the given object is currently in the success state
11781 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11785 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11786 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11787 impl Drop for CResult_NetAddressDecodeErrorZ {
11788 fn drop(&mut self) {
11789 if self.result_ok {
11790 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11791 let _ = unsafe { Box::from_raw(self.contents.result) };
11794 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11795 let _ = unsafe { Box::from_raw(self.contents.err) };
11800 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11801 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11802 let contents = if o.result_ok {
11803 let result = unsafe { o.contents.result };
11804 unsafe { o.contents.result = core::ptr::null_mut() };
11805 CResult_NetAddressDecodeErrorZPtr { result }
11807 let err = unsafe { o.contents.err };
11808 unsafe { o.contents.err = core::ptr::null_mut(); }
11809 CResult_NetAddressDecodeErrorZPtr { err }
11813 result_ok: o.result_ok,
11817 impl Clone for CResult_NetAddressDecodeErrorZ {
11818 fn clone(&self) -> Self {
11819 if self.result_ok {
11820 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11821 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11824 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11825 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11831 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11832 /// but with all dynamically-allocated buffers duplicated in new buffers.
11833 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11835 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11836 /// This corresponds to std::vector in C++
11837 pub struct CVec_UpdateAddHTLCZ {
11838 /// The elements in the array.
11839 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11840 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11841 /// The number of elements pointed to by `data`.
11844 impl CVec_UpdateAddHTLCZ {
11845 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11846 if self.datalen == 0 { return Vec::new(); }
11847 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11848 self.data = core::ptr::null_mut();
11852 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11853 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11856 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11857 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11858 let datalen = v.len();
11859 let data = Box::into_raw(v.into_boxed_slice());
11860 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11864 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11865 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11866 impl Drop for CVec_UpdateAddHTLCZ {
11867 fn drop(&mut self) {
11868 if self.datalen == 0 { return; }
11869 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11872 impl Clone for CVec_UpdateAddHTLCZ {
11873 fn clone(&self) -> Self {
11874 let mut res = Vec::new();
11875 if self.datalen == 0 { return Self::from(res); }
11876 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11881 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11882 /// This corresponds to std::vector in C++
11883 pub struct CVec_UpdateFulfillHTLCZ {
11884 /// The elements in the array.
11885 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11886 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11887 /// The number of elements pointed to by `data`.
11890 impl CVec_UpdateFulfillHTLCZ {
11891 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11892 if self.datalen == 0 { return Vec::new(); }
11893 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11894 self.data = core::ptr::null_mut();
11898 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11899 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11902 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11903 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11904 let datalen = v.len();
11905 let data = Box::into_raw(v.into_boxed_slice());
11906 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11910 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11911 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11912 impl Drop for CVec_UpdateFulfillHTLCZ {
11913 fn drop(&mut self) {
11914 if self.datalen == 0 { return; }
11915 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11918 impl Clone for CVec_UpdateFulfillHTLCZ {
11919 fn clone(&self) -> Self {
11920 let mut res = Vec::new();
11921 if self.datalen == 0 { return Self::from(res); }
11922 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11927 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11928 /// This corresponds to std::vector in C++
11929 pub struct CVec_UpdateFailHTLCZ {
11930 /// The elements in the array.
11931 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11932 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11933 /// The number of elements pointed to by `data`.
11936 impl CVec_UpdateFailHTLCZ {
11937 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11938 if self.datalen == 0 { return Vec::new(); }
11939 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11940 self.data = core::ptr::null_mut();
11944 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11945 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11948 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11949 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11950 let datalen = v.len();
11951 let data = Box::into_raw(v.into_boxed_slice());
11952 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11956 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11957 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11958 impl Drop for CVec_UpdateFailHTLCZ {
11959 fn drop(&mut self) {
11960 if self.datalen == 0 { return; }
11961 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11964 impl Clone for CVec_UpdateFailHTLCZ {
11965 fn clone(&self) -> Self {
11966 let mut res = Vec::new();
11967 if self.datalen == 0 { return Self::from(res); }
11968 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11973 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11974 /// This corresponds to std::vector in C++
11975 pub struct CVec_UpdateFailMalformedHTLCZ {
11976 /// The elements in the array.
11977 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11978 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11979 /// The number of elements pointed to by `data`.
11982 impl CVec_UpdateFailMalformedHTLCZ {
11983 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11984 if self.datalen == 0 { return Vec::new(); }
11985 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11986 self.data = core::ptr::null_mut();
11990 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11991 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11994 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11995 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11996 let datalen = v.len();
11997 let data = Box::into_raw(v.into_boxed_slice());
11998 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12002 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12003 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12004 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12005 fn drop(&mut self) {
12006 if self.datalen == 0 { return; }
12007 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12010 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12011 fn clone(&self) -> Self {
12012 let mut res = Vec::new();
12013 if self.datalen == 0 { return Self::from(res); }
12014 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12019 /// The contents of CResult_AcceptChannelDecodeErrorZ
12020 pub union CResult_AcceptChannelDecodeErrorZPtr {
12021 /// A pointer to the contents in the success state.
12022 /// Reading from this pointer when `result_ok` is not set is undefined.
12023 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12024 /// A pointer to the contents in the error state.
12025 /// Reading from this pointer when `result_ok` is set is undefined.
12026 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12029 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12030 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12032 pub struct CResult_AcceptChannelDecodeErrorZ {
12033 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12034 /// `err` or `result` depending on the state of `result_ok`.
12035 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12036 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12037 pub result_ok: bool,
12040 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12041 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12042 CResult_AcceptChannelDecodeErrorZ {
12043 contents: CResult_AcceptChannelDecodeErrorZPtr {
12044 result: Box::into_raw(Box::new(o)),
12050 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12051 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12052 CResult_AcceptChannelDecodeErrorZ {
12053 contents: CResult_AcceptChannelDecodeErrorZPtr {
12054 err: Box::into_raw(Box::new(e)),
12059 /// Checks if the given object is currently in the success state
12061 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12065 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12066 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12067 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12068 fn drop(&mut self) {
12069 if self.result_ok {
12070 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12071 let _ = unsafe { Box::from_raw(self.contents.result) };
12074 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12075 let _ = unsafe { Box::from_raw(self.contents.err) };
12080 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12081 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12082 let contents = if o.result_ok {
12083 let result = unsafe { o.contents.result };
12084 unsafe { o.contents.result = core::ptr::null_mut() };
12085 CResult_AcceptChannelDecodeErrorZPtr { result }
12087 let err = unsafe { o.contents.err };
12088 unsafe { o.contents.err = core::ptr::null_mut(); }
12089 CResult_AcceptChannelDecodeErrorZPtr { err }
12093 result_ok: o.result_ok,
12097 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12098 fn clone(&self) -> Self {
12099 if self.result_ok {
12100 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12101 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12104 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12105 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12111 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12112 /// but with all dynamically-allocated buffers duplicated in new buffers.
12113 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12115 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12116 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12117 /// A pointer to the contents in the success state.
12118 /// Reading from this pointer when `result_ok` is not set is undefined.
12119 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12120 /// A pointer to the contents in the error state.
12121 /// Reading from this pointer when `result_ok` is set is undefined.
12122 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12125 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12126 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12127 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12128 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12129 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12130 /// `err` or `result` depending on the state of `result_ok`.
12131 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12132 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12133 pub result_ok: bool,
12136 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12137 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12138 CResult_AnnouncementSignaturesDecodeErrorZ {
12139 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12140 result: Box::into_raw(Box::new(o)),
12146 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12147 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12148 CResult_AnnouncementSignaturesDecodeErrorZ {
12149 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12150 err: Box::into_raw(Box::new(e)),
12155 /// Checks if the given object is currently in the success state
12157 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12161 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12162 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12163 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12164 fn drop(&mut self) {
12165 if self.result_ok {
12166 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12167 let _ = unsafe { Box::from_raw(self.contents.result) };
12170 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12171 let _ = unsafe { Box::from_raw(self.contents.err) };
12176 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12177 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12178 let contents = if o.result_ok {
12179 let result = unsafe { o.contents.result };
12180 unsafe { o.contents.result = core::ptr::null_mut() };
12181 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12183 let err = unsafe { o.contents.err };
12184 unsafe { o.contents.err = core::ptr::null_mut(); }
12185 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12189 result_ok: o.result_ok,
12193 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12194 fn clone(&self) -> Self {
12195 if self.result_ok {
12196 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12197 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12200 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12201 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12207 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12208 /// but with all dynamically-allocated buffers duplicated in new buffers.
12209 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12211 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12212 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12213 /// A pointer to the contents in the success state.
12214 /// Reading from this pointer when `result_ok` is not set is undefined.
12215 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12216 /// A pointer to the contents in the error state.
12217 /// Reading from this pointer when `result_ok` is set is undefined.
12218 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12221 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12222 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12223 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12224 pub struct CResult_ChannelReestablishDecodeErrorZ {
12225 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12226 /// `err` or `result` depending on the state of `result_ok`.
12227 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12228 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12229 pub result_ok: bool,
12232 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12233 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12234 CResult_ChannelReestablishDecodeErrorZ {
12235 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12236 result: Box::into_raw(Box::new(o)),
12242 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12243 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12244 CResult_ChannelReestablishDecodeErrorZ {
12245 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12246 err: Box::into_raw(Box::new(e)),
12251 /// Checks if the given object is currently in the success state
12253 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12257 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12258 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12259 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12260 fn drop(&mut self) {
12261 if self.result_ok {
12262 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12263 let _ = unsafe { Box::from_raw(self.contents.result) };
12266 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12267 let _ = unsafe { Box::from_raw(self.contents.err) };
12272 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12273 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12274 let contents = if o.result_ok {
12275 let result = unsafe { o.contents.result };
12276 unsafe { o.contents.result = core::ptr::null_mut() };
12277 CResult_ChannelReestablishDecodeErrorZPtr { result }
12279 let err = unsafe { o.contents.err };
12280 unsafe { o.contents.err = core::ptr::null_mut(); }
12281 CResult_ChannelReestablishDecodeErrorZPtr { err }
12285 result_ok: o.result_ok,
12289 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12290 fn clone(&self) -> Self {
12291 if self.result_ok {
12292 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12293 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12296 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12297 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12303 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12304 /// but with all dynamically-allocated buffers duplicated in new buffers.
12305 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12307 /// The contents of CResult_ClosingSignedDecodeErrorZ
12308 pub union CResult_ClosingSignedDecodeErrorZPtr {
12309 /// A pointer to the contents in the success state.
12310 /// Reading from this pointer when `result_ok` is not set is undefined.
12311 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12312 /// A pointer to the contents in the error state.
12313 /// Reading from this pointer when `result_ok` is set is undefined.
12314 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12317 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12318 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12319 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12320 pub struct CResult_ClosingSignedDecodeErrorZ {
12321 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12322 /// `err` or `result` depending on the state of `result_ok`.
12323 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12324 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12325 pub result_ok: bool,
12328 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12329 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12330 CResult_ClosingSignedDecodeErrorZ {
12331 contents: CResult_ClosingSignedDecodeErrorZPtr {
12332 result: Box::into_raw(Box::new(o)),
12338 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12339 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12340 CResult_ClosingSignedDecodeErrorZ {
12341 contents: CResult_ClosingSignedDecodeErrorZPtr {
12342 err: Box::into_raw(Box::new(e)),
12347 /// Checks if the given object is currently in the success state
12349 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12353 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12354 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12355 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12356 fn drop(&mut self) {
12357 if self.result_ok {
12358 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12359 let _ = unsafe { Box::from_raw(self.contents.result) };
12362 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12363 let _ = unsafe { Box::from_raw(self.contents.err) };
12368 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12369 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12370 let contents = if o.result_ok {
12371 let result = unsafe { o.contents.result };
12372 unsafe { o.contents.result = core::ptr::null_mut() };
12373 CResult_ClosingSignedDecodeErrorZPtr { result }
12375 let err = unsafe { o.contents.err };
12376 unsafe { o.contents.err = core::ptr::null_mut(); }
12377 CResult_ClosingSignedDecodeErrorZPtr { err }
12381 result_ok: o.result_ok,
12385 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12386 fn clone(&self) -> Self {
12387 if self.result_ok {
12388 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12389 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12392 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12393 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12399 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12400 /// but with all dynamically-allocated buffers duplicated in new buffers.
12401 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12403 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12404 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12405 /// A pointer to the contents in the success state.
12406 /// Reading from this pointer when `result_ok` is not set is undefined.
12407 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12408 /// A pointer to the contents in the error state.
12409 /// Reading from this pointer when `result_ok` is set is undefined.
12410 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12413 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12414 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12415 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12416 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12417 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12418 /// `err` or `result` depending on the state of `result_ok`.
12419 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12420 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12421 pub result_ok: bool,
12424 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12425 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12426 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12427 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12428 result: Box::into_raw(Box::new(o)),
12434 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12435 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12436 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12437 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12438 err: Box::into_raw(Box::new(e)),
12443 /// Checks if the given object is currently in the success state
12445 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12449 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12450 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12451 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12452 fn drop(&mut self) {
12453 if self.result_ok {
12454 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12455 let _ = unsafe { Box::from_raw(self.contents.result) };
12458 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12459 let _ = unsafe { Box::from_raw(self.contents.err) };
12464 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12465 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12466 let contents = if o.result_ok {
12467 let result = unsafe { o.contents.result };
12468 unsafe { o.contents.result = core::ptr::null_mut() };
12469 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12471 let err = unsafe { o.contents.err };
12472 unsafe { o.contents.err = core::ptr::null_mut(); }
12473 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12477 result_ok: o.result_ok,
12481 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12482 fn clone(&self) -> Self {
12483 if self.result_ok {
12484 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12485 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12488 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12489 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12495 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12496 /// but with all dynamically-allocated buffers duplicated in new buffers.
12497 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12499 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12500 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12501 /// A pointer to the contents in the success state.
12502 /// Reading from this pointer when `result_ok` is not set is undefined.
12503 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12504 /// A pointer to the contents in the error state.
12505 /// Reading from this pointer when `result_ok` is set is undefined.
12506 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12509 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12510 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12512 pub struct CResult_CommitmentSignedDecodeErrorZ {
12513 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12514 /// `err` or `result` depending on the state of `result_ok`.
12515 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12516 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12517 pub result_ok: bool,
12520 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12521 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12522 CResult_CommitmentSignedDecodeErrorZ {
12523 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12524 result: Box::into_raw(Box::new(o)),
12530 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12531 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12532 CResult_CommitmentSignedDecodeErrorZ {
12533 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12534 err: Box::into_raw(Box::new(e)),
12539 /// Checks if the given object is currently in the success state
12541 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12545 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12546 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12547 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12548 fn drop(&mut self) {
12549 if self.result_ok {
12550 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12551 let _ = unsafe { Box::from_raw(self.contents.result) };
12554 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12555 let _ = unsafe { Box::from_raw(self.contents.err) };
12560 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12561 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12562 let contents = if o.result_ok {
12563 let result = unsafe { o.contents.result };
12564 unsafe { o.contents.result = core::ptr::null_mut() };
12565 CResult_CommitmentSignedDecodeErrorZPtr { result }
12567 let err = unsafe { o.contents.err };
12568 unsafe { o.contents.err = core::ptr::null_mut(); }
12569 CResult_CommitmentSignedDecodeErrorZPtr { err }
12573 result_ok: o.result_ok,
12577 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12578 fn clone(&self) -> Self {
12579 if self.result_ok {
12580 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12581 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12584 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12585 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12591 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12592 /// but with all dynamically-allocated buffers duplicated in new buffers.
12593 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12595 /// The contents of CResult_FundingCreatedDecodeErrorZ
12596 pub union CResult_FundingCreatedDecodeErrorZPtr {
12597 /// A pointer to the contents in the success state.
12598 /// Reading from this pointer when `result_ok` is not set is undefined.
12599 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12600 /// A pointer to the contents in the error state.
12601 /// Reading from this pointer when `result_ok` is set is undefined.
12602 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12605 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12606 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12608 pub struct CResult_FundingCreatedDecodeErrorZ {
12609 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12610 /// `err` or `result` depending on the state of `result_ok`.
12611 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12612 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12613 pub result_ok: bool,
12616 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12617 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12618 CResult_FundingCreatedDecodeErrorZ {
12619 contents: CResult_FundingCreatedDecodeErrorZPtr {
12620 result: Box::into_raw(Box::new(o)),
12626 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12627 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12628 CResult_FundingCreatedDecodeErrorZ {
12629 contents: CResult_FundingCreatedDecodeErrorZPtr {
12630 err: Box::into_raw(Box::new(e)),
12635 /// Checks if the given object is currently in the success state
12637 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12641 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12642 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12643 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12644 fn drop(&mut self) {
12645 if self.result_ok {
12646 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12647 let _ = unsafe { Box::from_raw(self.contents.result) };
12650 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12651 let _ = unsafe { Box::from_raw(self.contents.err) };
12656 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12657 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12658 let contents = if o.result_ok {
12659 let result = unsafe { o.contents.result };
12660 unsafe { o.contents.result = core::ptr::null_mut() };
12661 CResult_FundingCreatedDecodeErrorZPtr { result }
12663 let err = unsafe { o.contents.err };
12664 unsafe { o.contents.err = core::ptr::null_mut(); }
12665 CResult_FundingCreatedDecodeErrorZPtr { err }
12669 result_ok: o.result_ok,
12673 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12674 fn clone(&self) -> Self {
12675 if self.result_ok {
12676 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12677 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12680 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12681 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12687 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12688 /// but with all dynamically-allocated buffers duplicated in new buffers.
12689 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12691 /// The contents of CResult_FundingSignedDecodeErrorZ
12692 pub union CResult_FundingSignedDecodeErrorZPtr {
12693 /// A pointer to the contents in the success state.
12694 /// Reading from this pointer when `result_ok` is not set is undefined.
12695 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12696 /// A pointer to the contents in the error state.
12697 /// Reading from this pointer when `result_ok` is set is undefined.
12698 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12701 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12702 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12703 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12704 pub struct CResult_FundingSignedDecodeErrorZ {
12705 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12706 /// `err` or `result` depending on the state of `result_ok`.
12707 pub contents: CResult_FundingSignedDecodeErrorZPtr,
12708 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12709 pub result_ok: bool,
12712 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12713 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12714 CResult_FundingSignedDecodeErrorZ {
12715 contents: CResult_FundingSignedDecodeErrorZPtr {
12716 result: Box::into_raw(Box::new(o)),
12722 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12723 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12724 CResult_FundingSignedDecodeErrorZ {
12725 contents: CResult_FundingSignedDecodeErrorZPtr {
12726 err: Box::into_raw(Box::new(e)),
12731 /// Checks if the given object is currently in the success state
12733 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12737 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12738 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12739 impl Drop for CResult_FundingSignedDecodeErrorZ {
12740 fn drop(&mut self) {
12741 if self.result_ok {
12742 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12743 let _ = unsafe { Box::from_raw(self.contents.result) };
12746 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12747 let _ = unsafe { Box::from_raw(self.contents.err) };
12752 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12753 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12754 let contents = if o.result_ok {
12755 let result = unsafe { o.contents.result };
12756 unsafe { o.contents.result = core::ptr::null_mut() };
12757 CResult_FundingSignedDecodeErrorZPtr { result }
12759 let err = unsafe { o.contents.err };
12760 unsafe { o.contents.err = core::ptr::null_mut(); }
12761 CResult_FundingSignedDecodeErrorZPtr { err }
12765 result_ok: o.result_ok,
12769 impl Clone for CResult_FundingSignedDecodeErrorZ {
12770 fn clone(&self) -> Self {
12771 if self.result_ok {
12772 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12773 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12776 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12777 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12783 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12784 /// but with all dynamically-allocated buffers duplicated in new buffers.
12785 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12787 /// The contents of CResult_FundingLockedDecodeErrorZ
12788 pub union CResult_FundingLockedDecodeErrorZPtr {
12789 /// A pointer to the contents in the success state.
12790 /// Reading from this pointer when `result_ok` is not set is undefined.
12791 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12792 /// A pointer to the contents in the error state.
12793 /// Reading from this pointer when `result_ok` is set is undefined.
12794 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12797 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12798 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12800 pub struct CResult_FundingLockedDecodeErrorZ {
12801 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12802 /// `err` or `result` depending on the state of `result_ok`.
12803 pub contents: CResult_FundingLockedDecodeErrorZPtr,
12804 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12805 pub result_ok: bool,
12808 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12809 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12810 CResult_FundingLockedDecodeErrorZ {
12811 contents: CResult_FundingLockedDecodeErrorZPtr {
12812 result: Box::into_raw(Box::new(o)),
12818 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12819 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12820 CResult_FundingLockedDecodeErrorZ {
12821 contents: CResult_FundingLockedDecodeErrorZPtr {
12822 err: Box::into_raw(Box::new(e)),
12827 /// Checks if the given object is currently in the success state
12829 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12833 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12834 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12835 impl Drop for CResult_FundingLockedDecodeErrorZ {
12836 fn drop(&mut self) {
12837 if self.result_ok {
12838 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12839 let _ = unsafe { Box::from_raw(self.contents.result) };
12842 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12843 let _ = unsafe { Box::from_raw(self.contents.err) };
12848 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12849 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12850 let contents = if o.result_ok {
12851 let result = unsafe { o.contents.result };
12852 unsafe { o.contents.result = core::ptr::null_mut() };
12853 CResult_FundingLockedDecodeErrorZPtr { result }
12855 let err = unsafe { o.contents.err };
12856 unsafe { o.contents.err = core::ptr::null_mut(); }
12857 CResult_FundingLockedDecodeErrorZPtr { err }
12861 result_ok: o.result_ok,
12865 impl Clone for CResult_FundingLockedDecodeErrorZ {
12866 fn clone(&self) -> Self {
12867 if self.result_ok {
12868 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12869 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12872 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12873 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12879 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12880 /// but with all dynamically-allocated buffers duplicated in new buffers.
12881 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12883 /// The contents of CResult_InitDecodeErrorZ
12884 pub union CResult_InitDecodeErrorZPtr {
12885 /// A pointer to the contents in the success state.
12886 /// Reading from this pointer when `result_ok` is not set is undefined.
12887 pub result: *mut crate::lightning::ln::msgs::Init,
12888 /// A pointer to the contents in the error state.
12889 /// Reading from this pointer when `result_ok` is set is undefined.
12890 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12893 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12894 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12896 pub struct CResult_InitDecodeErrorZ {
12897 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12898 /// `err` or `result` depending on the state of `result_ok`.
12899 pub contents: CResult_InitDecodeErrorZPtr,
12900 /// Whether this CResult_InitDecodeErrorZ represents a success state.
12901 pub result_ok: bool,
12904 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12905 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12906 CResult_InitDecodeErrorZ {
12907 contents: CResult_InitDecodeErrorZPtr {
12908 result: Box::into_raw(Box::new(o)),
12914 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12915 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12916 CResult_InitDecodeErrorZ {
12917 contents: CResult_InitDecodeErrorZPtr {
12918 err: Box::into_raw(Box::new(e)),
12923 /// Checks if the given object is currently in the success state
12925 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12929 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12930 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12931 impl Drop for CResult_InitDecodeErrorZ {
12932 fn drop(&mut self) {
12933 if self.result_ok {
12934 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12935 let _ = unsafe { Box::from_raw(self.contents.result) };
12938 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12939 let _ = unsafe { Box::from_raw(self.contents.err) };
12944 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12945 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12946 let contents = if o.result_ok {
12947 let result = unsafe { o.contents.result };
12948 unsafe { o.contents.result = core::ptr::null_mut() };
12949 CResult_InitDecodeErrorZPtr { result }
12951 let err = unsafe { o.contents.err };
12952 unsafe { o.contents.err = core::ptr::null_mut(); }
12953 CResult_InitDecodeErrorZPtr { err }
12957 result_ok: o.result_ok,
12961 impl Clone for CResult_InitDecodeErrorZ {
12962 fn clone(&self) -> Self {
12963 if self.result_ok {
12964 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12965 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12968 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12969 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12975 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12976 /// but with all dynamically-allocated buffers duplicated in new buffers.
12977 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12979 /// The contents of CResult_OpenChannelDecodeErrorZ
12980 pub union CResult_OpenChannelDecodeErrorZPtr {
12981 /// A pointer to the contents in the success state.
12982 /// Reading from this pointer when `result_ok` is not set is undefined.
12983 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12984 /// A pointer to the contents in the error state.
12985 /// Reading from this pointer when `result_ok` is set is undefined.
12986 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12989 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12990 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12991 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12992 pub struct CResult_OpenChannelDecodeErrorZ {
12993 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12994 /// `err` or `result` depending on the state of `result_ok`.
12995 pub contents: CResult_OpenChannelDecodeErrorZPtr,
12996 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12997 pub result_ok: bool,
13000 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13001 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13002 CResult_OpenChannelDecodeErrorZ {
13003 contents: CResult_OpenChannelDecodeErrorZPtr {
13004 result: Box::into_raw(Box::new(o)),
13010 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13011 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13012 CResult_OpenChannelDecodeErrorZ {
13013 contents: CResult_OpenChannelDecodeErrorZPtr {
13014 err: Box::into_raw(Box::new(e)),
13019 /// Checks if the given object is currently in the success state
13021 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13025 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13026 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13027 impl Drop for CResult_OpenChannelDecodeErrorZ {
13028 fn drop(&mut self) {
13029 if self.result_ok {
13030 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13031 let _ = unsafe { Box::from_raw(self.contents.result) };
13034 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13035 let _ = unsafe { Box::from_raw(self.contents.err) };
13040 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13041 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13042 let contents = if o.result_ok {
13043 let result = unsafe { o.contents.result };
13044 unsafe { o.contents.result = core::ptr::null_mut() };
13045 CResult_OpenChannelDecodeErrorZPtr { result }
13047 let err = unsafe { o.contents.err };
13048 unsafe { o.contents.err = core::ptr::null_mut(); }
13049 CResult_OpenChannelDecodeErrorZPtr { err }
13053 result_ok: o.result_ok,
13057 impl Clone for CResult_OpenChannelDecodeErrorZ {
13058 fn clone(&self) -> Self {
13059 if self.result_ok {
13060 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13061 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13064 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13065 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13071 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13072 /// but with all dynamically-allocated buffers duplicated in new buffers.
13073 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13075 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13076 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13077 /// A pointer to the contents in the success state.
13078 /// Reading from this pointer when `result_ok` is not set is undefined.
13079 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13080 /// A pointer to the contents in the error state.
13081 /// Reading from this pointer when `result_ok` is set is undefined.
13082 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13085 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13086 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13088 pub struct CResult_RevokeAndACKDecodeErrorZ {
13089 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13090 /// `err` or `result` depending on the state of `result_ok`.
13091 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13092 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13093 pub result_ok: bool,
13096 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13097 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13098 CResult_RevokeAndACKDecodeErrorZ {
13099 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13100 result: Box::into_raw(Box::new(o)),
13106 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13107 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13108 CResult_RevokeAndACKDecodeErrorZ {
13109 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13110 err: Box::into_raw(Box::new(e)),
13115 /// Checks if the given object is currently in the success state
13117 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13121 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13122 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13123 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13124 fn drop(&mut self) {
13125 if self.result_ok {
13126 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13127 let _ = unsafe { Box::from_raw(self.contents.result) };
13130 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13131 let _ = unsafe { Box::from_raw(self.contents.err) };
13136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13137 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13138 let contents = if o.result_ok {
13139 let result = unsafe { o.contents.result };
13140 unsafe { o.contents.result = core::ptr::null_mut() };
13141 CResult_RevokeAndACKDecodeErrorZPtr { result }
13143 let err = unsafe { o.contents.err };
13144 unsafe { o.contents.err = core::ptr::null_mut(); }
13145 CResult_RevokeAndACKDecodeErrorZPtr { err }
13149 result_ok: o.result_ok,
13153 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13154 fn clone(&self) -> Self {
13155 if self.result_ok {
13156 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13157 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13160 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13161 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13167 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13168 /// but with all dynamically-allocated buffers duplicated in new buffers.
13169 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13171 /// The contents of CResult_ShutdownDecodeErrorZ
13172 pub union CResult_ShutdownDecodeErrorZPtr {
13173 /// A pointer to the contents in the success state.
13174 /// Reading from this pointer when `result_ok` is not set is undefined.
13175 pub result: *mut crate::lightning::ln::msgs::Shutdown,
13176 /// A pointer to the contents in the error state.
13177 /// Reading from this pointer when `result_ok` is set is undefined.
13178 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13181 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13182 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13184 pub struct CResult_ShutdownDecodeErrorZ {
13185 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13186 /// `err` or `result` depending on the state of `result_ok`.
13187 pub contents: CResult_ShutdownDecodeErrorZPtr,
13188 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13189 pub result_ok: bool,
13192 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13193 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13194 CResult_ShutdownDecodeErrorZ {
13195 contents: CResult_ShutdownDecodeErrorZPtr {
13196 result: Box::into_raw(Box::new(o)),
13202 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13203 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13204 CResult_ShutdownDecodeErrorZ {
13205 contents: CResult_ShutdownDecodeErrorZPtr {
13206 err: Box::into_raw(Box::new(e)),
13211 /// Checks if the given object is currently in the success state
13213 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13217 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13218 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13219 impl Drop for CResult_ShutdownDecodeErrorZ {
13220 fn drop(&mut self) {
13221 if self.result_ok {
13222 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13223 let _ = unsafe { Box::from_raw(self.contents.result) };
13226 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13227 let _ = unsafe { Box::from_raw(self.contents.err) };
13232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13233 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13234 let contents = if o.result_ok {
13235 let result = unsafe { o.contents.result };
13236 unsafe { o.contents.result = core::ptr::null_mut() };
13237 CResult_ShutdownDecodeErrorZPtr { result }
13239 let err = unsafe { o.contents.err };
13240 unsafe { o.contents.err = core::ptr::null_mut(); }
13241 CResult_ShutdownDecodeErrorZPtr { err }
13245 result_ok: o.result_ok,
13249 impl Clone for CResult_ShutdownDecodeErrorZ {
13250 fn clone(&self) -> Self {
13251 if self.result_ok {
13252 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13253 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13256 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13257 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13263 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13264 /// but with all dynamically-allocated buffers duplicated in new buffers.
13265 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13267 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13268 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13269 /// A pointer to the contents in the success state.
13270 /// Reading from this pointer when `result_ok` is not set is undefined.
13271 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13272 /// A pointer to the contents in the error state.
13273 /// Reading from this pointer when `result_ok` is set is undefined.
13274 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13277 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13278 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13279 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13280 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13281 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13282 /// `err` or `result` depending on the state of `result_ok`.
13283 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13284 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13285 pub result_ok: bool,
13288 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13289 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13290 CResult_UpdateFailHTLCDecodeErrorZ {
13291 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13292 result: Box::into_raw(Box::new(o)),
13298 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13299 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13300 CResult_UpdateFailHTLCDecodeErrorZ {
13301 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13302 err: Box::into_raw(Box::new(e)),
13307 /// Checks if the given object is currently in the success state
13309 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13313 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13314 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13315 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13316 fn drop(&mut self) {
13317 if self.result_ok {
13318 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13319 let _ = unsafe { Box::from_raw(self.contents.result) };
13322 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13323 let _ = unsafe { Box::from_raw(self.contents.err) };
13328 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13329 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13330 let contents = if o.result_ok {
13331 let result = unsafe { o.contents.result };
13332 unsafe { o.contents.result = core::ptr::null_mut() };
13333 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13335 let err = unsafe { o.contents.err };
13336 unsafe { o.contents.err = core::ptr::null_mut(); }
13337 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13341 result_ok: o.result_ok,
13345 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13346 fn clone(&self) -> Self {
13347 if self.result_ok {
13348 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13349 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13352 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13353 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13359 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13360 /// but with all dynamically-allocated buffers duplicated in new buffers.
13361 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13363 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13364 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13365 /// A pointer to the contents in the success state.
13366 /// Reading from this pointer when `result_ok` is not set is undefined.
13367 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13368 /// A pointer to the contents in the error state.
13369 /// Reading from this pointer when `result_ok` is set is undefined.
13370 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13373 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13374 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13375 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13376 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13377 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13378 /// `err` or `result` depending on the state of `result_ok`.
13379 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13380 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13381 pub result_ok: bool,
13384 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13385 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13386 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13387 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13388 result: Box::into_raw(Box::new(o)),
13394 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13395 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13396 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13397 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13398 err: Box::into_raw(Box::new(e)),
13403 /// Checks if the given object is currently in the success state
13405 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13409 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13410 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13411 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13412 fn drop(&mut self) {
13413 if self.result_ok {
13414 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13415 let _ = unsafe { Box::from_raw(self.contents.result) };
13418 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13419 let _ = unsafe { Box::from_raw(self.contents.err) };
13424 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13425 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13426 let contents = if o.result_ok {
13427 let result = unsafe { o.contents.result };
13428 unsafe { o.contents.result = core::ptr::null_mut() };
13429 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13431 let err = unsafe { o.contents.err };
13432 unsafe { o.contents.err = core::ptr::null_mut(); }
13433 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13437 result_ok: o.result_ok,
13441 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13442 fn clone(&self) -> Self {
13443 if self.result_ok {
13444 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13445 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13448 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13449 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13455 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13456 /// but with all dynamically-allocated buffers duplicated in new buffers.
13457 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13459 /// The contents of CResult_UpdateFeeDecodeErrorZ
13460 pub union CResult_UpdateFeeDecodeErrorZPtr {
13461 /// A pointer to the contents in the success state.
13462 /// Reading from this pointer when `result_ok` is not set is undefined.
13463 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13464 /// A pointer to the contents in the error state.
13465 /// Reading from this pointer when `result_ok` is set is undefined.
13466 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13469 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13470 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13471 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13472 pub struct CResult_UpdateFeeDecodeErrorZ {
13473 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13474 /// `err` or `result` depending on the state of `result_ok`.
13475 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13476 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13477 pub result_ok: bool,
13480 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13481 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13482 CResult_UpdateFeeDecodeErrorZ {
13483 contents: CResult_UpdateFeeDecodeErrorZPtr {
13484 result: Box::into_raw(Box::new(o)),
13490 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13491 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13492 CResult_UpdateFeeDecodeErrorZ {
13493 contents: CResult_UpdateFeeDecodeErrorZPtr {
13494 err: Box::into_raw(Box::new(e)),
13499 /// Checks if the given object is currently in the success state
13501 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13505 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13506 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13507 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13508 fn drop(&mut self) {
13509 if self.result_ok {
13510 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13511 let _ = unsafe { Box::from_raw(self.contents.result) };
13514 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13515 let _ = unsafe { Box::from_raw(self.contents.err) };
13520 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13521 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13522 let contents = if o.result_ok {
13523 let result = unsafe { o.contents.result };
13524 unsafe { o.contents.result = core::ptr::null_mut() };
13525 CResult_UpdateFeeDecodeErrorZPtr { result }
13527 let err = unsafe { o.contents.err };
13528 unsafe { o.contents.err = core::ptr::null_mut(); }
13529 CResult_UpdateFeeDecodeErrorZPtr { err }
13533 result_ok: o.result_ok,
13537 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13538 fn clone(&self) -> Self {
13539 if self.result_ok {
13540 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13541 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13544 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13545 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13551 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13552 /// but with all dynamically-allocated buffers duplicated in new buffers.
13553 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13555 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13556 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13557 /// A pointer to the contents in the success state.
13558 /// Reading from this pointer when `result_ok` is not set is undefined.
13559 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13560 /// A pointer to the contents in the error state.
13561 /// Reading from this pointer when `result_ok` is set is undefined.
13562 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13565 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13566 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13568 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13569 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13570 /// `err` or `result` depending on the state of `result_ok`.
13571 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13572 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13573 pub result_ok: bool,
13576 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13577 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13578 CResult_UpdateFulfillHTLCDecodeErrorZ {
13579 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13580 result: Box::into_raw(Box::new(o)),
13586 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13587 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13588 CResult_UpdateFulfillHTLCDecodeErrorZ {
13589 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13590 err: Box::into_raw(Box::new(e)),
13595 /// Checks if the given object is currently in the success state
13597 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13601 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13602 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13603 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13604 fn drop(&mut self) {
13605 if self.result_ok {
13606 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13607 let _ = unsafe { Box::from_raw(self.contents.result) };
13610 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13611 let _ = unsafe { Box::from_raw(self.contents.err) };
13616 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13617 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13618 let contents = if o.result_ok {
13619 let result = unsafe { o.contents.result };
13620 unsafe { o.contents.result = core::ptr::null_mut() };
13621 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13623 let err = unsafe { o.contents.err };
13624 unsafe { o.contents.err = core::ptr::null_mut(); }
13625 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13629 result_ok: o.result_ok,
13633 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13634 fn clone(&self) -> Self {
13635 if self.result_ok {
13636 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13637 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13640 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13641 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13647 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13648 /// but with all dynamically-allocated buffers duplicated in new buffers.
13649 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13651 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13652 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13653 /// A pointer to the contents in the success state.
13654 /// Reading from this pointer when `result_ok` is not set is undefined.
13655 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13656 /// A pointer to the contents in the error state.
13657 /// Reading from this pointer when `result_ok` is set is undefined.
13658 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13661 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13662 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13663 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13664 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13665 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13666 /// `err` or `result` depending on the state of `result_ok`.
13667 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13668 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13669 pub result_ok: bool,
13672 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13673 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13674 CResult_UpdateAddHTLCDecodeErrorZ {
13675 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13676 result: Box::into_raw(Box::new(o)),
13682 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13683 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13684 CResult_UpdateAddHTLCDecodeErrorZ {
13685 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13686 err: Box::into_raw(Box::new(e)),
13691 /// Checks if the given object is currently in the success state
13693 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13697 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13698 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13699 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13700 fn drop(&mut self) {
13701 if self.result_ok {
13702 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13703 let _ = unsafe { Box::from_raw(self.contents.result) };
13706 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13707 let _ = unsafe { Box::from_raw(self.contents.err) };
13712 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13713 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13714 let contents = if o.result_ok {
13715 let result = unsafe { o.contents.result };
13716 unsafe { o.contents.result = core::ptr::null_mut() };
13717 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13719 let err = unsafe { o.contents.err };
13720 unsafe { o.contents.err = core::ptr::null_mut(); }
13721 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13725 result_ok: o.result_ok,
13729 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13730 fn clone(&self) -> Self {
13731 if self.result_ok {
13732 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13733 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13736 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13737 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13743 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13744 /// but with all dynamically-allocated buffers duplicated in new buffers.
13745 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13747 /// The contents of CResult_PingDecodeErrorZ
13748 pub union CResult_PingDecodeErrorZPtr {
13749 /// A pointer to the contents in the success state.
13750 /// Reading from this pointer when `result_ok` is not set is undefined.
13751 pub result: *mut crate::lightning::ln::msgs::Ping,
13752 /// A pointer to the contents in the error state.
13753 /// Reading from this pointer when `result_ok` is set is undefined.
13754 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13757 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13758 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13760 pub struct CResult_PingDecodeErrorZ {
13761 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13762 /// `err` or `result` depending on the state of `result_ok`.
13763 pub contents: CResult_PingDecodeErrorZPtr,
13764 /// Whether this CResult_PingDecodeErrorZ represents a success state.
13765 pub result_ok: bool,
13768 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13769 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13770 CResult_PingDecodeErrorZ {
13771 contents: CResult_PingDecodeErrorZPtr {
13772 result: Box::into_raw(Box::new(o)),
13778 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13779 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13780 CResult_PingDecodeErrorZ {
13781 contents: CResult_PingDecodeErrorZPtr {
13782 err: Box::into_raw(Box::new(e)),
13787 /// Checks if the given object is currently in the success state
13789 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13793 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13794 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13795 impl Drop for CResult_PingDecodeErrorZ {
13796 fn drop(&mut self) {
13797 if self.result_ok {
13798 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13799 let _ = unsafe { Box::from_raw(self.contents.result) };
13802 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13803 let _ = unsafe { Box::from_raw(self.contents.err) };
13808 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13809 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13810 let contents = if o.result_ok {
13811 let result = unsafe { o.contents.result };
13812 unsafe { o.contents.result = core::ptr::null_mut() };
13813 CResult_PingDecodeErrorZPtr { result }
13815 let err = unsafe { o.contents.err };
13816 unsafe { o.contents.err = core::ptr::null_mut(); }
13817 CResult_PingDecodeErrorZPtr { err }
13821 result_ok: o.result_ok,
13825 impl Clone for CResult_PingDecodeErrorZ {
13826 fn clone(&self) -> Self {
13827 if self.result_ok {
13828 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13829 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13832 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13833 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13839 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13840 /// but with all dynamically-allocated buffers duplicated in new buffers.
13841 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13843 /// The contents of CResult_PongDecodeErrorZ
13844 pub union CResult_PongDecodeErrorZPtr {
13845 /// A pointer to the contents in the success state.
13846 /// Reading from this pointer when `result_ok` is not set is undefined.
13847 pub result: *mut crate::lightning::ln::msgs::Pong,
13848 /// A pointer to the contents in the error state.
13849 /// Reading from this pointer when `result_ok` is set is undefined.
13850 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13853 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13854 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13856 pub struct CResult_PongDecodeErrorZ {
13857 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13858 /// `err` or `result` depending on the state of `result_ok`.
13859 pub contents: CResult_PongDecodeErrorZPtr,
13860 /// Whether this CResult_PongDecodeErrorZ represents a success state.
13861 pub result_ok: bool,
13864 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13865 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13866 CResult_PongDecodeErrorZ {
13867 contents: CResult_PongDecodeErrorZPtr {
13868 result: Box::into_raw(Box::new(o)),
13874 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13875 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13876 CResult_PongDecodeErrorZ {
13877 contents: CResult_PongDecodeErrorZPtr {
13878 err: Box::into_raw(Box::new(e)),
13883 /// Checks if the given object is currently in the success state
13885 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13889 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13890 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13891 impl Drop for CResult_PongDecodeErrorZ {
13892 fn drop(&mut self) {
13893 if self.result_ok {
13894 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13895 let _ = unsafe { Box::from_raw(self.contents.result) };
13898 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13899 let _ = unsafe { Box::from_raw(self.contents.err) };
13904 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13905 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13906 let contents = if o.result_ok {
13907 let result = unsafe { o.contents.result };
13908 unsafe { o.contents.result = core::ptr::null_mut() };
13909 CResult_PongDecodeErrorZPtr { result }
13911 let err = unsafe { o.contents.err };
13912 unsafe { o.contents.err = core::ptr::null_mut(); }
13913 CResult_PongDecodeErrorZPtr { err }
13917 result_ok: o.result_ok,
13921 impl Clone for CResult_PongDecodeErrorZ {
13922 fn clone(&self) -> Self {
13923 if self.result_ok {
13924 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13925 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13928 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13929 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13935 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13936 /// but with all dynamically-allocated buffers duplicated in new buffers.
13937 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13939 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13940 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13941 /// A pointer to the contents in the success state.
13942 /// Reading from this pointer when `result_ok` is not set is undefined.
13943 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13944 /// A pointer to the contents in the error state.
13945 /// Reading from this pointer when `result_ok` is set is undefined.
13946 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13949 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13950 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13952 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13953 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13954 /// `err` or `result` depending on the state of `result_ok`.
13955 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13956 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13957 pub result_ok: bool,
13960 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13961 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13962 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13963 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13964 result: Box::into_raw(Box::new(o)),
13970 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13971 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13972 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13973 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13974 err: Box::into_raw(Box::new(e)),
13979 /// Checks if the given object is currently in the success state
13981 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13985 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13986 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13987 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13988 fn drop(&mut self) {
13989 if self.result_ok {
13990 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13991 let _ = unsafe { Box::from_raw(self.contents.result) };
13994 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13995 let _ = unsafe { Box::from_raw(self.contents.err) };
14000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14001 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14002 let contents = if o.result_ok {
14003 let result = unsafe { o.contents.result };
14004 unsafe { o.contents.result = core::ptr::null_mut() };
14005 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
14007 let err = unsafe { o.contents.err };
14008 unsafe { o.contents.err = core::ptr::null_mut(); }
14009 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14013 result_ok: o.result_ok,
14017 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14018 fn clone(&self) -> Self {
14019 if self.result_ok {
14020 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14021 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14024 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14025 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14031 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14032 /// but with all dynamically-allocated buffers duplicated in new buffers.
14033 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14035 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14036 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14037 /// A pointer to the contents in the success state.
14038 /// Reading from this pointer when `result_ok` is not set is undefined.
14039 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14040 /// A pointer to the contents in the error state.
14041 /// Reading from this pointer when `result_ok` is set is undefined.
14042 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14045 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14046 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14047 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14048 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14049 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14050 /// `err` or `result` depending on the state of `result_ok`.
14051 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14052 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14053 pub result_ok: bool,
14056 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14057 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14058 CResult_ChannelAnnouncementDecodeErrorZ {
14059 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14060 result: Box::into_raw(Box::new(o)),
14066 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14067 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14068 CResult_ChannelAnnouncementDecodeErrorZ {
14069 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14070 err: Box::into_raw(Box::new(e)),
14075 /// Checks if the given object is currently in the success state
14077 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14081 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14082 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14083 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14084 fn drop(&mut self) {
14085 if self.result_ok {
14086 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14087 let _ = unsafe { Box::from_raw(self.contents.result) };
14090 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14091 let _ = unsafe { Box::from_raw(self.contents.err) };
14096 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14097 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14098 let contents = if o.result_ok {
14099 let result = unsafe { o.contents.result };
14100 unsafe { o.contents.result = core::ptr::null_mut() };
14101 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14103 let err = unsafe { o.contents.err };
14104 unsafe { o.contents.err = core::ptr::null_mut(); }
14105 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14109 result_ok: o.result_ok,
14113 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14114 fn clone(&self) -> Self {
14115 if self.result_ok {
14116 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14117 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14120 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14121 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14127 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14128 /// but with all dynamically-allocated buffers duplicated in new buffers.
14129 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14131 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14132 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14133 /// A pointer to the contents in the success state.
14134 /// Reading from this pointer when `result_ok` is not set is undefined.
14135 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14136 /// A pointer to the contents in the error state.
14137 /// Reading from this pointer when `result_ok` is set is undefined.
14138 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14141 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14142 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14144 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14145 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14146 /// `err` or `result` depending on the state of `result_ok`.
14147 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14148 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14149 pub result_ok: bool,
14152 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14153 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14154 CResult_UnsignedChannelUpdateDecodeErrorZ {
14155 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14156 result: Box::into_raw(Box::new(o)),
14162 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14163 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14164 CResult_UnsignedChannelUpdateDecodeErrorZ {
14165 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14166 err: Box::into_raw(Box::new(e)),
14171 /// Checks if the given object is currently in the success state
14173 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14177 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14178 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14179 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14180 fn drop(&mut self) {
14181 if self.result_ok {
14182 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14183 let _ = unsafe { Box::from_raw(self.contents.result) };
14186 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14187 let _ = unsafe { Box::from_raw(self.contents.err) };
14192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14193 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14194 let contents = if o.result_ok {
14195 let result = unsafe { o.contents.result };
14196 unsafe { o.contents.result = core::ptr::null_mut() };
14197 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14199 let err = unsafe { o.contents.err };
14200 unsafe { o.contents.err = core::ptr::null_mut(); }
14201 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14205 result_ok: o.result_ok,
14209 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14210 fn clone(&self) -> Self {
14211 if self.result_ok {
14212 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14213 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14216 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14217 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14223 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14224 /// but with all dynamically-allocated buffers duplicated in new buffers.
14225 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14227 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14228 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14229 /// A pointer to the contents in the success state.
14230 /// Reading from this pointer when `result_ok` is not set is undefined.
14231 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14232 /// A pointer to the contents in the error state.
14233 /// Reading from this pointer when `result_ok` is set is undefined.
14234 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14237 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14238 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14240 pub struct CResult_ChannelUpdateDecodeErrorZ {
14241 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14242 /// `err` or `result` depending on the state of `result_ok`.
14243 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14244 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14245 pub result_ok: bool,
14248 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14249 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14250 CResult_ChannelUpdateDecodeErrorZ {
14251 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14252 result: Box::into_raw(Box::new(o)),
14258 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14259 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14260 CResult_ChannelUpdateDecodeErrorZ {
14261 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14262 err: Box::into_raw(Box::new(e)),
14267 /// Checks if the given object is currently in the success state
14269 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14273 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14274 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14275 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14276 fn drop(&mut self) {
14277 if self.result_ok {
14278 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14279 let _ = unsafe { Box::from_raw(self.contents.result) };
14282 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14283 let _ = unsafe { Box::from_raw(self.contents.err) };
14288 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14289 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14290 let contents = if o.result_ok {
14291 let result = unsafe { o.contents.result };
14292 unsafe { o.contents.result = core::ptr::null_mut() };
14293 CResult_ChannelUpdateDecodeErrorZPtr { result }
14295 let err = unsafe { o.contents.err };
14296 unsafe { o.contents.err = core::ptr::null_mut(); }
14297 CResult_ChannelUpdateDecodeErrorZPtr { err }
14301 result_ok: o.result_ok,
14305 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14306 fn clone(&self) -> Self {
14307 if self.result_ok {
14308 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14309 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14312 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14313 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14319 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14320 /// but with all dynamically-allocated buffers duplicated in new buffers.
14321 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14323 /// The contents of CResult_ErrorMessageDecodeErrorZ
14324 pub union CResult_ErrorMessageDecodeErrorZPtr {
14325 /// A pointer to the contents in the success state.
14326 /// Reading from this pointer when `result_ok` is not set is undefined.
14327 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14328 /// A pointer to the contents in the error state.
14329 /// Reading from this pointer when `result_ok` is set is undefined.
14330 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14333 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14334 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14336 pub struct CResult_ErrorMessageDecodeErrorZ {
14337 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14338 /// `err` or `result` depending on the state of `result_ok`.
14339 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14340 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14341 pub result_ok: bool,
14344 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14345 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14346 CResult_ErrorMessageDecodeErrorZ {
14347 contents: CResult_ErrorMessageDecodeErrorZPtr {
14348 result: Box::into_raw(Box::new(o)),
14354 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14355 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14356 CResult_ErrorMessageDecodeErrorZ {
14357 contents: CResult_ErrorMessageDecodeErrorZPtr {
14358 err: Box::into_raw(Box::new(e)),
14363 /// Checks if the given object is currently in the success state
14365 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14369 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14370 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14371 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14372 fn drop(&mut self) {
14373 if self.result_ok {
14374 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14375 let _ = unsafe { Box::from_raw(self.contents.result) };
14378 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14379 let _ = unsafe { Box::from_raw(self.contents.err) };
14384 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14385 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14386 let contents = if o.result_ok {
14387 let result = unsafe { o.contents.result };
14388 unsafe { o.contents.result = core::ptr::null_mut() };
14389 CResult_ErrorMessageDecodeErrorZPtr { result }
14391 let err = unsafe { o.contents.err };
14392 unsafe { o.contents.err = core::ptr::null_mut(); }
14393 CResult_ErrorMessageDecodeErrorZPtr { err }
14397 result_ok: o.result_ok,
14401 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14402 fn clone(&self) -> Self {
14403 if self.result_ok {
14404 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14405 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14408 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14409 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14415 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14416 /// but with all dynamically-allocated buffers duplicated in new buffers.
14417 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14419 /// The contents of CResult_WarningMessageDecodeErrorZ
14420 pub union CResult_WarningMessageDecodeErrorZPtr {
14421 /// A pointer to the contents in the success state.
14422 /// Reading from this pointer when `result_ok` is not set is undefined.
14423 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14424 /// A pointer to the contents in the error state.
14425 /// Reading from this pointer when `result_ok` is set is undefined.
14426 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14429 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14430 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14432 pub struct CResult_WarningMessageDecodeErrorZ {
14433 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14434 /// `err` or `result` depending on the state of `result_ok`.
14435 pub contents: CResult_WarningMessageDecodeErrorZPtr,
14436 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14437 pub result_ok: bool,
14440 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14441 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14442 CResult_WarningMessageDecodeErrorZ {
14443 contents: CResult_WarningMessageDecodeErrorZPtr {
14444 result: Box::into_raw(Box::new(o)),
14450 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14451 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14452 CResult_WarningMessageDecodeErrorZ {
14453 contents: CResult_WarningMessageDecodeErrorZPtr {
14454 err: Box::into_raw(Box::new(e)),
14459 /// Checks if the given object is currently in the success state
14461 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14465 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14466 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14467 impl Drop for CResult_WarningMessageDecodeErrorZ {
14468 fn drop(&mut self) {
14469 if self.result_ok {
14470 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14471 let _ = unsafe { Box::from_raw(self.contents.result) };
14474 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14475 let _ = unsafe { Box::from_raw(self.contents.err) };
14480 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14481 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14482 let contents = if o.result_ok {
14483 let result = unsafe { o.contents.result };
14484 unsafe { o.contents.result = core::ptr::null_mut() };
14485 CResult_WarningMessageDecodeErrorZPtr { result }
14487 let err = unsafe { o.contents.err };
14488 unsafe { o.contents.err = core::ptr::null_mut(); }
14489 CResult_WarningMessageDecodeErrorZPtr { err }
14493 result_ok: o.result_ok,
14497 impl Clone for CResult_WarningMessageDecodeErrorZ {
14498 fn clone(&self) -> Self {
14499 if self.result_ok {
14500 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14501 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14504 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14505 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14511 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14512 /// but with all dynamically-allocated buffers duplicated in new buffers.
14513 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14515 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14516 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14517 /// A pointer to the contents in the success state.
14518 /// Reading from this pointer when `result_ok` is not set is undefined.
14519 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14520 /// A pointer to the contents in the error state.
14521 /// Reading from this pointer when `result_ok` is set is undefined.
14522 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14525 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14526 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14527 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14528 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14529 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14530 /// `err` or `result` depending on the state of `result_ok`.
14531 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14532 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14533 pub result_ok: bool,
14536 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14537 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14538 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14539 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14540 result: Box::into_raw(Box::new(o)),
14546 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14547 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14548 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14549 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14550 err: Box::into_raw(Box::new(e)),
14555 /// Checks if the given object is currently in the success state
14557 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14561 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14562 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14563 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14564 fn drop(&mut self) {
14565 if self.result_ok {
14566 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14567 let _ = unsafe { Box::from_raw(self.contents.result) };
14570 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14571 let _ = unsafe { Box::from_raw(self.contents.err) };
14576 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14577 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14578 let contents = if o.result_ok {
14579 let result = unsafe { o.contents.result };
14580 unsafe { o.contents.result = core::ptr::null_mut() };
14581 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14583 let err = unsafe { o.contents.err };
14584 unsafe { o.contents.err = core::ptr::null_mut(); }
14585 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14589 result_ok: o.result_ok,
14593 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14594 fn clone(&self) -> Self {
14595 if self.result_ok {
14596 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14597 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14600 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14601 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14607 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14608 /// but with all dynamically-allocated buffers duplicated in new buffers.
14609 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14611 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14612 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14613 /// A pointer to the contents in the success state.
14614 /// Reading from this pointer when `result_ok` is not set is undefined.
14615 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14616 /// A pointer to the contents in the error state.
14617 /// Reading from this pointer when `result_ok` is set is undefined.
14618 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14621 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14622 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14623 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14624 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14625 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14626 /// `err` or `result` depending on the state of `result_ok`.
14627 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14628 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14629 pub result_ok: bool,
14632 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14633 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14634 CResult_NodeAnnouncementDecodeErrorZ {
14635 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14636 result: Box::into_raw(Box::new(o)),
14642 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14643 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14644 CResult_NodeAnnouncementDecodeErrorZ {
14645 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14646 err: Box::into_raw(Box::new(e)),
14651 /// Checks if the given object is currently in the success state
14653 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14657 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14658 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14659 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14660 fn drop(&mut self) {
14661 if self.result_ok {
14662 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14663 let _ = unsafe { Box::from_raw(self.contents.result) };
14666 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14667 let _ = unsafe { Box::from_raw(self.contents.err) };
14672 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14673 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14674 let contents = if o.result_ok {
14675 let result = unsafe { o.contents.result };
14676 unsafe { o.contents.result = core::ptr::null_mut() };
14677 CResult_NodeAnnouncementDecodeErrorZPtr { result }
14679 let err = unsafe { o.contents.err };
14680 unsafe { o.contents.err = core::ptr::null_mut(); }
14681 CResult_NodeAnnouncementDecodeErrorZPtr { err }
14685 result_ok: o.result_ok,
14689 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14690 fn clone(&self) -> Self {
14691 if self.result_ok {
14692 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14693 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14696 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14697 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14703 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14704 /// but with all dynamically-allocated buffers duplicated in new buffers.
14705 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14707 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14708 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14709 /// A pointer to the contents in the success state.
14710 /// Reading from this pointer when `result_ok` is not set is undefined.
14711 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14712 /// A pointer to the contents in the error state.
14713 /// Reading from this pointer when `result_ok` is set is undefined.
14714 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14717 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14718 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14720 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14721 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14722 /// `err` or `result` depending on the state of `result_ok`.
14723 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14724 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14725 pub result_ok: bool,
14728 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14729 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14730 CResult_QueryShortChannelIdsDecodeErrorZ {
14731 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14732 result: Box::into_raw(Box::new(o)),
14738 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14739 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14740 CResult_QueryShortChannelIdsDecodeErrorZ {
14741 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14742 err: Box::into_raw(Box::new(e)),
14747 /// Checks if the given object is currently in the success state
14749 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14753 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14754 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14755 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14756 fn drop(&mut self) {
14757 if self.result_ok {
14758 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14759 let _ = unsafe { Box::from_raw(self.contents.result) };
14762 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14763 let _ = unsafe { Box::from_raw(self.contents.err) };
14768 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14769 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14770 let contents = if o.result_ok {
14771 let result = unsafe { o.contents.result };
14772 unsafe { o.contents.result = core::ptr::null_mut() };
14773 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14775 let err = unsafe { o.contents.err };
14776 unsafe { o.contents.err = core::ptr::null_mut(); }
14777 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14781 result_ok: o.result_ok,
14785 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14786 fn clone(&self) -> Self {
14787 if self.result_ok {
14788 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14789 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14792 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14793 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14799 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14800 /// but with all dynamically-allocated buffers duplicated in new buffers.
14801 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14803 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14804 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14805 /// A pointer to the contents in the success state.
14806 /// Reading from this pointer when `result_ok` is not set is undefined.
14807 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14808 /// A pointer to the contents in the error state.
14809 /// Reading from this pointer when `result_ok` is set is undefined.
14810 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14813 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14814 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14815 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14816 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14817 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14818 /// `err` or `result` depending on the state of `result_ok`.
14819 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14820 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14821 pub result_ok: bool,
14824 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14825 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14826 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14827 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14828 result: Box::into_raw(Box::new(o)),
14834 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14835 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14836 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14837 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14838 err: Box::into_raw(Box::new(e)),
14843 /// Checks if the given object is currently in the success state
14845 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14849 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14850 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14851 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14852 fn drop(&mut self) {
14853 if self.result_ok {
14854 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14855 let _ = unsafe { Box::from_raw(self.contents.result) };
14858 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14859 let _ = unsafe { Box::from_raw(self.contents.err) };
14864 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14865 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14866 let contents = if o.result_ok {
14867 let result = unsafe { o.contents.result };
14868 unsafe { o.contents.result = core::ptr::null_mut() };
14869 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14871 let err = unsafe { o.contents.err };
14872 unsafe { o.contents.err = core::ptr::null_mut(); }
14873 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14877 result_ok: o.result_ok,
14881 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14882 fn clone(&self) -> Self {
14883 if self.result_ok {
14884 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14885 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14888 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14889 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14895 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14896 /// but with all dynamically-allocated buffers duplicated in new buffers.
14897 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14899 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14900 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14901 /// A pointer to the contents in the success state.
14902 /// Reading from this pointer when `result_ok` is not set is undefined.
14903 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14904 /// A pointer to the contents in the error state.
14905 /// Reading from this pointer when `result_ok` is set is undefined.
14906 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14909 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14910 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14912 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14913 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14914 /// `err` or `result` depending on the state of `result_ok`.
14915 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14916 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14917 pub result_ok: bool,
14920 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14921 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14922 CResult_QueryChannelRangeDecodeErrorZ {
14923 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14924 result: Box::into_raw(Box::new(o)),
14930 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14931 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14932 CResult_QueryChannelRangeDecodeErrorZ {
14933 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14934 err: Box::into_raw(Box::new(e)),
14939 /// Checks if the given object is currently in the success state
14941 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14945 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14946 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14947 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14948 fn drop(&mut self) {
14949 if self.result_ok {
14950 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14951 let _ = unsafe { Box::from_raw(self.contents.result) };
14954 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14955 let _ = unsafe { Box::from_raw(self.contents.err) };
14960 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14961 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14962 let contents = if o.result_ok {
14963 let result = unsafe { o.contents.result };
14964 unsafe { o.contents.result = core::ptr::null_mut() };
14965 CResult_QueryChannelRangeDecodeErrorZPtr { result }
14967 let err = unsafe { o.contents.err };
14968 unsafe { o.contents.err = core::ptr::null_mut(); }
14969 CResult_QueryChannelRangeDecodeErrorZPtr { err }
14973 result_ok: o.result_ok,
14977 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14978 fn clone(&self) -> Self {
14979 if self.result_ok {
14980 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14981 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14984 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14985 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14991 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14992 /// but with all dynamically-allocated buffers duplicated in new buffers.
14993 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14995 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14996 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14997 /// A pointer to the contents in the success state.
14998 /// Reading from this pointer when `result_ok` is not set is undefined.
14999 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
15000 /// A pointer to the contents in the error state.
15001 /// Reading from this pointer when `result_ok` is set is undefined.
15002 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15005 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
15006 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15007 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15008 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
15009 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
15010 /// `err` or `result` depending on the state of `result_ok`.
15011 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15012 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15013 pub result_ok: bool,
15016 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15017 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15018 CResult_ReplyChannelRangeDecodeErrorZ {
15019 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15020 result: Box::into_raw(Box::new(o)),
15026 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15027 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15028 CResult_ReplyChannelRangeDecodeErrorZ {
15029 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15030 err: Box::into_raw(Box::new(e)),
15035 /// Checks if the given object is currently in the success state
15037 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15041 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15042 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15043 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15044 fn drop(&mut self) {
15045 if self.result_ok {
15046 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15047 let _ = unsafe { Box::from_raw(self.contents.result) };
15050 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15051 let _ = unsafe { Box::from_raw(self.contents.err) };
15056 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15057 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15058 let contents = if o.result_ok {
15059 let result = unsafe { o.contents.result };
15060 unsafe { o.contents.result = core::ptr::null_mut() };
15061 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15063 let err = unsafe { o.contents.err };
15064 unsafe { o.contents.err = core::ptr::null_mut(); }
15065 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15069 result_ok: o.result_ok,
15073 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15074 fn clone(&self) -> Self {
15075 if self.result_ok {
15076 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15077 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15080 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15081 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15087 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15088 /// but with all dynamically-allocated buffers duplicated in new buffers.
15089 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15091 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15092 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15093 /// A pointer to the contents in the success state.
15094 /// Reading from this pointer when `result_ok` is not set is undefined.
15095 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15096 /// A pointer to the contents in the error state.
15097 /// Reading from this pointer when `result_ok` is set is undefined.
15098 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15101 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15102 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15103 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15104 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15105 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15106 /// `err` or `result` depending on the state of `result_ok`.
15107 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15108 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15109 pub result_ok: bool,
15112 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15113 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15114 CResult_GossipTimestampFilterDecodeErrorZ {
15115 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15116 result: Box::into_raw(Box::new(o)),
15122 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15123 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15124 CResult_GossipTimestampFilterDecodeErrorZ {
15125 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15126 err: Box::into_raw(Box::new(e)),
15131 /// Checks if the given object is currently in the success state
15133 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15137 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15138 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15139 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15140 fn drop(&mut self) {
15141 if self.result_ok {
15142 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15143 let _ = unsafe { Box::from_raw(self.contents.result) };
15146 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15147 let _ = unsafe { Box::from_raw(self.contents.err) };
15152 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15153 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15154 let contents = if o.result_ok {
15155 let result = unsafe { o.contents.result };
15156 unsafe { o.contents.result = core::ptr::null_mut() };
15157 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15159 let err = unsafe { o.contents.err };
15160 unsafe { o.contents.err = core::ptr::null_mut(); }
15161 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15165 result_ok: o.result_ok,
15169 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15170 fn clone(&self) -> Self {
15171 if self.result_ok {
15172 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15173 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15176 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15177 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15183 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15184 /// but with all dynamically-allocated buffers duplicated in new buffers.
15185 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15187 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15188 /// This corresponds to std::vector in C++
15189 pub struct CVec_PhantomRouteHintsZ {
15190 /// The elements in the array.
15191 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15192 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15193 /// The number of elements pointed to by `data`.
15196 impl CVec_PhantomRouteHintsZ {
15197 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15198 if self.datalen == 0 { return Vec::new(); }
15199 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15200 self.data = core::ptr::null_mut();
15204 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15205 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15208 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15209 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15210 let datalen = v.len();
15211 let data = Box::into_raw(v.into_boxed_slice());
15212 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15216 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15217 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15218 impl Drop for CVec_PhantomRouteHintsZ {
15219 fn drop(&mut self) {
15220 if self.datalen == 0 { return; }
15221 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15225 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15226 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15227 /// A pointer to the contents in the success state.
15228 /// Reading from this pointer when `result_ok` is not set is undefined.
15229 pub result: *mut crate::lightning_invoice::Invoice,
15230 /// A pointer to the contents in the error state.
15231 /// Reading from this pointer when `result_ok` is set is undefined.
15232 pub err: *mut crate::lightning_invoice::SignOrCreationError,
15235 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15236 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15238 pub struct CResult_InvoiceSignOrCreationErrorZ {
15239 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15240 /// `err` or `result` depending on the state of `result_ok`.
15241 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15242 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15243 pub result_ok: bool,
15246 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15247 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15248 CResult_InvoiceSignOrCreationErrorZ {
15249 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15250 result: Box::into_raw(Box::new(o)),
15256 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15257 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15258 CResult_InvoiceSignOrCreationErrorZ {
15259 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15260 err: Box::into_raw(Box::new(e)),
15265 /// Checks if the given object is currently in the success state
15267 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15271 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15272 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15273 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15274 fn drop(&mut self) {
15275 if self.result_ok {
15276 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15277 let _ = unsafe { Box::from_raw(self.contents.result) };
15280 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15281 let _ = unsafe { Box::from_raw(self.contents.err) };
15286 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15287 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15288 let contents = if o.result_ok {
15289 let result = unsafe { o.contents.result };
15290 unsafe { o.contents.result = core::ptr::null_mut() };
15291 CResult_InvoiceSignOrCreationErrorZPtr { result }
15293 let err = unsafe { o.contents.err };
15294 unsafe { o.contents.err = core::ptr::null_mut(); }
15295 CResult_InvoiceSignOrCreationErrorZPtr { err }
15299 result_ok: o.result_ok,
15303 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15304 fn clone(&self) -> Self {
15305 if self.result_ok {
15306 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15307 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15310 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15311 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15317 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15318 /// but with all dynamically-allocated buffers duplicated in new buffers.
15319 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15321 /// An enum which can either contain a crate::lightning::chain::Filter or not
15322 pub enum COption_FilterZ {
15323 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15324 Some(crate::lightning::chain::Filter),
15325 /// When we're in this state, this COption_FilterZ contains nothing
15328 impl COption_FilterZ {
15329 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15330 if let Self::None = self { false } else { true }
15332 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15335 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15336 if let Self::Some(v) = self { v } else { unreachable!() }
15340 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15341 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15342 COption_FilterZ::Some(o)
15345 /// Constructs a new COption_FilterZ containing nothing
15346 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15347 COption_FilterZ::None
15350 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15351 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15353 /// The contents of CResult_LockedChannelMonitorNoneZ
15354 pub union CResult_LockedChannelMonitorNoneZPtr {
15355 /// A pointer to the contents in the success state.
15356 /// Reading from this pointer when `result_ok` is not set is undefined.
15357 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15358 /// Note that this value is always NULL, as there are no contents in the Err variant
15359 pub err: *mut core::ffi::c_void,
15362 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15363 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15365 pub struct CResult_LockedChannelMonitorNoneZ {
15366 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15367 /// `err` or `result` depending on the state of `result_ok`.
15368 pub contents: CResult_LockedChannelMonitorNoneZPtr,
15369 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15370 pub result_ok: bool,
15373 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15374 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15375 CResult_LockedChannelMonitorNoneZ {
15376 contents: CResult_LockedChannelMonitorNoneZPtr {
15377 result: Box::into_raw(Box::new(o)),
15383 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15384 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15385 CResult_LockedChannelMonitorNoneZ {
15386 contents: CResult_LockedChannelMonitorNoneZPtr {
15387 err: core::ptr::null_mut(),
15392 /// Checks if the given object is currently in the success state
15394 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15398 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15399 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15400 impl Drop for CResult_LockedChannelMonitorNoneZ {
15401 fn drop(&mut self) {
15402 if self.result_ok {
15403 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15404 let _ = unsafe { Box::from_raw(self.contents.result) };
15410 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15411 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15412 let contents = if o.result_ok {
15413 let result = unsafe { o.contents.result };
15414 unsafe { o.contents.result = core::ptr::null_mut() };
15415 CResult_LockedChannelMonitorNoneZPtr { result }
15417 let _ = unsafe { Box::from_raw(o.contents.err) };
15418 o.contents.err = core::ptr::null_mut();
15419 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15423 result_ok: o.result_ok,
15428 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15429 /// This corresponds to std::vector in C++
15430 pub struct CVec_OutPointZ {
15431 /// The elements in the array.
15432 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15433 pub data: *mut crate::lightning::chain::transaction::OutPoint,
15434 /// The number of elements pointed to by `data`.
15437 impl CVec_OutPointZ {
15438 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15439 if self.datalen == 0 { return Vec::new(); }
15440 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15441 self.data = core::ptr::null_mut();
15445 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15446 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15449 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15450 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15451 let datalen = v.len();
15452 let data = Box::into_raw(v.into_boxed_slice());
15453 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15457 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15458 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15459 impl Drop for CVec_OutPointZ {
15460 fn drop(&mut self) {
15461 if self.datalen == 0 { return; }
15462 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15465 impl Clone for CVec_OutPointZ {
15466 fn clone(&self) -> Self {
15467 let mut res = Vec::new();
15468 if self.datalen == 0 { return Self::from(res); }
15469 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });