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 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2829 /// This corresponds to std::vector in C++
2830 pub struct CVec_PublicKeyZ {
2831 /// The elements in the array.
2832 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2833 pub data: *mut crate::c_types::PublicKey,
2834 /// The number of elements pointed to by `data`.
2837 impl CVec_PublicKeyZ {
2838 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
2839 if self.datalen == 0 { return Vec::new(); }
2840 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2841 self.data = core::ptr::null_mut();
2845 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
2846 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2849 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
2850 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
2851 let datalen = v.len();
2852 let data = Box::into_raw(v.into_boxed_slice());
2853 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2857 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2858 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
2859 impl Drop for CVec_PublicKeyZ {
2860 fn drop(&mut self) {
2861 if self.datalen == 0 { return; }
2862 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2865 impl Clone for CVec_PublicKeyZ {
2866 fn clone(&self) -> Self {
2867 let mut res = Vec::new();
2868 if self.datalen == 0 { return Self::from(res); }
2869 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2874 /// The contents of CResult_PaymentPurposeDecodeErrorZ
2875 pub union CResult_PaymentPurposeDecodeErrorZPtr {
2876 /// A pointer to the contents in the success state.
2877 /// Reading from this pointer when `result_ok` is not set is undefined.
2878 pub result: *mut crate::lightning::util::events::PaymentPurpose,
2879 /// A pointer to the contents in the error state.
2880 /// Reading from this pointer when `result_ok` is set is undefined.
2881 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2884 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2885 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2887 pub struct CResult_PaymentPurposeDecodeErrorZ {
2888 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2889 /// `err` or `result` depending on the state of `result_ok`.
2890 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
2891 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2892 pub result_ok: bool,
2895 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
2896 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
2897 CResult_PaymentPurposeDecodeErrorZ {
2898 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2899 result: Box::into_raw(Box::new(o)),
2905 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
2906 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
2907 CResult_PaymentPurposeDecodeErrorZ {
2908 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2909 err: Box::into_raw(Box::new(e)),
2914 /// Checks if the given object is currently in the success state
2916 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
2920 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
2921 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
2922 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
2923 fn drop(&mut self) {
2925 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2926 let _ = unsafe { Box::from_raw(self.contents.result) };
2929 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2930 let _ = unsafe { Box::from_raw(self.contents.err) };
2935 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
2936 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
2937 let contents = if o.result_ok {
2938 let result = unsafe { o.contents.result };
2939 unsafe { o.contents.result = core::ptr::null_mut() };
2940 CResult_PaymentPurposeDecodeErrorZPtr { result }
2942 let err = unsafe { o.contents.err };
2943 unsafe { o.contents.err = core::ptr::null_mut(); }
2944 CResult_PaymentPurposeDecodeErrorZPtr { err }
2948 result_ok: o.result_ok,
2952 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
2953 fn clone(&self) -> Self {
2955 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2956 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
2959 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2960 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2966 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
2967 /// but with all dynamically-allocated buffers duplicated in new buffers.
2968 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
2971 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2972 pub enum COption_ClosureReasonZ {
2973 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2974 Some(crate::lightning::util::events::ClosureReason),
2975 /// When we're in this state, this COption_ClosureReasonZ contains nothing
2978 impl COption_ClosureReasonZ {
2979 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2980 if let Self::None = self { false } else { true }
2982 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2985 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
2986 if let Self::Some(v) = self { v } else { unreachable!() }
2990 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
2991 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
2992 COption_ClosureReasonZ::Some(o)
2995 /// Constructs a new COption_ClosureReasonZ containing nothing
2996 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
2997 COption_ClosureReasonZ::None
3000 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3001 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3003 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3004 /// but with all dynamically-allocated buffers duplicated in new buffers.
3005 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3007 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3008 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3009 /// A pointer to the contents in the success state.
3010 /// Reading from this pointer when `result_ok` is not set is undefined.
3011 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3012 /// A pointer to the contents in the error state.
3013 /// Reading from this pointer when `result_ok` is set is undefined.
3014 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3017 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3018 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3019 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3020 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3021 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3022 /// `err` or `result` depending on the state of `result_ok`.
3023 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3024 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3025 pub result_ok: bool,
3028 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3029 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3030 CResult_COption_ClosureReasonZDecodeErrorZ {
3031 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3032 result: Box::into_raw(Box::new(o)),
3038 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3039 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3040 CResult_COption_ClosureReasonZDecodeErrorZ {
3041 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3042 err: Box::into_raw(Box::new(e)),
3047 /// Checks if the given object is currently in the success state
3049 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3053 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3054 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3055 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3056 fn drop(&mut self) {
3058 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3059 let _ = unsafe { Box::from_raw(self.contents.result) };
3062 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3063 let _ = unsafe { Box::from_raw(self.contents.err) };
3068 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3069 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3070 let contents = if o.result_ok {
3071 let result = unsafe { o.contents.result };
3072 unsafe { o.contents.result = core::ptr::null_mut() };
3073 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3075 let err = unsafe { o.contents.err };
3076 unsafe { o.contents.err = core::ptr::null_mut(); }
3077 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3081 result_ok: o.result_ok,
3085 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3086 fn clone(&self) -> Self {
3088 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3089 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3092 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3093 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3099 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3100 /// but with all dynamically-allocated buffers duplicated in new buffers.
3101 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3104 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3105 pub enum COption_NetworkUpdateZ {
3106 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3107 Some(crate::lightning::routing::gossip::NetworkUpdate),
3108 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3111 impl COption_NetworkUpdateZ {
3112 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3113 if let Self::None = self { false } else { true }
3115 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3118 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3119 if let Self::Some(v) = self { v } else { unreachable!() }
3123 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3124 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3125 COption_NetworkUpdateZ::Some(o)
3128 /// Constructs a new COption_NetworkUpdateZ containing nothing
3129 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3130 COption_NetworkUpdateZ::None
3133 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3134 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3136 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3137 /// but with all dynamically-allocated buffers duplicated in new buffers.
3138 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3140 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3141 /// This corresponds to std::vector in C++
3142 pub struct CVec_SpendableOutputDescriptorZ {
3143 /// The elements in the array.
3144 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3145 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3146 /// The number of elements pointed to by `data`.
3149 impl CVec_SpendableOutputDescriptorZ {
3150 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3151 if self.datalen == 0 { return Vec::new(); }
3152 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3153 self.data = core::ptr::null_mut();
3157 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3158 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3161 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3162 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3163 let datalen = v.len();
3164 let data = Box::into_raw(v.into_boxed_slice());
3165 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3169 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3170 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3171 impl Drop for CVec_SpendableOutputDescriptorZ {
3172 fn drop(&mut self) {
3173 if self.datalen == 0 { return; }
3174 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3177 impl Clone for CVec_SpendableOutputDescriptorZ {
3178 fn clone(&self) -> Self {
3179 let mut res = Vec::new();
3180 if self.datalen == 0 { return Self::from(res); }
3181 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3187 /// An enum which can either contain a crate::lightning::util::events::Event or not
3188 pub enum COption_EventZ {
3189 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3190 Some(crate::lightning::util::events::Event),
3191 /// When we're in this state, this COption_EventZ contains nothing
3194 impl COption_EventZ {
3195 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3196 if let Self::None = self { false } else { true }
3198 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3201 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3202 if let Self::Some(v) = self { v } else { unreachable!() }
3206 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3207 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3208 COption_EventZ::Some(o)
3211 /// Constructs a new COption_EventZ containing nothing
3212 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3213 COption_EventZ::None
3216 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3217 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3219 /// Creates a new COption_EventZ which has the same data as `orig`
3220 /// but with all dynamically-allocated buffers duplicated in new buffers.
3221 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3223 /// The contents of CResult_COption_EventZDecodeErrorZ
3224 pub union CResult_COption_EventZDecodeErrorZPtr {
3225 /// A pointer to the contents in the success state.
3226 /// Reading from this pointer when `result_ok` is not set is undefined.
3227 pub result: *mut crate::c_types::derived::COption_EventZ,
3228 /// A pointer to the contents in the error state.
3229 /// Reading from this pointer when `result_ok` is set is undefined.
3230 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3233 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3234 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3236 pub struct CResult_COption_EventZDecodeErrorZ {
3237 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3238 /// `err` or `result` depending on the state of `result_ok`.
3239 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3240 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3241 pub result_ok: bool,
3244 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3245 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3246 CResult_COption_EventZDecodeErrorZ {
3247 contents: CResult_COption_EventZDecodeErrorZPtr {
3248 result: Box::into_raw(Box::new(o)),
3254 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3255 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3256 CResult_COption_EventZDecodeErrorZ {
3257 contents: CResult_COption_EventZDecodeErrorZPtr {
3258 err: Box::into_raw(Box::new(e)),
3263 /// Checks if the given object is currently in the success state
3265 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3269 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3270 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3271 impl Drop for CResult_COption_EventZDecodeErrorZ {
3272 fn drop(&mut self) {
3274 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3275 let _ = unsafe { Box::from_raw(self.contents.result) };
3278 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3279 let _ = unsafe { Box::from_raw(self.contents.err) };
3284 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3285 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3286 let contents = if o.result_ok {
3287 let result = unsafe { o.contents.result };
3288 unsafe { o.contents.result = core::ptr::null_mut() };
3289 CResult_COption_EventZDecodeErrorZPtr { result }
3291 let err = unsafe { o.contents.err };
3292 unsafe { o.contents.err = core::ptr::null_mut(); }
3293 CResult_COption_EventZDecodeErrorZPtr { err }
3297 result_ok: o.result_ok,
3301 impl Clone for CResult_COption_EventZDecodeErrorZ {
3302 fn clone(&self) -> Self {
3304 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3305 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3308 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3309 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3315 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3316 /// but with all dynamically-allocated buffers duplicated in new buffers.
3317 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3319 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3320 /// This corresponds to std::vector in C++
3321 pub struct CVec_MessageSendEventZ {
3322 /// The elements in the array.
3323 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3324 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3325 /// The number of elements pointed to by `data`.
3328 impl CVec_MessageSendEventZ {
3329 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3330 if self.datalen == 0 { return Vec::new(); }
3331 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3332 self.data = core::ptr::null_mut();
3336 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3337 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3340 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3341 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3342 let datalen = v.len();
3343 let data = Box::into_raw(v.into_boxed_slice());
3344 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3348 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3349 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3350 impl Drop for CVec_MessageSendEventZ {
3351 fn drop(&mut self) {
3352 if self.datalen == 0 { return; }
3353 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3356 impl Clone for CVec_MessageSendEventZ {
3357 fn clone(&self) -> Self {
3358 let mut res = Vec::new();
3359 if self.datalen == 0 { return Self::from(res); }
3360 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3365 /// The contents of CResult_TxOutAccessErrorZ
3366 pub union CResult_TxOutAccessErrorZPtr {
3367 /// A pointer to the contents in the success state.
3368 /// Reading from this pointer when `result_ok` is not set is undefined.
3369 pub result: *mut crate::c_types::TxOut,
3370 /// A pointer to the contents in the error state.
3371 /// Reading from this pointer when `result_ok` is set is undefined.
3372 pub err: *mut crate::lightning::chain::AccessError,
3375 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3376 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3378 pub struct CResult_TxOutAccessErrorZ {
3379 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3380 /// `err` or `result` depending on the state of `result_ok`.
3381 pub contents: CResult_TxOutAccessErrorZPtr,
3382 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3383 pub result_ok: bool,
3386 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3387 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3388 CResult_TxOutAccessErrorZ {
3389 contents: CResult_TxOutAccessErrorZPtr {
3390 result: Box::into_raw(Box::new(o)),
3396 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3397 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3398 CResult_TxOutAccessErrorZ {
3399 contents: CResult_TxOutAccessErrorZPtr {
3400 err: Box::into_raw(Box::new(e)),
3405 /// Checks if the given object is currently in the success state
3407 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3411 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3412 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3413 impl Drop for CResult_TxOutAccessErrorZ {
3414 fn drop(&mut self) {
3416 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3417 let _ = unsafe { Box::from_raw(self.contents.result) };
3420 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3421 let _ = unsafe { Box::from_raw(self.contents.err) };
3426 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3427 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3428 let contents = if o.result_ok {
3429 let result = unsafe { o.contents.result };
3430 unsafe { o.contents.result = core::ptr::null_mut() };
3431 CResult_TxOutAccessErrorZPtr { result }
3433 let err = unsafe { o.contents.err };
3434 unsafe { o.contents.err = core::ptr::null_mut(); }
3435 CResult_TxOutAccessErrorZPtr { err }
3439 result_ok: o.result_ok,
3443 impl Clone for CResult_TxOutAccessErrorZ {
3444 fn clone(&self) -> Self {
3446 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3447 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3450 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3451 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3457 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3458 /// but with all dynamically-allocated buffers duplicated in new buffers.
3459 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3461 /// A tuple of 2 elements. See the individual fields for the types contained.
3462 pub struct C2Tuple_usizeTransactionZ {
3463 /// The element at position 0
3465 /// The element at position 1
3466 pub b: crate::c_types::Transaction,
3468 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3469 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3476 impl C2Tuple_usizeTransactionZ {
3477 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3481 impl Clone for C2Tuple_usizeTransactionZ {
3482 fn clone(&self) -> Self {
3484 a: Clone::clone(&self.a),
3485 b: Clone::clone(&self.b),
3490 /// Creates a new tuple which has the same data as `orig`
3491 /// but with all dynamically-allocated buffers duplicated in new buffers.
3492 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3493 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3495 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3496 C2Tuple_usizeTransactionZ { a, b, }
3500 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3501 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3503 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3504 /// This corresponds to std::vector in C++
3505 pub struct CVec_C2Tuple_usizeTransactionZZ {
3506 /// The elements in the array.
3507 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3508 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3509 /// The number of elements pointed to by `data`.
3512 impl CVec_C2Tuple_usizeTransactionZZ {
3513 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3514 if self.datalen == 0 { return Vec::new(); }
3515 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3516 self.data = core::ptr::null_mut();
3520 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3521 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3524 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3525 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3526 let datalen = v.len();
3527 let data = Box::into_raw(v.into_boxed_slice());
3528 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3532 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3533 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3534 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3535 fn drop(&mut self) {
3536 if self.datalen == 0 { return; }
3537 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3540 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3541 fn clone(&self) -> Self {
3542 let mut res = Vec::new();
3543 if self.datalen == 0 { return Self::from(res); }
3544 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3549 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3550 /// This corresponds to std::vector in C++
3551 pub struct CVec_TxidZ {
3552 /// The elements in the array.
3553 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3554 pub data: *mut crate::c_types::ThirtyTwoBytes,
3555 /// The number of elements pointed to by `data`.
3559 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3560 if self.datalen == 0 { return Vec::new(); }
3561 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3562 self.data = core::ptr::null_mut();
3566 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3567 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3570 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3571 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3572 let datalen = v.len();
3573 let data = Box::into_raw(v.into_boxed_slice());
3574 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3578 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3579 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3580 impl Drop for CVec_TxidZ {
3581 fn drop(&mut self) {
3582 if self.datalen == 0 { return; }
3583 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3586 impl Clone for CVec_TxidZ {
3587 fn clone(&self) -> Self {
3588 let mut res = Vec::new();
3589 if self.datalen == 0 { return Self::from(res); }
3590 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3595 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3596 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3597 /// Note that this value is always NULL, as there are no contents in the OK variant
3598 pub result: *mut core::ffi::c_void,
3599 /// A pointer to the contents in the error state.
3600 /// Reading from this pointer when `result_ok` is set is undefined.
3601 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3604 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3605 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3607 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3608 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3609 /// `err` or `result` depending on the state of `result_ok`.
3610 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3611 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3612 pub result_ok: bool,
3615 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3616 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3617 CResult_NoneChannelMonitorUpdateErrZ {
3618 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3619 result: core::ptr::null_mut(),
3625 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3626 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3627 CResult_NoneChannelMonitorUpdateErrZ {
3628 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3629 err: Box::into_raw(Box::new(e)),
3634 /// Checks if the given object is currently in the success state
3636 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3640 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3641 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3642 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3643 fn drop(&mut self) {
3646 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3647 let _ = unsafe { Box::from_raw(self.contents.err) };
3652 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3653 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3654 let contents = if o.result_ok {
3655 let _ = unsafe { Box::from_raw(o.contents.result) };
3656 o.contents.result = core::ptr::null_mut();
3657 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3659 let err = unsafe { o.contents.err };
3660 unsafe { o.contents.err = core::ptr::null_mut(); }
3661 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3665 result_ok: o.result_ok,
3669 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3670 fn clone(&self) -> Self {
3672 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3673 result: core::ptr::null_mut()
3676 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3677 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3683 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3684 /// but with all dynamically-allocated buffers duplicated in new buffers.
3685 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3687 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3688 /// This corresponds to std::vector in C++
3689 pub struct CVec_MonitorEventZ {
3690 /// The elements in the array.
3691 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3692 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3693 /// The number of elements pointed to by `data`.
3696 impl CVec_MonitorEventZ {
3697 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3698 if self.datalen == 0 { return Vec::new(); }
3699 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3700 self.data = core::ptr::null_mut();
3704 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3705 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3708 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3709 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3710 let datalen = v.len();
3711 let data = Box::into_raw(v.into_boxed_slice());
3712 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3716 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3717 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3718 impl Drop for CVec_MonitorEventZ {
3719 fn drop(&mut self) {
3720 if self.datalen == 0 { return; }
3721 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3724 impl Clone for CVec_MonitorEventZ {
3725 fn clone(&self) -> Self {
3726 let mut res = Vec::new();
3727 if self.datalen == 0 { return Self::from(res); }
3728 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3733 /// A tuple of 2 elements. See the individual fields for the types contained.
3734 pub struct C2Tuple_OutPointCVec_MonitorEventZZ {
3735 /// The element at position 0
3736 pub a: crate::lightning::chain::transaction::OutPoint,
3737 /// The element at position 1
3738 pub b: crate::c_types::derived::CVec_MonitorEventZ,
3740 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)> for C2Tuple_OutPointCVec_MonitorEventZZ {
3741 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)) -> Self {
3748 impl C2Tuple_OutPointCVec_MonitorEventZZ {
3749 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ) {
3753 impl Clone for C2Tuple_OutPointCVec_MonitorEventZZ {
3754 fn clone(&self) -> Self {
3756 a: Clone::clone(&self.a),
3757 b: Clone::clone(&self.b),
3762 /// Creates a new tuple which has the same data as `orig`
3763 /// but with all dynamically-allocated buffers duplicated in new buffers.
3764 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorEventZZ) -> C2Tuple_OutPointCVec_MonitorEventZZ { Clone::clone(&orig) }
3765 /// Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
3767 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ) -> C2Tuple_OutPointCVec_MonitorEventZZ {
3768 C2Tuple_OutPointCVec_MonitorEventZZ { a, b, }
3772 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
3773 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_free(_res: C2Tuple_OutPointCVec_MonitorEventZZ) { }
3775 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
3776 /// This corresponds to std::vector in C++
3777 pub struct CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3778 /// The elements in the array.
3779 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3780 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ,
3781 /// The number of elements pointed to by `data`.
3784 impl CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3785 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ> {
3786 if self.datalen == 0 { return Vec::new(); }
3787 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3788 self.data = core::ptr::null_mut();
3792 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ] {
3793 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3796 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>> for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3797 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>) -> Self {
3798 let datalen = v.len();
3799 let data = Box::into_raw(v.into_boxed_slice());
3800 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3804 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3805 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorEventZZZ) { }
3806 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3807 fn drop(&mut self) {
3808 if self.datalen == 0 { return; }
3809 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3812 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3813 fn clone(&self) -> Self {
3814 let mut res = Vec::new();
3815 if self.datalen == 0 { return Self::from(res); }
3816 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3822 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3823 pub enum COption_C2Tuple_usizeTransactionZZ {
3824 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3825 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3826 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3829 impl COption_C2Tuple_usizeTransactionZZ {
3830 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3831 if let Self::None = self { false } else { true }
3833 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3836 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3837 if let Self::Some(v) = self { v } else { unreachable!() }
3841 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3842 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3843 COption_C2Tuple_usizeTransactionZZ::Some(o)
3846 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3847 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3848 COption_C2Tuple_usizeTransactionZZ::None
3851 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3852 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3854 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3855 /// but with all dynamically-allocated buffers duplicated in new buffers.
3856 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3858 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3859 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3860 /// A pointer to the contents in the success state.
3861 /// Reading from this pointer when `result_ok` is not set is undefined.
3862 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3863 /// A pointer to the contents in the error state.
3864 /// Reading from this pointer when `result_ok` is set is undefined.
3865 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3868 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3869 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3871 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3872 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3873 /// `err` or `result` depending on the state of `result_ok`.
3874 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3875 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3876 pub result_ok: bool,
3879 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3880 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3881 CResult_FixedPenaltyScorerDecodeErrorZ {
3882 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3883 result: Box::into_raw(Box::new(o)),
3889 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3890 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3891 CResult_FixedPenaltyScorerDecodeErrorZ {
3892 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3893 err: Box::into_raw(Box::new(e)),
3898 /// Checks if the given object is currently in the success state
3900 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3904 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3905 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3906 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3907 fn drop(&mut self) {
3909 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3910 let _ = unsafe { Box::from_raw(self.contents.result) };
3913 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3914 let _ = unsafe { Box::from_raw(self.contents.err) };
3919 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3920 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3921 let contents = if o.result_ok {
3922 let result = unsafe { o.contents.result };
3923 unsafe { o.contents.result = core::ptr::null_mut() };
3924 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3926 let err = unsafe { o.contents.err };
3927 unsafe { o.contents.err = core::ptr::null_mut(); }
3928 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3932 result_ok: o.result_ok,
3936 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3937 fn clone(&self) -> Self {
3939 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3940 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3943 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3944 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3950 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3951 /// but with all dynamically-allocated buffers duplicated in new buffers.
3952 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3954 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3955 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3956 /// A pointer to the contents in the success state.
3957 /// Reading from this pointer when `result_ok` is not set is undefined.
3958 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3959 /// A pointer to the contents in the error state.
3960 /// Reading from this pointer when `result_ok` is set is undefined.
3961 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3964 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3965 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3967 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
3968 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
3969 /// `err` or `result` depending on the state of `result_ok`.
3970 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
3971 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
3972 pub result_ok: bool,
3975 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
3976 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
3977 CResult_ProbabilisticScorerDecodeErrorZ {
3978 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3979 result: Box::into_raw(Box::new(o)),
3985 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
3986 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
3987 CResult_ProbabilisticScorerDecodeErrorZ {
3988 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3989 err: Box::into_raw(Box::new(e)),
3994 /// Checks if the given object is currently in the success state
3996 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4000 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4001 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4002 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4003 fn drop(&mut self) {
4005 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4006 let _ = unsafe { Box::from_raw(self.contents.result) };
4009 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4010 let _ = unsafe { Box::from_raw(self.contents.err) };
4015 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4016 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4017 let contents = if o.result_ok {
4018 let result = unsafe { o.contents.result };
4019 unsafe { o.contents.result = core::ptr::null_mut() };
4020 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4022 let err = unsafe { o.contents.err };
4023 unsafe { o.contents.err = core::ptr::null_mut(); }
4024 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4028 result_ok: o.result_ok,
4033 /// The contents of CResult_InitFeaturesDecodeErrorZ
4034 pub union CResult_InitFeaturesDecodeErrorZPtr {
4035 /// A pointer to the contents in the success state.
4036 /// Reading from this pointer when `result_ok` is not set is undefined.
4037 pub result: *mut crate::lightning::ln::features::InitFeatures,
4038 /// A pointer to the contents in the error state.
4039 /// Reading from this pointer when `result_ok` is set is undefined.
4040 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4043 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4044 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4045 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4046 pub struct CResult_InitFeaturesDecodeErrorZ {
4047 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4048 /// `err` or `result` depending on the state of `result_ok`.
4049 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4050 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4051 pub result_ok: bool,
4054 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4055 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4056 CResult_InitFeaturesDecodeErrorZ {
4057 contents: CResult_InitFeaturesDecodeErrorZPtr {
4058 result: Box::into_raw(Box::new(o)),
4064 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4065 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4066 CResult_InitFeaturesDecodeErrorZ {
4067 contents: CResult_InitFeaturesDecodeErrorZPtr {
4068 err: Box::into_raw(Box::new(e)),
4073 /// Checks if the given object is currently in the success state
4075 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4079 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4080 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4081 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4082 fn drop(&mut self) {
4084 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4085 let _ = unsafe { Box::from_raw(self.contents.result) };
4088 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4089 let _ = unsafe { Box::from_raw(self.contents.err) };
4094 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4095 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4096 let contents = if o.result_ok {
4097 let result = unsafe { o.contents.result };
4098 unsafe { o.contents.result = core::ptr::null_mut() };
4099 CResult_InitFeaturesDecodeErrorZPtr { result }
4101 let err = unsafe { o.contents.err };
4102 unsafe { o.contents.err = core::ptr::null_mut(); }
4103 CResult_InitFeaturesDecodeErrorZPtr { err }
4107 result_ok: o.result_ok,
4111 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4112 fn clone(&self) -> Self {
4114 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4115 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4118 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4119 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4125 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4126 /// but with all dynamically-allocated buffers duplicated in new buffers.
4127 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4129 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4130 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4131 /// A pointer to the contents in the success state.
4132 /// Reading from this pointer when `result_ok` is not set is undefined.
4133 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4134 /// A pointer to the contents in the error state.
4135 /// Reading from this pointer when `result_ok` is set is undefined.
4136 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4139 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4140 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4142 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4143 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4144 /// `err` or `result` depending on the state of `result_ok`.
4145 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4146 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4147 pub result_ok: bool,
4150 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4151 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4152 CResult_ChannelFeaturesDecodeErrorZ {
4153 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4154 result: Box::into_raw(Box::new(o)),
4160 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4161 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4162 CResult_ChannelFeaturesDecodeErrorZ {
4163 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4164 err: Box::into_raw(Box::new(e)),
4169 /// Checks if the given object is currently in the success state
4171 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4175 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4176 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4177 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4178 fn drop(&mut self) {
4180 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4181 let _ = unsafe { Box::from_raw(self.contents.result) };
4184 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4185 let _ = unsafe { Box::from_raw(self.contents.err) };
4190 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4191 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4192 let contents = if o.result_ok {
4193 let result = unsafe { o.contents.result };
4194 unsafe { o.contents.result = core::ptr::null_mut() };
4195 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4197 let err = unsafe { o.contents.err };
4198 unsafe { o.contents.err = core::ptr::null_mut(); }
4199 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4203 result_ok: o.result_ok,
4207 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4208 fn clone(&self) -> Self {
4210 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4211 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4214 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4215 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4221 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4222 /// but with all dynamically-allocated buffers duplicated in new buffers.
4223 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4225 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4226 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4227 /// A pointer to the contents in the success state.
4228 /// Reading from this pointer when `result_ok` is not set is undefined.
4229 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4230 /// A pointer to the contents in the error state.
4231 /// Reading from this pointer when `result_ok` is set is undefined.
4232 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4235 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4236 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4238 pub struct CResult_NodeFeaturesDecodeErrorZ {
4239 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4240 /// `err` or `result` depending on the state of `result_ok`.
4241 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4242 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4243 pub result_ok: bool,
4246 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4247 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4248 CResult_NodeFeaturesDecodeErrorZ {
4249 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4250 result: Box::into_raw(Box::new(o)),
4256 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4257 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4258 CResult_NodeFeaturesDecodeErrorZ {
4259 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4260 err: Box::into_raw(Box::new(e)),
4265 /// Checks if the given object is currently in the success state
4267 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4271 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4272 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4273 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4274 fn drop(&mut self) {
4276 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4277 let _ = unsafe { Box::from_raw(self.contents.result) };
4280 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4281 let _ = unsafe { Box::from_raw(self.contents.err) };
4286 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4287 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4288 let contents = if o.result_ok {
4289 let result = unsafe { o.contents.result };
4290 unsafe { o.contents.result = core::ptr::null_mut() };
4291 CResult_NodeFeaturesDecodeErrorZPtr { result }
4293 let err = unsafe { o.contents.err };
4294 unsafe { o.contents.err = core::ptr::null_mut(); }
4295 CResult_NodeFeaturesDecodeErrorZPtr { err }
4299 result_ok: o.result_ok,
4303 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4304 fn clone(&self) -> Self {
4306 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4307 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4310 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4311 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4317 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4318 /// but with all dynamically-allocated buffers duplicated in new buffers.
4319 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4321 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4322 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4323 /// A pointer to the contents in the success state.
4324 /// Reading from this pointer when `result_ok` is not set is undefined.
4325 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4326 /// A pointer to the contents in the error state.
4327 /// Reading from this pointer when `result_ok` is set is undefined.
4328 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4331 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4332 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4333 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4334 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4335 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4336 /// `err` or `result` depending on the state of `result_ok`.
4337 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4338 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4339 pub result_ok: bool,
4342 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4343 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4344 CResult_InvoiceFeaturesDecodeErrorZ {
4345 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4346 result: Box::into_raw(Box::new(o)),
4352 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4353 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4354 CResult_InvoiceFeaturesDecodeErrorZ {
4355 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4356 err: Box::into_raw(Box::new(e)),
4361 /// Checks if the given object is currently in the success state
4363 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4367 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4368 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4369 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4370 fn drop(&mut self) {
4372 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4373 let _ = unsafe { Box::from_raw(self.contents.result) };
4376 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4377 let _ = unsafe { Box::from_raw(self.contents.err) };
4382 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4383 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4384 let contents = if o.result_ok {
4385 let result = unsafe { o.contents.result };
4386 unsafe { o.contents.result = core::ptr::null_mut() };
4387 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4389 let err = unsafe { o.contents.err };
4390 unsafe { o.contents.err = core::ptr::null_mut(); }
4391 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4395 result_ok: o.result_ok,
4399 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4400 fn clone(&self) -> Self {
4402 Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4403 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4406 Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4407 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4413 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4414 /// but with all dynamically-allocated buffers duplicated in new buffers.
4415 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4417 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4418 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4419 /// A pointer to the contents in the success state.
4420 /// Reading from this pointer when `result_ok` is not set is undefined.
4421 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4422 /// A pointer to the contents in the error state.
4423 /// Reading from this pointer when `result_ok` is set is undefined.
4424 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4427 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4428 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4429 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4430 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4431 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4432 /// `err` or `result` depending on the state of `result_ok`.
4433 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4434 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4435 pub result_ok: bool,
4438 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4439 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4440 CResult_ChannelTypeFeaturesDecodeErrorZ {
4441 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4442 result: Box::into_raw(Box::new(o)),
4448 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4449 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4450 CResult_ChannelTypeFeaturesDecodeErrorZ {
4451 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4452 err: Box::into_raw(Box::new(e)),
4457 /// Checks if the given object is currently in the success state
4459 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4463 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4464 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4465 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4466 fn drop(&mut self) {
4468 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4469 let _ = unsafe { Box::from_raw(self.contents.result) };
4472 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4473 let _ = unsafe { Box::from_raw(self.contents.err) };
4478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4479 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4480 let contents = if o.result_ok {
4481 let result = unsafe { o.contents.result };
4482 unsafe { o.contents.result = core::ptr::null_mut() };
4483 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4485 let err = unsafe { o.contents.err };
4486 unsafe { o.contents.err = core::ptr::null_mut(); }
4487 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4491 result_ok: o.result_ok,
4495 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4496 fn clone(&self) -> Self {
4498 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4499 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4502 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4503 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4509 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4510 /// but with all dynamically-allocated buffers duplicated in new buffers.
4511 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4513 /// The contents of CResult_NodeIdDecodeErrorZ
4514 pub union CResult_NodeIdDecodeErrorZPtr {
4515 /// A pointer to the contents in the success state.
4516 /// Reading from this pointer when `result_ok` is not set is undefined.
4517 pub result: *mut crate::lightning::routing::gossip::NodeId,
4518 /// A pointer to the contents in the error state.
4519 /// Reading from this pointer when `result_ok` is set is undefined.
4520 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4523 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4524 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4526 pub struct CResult_NodeIdDecodeErrorZ {
4527 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4528 /// `err` or `result` depending on the state of `result_ok`.
4529 pub contents: CResult_NodeIdDecodeErrorZPtr,
4530 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4531 pub result_ok: bool,
4534 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
4535 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
4536 CResult_NodeIdDecodeErrorZ {
4537 contents: CResult_NodeIdDecodeErrorZPtr {
4538 result: Box::into_raw(Box::new(o)),
4544 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
4545 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
4546 CResult_NodeIdDecodeErrorZ {
4547 contents: CResult_NodeIdDecodeErrorZPtr {
4548 err: Box::into_raw(Box::new(e)),
4553 /// Checks if the given object is currently in the success state
4555 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
4559 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
4560 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
4561 impl Drop for CResult_NodeIdDecodeErrorZ {
4562 fn drop(&mut self) {
4564 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4565 let _ = unsafe { Box::from_raw(self.contents.result) };
4568 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4569 let _ = unsafe { Box::from_raw(self.contents.err) };
4574 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
4575 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
4576 let contents = if o.result_ok {
4577 let result = unsafe { o.contents.result };
4578 unsafe { o.contents.result = core::ptr::null_mut() };
4579 CResult_NodeIdDecodeErrorZPtr { result }
4581 let err = unsafe { o.contents.err };
4582 unsafe { o.contents.err = core::ptr::null_mut(); }
4583 CResult_NodeIdDecodeErrorZPtr { err }
4587 result_ok: o.result_ok,
4591 impl Clone for CResult_NodeIdDecodeErrorZ {
4592 fn clone(&self) -> Self {
4594 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
4595 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
4598 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
4599 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4605 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
4606 /// but with all dynamically-allocated buffers duplicated in new buffers.
4607 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
4609 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4610 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4611 /// A pointer to the contents in the success state.
4612 /// Reading from this pointer when `result_ok` is not set is undefined.
4613 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
4614 /// A pointer to the contents in the error state.
4615 /// Reading from this pointer when `result_ok` is set is undefined.
4616 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4619 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
4620 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4622 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
4623 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
4624 /// `err` or `result` depending on the state of `result_ok`.
4625 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
4626 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
4627 pub result_ok: bool,
4630 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
4631 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4632 CResult_COption_NetworkUpdateZDecodeErrorZ {
4633 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4634 result: Box::into_raw(Box::new(o)),
4640 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
4641 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4642 CResult_COption_NetworkUpdateZDecodeErrorZ {
4643 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4644 err: Box::into_raw(Box::new(e)),
4649 /// Checks if the given object is currently in the success state
4651 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
4655 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
4656 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
4657 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
4658 fn drop(&mut self) {
4660 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4661 let _ = unsafe { Box::from_raw(self.contents.result) };
4664 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4665 let _ = unsafe { Box::from_raw(self.contents.err) };
4670 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
4671 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4672 let contents = if o.result_ok {
4673 let result = unsafe { o.contents.result };
4674 unsafe { o.contents.result = core::ptr::null_mut() };
4675 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
4677 let err = unsafe { o.contents.err };
4678 unsafe { o.contents.err = core::ptr::null_mut(); }
4679 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
4683 result_ok: o.result_ok,
4687 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
4688 fn clone(&self) -> Self {
4690 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4691 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
4694 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4695 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4701 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
4702 /// but with all dynamically-allocated buffers duplicated in new buffers.
4703 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
4705 /// An enum which can either contain a crate::lightning::chain::Access or not
4706 pub enum COption_AccessZ {
4707 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
4708 Some(crate::lightning::chain::Access),
4709 /// When we're in this state, this COption_AccessZ contains nothing
4712 impl COption_AccessZ {
4713 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4714 if let Self::None = self { false } else { true }
4716 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4719 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
4720 if let Self::Some(v) = self { v } else { unreachable!() }
4724 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
4725 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
4726 COption_AccessZ::Some(o)
4729 /// Constructs a new COption_AccessZ containing nothing
4730 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
4731 COption_AccessZ::None
4734 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
4735 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
4737 /// The contents of CResult_boolLightningErrorZ
4738 pub union CResult_boolLightningErrorZPtr {
4739 /// A pointer to the contents in the success state.
4740 /// Reading from this pointer when `result_ok` is not set is undefined.
4741 pub result: *mut bool,
4742 /// A pointer to the contents in the error state.
4743 /// Reading from this pointer when `result_ok` is set is undefined.
4744 pub err: *mut crate::lightning::ln::msgs::LightningError,
4747 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
4748 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4749 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4750 pub struct CResult_boolLightningErrorZ {
4751 /// The contents of this CResult_boolLightningErrorZ, accessible via either
4752 /// `err` or `result` depending on the state of `result_ok`.
4753 pub contents: CResult_boolLightningErrorZPtr,
4754 /// Whether this CResult_boolLightningErrorZ represents a success state.
4755 pub result_ok: bool,
4758 /// Creates a new CResult_boolLightningErrorZ in the success state.
4759 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
4760 CResult_boolLightningErrorZ {
4761 contents: CResult_boolLightningErrorZPtr {
4762 result: Box::into_raw(Box::new(o)),
4768 /// Creates a new CResult_boolLightningErrorZ in the error state.
4769 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
4770 CResult_boolLightningErrorZ {
4771 contents: CResult_boolLightningErrorZPtr {
4772 err: Box::into_raw(Box::new(e)),
4777 /// Checks if the given object is currently in the success state
4779 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
4783 /// Frees any resources used by the CResult_boolLightningErrorZ.
4784 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
4785 impl Drop for CResult_boolLightningErrorZ {
4786 fn drop(&mut self) {
4788 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4789 let _ = unsafe { Box::from_raw(self.contents.result) };
4792 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4793 let _ = unsafe { Box::from_raw(self.contents.err) };
4798 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
4799 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
4800 let contents = if o.result_ok {
4801 let result = unsafe { o.contents.result };
4802 unsafe { o.contents.result = core::ptr::null_mut() };
4803 CResult_boolLightningErrorZPtr { result }
4805 let err = unsafe { o.contents.err };
4806 unsafe { o.contents.err = core::ptr::null_mut(); }
4807 CResult_boolLightningErrorZPtr { err }
4811 result_ok: o.result_ok,
4815 impl Clone for CResult_boolLightningErrorZ {
4816 fn clone(&self) -> Self {
4818 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
4819 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4822 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
4823 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4829 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
4830 /// but with all dynamically-allocated buffers duplicated in new buffers.
4831 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
4833 /// A tuple of 3 elements. See the individual fields for the types contained.
4834 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4835 /// The element at position 0
4836 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
4837 /// The element at position 1
4838 pub b: crate::lightning::ln::msgs::ChannelUpdate,
4839 /// The element at position 2
4840 pub c: crate::lightning::ln::msgs::ChannelUpdate,
4842 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4843 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
4851 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4852 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
4853 (self.a, self.b, self.c)
4856 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4857 fn clone(&self) -> Self {
4859 a: Clone::clone(&self.a),
4860 b: Clone::clone(&self.b),
4861 c: Clone::clone(&self.c),
4866 /// Creates a new tuple which has the same data as `orig`
4867 /// but with all dynamically-allocated buffers duplicated in new buffers.
4868 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
4869 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
4871 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 {
4872 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
4876 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
4877 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
4879 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4880 /// This corresponds to std::vector in C++
4881 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4882 /// The elements in the array.
4883 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4884 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
4885 /// The number of elements pointed to by `data`.
4888 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4889 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
4890 if self.datalen == 0 { return Vec::new(); }
4891 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4892 self.data = core::ptr::null_mut();
4896 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
4897 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4900 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4901 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
4902 let datalen = v.len();
4903 let data = Box::into_raw(v.into_boxed_slice());
4904 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4908 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4909 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
4910 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4911 fn drop(&mut self) {
4912 if self.datalen == 0 { return; }
4913 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4916 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4917 fn clone(&self) -> Self {
4918 let mut res = Vec::new();
4919 if self.datalen == 0 { return Self::from(res); }
4920 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4925 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4926 /// This corresponds to std::vector in C++
4927 pub struct CVec_NodeAnnouncementZ {
4928 /// The elements in the array.
4929 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4930 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
4931 /// The number of elements pointed to by `data`.
4934 impl CVec_NodeAnnouncementZ {
4935 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
4936 if self.datalen == 0 { return Vec::new(); }
4937 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4938 self.data = core::ptr::null_mut();
4942 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
4943 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4946 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
4947 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
4948 let datalen = v.len();
4949 let data = Box::into_raw(v.into_boxed_slice());
4950 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4954 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4955 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
4956 impl Drop for CVec_NodeAnnouncementZ {
4957 fn drop(&mut self) {
4958 if self.datalen == 0 { return; }
4959 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4962 impl Clone for CVec_NodeAnnouncementZ {
4963 fn clone(&self) -> Self {
4964 let mut res = Vec::new();
4965 if self.datalen == 0 { return Self::from(res); }
4966 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4971 /// The contents of CResult_NoneLightningErrorZ
4972 pub union CResult_NoneLightningErrorZPtr {
4973 /// Note that this value is always NULL, as there are no contents in the OK variant
4974 pub result: *mut core::ffi::c_void,
4975 /// A pointer to the contents in the error state.
4976 /// Reading from this pointer when `result_ok` is set is undefined.
4977 pub err: *mut crate::lightning::ln::msgs::LightningError,
4980 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4981 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4983 pub struct CResult_NoneLightningErrorZ {
4984 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
4985 /// `err` or `result` depending on the state of `result_ok`.
4986 pub contents: CResult_NoneLightningErrorZPtr,
4987 /// Whether this CResult_NoneLightningErrorZ represents a success state.
4988 pub result_ok: bool,
4991 /// Creates a new CResult_NoneLightningErrorZ in the success state.
4992 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
4993 CResult_NoneLightningErrorZ {
4994 contents: CResult_NoneLightningErrorZPtr {
4995 result: core::ptr::null_mut(),
5001 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5002 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5003 CResult_NoneLightningErrorZ {
5004 contents: CResult_NoneLightningErrorZPtr {
5005 err: Box::into_raw(Box::new(e)),
5010 /// Checks if the given object is currently in the success state
5012 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5016 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5017 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5018 impl Drop for CResult_NoneLightningErrorZ {
5019 fn drop(&mut self) {
5022 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5023 let _ = unsafe { Box::from_raw(self.contents.err) };
5028 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5029 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5030 let contents = if o.result_ok {
5031 let _ = unsafe { Box::from_raw(o.contents.result) };
5032 o.contents.result = core::ptr::null_mut();
5033 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5035 let err = unsafe { o.contents.err };
5036 unsafe { o.contents.err = core::ptr::null_mut(); }
5037 CResult_NoneLightningErrorZPtr { err }
5041 result_ok: o.result_ok,
5045 impl Clone for CResult_NoneLightningErrorZ {
5046 fn clone(&self) -> Self {
5048 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5049 result: core::ptr::null_mut()
5052 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5053 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5059 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5060 /// but with all dynamically-allocated buffers duplicated in new buffers.
5061 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5063 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5064 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5065 /// A pointer to the contents in the success state.
5066 /// Reading from this pointer when `result_ok` is not set is undefined.
5067 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5068 /// A pointer to the contents in the error state.
5069 /// Reading from this pointer when `result_ok` is set is undefined.
5070 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5073 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5074 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5076 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5077 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5078 /// `err` or `result` depending on the state of `result_ok`.
5079 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5080 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5081 pub result_ok: bool,
5084 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5085 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5086 CResult_ChannelUpdateInfoDecodeErrorZ {
5087 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5088 result: Box::into_raw(Box::new(o)),
5094 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5095 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5096 CResult_ChannelUpdateInfoDecodeErrorZ {
5097 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5098 err: Box::into_raw(Box::new(e)),
5103 /// Checks if the given object is currently in the success state
5105 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5109 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5110 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5111 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5112 fn drop(&mut self) {
5114 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5115 let _ = unsafe { Box::from_raw(self.contents.result) };
5118 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5119 let _ = unsafe { Box::from_raw(self.contents.err) };
5124 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5125 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5126 let contents = if o.result_ok {
5127 let result = unsafe { o.contents.result };
5128 unsafe { o.contents.result = core::ptr::null_mut() };
5129 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5131 let err = unsafe { o.contents.err };
5132 unsafe { o.contents.err = core::ptr::null_mut(); }
5133 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5137 result_ok: o.result_ok,
5141 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5142 fn clone(&self) -> Self {
5144 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5145 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5148 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5149 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5155 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5156 /// but with all dynamically-allocated buffers duplicated in new buffers.
5157 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5159 /// The contents of CResult_ChannelInfoDecodeErrorZ
5160 pub union CResult_ChannelInfoDecodeErrorZPtr {
5161 /// A pointer to the contents in the success state.
5162 /// Reading from this pointer when `result_ok` is not set is undefined.
5163 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5164 /// A pointer to the contents in the error state.
5165 /// Reading from this pointer when `result_ok` is set is undefined.
5166 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5169 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5170 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172 pub struct CResult_ChannelInfoDecodeErrorZ {
5173 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5174 /// `err` or `result` depending on the state of `result_ok`.
5175 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5176 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5177 pub result_ok: bool,
5180 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5181 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5182 CResult_ChannelInfoDecodeErrorZ {
5183 contents: CResult_ChannelInfoDecodeErrorZPtr {
5184 result: Box::into_raw(Box::new(o)),
5190 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5191 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5192 CResult_ChannelInfoDecodeErrorZ {
5193 contents: CResult_ChannelInfoDecodeErrorZPtr {
5194 err: Box::into_raw(Box::new(e)),
5199 /// Checks if the given object is currently in the success state
5201 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5205 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5206 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5207 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5208 fn drop(&mut self) {
5210 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5211 let _ = unsafe { Box::from_raw(self.contents.result) };
5214 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5215 let _ = unsafe { Box::from_raw(self.contents.err) };
5220 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5221 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5222 let contents = if o.result_ok {
5223 let result = unsafe { o.contents.result };
5224 unsafe { o.contents.result = core::ptr::null_mut() };
5225 CResult_ChannelInfoDecodeErrorZPtr { result }
5227 let err = unsafe { o.contents.err };
5228 unsafe { o.contents.err = core::ptr::null_mut(); }
5229 CResult_ChannelInfoDecodeErrorZPtr { err }
5233 result_ok: o.result_ok,
5237 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5238 fn clone(&self) -> Self {
5240 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5241 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5244 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5245 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5251 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5252 /// but with all dynamically-allocated buffers duplicated in new buffers.
5253 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5255 /// The contents of CResult_RoutingFeesDecodeErrorZ
5256 pub union CResult_RoutingFeesDecodeErrorZPtr {
5257 /// A pointer to the contents in the success state.
5258 /// Reading from this pointer when `result_ok` is not set is undefined.
5259 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5260 /// A pointer to the contents in the error state.
5261 /// Reading from this pointer when `result_ok` is set is undefined.
5262 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5265 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5266 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5268 pub struct CResult_RoutingFeesDecodeErrorZ {
5269 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5270 /// `err` or `result` depending on the state of `result_ok`.
5271 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5272 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5273 pub result_ok: bool,
5276 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5277 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5278 CResult_RoutingFeesDecodeErrorZ {
5279 contents: CResult_RoutingFeesDecodeErrorZPtr {
5280 result: Box::into_raw(Box::new(o)),
5286 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5287 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5288 CResult_RoutingFeesDecodeErrorZ {
5289 contents: CResult_RoutingFeesDecodeErrorZPtr {
5290 err: Box::into_raw(Box::new(e)),
5295 /// Checks if the given object is currently in the success state
5297 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5301 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5302 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5303 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5304 fn drop(&mut self) {
5306 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5307 let _ = unsafe { Box::from_raw(self.contents.result) };
5310 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5311 let _ = unsafe { Box::from_raw(self.contents.err) };
5316 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5317 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5318 let contents = if o.result_ok {
5319 let result = unsafe { o.contents.result };
5320 unsafe { o.contents.result = core::ptr::null_mut() };
5321 CResult_RoutingFeesDecodeErrorZPtr { result }
5323 let err = unsafe { o.contents.err };
5324 unsafe { o.contents.err = core::ptr::null_mut(); }
5325 CResult_RoutingFeesDecodeErrorZPtr { err }
5329 result_ok: o.result_ok,
5333 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5334 fn clone(&self) -> Self {
5336 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5337 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5340 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5341 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5347 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5348 /// but with all dynamically-allocated buffers duplicated in new buffers.
5349 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5351 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5352 /// This corresponds to std::vector in C++
5353 pub struct CVec_NetAddressZ {
5354 /// The elements in the array.
5355 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5356 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5357 /// The number of elements pointed to by `data`.
5360 impl CVec_NetAddressZ {
5361 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5362 if self.datalen == 0 { return Vec::new(); }
5363 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5364 self.data = core::ptr::null_mut();
5368 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5369 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5372 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5373 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5374 let datalen = v.len();
5375 let data = Box::into_raw(v.into_boxed_slice());
5376 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5380 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5381 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5382 impl Drop for CVec_NetAddressZ {
5383 fn drop(&mut self) {
5384 if self.datalen == 0 { return; }
5385 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5388 impl Clone for CVec_NetAddressZ {
5389 fn clone(&self) -> Self {
5390 let mut res = Vec::new();
5391 if self.datalen == 0 { return Self::from(res); }
5392 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5397 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5398 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5399 /// A pointer to the contents in the success state.
5400 /// Reading from this pointer when `result_ok` is not set is undefined.
5401 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5402 /// A pointer to the contents in the error state.
5403 /// Reading from this pointer when `result_ok` is set is undefined.
5404 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5407 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5408 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5410 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5411 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5412 /// `err` or `result` depending on the state of `result_ok`.
5413 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5414 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5415 pub result_ok: bool,
5418 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5419 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5420 CResult_NodeAnnouncementInfoDecodeErrorZ {
5421 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5422 result: Box::into_raw(Box::new(o)),
5428 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5429 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5430 CResult_NodeAnnouncementInfoDecodeErrorZ {
5431 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5432 err: Box::into_raw(Box::new(e)),
5437 /// Checks if the given object is currently in the success state
5439 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5443 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5444 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5445 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5446 fn drop(&mut self) {
5448 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5449 let _ = unsafe { Box::from_raw(self.contents.result) };
5452 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5453 let _ = unsafe { Box::from_raw(self.contents.err) };
5458 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5459 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5460 let contents = if o.result_ok {
5461 let result = unsafe { o.contents.result };
5462 unsafe { o.contents.result = core::ptr::null_mut() };
5463 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5465 let err = unsafe { o.contents.err };
5466 unsafe { o.contents.err = core::ptr::null_mut(); }
5467 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5471 result_ok: o.result_ok,
5475 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5476 fn clone(&self) -> Self {
5478 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5479 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5482 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5483 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5489 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5490 /// but with all dynamically-allocated buffers duplicated in new buffers.
5491 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5493 /// A dynamically-allocated array of u64s of arbitrary size.
5494 /// This corresponds to std::vector in C++
5495 pub struct CVec_u64Z {
5496 /// The elements in the array.
5497 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5499 /// The number of elements pointed to by `data`.
5503 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
5504 if self.datalen == 0 { return Vec::new(); }
5505 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5506 self.data = core::ptr::null_mut();
5510 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5511 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5514 impl From<Vec<u64>> for CVec_u64Z {
5515 fn from(v: Vec<u64>) -> Self {
5516 let datalen = v.len();
5517 let data = Box::into_raw(v.into_boxed_slice());
5518 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5522 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5523 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5524 impl Drop for CVec_u64Z {
5525 fn drop(&mut self) {
5526 if self.datalen == 0 { return; }
5527 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5530 impl Clone for CVec_u64Z {
5531 fn clone(&self) -> Self {
5532 let mut res = Vec::new();
5533 if self.datalen == 0 { return Self::from(res); }
5534 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5539 /// The contents of CResult_NodeInfoDecodeErrorZ
5540 pub union CResult_NodeInfoDecodeErrorZPtr {
5541 /// A pointer to the contents in the success state.
5542 /// Reading from this pointer when `result_ok` is not set is undefined.
5543 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
5544 /// A pointer to the contents in the error state.
5545 /// Reading from this pointer when `result_ok` is set is undefined.
5546 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5549 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5550 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5552 pub struct CResult_NodeInfoDecodeErrorZ {
5553 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5554 /// `err` or `result` depending on the state of `result_ok`.
5555 pub contents: CResult_NodeInfoDecodeErrorZPtr,
5556 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5557 pub result_ok: bool,
5560 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5561 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5562 CResult_NodeInfoDecodeErrorZ {
5563 contents: CResult_NodeInfoDecodeErrorZPtr {
5564 result: Box::into_raw(Box::new(o)),
5570 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5571 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5572 CResult_NodeInfoDecodeErrorZ {
5573 contents: CResult_NodeInfoDecodeErrorZPtr {
5574 err: Box::into_raw(Box::new(e)),
5579 /// Checks if the given object is currently in the success state
5581 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
5585 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5586 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5587 impl Drop for CResult_NodeInfoDecodeErrorZ {
5588 fn drop(&mut self) {
5590 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5591 let _ = unsafe { Box::from_raw(self.contents.result) };
5594 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5595 let _ = unsafe { Box::from_raw(self.contents.err) };
5600 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5601 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5602 let contents = if o.result_ok {
5603 let result = unsafe { o.contents.result };
5604 unsafe { o.contents.result = core::ptr::null_mut() };
5605 CResult_NodeInfoDecodeErrorZPtr { result }
5607 let err = unsafe { o.contents.err };
5608 unsafe { o.contents.err = core::ptr::null_mut(); }
5609 CResult_NodeInfoDecodeErrorZPtr { err }
5613 result_ok: o.result_ok,
5617 impl Clone for CResult_NodeInfoDecodeErrorZ {
5618 fn clone(&self) -> Self {
5620 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5621 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
5624 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5625 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5631 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5632 /// but with all dynamically-allocated buffers duplicated in new buffers.
5633 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
5635 /// The contents of CResult_NetworkGraphDecodeErrorZ
5636 pub union CResult_NetworkGraphDecodeErrorZPtr {
5637 /// A pointer to the contents in the success state.
5638 /// Reading from this pointer when `result_ok` is not set is undefined.
5639 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
5640 /// A pointer to the contents in the error state.
5641 /// Reading from this pointer when `result_ok` is set is undefined.
5642 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5645 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5646 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5648 pub struct CResult_NetworkGraphDecodeErrorZ {
5649 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5650 /// `err` or `result` depending on the state of `result_ok`.
5651 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5652 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5653 pub result_ok: bool,
5656 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5657 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5658 CResult_NetworkGraphDecodeErrorZ {
5659 contents: CResult_NetworkGraphDecodeErrorZPtr {
5660 result: Box::into_raw(Box::new(o)),
5666 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5667 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5668 CResult_NetworkGraphDecodeErrorZ {
5669 contents: CResult_NetworkGraphDecodeErrorZPtr {
5670 err: Box::into_raw(Box::new(e)),
5675 /// Checks if the given object is currently in the success state
5677 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
5681 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
5682 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5683 impl Drop for CResult_NetworkGraphDecodeErrorZ {
5684 fn drop(&mut self) {
5686 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5687 let _ = unsafe { Box::from_raw(self.contents.result) };
5690 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5691 let _ = unsafe { Box::from_raw(self.contents.err) };
5696 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5697 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
5698 let contents = if o.result_ok {
5699 let result = unsafe { o.contents.result };
5700 unsafe { o.contents.result = core::ptr::null_mut() };
5701 CResult_NetworkGraphDecodeErrorZPtr { result }
5703 let err = unsafe { o.contents.err };
5704 unsafe { o.contents.err = core::ptr::null_mut(); }
5705 CResult_NetworkGraphDecodeErrorZPtr { err }
5709 result_ok: o.result_ok,
5715 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
5716 pub enum COption_CVec_NetAddressZZ {
5717 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
5718 Some(crate::c_types::derived::CVec_NetAddressZ),
5719 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
5722 impl COption_CVec_NetAddressZZ {
5723 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5724 if let Self::None = self { false } else { true }
5726 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5729 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
5730 if let Self::Some(v) = self { v } else { unreachable!() }
5734 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
5735 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
5736 COption_CVec_NetAddressZZ::Some(o)
5739 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
5740 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
5741 COption_CVec_NetAddressZZ::None
5744 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
5745 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
5747 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
5748 /// but with all dynamically-allocated buffers duplicated in new buffers.
5749 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
5751 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
5752 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5753 /// A pointer to the contents in the success state.
5754 /// Reading from this pointer when `result_ok` is not set is undefined.
5755 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
5756 /// A pointer to the contents in the error state.
5757 /// Reading from this pointer when `result_ok` is set is undefined.
5758 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5761 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5762 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5764 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5765 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
5766 /// `err` or `result` depending on the state of `result_ok`.
5767 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
5768 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
5769 pub result_ok: bool,
5772 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
5773 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5774 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5775 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5776 result: Box::into_raw(Box::new(o)),
5782 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
5783 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5784 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5785 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5786 err: Box::into_raw(Box::new(e)),
5791 /// Checks if the given object is currently in the success state
5793 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
5797 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
5798 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
5799 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5800 fn drop(&mut self) {
5802 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5803 let _ = unsafe { Box::from_raw(self.contents.result) };
5806 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5807 let _ = unsafe { Box::from_raw(self.contents.err) };
5812 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5813 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
5814 let contents = if o.result_ok {
5815 let result = unsafe { o.contents.result };
5816 unsafe { o.contents.result = core::ptr::null_mut() };
5817 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
5819 let err = unsafe { o.contents.err };
5820 unsafe { o.contents.err = core::ptr::null_mut(); }
5821 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
5825 result_ok: o.result_ok,
5829 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5830 fn clone(&self) -> Self {
5832 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5833 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
5836 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5837 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5843 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
5844 /// but with all dynamically-allocated buffers duplicated in new buffers.
5845 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
5847 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
5848 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5849 /// A pointer to the contents in the success state.
5850 /// Reading from this pointer when `result_ok` is not set is undefined.
5851 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
5852 /// A pointer to the contents in the error state.
5853 /// Reading from this pointer when `result_ok` is set is undefined.
5854 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5857 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5858 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5860 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5861 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
5862 /// `err` or `result` depending on the state of `result_ok`.
5863 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
5864 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
5865 pub result_ok: bool,
5868 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
5869 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5870 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5871 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5872 result: Box::into_raw(Box::new(o)),
5878 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
5879 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5880 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5881 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5882 err: Box::into_raw(Box::new(e)),
5887 /// Checks if the given object is currently in the success state
5889 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
5893 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
5894 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
5895 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5896 fn drop(&mut self) {
5898 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5899 let _ = unsafe { Box::from_raw(self.contents.result) };
5902 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5903 let _ = unsafe { Box::from_raw(self.contents.err) };
5908 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5909 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
5910 let contents = if o.result_ok {
5911 let result = unsafe { o.contents.result };
5912 unsafe { o.contents.result = core::ptr::null_mut() };
5913 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
5915 let err = unsafe { o.contents.err };
5916 unsafe { o.contents.err = core::ptr::null_mut(); }
5917 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
5921 result_ok: o.result_ok,
5925 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5926 fn clone(&self) -> Self {
5928 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5929 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
5932 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5933 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5939 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
5940 /// but with all dynamically-allocated buffers duplicated in new buffers.
5941 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
5943 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5944 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
5945 /// A pointer to the contents in the success state.
5946 /// Reading from this pointer when `result_ok` is not set is undefined.
5947 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
5948 /// A pointer to the contents in the error state.
5949 /// Reading from this pointer when `result_ok` is set is undefined.
5950 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5953 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5954 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5956 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
5957 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5958 /// `err` or `result` depending on the state of `result_ok`.
5959 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
5960 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5961 pub result_ok: bool,
5964 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
5965 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
5966 CResult_SpendableOutputDescriptorDecodeErrorZ {
5967 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
5968 result: Box::into_raw(Box::new(o)),
5974 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
5975 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
5976 CResult_SpendableOutputDescriptorDecodeErrorZ {
5977 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
5978 err: Box::into_raw(Box::new(e)),
5983 /// Checks if the given object is currently in the success state
5985 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
5989 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
5990 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
5991 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
5992 fn drop(&mut self) {
5994 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5995 let _ = unsafe { Box::from_raw(self.contents.result) };
5998 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5999 let _ = unsafe { Box::from_raw(self.contents.err) };
6004 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6005 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6006 let contents = if o.result_ok {
6007 let result = unsafe { o.contents.result };
6008 unsafe { o.contents.result = core::ptr::null_mut() };
6009 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6011 let err = unsafe { o.contents.err };
6012 unsafe { o.contents.err = core::ptr::null_mut(); }
6013 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6017 result_ok: o.result_ok,
6021 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6022 fn clone(&self) -> Self {
6024 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6025 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6028 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6029 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6035 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6036 /// but with all dynamically-allocated buffers duplicated in new buffers.
6037 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6039 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6040 /// This corresponds to std::vector in C++
6041 pub struct CVec_PaymentPreimageZ {
6042 /// The elements in the array.
6043 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6044 pub data: *mut crate::c_types::ThirtyTwoBytes,
6045 /// The number of elements pointed to by `data`.
6048 impl CVec_PaymentPreimageZ {
6049 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6050 if self.datalen == 0 { return Vec::new(); }
6051 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6052 self.data = core::ptr::null_mut();
6056 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6057 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6060 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6061 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6062 let datalen = v.len();
6063 let data = Box::into_raw(v.into_boxed_slice());
6064 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6068 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6069 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6070 impl Drop for CVec_PaymentPreimageZ {
6071 fn drop(&mut self) {
6072 if self.datalen == 0 { return; }
6073 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6076 impl Clone for CVec_PaymentPreimageZ {
6077 fn clone(&self) -> Self {
6078 let mut res = Vec::new();
6079 if self.datalen == 0 { return Self::from(res); }
6080 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6085 /// A tuple of 2 elements. See the individual fields for the types contained.
6086 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6087 /// The element at position 0
6088 pub a: crate::c_types::Signature,
6089 /// The element at position 1
6090 pub b: crate::c_types::derived::CVec_SignatureZ,
6092 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6093 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6100 impl C2Tuple_SignatureCVec_SignatureZZ {
6101 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6105 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6106 fn clone(&self) -> Self {
6108 a: Clone::clone(&self.a),
6109 b: Clone::clone(&self.b),
6114 /// Creates a new tuple which has the same data as `orig`
6115 /// but with all dynamically-allocated buffers duplicated in new buffers.
6116 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6117 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6119 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6120 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6124 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6125 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6127 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6128 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6129 /// A pointer to the contents in the success state.
6130 /// Reading from this pointer when `result_ok` is not set is undefined.
6131 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6132 /// Note that this value is always NULL, as there are no contents in the Err variant
6133 pub err: *mut core::ffi::c_void,
6136 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6137 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6139 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6140 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6141 /// `err` or `result` depending on the state of `result_ok`.
6142 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6143 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6144 pub result_ok: bool,
6147 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6148 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6149 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6150 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6151 result: Box::into_raw(Box::new(o)),
6157 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6158 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6159 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6160 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6161 err: core::ptr::null_mut(),
6166 /// Checks if the given object is currently in the success state
6168 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6172 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6173 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6174 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6175 fn drop(&mut self) {
6177 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6178 let _ = unsafe { Box::from_raw(self.contents.result) };
6184 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6185 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6186 let contents = if o.result_ok {
6187 let result = unsafe { o.contents.result };
6188 unsafe { o.contents.result = core::ptr::null_mut() };
6189 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6191 let _ = unsafe { Box::from_raw(o.contents.err) };
6192 o.contents.err = core::ptr::null_mut();
6193 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6197 result_ok: o.result_ok,
6201 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6202 fn clone(&self) -> Self {
6204 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6205 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6208 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6209 err: core::ptr::null_mut()
6215 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6216 /// but with all dynamically-allocated buffers duplicated in new buffers.
6217 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6219 /// The contents of CResult_SignatureNoneZ
6220 pub union CResult_SignatureNoneZPtr {
6221 /// A pointer to the contents in the success state.
6222 /// Reading from this pointer when `result_ok` is not set is undefined.
6223 pub result: *mut crate::c_types::Signature,
6224 /// Note that this value is always NULL, as there are no contents in the Err variant
6225 pub err: *mut core::ffi::c_void,
6228 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6229 /// containing a crate::c_types::Signature on success and a () on failure.
6230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6231 pub struct CResult_SignatureNoneZ {
6232 /// The contents of this CResult_SignatureNoneZ, accessible via either
6233 /// `err` or `result` depending on the state of `result_ok`.
6234 pub contents: CResult_SignatureNoneZPtr,
6235 /// Whether this CResult_SignatureNoneZ represents a success state.
6236 pub result_ok: bool,
6239 /// Creates a new CResult_SignatureNoneZ in the success state.
6240 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6241 CResult_SignatureNoneZ {
6242 contents: CResult_SignatureNoneZPtr {
6243 result: Box::into_raw(Box::new(o)),
6249 /// Creates a new CResult_SignatureNoneZ in the error state.
6250 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6251 CResult_SignatureNoneZ {
6252 contents: CResult_SignatureNoneZPtr {
6253 err: core::ptr::null_mut(),
6258 /// Checks if the given object is currently in the success state
6260 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6264 /// Frees any resources used by the CResult_SignatureNoneZ.
6265 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6266 impl Drop for CResult_SignatureNoneZ {
6267 fn drop(&mut self) {
6269 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6270 let _ = unsafe { Box::from_raw(self.contents.result) };
6276 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6277 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6278 let contents = if o.result_ok {
6279 let result = unsafe { o.contents.result };
6280 unsafe { o.contents.result = core::ptr::null_mut() };
6281 CResult_SignatureNoneZPtr { result }
6283 let _ = unsafe { Box::from_raw(o.contents.err) };
6284 o.contents.err = core::ptr::null_mut();
6285 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6289 result_ok: o.result_ok,
6293 impl Clone for CResult_SignatureNoneZ {
6294 fn clone(&self) -> Self {
6296 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6297 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6300 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6301 err: core::ptr::null_mut()
6307 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6308 /// but with all dynamically-allocated buffers duplicated in new buffers.
6309 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6311 /// A tuple of 2 elements. See the individual fields for the types contained.
6312 pub struct C2Tuple_SignatureSignatureZ {
6313 /// The element at position 0
6314 pub a: crate::c_types::Signature,
6315 /// The element at position 1
6316 pub b: crate::c_types::Signature,
6318 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6319 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6326 impl C2Tuple_SignatureSignatureZ {
6327 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6331 impl Clone for C2Tuple_SignatureSignatureZ {
6332 fn clone(&self) -> Self {
6334 a: Clone::clone(&self.a),
6335 b: Clone::clone(&self.b),
6340 /// Creates a new tuple which has the same data as `orig`
6341 /// but with all dynamically-allocated buffers duplicated in new buffers.
6342 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6343 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6345 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6346 C2Tuple_SignatureSignatureZ { a, b, }
6350 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6351 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6353 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6354 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6355 /// A pointer to the contents in the success state.
6356 /// Reading from this pointer when `result_ok` is not set is undefined.
6357 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6358 /// Note that this value is always NULL, as there are no contents in the Err variant
6359 pub err: *mut core::ffi::c_void,
6362 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6363 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6365 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6366 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6367 /// `err` or `result` depending on the state of `result_ok`.
6368 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6369 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6370 pub result_ok: bool,
6373 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6374 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6375 CResult_C2Tuple_SignatureSignatureZNoneZ {
6376 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6377 result: Box::into_raw(Box::new(o)),
6383 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6384 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6385 CResult_C2Tuple_SignatureSignatureZNoneZ {
6386 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6387 err: core::ptr::null_mut(),
6392 /// Checks if the given object is currently in the success state
6394 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6398 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6399 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6400 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
6401 fn drop(&mut self) {
6403 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6404 let _ = unsafe { Box::from_raw(self.contents.result) };
6410 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6411 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
6412 let contents = if o.result_ok {
6413 let result = unsafe { o.contents.result };
6414 unsafe { o.contents.result = core::ptr::null_mut() };
6415 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
6417 let _ = unsafe { Box::from_raw(o.contents.err) };
6418 o.contents.err = core::ptr::null_mut();
6419 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6423 result_ok: o.result_ok,
6427 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6428 fn clone(&self) -> Self {
6430 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6431 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6434 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6435 err: core::ptr::null_mut()
6441 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6442 /// but with all dynamically-allocated buffers duplicated in new buffers.
6443 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6445 /// The contents of CResult_SecretKeyNoneZ
6446 pub union CResult_SecretKeyNoneZPtr {
6447 /// A pointer to the contents in the success state.
6448 /// Reading from this pointer when `result_ok` is not set is undefined.
6449 pub result: *mut crate::c_types::SecretKey,
6450 /// Note that this value is always NULL, as there are no contents in the Err variant
6451 pub err: *mut core::ffi::c_void,
6454 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6455 /// containing a crate::c_types::SecretKey on success and a () on failure.
6456 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6457 pub struct CResult_SecretKeyNoneZ {
6458 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6459 /// `err` or `result` depending on the state of `result_ok`.
6460 pub contents: CResult_SecretKeyNoneZPtr,
6461 /// Whether this CResult_SecretKeyNoneZ represents a success state.
6462 pub result_ok: bool,
6465 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6466 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6467 CResult_SecretKeyNoneZ {
6468 contents: CResult_SecretKeyNoneZPtr {
6469 result: Box::into_raw(Box::new(o)),
6475 /// Creates a new CResult_SecretKeyNoneZ in the error state.
6476 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
6477 CResult_SecretKeyNoneZ {
6478 contents: CResult_SecretKeyNoneZPtr {
6479 err: core::ptr::null_mut(),
6484 /// Checks if the given object is currently in the success state
6486 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
6490 /// Frees any resources used by the CResult_SecretKeyNoneZ.
6491 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
6492 impl Drop for CResult_SecretKeyNoneZ {
6493 fn drop(&mut self) {
6495 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6496 let _ = unsafe { Box::from_raw(self.contents.result) };
6502 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
6503 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
6504 let contents = if o.result_ok {
6505 let result = unsafe { o.contents.result };
6506 unsafe { o.contents.result = core::ptr::null_mut() };
6507 CResult_SecretKeyNoneZPtr { result }
6509 let _ = unsafe { Box::from_raw(o.contents.err) };
6510 o.contents.err = core::ptr::null_mut();
6511 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
6515 result_ok: o.result_ok,
6519 impl Clone for CResult_SecretKeyNoneZ {
6520 fn clone(&self) -> Self {
6522 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
6523 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
6526 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
6527 err: core::ptr::null_mut()
6533 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
6534 /// but with all dynamically-allocated buffers duplicated in new buffers.
6535 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
6537 /// The contents of CResult_SignDecodeErrorZ
6538 pub union CResult_SignDecodeErrorZPtr {
6539 /// A pointer to the contents in the success state.
6540 /// Reading from this pointer when `result_ok` is not set is undefined.
6541 pub result: *mut crate::lightning::chain::keysinterface::Sign,
6542 /// A pointer to the contents in the error state.
6543 /// Reading from this pointer when `result_ok` is set is undefined.
6544 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6547 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6548 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6549 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6550 pub struct CResult_SignDecodeErrorZ {
6551 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
6552 /// `err` or `result` depending on the state of `result_ok`.
6553 pub contents: CResult_SignDecodeErrorZPtr,
6554 /// Whether this CResult_SignDecodeErrorZ represents a success state.
6555 pub result_ok: bool,
6558 /// Creates a new CResult_SignDecodeErrorZ in the success state.
6559 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
6560 CResult_SignDecodeErrorZ {
6561 contents: CResult_SignDecodeErrorZPtr {
6562 result: Box::into_raw(Box::new(o)),
6568 /// Creates a new CResult_SignDecodeErrorZ in the error state.
6569 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
6570 CResult_SignDecodeErrorZ {
6571 contents: CResult_SignDecodeErrorZPtr {
6572 err: Box::into_raw(Box::new(e)),
6577 /// Checks if the given object is currently in the success state
6579 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
6583 /// Frees any resources used by the CResult_SignDecodeErrorZ.
6584 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
6585 impl Drop for CResult_SignDecodeErrorZ {
6586 fn drop(&mut self) {
6588 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6589 let _ = unsafe { Box::from_raw(self.contents.result) };
6592 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6593 let _ = unsafe { Box::from_raw(self.contents.err) };
6598 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
6599 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
6600 let contents = if o.result_ok {
6601 let result = unsafe { o.contents.result };
6602 unsafe { o.contents.result = core::ptr::null_mut() };
6603 CResult_SignDecodeErrorZPtr { result }
6605 let err = unsafe { o.contents.err };
6606 unsafe { o.contents.err = core::ptr::null_mut(); }
6607 CResult_SignDecodeErrorZPtr { err }
6611 result_ok: o.result_ok,
6615 impl Clone for CResult_SignDecodeErrorZ {
6616 fn clone(&self) -> Self {
6618 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
6619 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
6622 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
6623 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6629 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
6630 /// but with all dynamically-allocated buffers duplicated in new buffers.
6631 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
6633 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6634 /// This corresponds to std::vector in C++
6635 pub struct CVec_u5Z {
6636 /// The elements in the array.
6637 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6638 pub data: *mut crate::c_types::u5,
6639 /// The number of elements pointed to by `data`.
6643 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
6644 if self.datalen == 0 { return Vec::new(); }
6645 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6646 self.data = core::ptr::null_mut();
6650 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
6651 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6654 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
6655 fn from(v: Vec<crate::c_types::u5>) -> Self {
6656 let datalen = v.len();
6657 let data = Box::into_raw(v.into_boxed_slice());
6658 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6662 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6663 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
6664 impl Drop for CVec_u5Z {
6665 fn drop(&mut self) {
6666 if self.datalen == 0 { return; }
6667 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6670 impl Clone for CVec_u5Z {
6671 fn clone(&self) -> Self {
6672 let mut res = Vec::new();
6673 if self.datalen == 0 { return Self::from(res); }
6674 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6679 /// The contents of CResult_RecoverableSignatureNoneZ
6680 pub union CResult_RecoverableSignatureNoneZPtr {
6681 /// A pointer to the contents in the success state.
6682 /// Reading from this pointer when `result_ok` is not set is undefined.
6683 pub result: *mut crate::c_types::RecoverableSignature,
6684 /// Note that this value is always NULL, as there are no contents in the Err variant
6685 pub err: *mut core::ffi::c_void,
6688 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6689 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
6690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6691 pub struct CResult_RecoverableSignatureNoneZ {
6692 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6693 /// `err` or `result` depending on the state of `result_ok`.
6694 pub contents: CResult_RecoverableSignatureNoneZPtr,
6695 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6696 pub result_ok: bool,
6699 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
6700 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
6701 CResult_RecoverableSignatureNoneZ {
6702 contents: CResult_RecoverableSignatureNoneZPtr {
6703 result: Box::into_raw(Box::new(o)),
6709 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
6710 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
6711 CResult_RecoverableSignatureNoneZ {
6712 contents: CResult_RecoverableSignatureNoneZPtr {
6713 err: core::ptr::null_mut(),
6718 /// Checks if the given object is currently in the success state
6720 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
6724 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
6725 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
6726 impl Drop for CResult_RecoverableSignatureNoneZ {
6727 fn drop(&mut self) {
6729 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6730 let _ = unsafe { Box::from_raw(self.contents.result) };
6736 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
6737 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
6738 let contents = if o.result_ok {
6739 let result = unsafe { o.contents.result };
6740 unsafe { o.contents.result = core::ptr::null_mut() };
6741 CResult_RecoverableSignatureNoneZPtr { result }
6743 let _ = unsafe { Box::from_raw(o.contents.err) };
6744 o.contents.err = core::ptr::null_mut();
6745 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
6749 result_ok: o.result_ok,
6753 impl Clone for CResult_RecoverableSignatureNoneZ {
6754 fn clone(&self) -> Self {
6756 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
6757 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
6760 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
6761 err: core::ptr::null_mut()
6767 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
6768 /// but with all dynamically-allocated buffers duplicated in new buffers.
6769 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
6771 /// A dynamically-allocated array of u8s of arbitrary size.
6772 /// This corresponds to std::vector in C++
6773 pub struct CVec_u8Z {
6774 /// The elements in the array.
6775 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6777 /// The number of elements pointed to by `data`.
6781 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
6782 if self.datalen == 0 { return Vec::new(); }
6783 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6784 self.data = core::ptr::null_mut();
6788 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
6789 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6792 impl From<Vec<u8>> for CVec_u8Z {
6793 fn from(v: Vec<u8>) -> Self {
6794 let datalen = v.len();
6795 let data = Box::into_raw(v.into_boxed_slice());
6796 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6800 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6801 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
6802 impl Drop for CVec_u8Z {
6803 fn drop(&mut self) {
6804 if self.datalen == 0 { return; }
6805 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6808 impl Clone for CVec_u8Z {
6809 fn clone(&self) -> Self {
6810 let mut res = Vec::new();
6811 if self.datalen == 0 { return Self::from(res); }
6812 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6817 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6818 /// This corresponds to std::vector in C++
6819 pub struct CVec_CVec_u8ZZ {
6820 /// The elements in the array.
6821 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6822 pub data: *mut crate::c_types::derived::CVec_u8Z,
6823 /// The number of elements pointed to by `data`.
6826 impl CVec_CVec_u8ZZ {
6827 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
6828 if self.datalen == 0 { return Vec::new(); }
6829 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6830 self.data = core::ptr::null_mut();
6834 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
6835 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6838 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
6839 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
6840 let datalen = v.len();
6841 let data = Box::into_raw(v.into_boxed_slice());
6842 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6846 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6847 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
6848 impl Drop for CVec_CVec_u8ZZ {
6849 fn drop(&mut self) {
6850 if self.datalen == 0 { return; }
6851 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6854 impl Clone for CVec_CVec_u8ZZ {
6855 fn clone(&self) -> Self {
6856 let mut res = Vec::new();
6857 if self.datalen == 0 { return Self::from(res); }
6858 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6863 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
6864 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
6865 /// A pointer to the contents in the success state.
6866 /// Reading from this pointer when `result_ok` is not set is undefined.
6867 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
6868 /// Note that this value is always NULL, as there are no contents in the Err variant
6869 pub err: *mut core::ffi::c_void,
6872 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6873 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6875 pub struct CResult_CVec_CVec_u8ZZNoneZ {
6876 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6877 /// `err` or `result` depending on the state of `result_ok`.
6878 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
6879 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6880 pub result_ok: bool,
6883 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
6884 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
6885 CResult_CVec_CVec_u8ZZNoneZ {
6886 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6887 result: Box::into_raw(Box::new(o)),
6893 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
6894 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
6895 CResult_CVec_CVec_u8ZZNoneZ {
6896 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6897 err: core::ptr::null_mut(),
6902 /// Checks if the given object is currently in the success state
6904 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
6908 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
6909 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
6910 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
6911 fn drop(&mut self) {
6913 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6914 let _ = unsafe { Box::from_raw(self.contents.result) };
6920 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
6921 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
6922 let contents = if o.result_ok {
6923 let result = unsafe { o.contents.result };
6924 unsafe { o.contents.result = core::ptr::null_mut() };
6925 CResult_CVec_CVec_u8ZZNoneZPtr { result }
6927 let _ = unsafe { Box::from_raw(o.contents.err) };
6928 o.contents.err = core::ptr::null_mut();
6929 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
6933 result_ok: o.result_ok,
6937 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
6938 fn clone(&self) -> Self {
6940 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6941 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
6944 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6945 err: core::ptr::null_mut()
6951 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
6952 /// but with all dynamically-allocated buffers duplicated in new buffers.
6953 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
6955 /// The contents of CResult_InMemorySignerDecodeErrorZ
6956 pub union CResult_InMemorySignerDecodeErrorZPtr {
6957 /// A pointer to the contents in the success state.
6958 /// Reading from this pointer when `result_ok` is not set is undefined.
6959 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
6960 /// A pointer to the contents in the error state.
6961 /// Reading from this pointer when `result_ok` is set is undefined.
6962 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6965 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6966 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6968 pub struct CResult_InMemorySignerDecodeErrorZ {
6969 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6970 /// `err` or `result` depending on the state of `result_ok`.
6971 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
6972 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6973 pub result_ok: bool,
6976 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
6977 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
6978 CResult_InMemorySignerDecodeErrorZ {
6979 contents: CResult_InMemorySignerDecodeErrorZPtr {
6980 result: Box::into_raw(Box::new(o)),
6986 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
6987 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
6988 CResult_InMemorySignerDecodeErrorZ {
6989 contents: CResult_InMemorySignerDecodeErrorZPtr {
6990 err: Box::into_raw(Box::new(e)),
6995 /// Checks if the given object is currently in the success state
6997 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7001 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7002 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7003 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7004 fn drop(&mut self) {
7006 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7007 let _ = unsafe { Box::from_raw(self.contents.result) };
7010 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7011 let _ = unsafe { Box::from_raw(self.contents.err) };
7016 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7017 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7018 let contents = if o.result_ok {
7019 let result = unsafe { o.contents.result };
7020 unsafe { o.contents.result = core::ptr::null_mut() };
7021 CResult_InMemorySignerDecodeErrorZPtr { result }
7023 let err = unsafe { o.contents.err };
7024 unsafe { o.contents.err = core::ptr::null_mut(); }
7025 CResult_InMemorySignerDecodeErrorZPtr { err }
7029 result_ok: o.result_ok,
7033 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7034 fn clone(&self) -> Self {
7036 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7037 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7040 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7041 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7047 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7048 /// but with all dynamically-allocated buffers duplicated in new buffers.
7049 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7051 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7052 /// This corresponds to std::vector in C++
7053 pub struct CVec_TxOutZ {
7054 /// The elements in the array.
7055 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7056 pub data: *mut crate::c_types::TxOut,
7057 /// The number of elements pointed to by `data`.
7061 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7062 if self.datalen == 0 { return Vec::new(); }
7063 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7064 self.data = core::ptr::null_mut();
7068 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7069 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7072 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7073 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7074 let datalen = v.len();
7075 let data = Box::into_raw(v.into_boxed_slice());
7076 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7080 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7081 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7082 impl Drop for CVec_TxOutZ {
7083 fn drop(&mut self) {
7084 if self.datalen == 0 { return; }
7085 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7088 impl Clone for CVec_TxOutZ {
7089 fn clone(&self) -> Self {
7090 let mut res = Vec::new();
7091 if self.datalen == 0 { return Self::from(res); }
7092 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7097 /// The contents of CResult_TransactionNoneZ
7098 pub union CResult_TransactionNoneZPtr {
7099 /// A pointer to the contents in the success state.
7100 /// Reading from this pointer when `result_ok` is not set is undefined.
7101 pub result: *mut crate::c_types::Transaction,
7102 /// Note that this value is always NULL, as there are no contents in the Err variant
7103 pub err: *mut core::ffi::c_void,
7106 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7107 /// containing a crate::c_types::Transaction on success and a () on failure.
7108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7109 pub struct CResult_TransactionNoneZ {
7110 /// The contents of this CResult_TransactionNoneZ, accessible via either
7111 /// `err` or `result` depending on the state of `result_ok`.
7112 pub contents: CResult_TransactionNoneZPtr,
7113 /// Whether this CResult_TransactionNoneZ represents a success state.
7114 pub result_ok: bool,
7117 /// Creates a new CResult_TransactionNoneZ in the success state.
7118 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7119 CResult_TransactionNoneZ {
7120 contents: CResult_TransactionNoneZPtr {
7121 result: Box::into_raw(Box::new(o)),
7127 /// Creates a new CResult_TransactionNoneZ in the error state.
7128 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7129 CResult_TransactionNoneZ {
7130 contents: CResult_TransactionNoneZPtr {
7131 err: core::ptr::null_mut(),
7136 /// Checks if the given object is currently in the success state
7138 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7142 /// Frees any resources used by the CResult_TransactionNoneZ.
7143 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7144 impl Drop for CResult_TransactionNoneZ {
7145 fn drop(&mut self) {
7147 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7148 let _ = unsafe { Box::from_raw(self.contents.result) };
7154 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7155 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7156 let contents = if o.result_ok {
7157 let result = unsafe { o.contents.result };
7158 unsafe { o.contents.result = core::ptr::null_mut() };
7159 CResult_TransactionNoneZPtr { result }
7161 let _ = unsafe { Box::from_raw(o.contents.err) };
7162 o.contents.err = core::ptr::null_mut();
7163 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7167 result_ok: o.result_ok,
7171 impl Clone for CResult_TransactionNoneZ {
7172 fn clone(&self) -> Self {
7174 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7175 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7178 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7179 err: core::ptr::null_mut()
7185 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7186 /// but with all dynamically-allocated buffers duplicated in new buffers.
7187 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7189 /// A tuple of 2 elements. See the individual fields for the types contained.
7190 pub struct C2Tuple_BlockHashChannelMonitorZ {
7191 /// The element at position 0
7192 pub a: crate::c_types::ThirtyTwoBytes,
7193 /// The element at position 1
7194 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7196 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7197 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7204 impl C2Tuple_BlockHashChannelMonitorZ {
7205 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
7209 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
7211 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
7212 C2Tuple_BlockHashChannelMonitorZ { a, b, }
7216 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
7217 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
7219 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7220 /// This corresponds to std::vector in C++
7221 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
7222 /// The elements in the array.
7223 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7224 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7225 /// The number of elements pointed to by `data`.
7228 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
7229 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
7230 if self.datalen == 0 { return Vec::new(); }
7231 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7232 self.data = core::ptr::null_mut();
7236 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
7237 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7240 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7241 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
7242 let datalen = v.len();
7243 let data = Box::into_raw(v.into_boxed_slice());
7244 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7248 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7249 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
7250 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7251 fn drop(&mut self) {
7252 if self.datalen == 0 { return; }
7253 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7257 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7258 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7259 /// A pointer to the contents in the success state.
7260 /// Reading from this pointer when `result_ok` is not set is undefined.
7261 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
7262 /// A pointer to the contents in the error state.
7263 /// Reading from this pointer when `result_ok` is set is undefined.
7264 pub err: *mut crate::c_types::IOError,
7267 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7268 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7270 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7271 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7272 /// `err` or `result` depending on the state of `result_ok`.
7273 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
7274 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7275 pub result_ok: bool,
7278 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
7279 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7280 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7281 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7282 result: Box::into_raw(Box::new(o)),
7288 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
7289 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7290 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7291 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7292 err: Box::into_raw(Box::new(e)),
7297 /// Checks if the given object is currently in the success state
7299 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
7303 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
7304 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
7305 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7306 fn drop(&mut self) {
7308 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7309 let _ = unsafe { Box::from_raw(self.contents.result) };
7312 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7313 let _ = unsafe { Box::from_raw(self.contents.err) };
7318 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7319 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
7320 let contents = if o.result_ok {
7321 let result = unsafe { o.contents.result };
7322 unsafe { o.contents.result = core::ptr::null_mut() };
7323 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
7325 let err = unsafe { o.contents.err };
7326 unsafe { o.contents.err = core::ptr::null_mut(); }
7327 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
7331 result_ok: o.result_ok,
7337 /// An enum which can either contain a u16 or not
7338 pub enum COption_u16Z {
7339 /// When we're in this state, this COption_u16Z contains a u16
7341 /// When we're in this state, this COption_u16Z contains nothing
7345 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7346 if let Self::None = self { false } else { true }
7348 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7351 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
7352 if let Self::Some(v) = self { v } else { unreachable!() }
7356 /// Constructs a new COption_u16Z containing a u16
7357 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
7358 COption_u16Z::Some(o)
7361 /// Constructs a new COption_u16Z containing nothing
7362 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
7366 /// Frees any resources associated with the u16, if we are in the Some state
7367 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
7369 /// Creates a new COption_u16Z which has the same data as `orig`
7370 /// but with all dynamically-allocated buffers duplicated in new buffers.
7371 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
7373 /// The contents of CResult_NoneAPIErrorZ
7374 pub union CResult_NoneAPIErrorZPtr {
7375 /// Note that this value is always NULL, as there are no contents in the OK variant
7376 pub result: *mut core::ffi::c_void,
7377 /// A pointer to the contents in the error state.
7378 /// Reading from this pointer when `result_ok` is set is undefined.
7379 pub err: *mut crate::lightning::util::errors::APIError,
7382 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7383 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
7384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7385 pub struct CResult_NoneAPIErrorZ {
7386 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
7387 /// `err` or `result` depending on the state of `result_ok`.
7388 pub contents: CResult_NoneAPIErrorZPtr,
7389 /// Whether this CResult_NoneAPIErrorZ represents a success state.
7390 pub result_ok: bool,
7393 /// Creates a new CResult_NoneAPIErrorZ in the success state.
7394 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
7395 CResult_NoneAPIErrorZ {
7396 contents: CResult_NoneAPIErrorZPtr {
7397 result: core::ptr::null_mut(),
7403 /// Creates a new CResult_NoneAPIErrorZ in the error state.
7404 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
7405 CResult_NoneAPIErrorZ {
7406 contents: CResult_NoneAPIErrorZPtr {
7407 err: Box::into_raw(Box::new(e)),
7412 /// Checks if the given object is currently in the success state
7414 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
7418 /// Frees any resources used by the CResult_NoneAPIErrorZ.
7419 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
7420 impl Drop for CResult_NoneAPIErrorZ {
7421 fn drop(&mut self) {
7424 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7425 let _ = unsafe { Box::from_raw(self.contents.err) };
7430 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
7431 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
7432 let contents = if o.result_ok {
7433 let _ = unsafe { Box::from_raw(o.contents.result) };
7434 o.contents.result = core::ptr::null_mut();
7435 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
7437 let err = unsafe { o.contents.err };
7438 unsafe { o.contents.err = core::ptr::null_mut(); }
7439 CResult_NoneAPIErrorZPtr { err }
7443 result_ok: o.result_ok,
7447 impl Clone for CResult_NoneAPIErrorZ {
7448 fn clone(&self) -> Self {
7450 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
7451 result: core::ptr::null_mut()
7454 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
7455 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7461 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
7462 /// but with all dynamically-allocated buffers duplicated in new buffers.
7463 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
7465 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7466 /// This corresponds to std::vector in C++
7467 pub struct CVec_CResult_NoneAPIErrorZZ {
7468 /// The elements in the array.
7469 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7470 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
7471 /// The number of elements pointed to by `data`.
7474 impl CVec_CResult_NoneAPIErrorZZ {
7475 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
7476 if self.datalen == 0 { return Vec::new(); }
7477 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7478 self.data = core::ptr::null_mut();
7482 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
7483 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7486 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
7487 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
7488 let datalen = v.len();
7489 let data = Box::into_raw(v.into_boxed_slice());
7490 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7494 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7495 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
7496 impl Drop for CVec_CResult_NoneAPIErrorZZ {
7497 fn drop(&mut self) {
7498 if self.datalen == 0 { return; }
7499 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7502 impl Clone for CVec_CResult_NoneAPIErrorZZ {
7503 fn clone(&self) -> Self {
7504 let mut res = Vec::new();
7505 if self.datalen == 0 { return Self::from(res); }
7506 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7511 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7512 /// This corresponds to std::vector in C++
7513 pub struct CVec_APIErrorZ {
7514 /// The elements in the array.
7515 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7516 pub data: *mut crate::lightning::util::errors::APIError,
7517 /// The number of elements pointed to by `data`.
7520 impl CVec_APIErrorZ {
7521 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
7522 if self.datalen == 0 { return Vec::new(); }
7523 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7524 self.data = core::ptr::null_mut();
7528 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
7529 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7532 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
7533 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
7534 let datalen = v.len();
7535 let data = Box::into_raw(v.into_boxed_slice());
7536 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7540 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7541 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
7542 impl Drop for CVec_APIErrorZ {
7543 fn drop(&mut self) {
7544 if self.datalen == 0 { return; }
7545 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7548 impl Clone for CVec_APIErrorZ {
7549 fn clone(&self) -> Self {
7550 let mut res = Vec::new();
7551 if self.datalen == 0 { return Self::from(res); }
7552 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7557 /// The contents of CResult__u832APIErrorZ
7558 pub union CResult__u832APIErrorZPtr {
7559 /// A pointer to the contents in the success state.
7560 /// Reading from this pointer when `result_ok` is not set is undefined.
7561 pub result: *mut crate::c_types::ThirtyTwoBytes,
7562 /// A pointer to the contents in the error state.
7563 /// Reading from this pointer when `result_ok` is set is undefined.
7564 pub err: *mut crate::lightning::util::errors::APIError,
7567 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
7568 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7569 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7570 pub struct CResult__u832APIErrorZ {
7571 /// The contents of this CResult__u832APIErrorZ, accessible via either
7572 /// `err` or `result` depending on the state of `result_ok`.
7573 pub contents: CResult__u832APIErrorZPtr,
7574 /// Whether this CResult__u832APIErrorZ represents a success state.
7575 pub result_ok: bool,
7578 /// Creates a new CResult__u832APIErrorZ in the success state.
7579 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
7580 CResult__u832APIErrorZ {
7581 contents: CResult__u832APIErrorZPtr {
7582 result: Box::into_raw(Box::new(o)),
7588 /// Creates a new CResult__u832APIErrorZ in the error state.
7589 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
7590 CResult__u832APIErrorZ {
7591 contents: CResult__u832APIErrorZPtr {
7592 err: Box::into_raw(Box::new(e)),
7597 /// Checks if the given object is currently in the success state
7599 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
7603 /// Frees any resources used by the CResult__u832APIErrorZ.
7604 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
7605 impl Drop for CResult__u832APIErrorZ {
7606 fn drop(&mut self) {
7608 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7609 let _ = unsafe { Box::from_raw(self.contents.result) };
7612 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7613 let _ = unsafe { Box::from_raw(self.contents.err) };
7618 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
7619 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7620 let contents = if o.result_ok {
7621 let result = unsafe { o.contents.result };
7622 unsafe { o.contents.result = core::ptr::null_mut() };
7623 CResult__u832APIErrorZPtr { result }
7625 let err = unsafe { o.contents.err };
7626 unsafe { o.contents.err = core::ptr::null_mut(); }
7627 CResult__u832APIErrorZPtr { err }
7631 result_ok: o.result_ok,
7635 impl Clone for CResult__u832APIErrorZ {
7636 fn clone(&self) -> Self {
7638 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
7639 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7642 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
7643 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7649 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
7650 /// but with all dynamically-allocated buffers duplicated in new buffers.
7651 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
7653 /// The contents of CResult_PaymentIdPaymentSendFailureZ
7654 pub union CResult_PaymentIdPaymentSendFailureZPtr {
7655 /// A pointer to the contents in the success state.
7656 /// Reading from this pointer when `result_ok` is not set is undefined.
7657 pub result: *mut crate::c_types::ThirtyTwoBytes,
7658 /// A pointer to the contents in the error state.
7659 /// Reading from this pointer when `result_ok` is set is undefined.
7660 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7663 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
7664 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7665 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7666 pub struct CResult_PaymentIdPaymentSendFailureZ {
7667 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
7668 /// `err` or `result` depending on the state of `result_ok`.
7669 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
7670 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
7671 pub result_ok: bool,
7674 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
7675 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
7676 CResult_PaymentIdPaymentSendFailureZ {
7677 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7678 result: Box::into_raw(Box::new(o)),
7684 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
7685 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
7686 CResult_PaymentIdPaymentSendFailureZ {
7687 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7688 err: Box::into_raw(Box::new(e)),
7693 /// Checks if the given object is currently in the success state
7695 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
7699 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
7700 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
7701 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
7702 fn drop(&mut self) {
7704 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7705 let _ = unsafe { Box::from_raw(self.contents.result) };
7708 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7709 let _ = unsafe { Box::from_raw(self.contents.err) };
7714 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
7715 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7716 let contents = if o.result_ok {
7717 let result = unsafe { o.contents.result };
7718 unsafe { o.contents.result = core::ptr::null_mut() };
7719 CResult_PaymentIdPaymentSendFailureZPtr { result }
7721 let err = unsafe { o.contents.err };
7722 unsafe { o.contents.err = core::ptr::null_mut(); }
7723 CResult_PaymentIdPaymentSendFailureZPtr { err }
7727 result_ok: o.result_ok,
7731 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
7732 fn clone(&self) -> Self {
7734 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7735 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7738 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7739 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7745 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
7746 /// but with all dynamically-allocated buffers duplicated in new buffers.
7747 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
7749 /// The contents of CResult_NonePaymentSendFailureZ
7750 pub union CResult_NonePaymentSendFailureZPtr {
7751 /// Note that this value is always NULL, as there are no contents in the OK variant
7752 pub result: *mut core::ffi::c_void,
7753 /// A pointer to the contents in the error state.
7754 /// Reading from this pointer when `result_ok` is set is undefined.
7755 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7758 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7759 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7761 pub struct CResult_NonePaymentSendFailureZ {
7762 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7763 /// `err` or `result` depending on the state of `result_ok`.
7764 pub contents: CResult_NonePaymentSendFailureZPtr,
7765 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
7766 pub result_ok: bool,
7769 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
7770 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
7771 CResult_NonePaymentSendFailureZ {
7772 contents: CResult_NonePaymentSendFailureZPtr {
7773 result: core::ptr::null_mut(),
7779 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
7780 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
7781 CResult_NonePaymentSendFailureZ {
7782 contents: CResult_NonePaymentSendFailureZPtr {
7783 err: Box::into_raw(Box::new(e)),
7788 /// Checks if the given object is currently in the success state
7790 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
7794 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
7795 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
7796 impl Drop for CResult_NonePaymentSendFailureZ {
7797 fn drop(&mut self) {
7800 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7801 let _ = unsafe { Box::from_raw(self.contents.err) };
7806 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
7807 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7808 let contents = if o.result_ok {
7809 let _ = unsafe { Box::from_raw(o.contents.result) };
7810 o.contents.result = core::ptr::null_mut();
7811 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
7813 let err = unsafe { o.contents.err };
7814 unsafe { o.contents.err = core::ptr::null_mut(); }
7815 CResult_NonePaymentSendFailureZPtr { err }
7819 result_ok: o.result_ok,
7823 impl Clone for CResult_NonePaymentSendFailureZ {
7824 fn clone(&self) -> Self {
7826 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
7827 result: core::ptr::null_mut()
7830 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
7831 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7837 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
7838 /// but with all dynamically-allocated buffers duplicated in new buffers.
7839 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
7841 /// A tuple of 2 elements. See the individual fields for the types contained.
7842 pub struct C2Tuple_PaymentHashPaymentIdZ {
7843 /// The element at position 0
7844 pub a: crate::c_types::ThirtyTwoBytes,
7845 /// The element at position 1
7846 pub b: crate::c_types::ThirtyTwoBytes,
7848 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
7849 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
7856 impl C2Tuple_PaymentHashPaymentIdZ {
7857 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
7861 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
7862 fn clone(&self) -> Self {
7864 a: Clone::clone(&self.a),
7865 b: Clone::clone(&self.b),
7870 /// Creates a new tuple which has the same data as `orig`
7871 /// but with all dynamically-allocated buffers duplicated in new buffers.
7872 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
7873 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
7875 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
7876 C2Tuple_PaymentHashPaymentIdZ { a, b, }
7880 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
7881 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
7883 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
7884 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7885 /// A pointer to the contents in the success state.
7886 /// Reading from this pointer when `result_ok` is not set is undefined.
7887 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
7888 /// A pointer to the contents in the error state.
7889 /// Reading from this pointer when `result_ok` is set is undefined.
7890 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7893 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
7894 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7896 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7897 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
7898 /// `err` or `result` depending on the state of `result_ok`.
7899 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
7900 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
7901 pub result_ok: bool,
7904 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
7905 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7906 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7907 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7908 result: Box::into_raw(Box::new(o)),
7914 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
7915 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7916 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7917 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7918 err: Box::into_raw(Box::new(e)),
7923 /// Checks if the given object is currently in the success state
7925 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
7929 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
7930 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
7931 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7932 fn drop(&mut self) {
7934 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7935 let _ = unsafe { Box::from_raw(self.contents.result) };
7938 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7939 let _ = unsafe { Box::from_raw(self.contents.err) };
7944 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7945 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7946 let contents = if o.result_ok {
7947 let result = unsafe { o.contents.result };
7948 unsafe { o.contents.result = core::ptr::null_mut() };
7949 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
7951 let err = unsafe { o.contents.err };
7952 unsafe { o.contents.err = core::ptr::null_mut(); }
7953 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
7957 result_ok: o.result_ok,
7961 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7962 fn clone(&self) -> Self {
7964 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7965 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
7968 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7969 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7975 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
7976 /// but with all dynamically-allocated buffers duplicated in new buffers.
7977 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
7979 /// A tuple of 2 elements. See the individual fields for the types contained.
7980 pub struct C2Tuple_PaymentHashPaymentSecretZ {
7981 /// The element at position 0
7982 pub a: crate::c_types::ThirtyTwoBytes,
7983 /// The element at position 1
7984 pub b: crate::c_types::ThirtyTwoBytes,
7986 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
7987 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
7994 impl C2Tuple_PaymentHashPaymentSecretZ {
7995 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
7999 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8000 fn clone(&self) -> Self {
8002 a: Clone::clone(&self.a),
8003 b: Clone::clone(&self.b),
8008 /// Creates a new tuple which has the same data as `orig`
8009 /// but with all dynamically-allocated buffers duplicated in new buffers.
8010 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8011 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8013 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8014 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8018 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8019 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8021 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8022 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8023 /// A pointer to the contents in the success state.
8024 /// Reading from this pointer when `result_ok` is not set is undefined.
8025 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8026 /// Note that this value is always NULL, as there are no contents in the Err variant
8027 pub err: *mut core::ffi::c_void,
8030 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8031 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8032 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8033 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8034 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8035 /// `err` or `result` depending on the state of `result_ok`.
8036 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8037 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8038 pub result_ok: bool,
8041 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8042 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8043 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8044 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8045 result: Box::into_raw(Box::new(o)),
8051 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8052 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8053 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8054 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8055 err: core::ptr::null_mut(),
8060 /// Checks if the given object is currently in the success state
8062 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8066 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8067 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8068 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8069 fn drop(&mut self) {
8071 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8072 let _ = unsafe { Box::from_raw(self.contents.result) };
8078 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8079 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8080 let contents = if o.result_ok {
8081 let result = unsafe { o.contents.result };
8082 unsafe { o.contents.result = core::ptr::null_mut() };
8083 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8085 let _ = unsafe { Box::from_raw(o.contents.err) };
8086 o.contents.err = core::ptr::null_mut();
8087 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8091 result_ok: o.result_ok,
8095 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8096 fn clone(&self) -> Self {
8098 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8099 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8102 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8103 err: core::ptr::null_mut()
8109 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8110 /// but with all dynamically-allocated buffers duplicated in new buffers.
8111 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8113 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8114 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8115 /// A pointer to the contents in the success state.
8116 /// Reading from this pointer when `result_ok` is not set is undefined.
8117 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8118 /// A pointer to the contents in the error state.
8119 /// Reading from this pointer when `result_ok` is set is undefined.
8120 pub err: *mut crate::lightning::util::errors::APIError,
8123 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8124 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8126 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8127 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8128 /// `err` or `result` depending on the state of `result_ok`.
8129 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8130 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8131 pub result_ok: bool,
8134 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8135 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8136 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8137 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8138 result: Box::into_raw(Box::new(o)),
8144 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8145 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8146 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8147 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8148 err: Box::into_raw(Box::new(e)),
8153 /// Checks if the given object is currently in the success state
8155 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
8159 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
8160 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
8161 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8162 fn drop(&mut self) {
8164 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8165 let _ = unsafe { Box::from_raw(self.contents.result) };
8168 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8169 let _ = unsafe { Box::from_raw(self.contents.err) };
8174 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8175 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
8176 let contents = if o.result_ok {
8177 let result = unsafe { o.contents.result };
8178 unsafe { o.contents.result = core::ptr::null_mut() };
8179 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
8181 let err = unsafe { o.contents.err };
8182 unsafe { o.contents.err = core::ptr::null_mut(); }
8183 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
8187 result_ok: o.result_ok,
8191 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8192 fn clone(&self) -> Self {
8194 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8195 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8198 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8199 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8205 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
8206 /// but with all dynamically-allocated buffers duplicated in new buffers.
8207 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
8209 /// The contents of CResult_PaymentSecretNoneZ
8210 pub union CResult_PaymentSecretNoneZPtr {
8211 /// A pointer to the contents in the success state.
8212 /// Reading from this pointer when `result_ok` is not set is undefined.
8213 pub result: *mut crate::c_types::ThirtyTwoBytes,
8214 /// Note that this value is always NULL, as there are no contents in the Err variant
8215 pub err: *mut core::ffi::c_void,
8218 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8219 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8220 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8221 pub struct CResult_PaymentSecretNoneZ {
8222 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8223 /// `err` or `result` depending on the state of `result_ok`.
8224 pub contents: CResult_PaymentSecretNoneZPtr,
8225 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8226 pub result_ok: bool,
8229 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8230 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8231 CResult_PaymentSecretNoneZ {
8232 contents: CResult_PaymentSecretNoneZPtr {
8233 result: Box::into_raw(Box::new(o)),
8239 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8240 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8241 CResult_PaymentSecretNoneZ {
8242 contents: CResult_PaymentSecretNoneZPtr {
8243 err: core::ptr::null_mut(),
8248 /// Checks if the given object is currently in the success state
8250 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8254 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8255 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8256 impl Drop for CResult_PaymentSecretNoneZ {
8257 fn drop(&mut self) {
8259 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8260 let _ = unsafe { Box::from_raw(self.contents.result) };
8266 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8267 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8268 let contents = if o.result_ok {
8269 let result = unsafe { o.contents.result };
8270 unsafe { o.contents.result = core::ptr::null_mut() };
8271 CResult_PaymentSecretNoneZPtr { result }
8273 let _ = unsafe { Box::from_raw(o.contents.err) };
8274 o.contents.err = core::ptr::null_mut();
8275 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8279 result_ok: o.result_ok,
8283 impl Clone for CResult_PaymentSecretNoneZ {
8284 fn clone(&self) -> Self {
8286 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8287 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8290 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8291 err: core::ptr::null_mut()
8297 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8298 /// but with all dynamically-allocated buffers duplicated in new buffers.
8299 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
8301 /// The contents of CResult_PaymentSecretAPIErrorZ
8302 pub union CResult_PaymentSecretAPIErrorZPtr {
8303 /// A pointer to the contents in the success state.
8304 /// Reading from this pointer when `result_ok` is not set is undefined.
8305 pub result: *mut crate::c_types::ThirtyTwoBytes,
8306 /// A pointer to the contents in the error state.
8307 /// Reading from this pointer when `result_ok` is set is undefined.
8308 pub err: *mut crate::lightning::util::errors::APIError,
8311 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8312 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8313 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8314 pub struct CResult_PaymentSecretAPIErrorZ {
8315 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8316 /// `err` or `result` depending on the state of `result_ok`.
8317 pub contents: CResult_PaymentSecretAPIErrorZPtr,
8318 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8319 pub result_ok: bool,
8322 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
8323 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
8324 CResult_PaymentSecretAPIErrorZ {
8325 contents: CResult_PaymentSecretAPIErrorZPtr {
8326 result: Box::into_raw(Box::new(o)),
8332 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
8333 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
8334 CResult_PaymentSecretAPIErrorZ {
8335 contents: CResult_PaymentSecretAPIErrorZPtr {
8336 err: Box::into_raw(Box::new(e)),
8341 /// Checks if the given object is currently in the success state
8343 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
8347 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
8348 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
8349 impl Drop for CResult_PaymentSecretAPIErrorZ {
8350 fn drop(&mut self) {
8352 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8353 let _ = unsafe { Box::from_raw(self.contents.result) };
8356 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8357 let _ = unsafe { Box::from_raw(self.contents.err) };
8362 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
8363 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8364 let contents = if o.result_ok {
8365 let result = unsafe { o.contents.result };
8366 unsafe { o.contents.result = core::ptr::null_mut() };
8367 CResult_PaymentSecretAPIErrorZPtr { result }
8369 let err = unsafe { o.contents.err };
8370 unsafe { o.contents.err = core::ptr::null_mut(); }
8371 CResult_PaymentSecretAPIErrorZPtr { err }
8375 result_ok: o.result_ok,
8379 impl Clone for CResult_PaymentSecretAPIErrorZ {
8380 fn clone(&self) -> Self {
8382 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
8383 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8386 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
8387 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8393 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
8394 /// but with all dynamically-allocated buffers duplicated in new buffers.
8395 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
8397 /// The contents of CResult_PaymentPreimageAPIErrorZ
8398 pub union CResult_PaymentPreimageAPIErrorZPtr {
8399 /// A pointer to the contents in the success state.
8400 /// Reading from this pointer when `result_ok` is not set is undefined.
8401 pub result: *mut crate::c_types::ThirtyTwoBytes,
8402 /// A pointer to the contents in the error state.
8403 /// Reading from this pointer when `result_ok` is set is undefined.
8404 pub err: *mut crate::lightning::util::errors::APIError,
8407 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8408 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8410 pub struct CResult_PaymentPreimageAPIErrorZ {
8411 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8412 /// `err` or `result` depending on the state of `result_ok`.
8413 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
8414 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8415 pub result_ok: bool,
8418 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
8419 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
8420 CResult_PaymentPreimageAPIErrorZ {
8421 contents: CResult_PaymentPreimageAPIErrorZPtr {
8422 result: Box::into_raw(Box::new(o)),
8428 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
8429 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
8430 CResult_PaymentPreimageAPIErrorZ {
8431 contents: CResult_PaymentPreimageAPIErrorZPtr {
8432 err: Box::into_raw(Box::new(e)),
8437 /// Checks if the given object is currently in the success state
8439 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
8443 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
8444 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
8445 impl Drop for CResult_PaymentPreimageAPIErrorZ {
8446 fn drop(&mut self) {
8448 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8449 let _ = unsafe { Box::from_raw(self.contents.result) };
8452 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8453 let _ = unsafe { Box::from_raw(self.contents.err) };
8458 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
8459 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8460 let contents = if o.result_ok {
8461 let result = unsafe { o.contents.result };
8462 unsafe { o.contents.result = core::ptr::null_mut() };
8463 CResult_PaymentPreimageAPIErrorZPtr { result }
8465 let err = unsafe { o.contents.err };
8466 unsafe { o.contents.err = core::ptr::null_mut(); }
8467 CResult_PaymentPreimageAPIErrorZPtr { err }
8471 result_ok: o.result_ok,
8475 impl Clone for CResult_PaymentPreimageAPIErrorZ {
8476 fn clone(&self) -> Self {
8478 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
8479 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8482 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
8483 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8489 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
8490 /// but with all dynamically-allocated buffers duplicated in new buffers.
8491 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
8493 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8494 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8495 /// A pointer to the contents in the success state.
8496 /// Reading from this pointer when `result_ok` is not set is undefined.
8497 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
8498 /// A pointer to the contents in the error state.
8499 /// Reading from this pointer when `result_ok` is set is undefined.
8500 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8503 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8504 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8506 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
8507 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8508 /// `err` or `result` depending on the state of `result_ok`.
8509 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
8510 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8511 pub result_ok: bool,
8514 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
8515 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8516 CResult_CounterpartyForwardingInfoDecodeErrorZ {
8517 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8518 result: Box::into_raw(Box::new(o)),
8524 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
8525 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8526 CResult_CounterpartyForwardingInfoDecodeErrorZ {
8527 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8528 err: Box::into_raw(Box::new(e)),
8533 /// Checks if the given object is currently in the success state
8535 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
8539 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
8540 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
8541 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8542 fn drop(&mut self) {
8544 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8545 let _ = unsafe { Box::from_raw(self.contents.result) };
8548 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8549 let _ = unsafe { Box::from_raw(self.contents.err) };
8554 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8555 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8556 let contents = if o.result_ok {
8557 let result = unsafe { o.contents.result };
8558 unsafe { o.contents.result = core::ptr::null_mut() };
8559 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
8561 let err = unsafe { o.contents.err };
8562 unsafe { o.contents.err = core::ptr::null_mut(); }
8563 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
8567 result_ok: o.result_ok,
8571 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8572 fn clone(&self) -> Self {
8574 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8575 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
8578 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8579 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8585 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
8586 /// but with all dynamically-allocated buffers duplicated in new buffers.
8587 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
8589 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
8590 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
8591 /// A pointer to the contents in the success state.
8592 /// Reading from this pointer when `result_ok` is not set is undefined.
8593 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
8594 /// A pointer to the contents in the error state.
8595 /// Reading from this pointer when `result_ok` is set is undefined.
8596 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8599 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8600 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8602 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
8603 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8604 /// `err` or `result` depending on the state of `result_ok`.
8605 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
8606 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8607 pub result_ok: bool,
8610 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
8611 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
8612 CResult_ChannelCounterpartyDecodeErrorZ {
8613 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8614 result: Box::into_raw(Box::new(o)),
8620 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
8621 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
8622 CResult_ChannelCounterpartyDecodeErrorZ {
8623 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8624 err: Box::into_raw(Box::new(e)),
8629 /// Checks if the given object is currently in the success state
8631 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
8635 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
8636 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
8637 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
8638 fn drop(&mut self) {
8640 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8641 let _ = unsafe { Box::from_raw(self.contents.result) };
8644 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8645 let _ = unsafe { Box::from_raw(self.contents.err) };
8650 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
8651 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
8652 let contents = if o.result_ok {
8653 let result = unsafe { o.contents.result };
8654 unsafe { o.contents.result = core::ptr::null_mut() };
8655 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
8657 let err = unsafe { o.contents.err };
8658 unsafe { o.contents.err = core::ptr::null_mut(); }
8659 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
8663 result_ok: o.result_ok,
8667 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
8668 fn clone(&self) -> Self {
8670 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8671 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
8674 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8675 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8681 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
8682 /// but with all dynamically-allocated buffers duplicated in new buffers.
8683 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
8685 /// The contents of CResult_ChannelDetailsDecodeErrorZ
8686 pub union CResult_ChannelDetailsDecodeErrorZPtr {
8687 /// A pointer to the contents in the success state.
8688 /// Reading from this pointer when `result_ok` is not set is undefined.
8689 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
8690 /// A pointer to the contents in the error state.
8691 /// Reading from this pointer when `result_ok` is set is undefined.
8692 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8695 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
8696 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
8697 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8698 pub struct CResult_ChannelDetailsDecodeErrorZ {
8699 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
8700 /// `err` or `result` depending on the state of `result_ok`.
8701 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
8702 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
8703 pub result_ok: bool,
8706 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
8707 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
8708 CResult_ChannelDetailsDecodeErrorZ {
8709 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8710 result: Box::into_raw(Box::new(o)),
8716 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
8717 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
8718 CResult_ChannelDetailsDecodeErrorZ {
8719 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8720 err: Box::into_raw(Box::new(e)),
8725 /// Checks if the given object is currently in the success state
8727 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
8731 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
8732 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
8733 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
8734 fn drop(&mut self) {
8736 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8737 let _ = unsafe { Box::from_raw(self.contents.result) };
8740 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8741 let _ = unsafe { Box::from_raw(self.contents.err) };
8746 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
8747 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
8748 let contents = if o.result_ok {
8749 let result = unsafe { o.contents.result };
8750 unsafe { o.contents.result = core::ptr::null_mut() };
8751 CResult_ChannelDetailsDecodeErrorZPtr { result }
8753 let err = unsafe { o.contents.err };
8754 unsafe { o.contents.err = core::ptr::null_mut(); }
8755 CResult_ChannelDetailsDecodeErrorZPtr { err }
8759 result_ok: o.result_ok,
8763 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
8764 fn clone(&self) -> Self {
8766 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
8767 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
8770 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
8771 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8777 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
8778 /// but with all dynamically-allocated buffers duplicated in new buffers.
8779 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
8781 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
8782 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
8783 /// A pointer to the contents in the success state.
8784 /// Reading from this pointer when `result_ok` is not set is undefined.
8785 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
8786 /// A pointer to the contents in the error state.
8787 /// Reading from this pointer when `result_ok` is set is undefined.
8788 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8791 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
8792 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
8793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8794 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
8795 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
8796 /// `err` or `result` depending on the state of `result_ok`.
8797 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
8798 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
8799 pub result_ok: bool,
8802 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
8803 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
8804 CResult_PhantomRouteHintsDecodeErrorZ {
8805 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8806 result: Box::into_raw(Box::new(o)),
8812 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
8813 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
8814 CResult_PhantomRouteHintsDecodeErrorZ {
8815 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8816 err: Box::into_raw(Box::new(e)),
8821 /// Checks if the given object is currently in the success state
8823 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
8827 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
8828 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
8829 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
8830 fn drop(&mut self) {
8832 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8833 let _ = unsafe { Box::from_raw(self.contents.result) };
8836 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8837 let _ = unsafe { Box::from_raw(self.contents.err) };
8842 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
8843 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
8844 let contents = if o.result_ok {
8845 let result = unsafe { o.contents.result };
8846 unsafe { o.contents.result = core::ptr::null_mut() };
8847 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
8849 let err = unsafe { o.contents.err };
8850 unsafe { o.contents.err = core::ptr::null_mut(); }
8851 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
8855 result_ok: o.result_ok,
8859 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
8860 fn clone(&self) -> Self {
8862 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8863 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
8866 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8867 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8873 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
8874 /// but with all dynamically-allocated buffers duplicated in new buffers.
8875 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
8877 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
8878 /// This corresponds to std::vector in C++
8879 pub struct CVec_ChannelMonitorZ {
8880 /// The elements in the array.
8881 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8882 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
8883 /// The number of elements pointed to by `data`.
8886 impl CVec_ChannelMonitorZ {
8887 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
8888 if self.datalen == 0 { return Vec::new(); }
8889 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8890 self.data = core::ptr::null_mut();
8894 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
8895 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8898 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
8899 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
8900 let datalen = v.len();
8901 let data = Box::into_raw(v.into_boxed_slice());
8902 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8906 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8907 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
8908 impl Drop for CVec_ChannelMonitorZ {
8909 fn drop(&mut self) {
8910 if self.datalen == 0 { return; }
8911 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8915 /// A tuple of 2 elements. See the individual fields for the types contained.
8916 pub struct C2Tuple_BlockHashChannelManagerZ {
8917 /// The element at position 0
8918 pub a: crate::c_types::ThirtyTwoBytes,
8919 /// The element at position 1
8920 pub b: crate::lightning::ln::channelmanager::ChannelManager,
8922 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
8923 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
8930 impl C2Tuple_BlockHashChannelManagerZ {
8931 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
8935 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
8937 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
8938 C2Tuple_BlockHashChannelManagerZ { a, b, }
8942 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
8943 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
8945 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
8946 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8947 /// A pointer to the contents in the success state.
8948 /// Reading from this pointer when `result_ok` is not set is undefined.
8949 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
8950 /// A pointer to the contents in the error state.
8951 /// Reading from this pointer when `result_ok` is set is undefined.
8952 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8955 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
8956 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8957 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8958 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8959 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
8960 /// `err` or `result` depending on the state of `result_ok`.
8961 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
8962 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
8963 pub result_ok: bool,
8966 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
8967 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8968 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8969 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8970 result: Box::into_raw(Box::new(o)),
8976 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
8977 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8978 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8979 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8980 err: Box::into_raw(Box::new(e)),
8985 /// Checks if the given object is currently in the success state
8987 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
8991 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
8992 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
8993 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8994 fn drop(&mut self) {
8996 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8997 let _ = unsafe { Box::from_raw(self.contents.result) };
9000 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9001 let _ = unsafe { Box::from_raw(self.contents.err) };
9006 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9007 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9008 let contents = if o.result_ok {
9009 let result = unsafe { o.contents.result };
9010 unsafe { o.contents.result = core::ptr::null_mut() };
9011 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9013 let err = unsafe { o.contents.err };
9014 unsafe { o.contents.err = core::ptr::null_mut(); }
9015 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9019 result_ok: o.result_ok,
9024 /// The contents of CResult_ChannelConfigDecodeErrorZ
9025 pub union CResult_ChannelConfigDecodeErrorZPtr {
9026 /// A pointer to the contents in the success state.
9027 /// Reading from this pointer when `result_ok` is not set is undefined.
9028 pub result: *mut crate::lightning::util::config::ChannelConfig,
9029 /// A pointer to the contents in the error state.
9030 /// Reading from this pointer when `result_ok` is set is undefined.
9031 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9034 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9035 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9037 pub struct CResult_ChannelConfigDecodeErrorZ {
9038 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9039 /// `err` or `result` depending on the state of `result_ok`.
9040 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9041 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9042 pub result_ok: bool,
9045 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9046 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9047 CResult_ChannelConfigDecodeErrorZ {
9048 contents: CResult_ChannelConfigDecodeErrorZPtr {
9049 result: Box::into_raw(Box::new(o)),
9055 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9056 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9057 CResult_ChannelConfigDecodeErrorZ {
9058 contents: CResult_ChannelConfigDecodeErrorZPtr {
9059 err: Box::into_raw(Box::new(e)),
9064 /// Checks if the given object is currently in the success state
9066 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9070 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9071 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9072 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9073 fn drop(&mut self) {
9075 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9076 let _ = unsafe { Box::from_raw(self.contents.result) };
9079 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9080 let _ = unsafe { Box::from_raw(self.contents.err) };
9085 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9086 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9087 let contents = if o.result_ok {
9088 let result = unsafe { o.contents.result };
9089 unsafe { o.contents.result = core::ptr::null_mut() };
9090 CResult_ChannelConfigDecodeErrorZPtr { result }
9092 let err = unsafe { o.contents.err };
9093 unsafe { o.contents.err = core::ptr::null_mut(); }
9094 CResult_ChannelConfigDecodeErrorZPtr { err }
9098 result_ok: o.result_ok,
9102 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9103 fn clone(&self) -> Self {
9105 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9106 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9109 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9110 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9116 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9117 /// but with all dynamically-allocated buffers duplicated in new buffers.
9118 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9120 /// The contents of CResult_OutPointDecodeErrorZ
9121 pub union CResult_OutPointDecodeErrorZPtr {
9122 /// A pointer to the contents in the success state.
9123 /// Reading from this pointer when `result_ok` is not set is undefined.
9124 pub result: *mut crate::lightning::chain::transaction::OutPoint,
9125 /// A pointer to the contents in the error state.
9126 /// Reading from this pointer when `result_ok` is set is undefined.
9127 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9130 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9131 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9133 pub struct CResult_OutPointDecodeErrorZ {
9134 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9135 /// `err` or `result` depending on the state of `result_ok`.
9136 pub contents: CResult_OutPointDecodeErrorZPtr,
9137 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9138 pub result_ok: bool,
9141 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9142 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9143 CResult_OutPointDecodeErrorZ {
9144 contents: CResult_OutPointDecodeErrorZPtr {
9145 result: Box::into_raw(Box::new(o)),
9151 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9152 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9153 CResult_OutPointDecodeErrorZ {
9154 contents: CResult_OutPointDecodeErrorZPtr {
9155 err: Box::into_raw(Box::new(e)),
9160 /// Checks if the given object is currently in the success state
9162 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
9166 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
9167 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
9168 impl Drop for CResult_OutPointDecodeErrorZ {
9169 fn drop(&mut self) {
9171 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9172 let _ = unsafe { Box::from_raw(self.contents.result) };
9175 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9176 let _ = unsafe { Box::from_raw(self.contents.err) };
9181 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
9182 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
9183 let contents = if o.result_ok {
9184 let result = unsafe { o.contents.result };
9185 unsafe { o.contents.result = core::ptr::null_mut() };
9186 CResult_OutPointDecodeErrorZPtr { result }
9188 let err = unsafe { o.contents.err };
9189 unsafe { o.contents.err = core::ptr::null_mut(); }
9190 CResult_OutPointDecodeErrorZPtr { err }
9194 result_ok: o.result_ok,
9198 impl Clone for CResult_OutPointDecodeErrorZ {
9199 fn clone(&self) -> Self {
9201 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
9202 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
9205 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
9206 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9212 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9213 /// but with all dynamically-allocated buffers duplicated in new buffers.
9214 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
9216 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
9217 pub enum COption_TypeZ {
9218 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9219 Some(crate::lightning::ln::wire::Type),
9220 /// When we're in this state, this COption_TypeZ contains nothing
9223 impl COption_TypeZ {
9224 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9225 if let Self::None = self { false } else { true }
9227 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9230 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
9231 if let Self::Some(v) = self { v } else { unreachable!() }
9235 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
9236 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
9237 COption_TypeZ::Some(o)
9240 /// Constructs a new COption_TypeZ containing nothing
9241 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
9245 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
9246 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
9248 /// The contents of CResult_COption_TypeZDecodeErrorZ
9249 pub union CResult_COption_TypeZDecodeErrorZPtr {
9250 /// A pointer to the contents in the success state.
9251 /// Reading from this pointer when `result_ok` is not set is undefined.
9252 pub result: *mut crate::c_types::derived::COption_TypeZ,
9253 /// A pointer to the contents in the error state.
9254 /// Reading from this pointer when `result_ok` is set is undefined.
9255 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9258 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9259 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9260 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9261 pub struct CResult_COption_TypeZDecodeErrorZ {
9262 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9263 /// `err` or `result` depending on the state of `result_ok`.
9264 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
9265 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9266 pub result_ok: bool,
9269 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
9270 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
9271 CResult_COption_TypeZDecodeErrorZ {
9272 contents: CResult_COption_TypeZDecodeErrorZPtr {
9273 result: Box::into_raw(Box::new(o)),
9279 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
9280 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
9281 CResult_COption_TypeZDecodeErrorZ {
9282 contents: CResult_COption_TypeZDecodeErrorZPtr {
9283 err: Box::into_raw(Box::new(e)),
9288 /// Checks if the given object is currently in the success state
9290 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
9294 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
9295 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
9296 impl Drop for CResult_COption_TypeZDecodeErrorZ {
9297 fn drop(&mut self) {
9299 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9300 let _ = unsafe { Box::from_raw(self.contents.result) };
9303 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9304 let _ = unsafe { Box::from_raw(self.contents.err) };
9309 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
9310 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9311 let contents = if o.result_ok {
9312 let result = unsafe { o.contents.result };
9313 unsafe { o.contents.result = core::ptr::null_mut() };
9314 CResult_COption_TypeZDecodeErrorZPtr { result }
9316 let err = unsafe { o.contents.err };
9317 unsafe { o.contents.err = core::ptr::null_mut(); }
9318 CResult_COption_TypeZDecodeErrorZPtr { err }
9322 result_ok: o.result_ok,
9327 /// The contents of CResult_PaymentIdPaymentErrorZ
9328 pub union CResult_PaymentIdPaymentErrorZPtr {
9329 /// A pointer to the contents in the success state.
9330 /// Reading from this pointer when `result_ok` is not set is undefined.
9331 pub result: *mut crate::c_types::ThirtyTwoBytes,
9332 /// A pointer to the contents in the error state.
9333 /// Reading from this pointer when `result_ok` is set is undefined.
9334 pub err: *mut crate::lightning_invoice::payment::PaymentError,
9337 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
9338 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
9339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9340 pub struct CResult_PaymentIdPaymentErrorZ {
9341 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
9342 /// `err` or `result` depending on the state of `result_ok`.
9343 pub contents: CResult_PaymentIdPaymentErrorZPtr,
9344 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
9345 pub result_ok: bool,
9348 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
9349 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
9350 CResult_PaymentIdPaymentErrorZ {
9351 contents: CResult_PaymentIdPaymentErrorZPtr {
9352 result: Box::into_raw(Box::new(o)),
9358 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
9359 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
9360 CResult_PaymentIdPaymentErrorZ {
9361 contents: CResult_PaymentIdPaymentErrorZPtr {
9362 err: Box::into_raw(Box::new(e)),
9367 /// Checks if the given object is currently in the success state
9369 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
9373 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
9374 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
9375 impl Drop for CResult_PaymentIdPaymentErrorZ {
9376 fn drop(&mut self) {
9378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9379 let _ = unsafe { Box::from_raw(self.contents.result) };
9382 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9383 let _ = unsafe { Box::from_raw(self.contents.err) };
9388 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
9389 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
9390 let contents = if o.result_ok {
9391 let result = unsafe { o.contents.result };
9392 unsafe { o.contents.result = core::ptr::null_mut() };
9393 CResult_PaymentIdPaymentErrorZPtr { result }
9395 let err = unsafe { o.contents.err };
9396 unsafe { o.contents.err = core::ptr::null_mut(); }
9397 CResult_PaymentIdPaymentErrorZPtr { err }
9401 result_ok: o.result_ok,
9405 impl Clone for CResult_PaymentIdPaymentErrorZ {
9406 fn clone(&self) -> Self {
9408 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
9409 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9412 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
9413 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
9419 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
9420 /// but with all dynamically-allocated buffers duplicated in new buffers.
9421 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
9423 /// The contents of CResult_SiPrefixParseErrorZ
9424 pub union CResult_SiPrefixParseErrorZPtr {
9425 /// A pointer to the contents in the success state.
9426 /// Reading from this pointer when `result_ok` is not set is undefined.
9427 pub result: *mut crate::lightning_invoice::SiPrefix,
9428 /// A pointer to the contents in the error state.
9429 /// Reading from this pointer when `result_ok` is set is undefined.
9430 pub err: *mut crate::lightning_invoice::ParseError,
9433 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
9434 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
9435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9436 pub struct CResult_SiPrefixParseErrorZ {
9437 /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
9438 /// `err` or `result` depending on the state of `result_ok`.
9439 pub contents: CResult_SiPrefixParseErrorZPtr,
9440 /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
9441 pub result_ok: bool,
9444 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
9445 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
9446 CResult_SiPrefixParseErrorZ {
9447 contents: CResult_SiPrefixParseErrorZPtr {
9448 result: Box::into_raw(Box::new(o)),
9454 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
9455 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
9456 CResult_SiPrefixParseErrorZ {
9457 contents: CResult_SiPrefixParseErrorZPtr {
9458 err: Box::into_raw(Box::new(e)),
9463 /// Checks if the given object is currently in the success state
9465 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
9469 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
9470 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
9471 impl Drop for CResult_SiPrefixParseErrorZ {
9472 fn drop(&mut self) {
9474 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9475 let _ = unsafe { Box::from_raw(self.contents.result) };
9478 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9479 let _ = unsafe { Box::from_raw(self.contents.err) };
9484 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
9485 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
9486 let contents = if o.result_ok {
9487 let result = unsafe { o.contents.result };
9488 unsafe { o.contents.result = core::ptr::null_mut() };
9489 CResult_SiPrefixParseErrorZPtr { result }
9491 let err = unsafe { o.contents.err };
9492 unsafe { o.contents.err = core::ptr::null_mut(); }
9493 CResult_SiPrefixParseErrorZPtr { err }
9497 result_ok: o.result_ok,
9501 impl Clone for CResult_SiPrefixParseErrorZ {
9502 fn clone(&self) -> Self {
9504 Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
9505 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
9508 Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
9509 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9515 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
9516 /// but with all dynamically-allocated buffers duplicated in new buffers.
9517 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
9519 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
9520 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
9521 /// A pointer to the contents in the success state.
9522 /// Reading from this pointer when `result_ok` is not set is undefined.
9523 pub result: *mut crate::lightning_invoice::Invoice,
9524 /// A pointer to the contents in the error state.
9525 /// Reading from this pointer when `result_ok` is set is undefined.
9526 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
9529 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
9530 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
9531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9532 pub struct CResult_InvoiceParseOrSemanticErrorZ {
9533 /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
9534 /// `err` or `result` depending on the state of `result_ok`.
9535 pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
9536 /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
9537 pub result_ok: bool,
9540 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
9541 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
9542 CResult_InvoiceParseOrSemanticErrorZ {
9543 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9544 result: Box::into_raw(Box::new(o)),
9550 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
9551 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
9552 CResult_InvoiceParseOrSemanticErrorZ {
9553 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9554 err: Box::into_raw(Box::new(e)),
9559 /// Checks if the given object is currently in the success state
9561 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
9565 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
9566 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
9567 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
9568 fn drop(&mut self) {
9570 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9571 let _ = unsafe { Box::from_raw(self.contents.result) };
9574 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9575 let _ = unsafe { Box::from_raw(self.contents.err) };
9580 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
9581 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
9582 let contents = if o.result_ok {
9583 let result = unsafe { o.contents.result };
9584 unsafe { o.contents.result = core::ptr::null_mut() };
9585 CResult_InvoiceParseOrSemanticErrorZPtr { result }
9587 let err = unsafe { o.contents.err };
9588 unsafe { o.contents.err = core::ptr::null_mut(); }
9589 CResult_InvoiceParseOrSemanticErrorZPtr { err }
9593 result_ok: o.result_ok,
9597 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
9598 fn clone(&self) -> Self {
9600 Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9601 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
9604 Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9605 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
9611 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
9612 /// but with all dynamically-allocated buffers duplicated in new buffers.
9613 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
9615 /// The contents of CResult_SignedRawInvoiceParseErrorZ
9616 pub union CResult_SignedRawInvoiceParseErrorZPtr {
9617 /// A pointer to the contents in the success state.
9618 /// Reading from this pointer when `result_ok` is not set is undefined.
9619 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
9620 /// A pointer to the contents in the error state.
9621 /// Reading from this pointer when `result_ok` is set is undefined.
9622 pub err: *mut crate::lightning_invoice::ParseError,
9625 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
9626 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
9627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9628 pub struct CResult_SignedRawInvoiceParseErrorZ {
9629 /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
9630 /// `err` or `result` depending on the state of `result_ok`.
9631 pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
9632 /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
9633 pub result_ok: bool,
9636 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
9637 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
9638 CResult_SignedRawInvoiceParseErrorZ {
9639 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9640 result: Box::into_raw(Box::new(o)),
9646 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
9647 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
9648 CResult_SignedRawInvoiceParseErrorZ {
9649 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9650 err: Box::into_raw(Box::new(e)),
9655 /// Checks if the given object is currently in the success state
9657 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
9661 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
9662 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
9663 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
9664 fn drop(&mut self) {
9666 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9667 let _ = unsafe { Box::from_raw(self.contents.result) };
9670 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9671 let _ = unsafe { Box::from_raw(self.contents.err) };
9676 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
9677 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
9678 let contents = if o.result_ok {
9679 let result = unsafe { o.contents.result };
9680 unsafe { o.contents.result = core::ptr::null_mut() };
9681 CResult_SignedRawInvoiceParseErrorZPtr { result }
9683 let err = unsafe { o.contents.err };
9684 unsafe { o.contents.err = core::ptr::null_mut(); }
9685 CResult_SignedRawInvoiceParseErrorZPtr { err }
9689 result_ok: o.result_ok,
9693 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
9694 fn clone(&self) -> Self {
9696 Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9697 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
9700 Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9701 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9707 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
9708 /// but with all dynamically-allocated buffers duplicated in new buffers.
9709 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
9711 /// A tuple of 3 elements. See the individual fields for the types contained.
9712 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9713 /// The element at position 0
9714 pub a: crate::lightning_invoice::RawInvoice,
9715 /// The element at position 1
9716 pub b: crate::c_types::ThirtyTwoBytes,
9717 /// The element at position 2
9718 pub c: crate::lightning_invoice::InvoiceSignature,
9720 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9721 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
9729 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9730 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
9731 (self.a, self.b, self.c)
9734 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9735 fn clone(&self) -> Self {
9737 a: Clone::clone(&self.a),
9738 b: Clone::clone(&self.b),
9739 c: Clone::clone(&self.c),
9744 /// Creates a new tuple which has the same data as `orig`
9745 /// but with all dynamically-allocated buffers duplicated in new buffers.
9746 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
9747 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
9749 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 {
9750 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
9754 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
9755 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
9757 /// The contents of CResult_PayeePubKeyErrorZ
9758 pub union CResult_PayeePubKeyErrorZPtr {
9759 /// A pointer to the contents in the success state.
9760 /// Reading from this pointer when `result_ok` is not set is undefined.
9761 pub result: *mut crate::lightning_invoice::PayeePubKey,
9762 /// A pointer to the contents in the error state.
9763 /// Reading from this pointer when `result_ok` is set is undefined.
9764 pub err: *mut crate::c_types::Secp256k1Error,
9767 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
9768 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
9769 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9770 pub struct CResult_PayeePubKeyErrorZ {
9771 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
9772 /// `err` or `result` depending on the state of `result_ok`.
9773 pub contents: CResult_PayeePubKeyErrorZPtr,
9774 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
9775 pub result_ok: bool,
9778 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
9779 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
9780 CResult_PayeePubKeyErrorZ {
9781 contents: CResult_PayeePubKeyErrorZPtr {
9782 result: Box::into_raw(Box::new(o)),
9788 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
9789 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
9790 CResult_PayeePubKeyErrorZ {
9791 contents: CResult_PayeePubKeyErrorZPtr {
9792 err: Box::into_raw(Box::new(e)),
9797 /// Checks if the given object is currently in the success state
9799 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
9803 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
9804 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
9805 impl Drop for CResult_PayeePubKeyErrorZ {
9806 fn drop(&mut self) {
9808 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9809 let _ = unsafe { Box::from_raw(self.contents.result) };
9812 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9813 let _ = unsafe { Box::from_raw(self.contents.err) };
9818 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
9819 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
9820 let contents = if o.result_ok {
9821 let result = unsafe { o.contents.result };
9822 unsafe { o.contents.result = core::ptr::null_mut() };
9823 CResult_PayeePubKeyErrorZPtr { result }
9825 let err = unsafe { o.contents.err };
9826 unsafe { o.contents.err = core::ptr::null_mut(); }
9827 CResult_PayeePubKeyErrorZPtr { err }
9831 result_ok: o.result_ok,
9835 impl Clone for CResult_PayeePubKeyErrorZ {
9836 fn clone(&self) -> Self {
9838 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
9839 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
9842 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
9843 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
9849 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
9850 /// but with all dynamically-allocated buffers duplicated in new buffers.
9851 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
9853 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
9854 /// This corresponds to std::vector in C++
9855 pub struct CVec_PrivateRouteZ {
9856 /// The elements in the array.
9857 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9858 pub data: *mut crate::lightning_invoice::PrivateRoute,
9859 /// The number of elements pointed to by `data`.
9862 impl CVec_PrivateRouteZ {
9863 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
9864 if self.datalen == 0 { return Vec::new(); }
9865 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9866 self.data = core::ptr::null_mut();
9870 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
9871 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9874 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
9875 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
9876 let datalen = v.len();
9877 let data = Box::into_raw(v.into_boxed_slice());
9878 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9882 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9883 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
9884 impl Drop for CVec_PrivateRouteZ {
9885 fn drop(&mut self) {
9886 if self.datalen == 0 { return; }
9887 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9890 impl Clone for CVec_PrivateRouteZ {
9891 fn clone(&self) -> Self {
9892 let mut res = Vec::new();
9893 if self.datalen == 0 { return Self::from(res); }
9894 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9899 /// The contents of CResult_PositiveTimestampCreationErrorZ
9900 pub union CResult_PositiveTimestampCreationErrorZPtr {
9901 /// A pointer to the contents in the success state.
9902 /// Reading from this pointer when `result_ok` is not set is undefined.
9903 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
9904 /// A pointer to the contents in the error state.
9905 /// Reading from this pointer when `result_ok` is set is undefined.
9906 pub err: *mut crate::lightning_invoice::CreationError,
9909 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
9910 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
9911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9912 pub struct CResult_PositiveTimestampCreationErrorZ {
9913 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
9914 /// `err` or `result` depending on the state of `result_ok`.
9915 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
9916 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
9917 pub result_ok: bool,
9920 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
9921 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
9922 CResult_PositiveTimestampCreationErrorZ {
9923 contents: CResult_PositiveTimestampCreationErrorZPtr {
9924 result: Box::into_raw(Box::new(o)),
9930 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
9931 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
9932 CResult_PositiveTimestampCreationErrorZ {
9933 contents: CResult_PositiveTimestampCreationErrorZPtr {
9934 err: Box::into_raw(Box::new(e)),
9939 /// Checks if the given object is currently in the success state
9941 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
9945 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
9946 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
9947 impl Drop for CResult_PositiveTimestampCreationErrorZ {
9948 fn drop(&mut self) {
9950 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9951 let _ = unsafe { Box::from_raw(self.contents.result) };
9954 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9955 let _ = unsafe { Box::from_raw(self.contents.err) };
9960 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
9961 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
9962 let contents = if o.result_ok {
9963 let result = unsafe { o.contents.result };
9964 unsafe { o.contents.result = core::ptr::null_mut() };
9965 CResult_PositiveTimestampCreationErrorZPtr { result }
9967 let err = unsafe { o.contents.err };
9968 unsafe { o.contents.err = core::ptr::null_mut(); }
9969 CResult_PositiveTimestampCreationErrorZPtr { err }
9973 result_ok: o.result_ok,
9977 impl Clone for CResult_PositiveTimestampCreationErrorZ {
9978 fn clone(&self) -> Self {
9980 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
9981 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
9984 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
9985 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9991 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
9992 /// but with all dynamically-allocated buffers duplicated in new buffers.
9993 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
9995 /// The contents of CResult_NoneSemanticErrorZ
9996 pub union CResult_NoneSemanticErrorZPtr {
9997 /// Note that this value is always NULL, as there are no contents in the OK variant
9998 pub result: *mut core::ffi::c_void,
9999 /// A pointer to the contents in the error state.
10000 /// Reading from this pointer when `result_ok` is set is undefined.
10001 pub err: *mut crate::lightning_invoice::SemanticError,
10004 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10005 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10006 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10007 pub struct CResult_NoneSemanticErrorZ {
10008 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
10009 /// `err` or `result` depending on the state of `result_ok`.
10010 pub contents: CResult_NoneSemanticErrorZPtr,
10011 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
10012 pub result_ok: bool,
10015 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
10016 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
10017 CResult_NoneSemanticErrorZ {
10018 contents: CResult_NoneSemanticErrorZPtr {
10019 result: core::ptr::null_mut(),
10025 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
10026 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
10027 CResult_NoneSemanticErrorZ {
10028 contents: CResult_NoneSemanticErrorZPtr {
10029 err: Box::into_raw(Box::new(e)),
10034 /// Checks if the given object is currently in the success state
10036 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
10040 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
10041 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
10042 impl Drop for CResult_NoneSemanticErrorZ {
10043 fn drop(&mut self) {
10044 if self.result_ok {
10046 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10047 let _ = unsafe { Box::from_raw(self.contents.err) };
10052 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
10053 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
10054 let contents = if o.result_ok {
10055 let _ = unsafe { Box::from_raw(o.contents.result) };
10056 o.contents.result = core::ptr::null_mut();
10057 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
10059 let err = unsafe { o.contents.err };
10060 unsafe { o.contents.err = core::ptr::null_mut(); }
10061 CResult_NoneSemanticErrorZPtr { err }
10065 result_ok: o.result_ok,
10069 impl Clone for CResult_NoneSemanticErrorZ {
10070 fn clone(&self) -> Self {
10071 if self.result_ok {
10072 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
10073 result: core::ptr::null_mut()
10076 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
10077 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10083 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10084 /// but with all dynamically-allocated buffers duplicated in new buffers.
10085 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
10087 /// The contents of CResult_InvoiceSemanticErrorZ
10088 pub union CResult_InvoiceSemanticErrorZPtr {
10089 /// A pointer to the contents in the success state.
10090 /// Reading from this pointer when `result_ok` is not set is undefined.
10091 pub result: *mut crate::lightning_invoice::Invoice,
10092 /// A pointer to the contents in the error state.
10093 /// Reading from this pointer when `result_ok` is set is undefined.
10094 pub err: *mut crate::lightning_invoice::SemanticError,
10097 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10098 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10099 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10100 pub struct CResult_InvoiceSemanticErrorZ {
10101 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10102 /// `err` or `result` depending on the state of `result_ok`.
10103 pub contents: CResult_InvoiceSemanticErrorZPtr,
10104 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10105 pub result_ok: bool,
10108 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10109 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
10110 CResult_InvoiceSemanticErrorZ {
10111 contents: CResult_InvoiceSemanticErrorZPtr {
10112 result: Box::into_raw(Box::new(o)),
10118 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10119 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
10120 CResult_InvoiceSemanticErrorZ {
10121 contents: CResult_InvoiceSemanticErrorZPtr {
10122 err: Box::into_raw(Box::new(e)),
10127 /// Checks if the given object is currently in the success state
10129 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
10133 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10134 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
10135 impl Drop for CResult_InvoiceSemanticErrorZ {
10136 fn drop(&mut self) {
10137 if self.result_ok {
10138 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10139 let _ = unsafe { Box::from_raw(self.contents.result) };
10142 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10143 let _ = unsafe { Box::from_raw(self.contents.err) };
10148 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
10149 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
10150 let contents = if o.result_ok {
10151 let result = unsafe { o.contents.result };
10152 unsafe { o.contents.result = core::ptr::null_mut() };
10153 CResult_InvoiceSemanticErrorZPtr { result }
10155 let err = unsafe { o.contents.err };
10156 unsafe { o.contents.err = core::ptr::null_mut(); }
10157 CResult_InvoiceSemanticErrorZPtr { err }
10161 result_ok: o.result_ok,
10165 impl Clone for CResult_InvoiceSemanticErrorZ {
10166 fn clone(&self) -> Self {
10167 if self.result_ok {
10168 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
10169 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10172 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
10173 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10179 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10180 /// but with all dynamically-allocated buffers duplicated in new buffers.
10181 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
10183 /// The contents of CResult_DescriptionCreationErrorZ
10184 pub union CResult_DescriptionCreationErrorZPtr {
10185 /// A pointer to the contents in the success state.
10186 /// Reading from this pointer when `result_ok` is not set is undefined.
10187 pub result: *mut crate::lightning_invoice::Description,
10188 /// A pointer to the contents in the error state.
10189 /// Reading from this pointer when `result_ok` is set is undefined.
10190 pub err: *mut crate::lightning_invoice::CreationError,
10193 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10194 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10195 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10196 pub struct CResult_DescriptionCreationErrorZ {
10197 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10198 /// `err` or `result` depending on the state of `result_ok`.
10199 pub contents: CResult_DescriptionCreationErrorZPtr,
10200 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
10201 pub result_ok: bool,
10204 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
10205 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
10206 CResult_DescriptionCreationErrorZ {
10207 contents: CResult_DescriptionCreationErrorZPtr {
10208 result: Box::into_raw(Box::new(o)),
10214 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
10215 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
10216 CResult_DescriptionCreationErrorZ {
10217 contents: CResult_DescriptionCreationErrorZPtr {
10218 err: Box::into_raw(Box::new(e)),
10223 /// Checks if the given object is currently in the success state
10225 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
10229 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
10230 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
10231 impl Drop for CResult_DescriptionCreationErrorZ {
10232 fn drop(&mut self) {
10233 if self.result_ok {
10234 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10235 let _ = unsafe { Box::from_raw(self.contents.result) };
10238 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10239 let _ = unsafe { Box::from_raw(self.contents.err) };
10244 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
10245 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
10246 let contents = if o.result_ok {
10247 let result = unsafe { o.contents.result };
10248 unsafe { o.contents.result = core::ptr::null_mut() };
10249 CResult_DescriptionCreationErrorZPtr { result }
10251 let err = unsafe { o.contents.err };
10252 unsafe { o.contents.err = core::ptr::null_mut(); }
10253 CResult_DescriptionCreationErrorZPtr { err }
10257 result_ok: o.result_ok,
10261 impl Clone for CResult_DescriptionCreationErrorZ {
10262 fn clone(&self) -> Self {
10263 if self.result_ok {
10264 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
10265 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
10268 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
10269 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10275 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10276 /// but with all dynamically-allocated buffers duplicated in new buffers.
10277 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
10279 /// The contents of CResult_PrivateRouteCreationErrorZ
10280 pub union CResult_PrivateRouteCreationErrorZPtr {
10281 /// A pointer to the contents in the success state.
10282 /// Reading from this pointer when `result_ok` is not set is undefined.
10283 pub result: *mut crate::lightning_invoice::PrivateRoute,
10284 /// A pointer to the contents in the error state.
10285 /// Reading from this pointer when `result_ok` is set is undefined.
10286 pub err: *mut crate::lightning_invoice::CreationError,
10289 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
10290 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
10291 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10292 pub struct CResult_PrivateRouteCreationErrorZ {
10293 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
10294 /// `err` or `result` depending on the state of `result_ok`.
10295 pub contents: CResult_PrivateRouteCreationErrorZPtr,
10296 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
10297 pub result_ok: bool,
10300 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10301 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
10302 CResult_PrivateRouteCreationErrorZ {
10303 contents: CResult_PrivateRouteCreationErrorZPtr {
10304 result: Box::into_raw(Box::new(o)),
10310 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10311 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
10312 CResult_PrivateRouteCreationErrorZ {
10313 contents: CResult_PrivateRouteCreationErrorZPtr {
10314 err: Box::into_raw(Box::new(e)),
10319 /// Checks if the given object is currently in the success state
10321 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
10325 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10326 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
10327 impl Drop for CResult_PrivateRouteCreationErrorZ {
10328 fn drop(&mut self) {
10329 if self.result_ok {
10330 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10331 let _ = unsafe { Box::from_raw(self.contents.result) };
10334 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10335 let _ = unsafe { Box::from_raw(self.contents.err) };
10340 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
10341 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
10342 let contents = if o.result_ok {
10343 let result = unsafe { o.contents.result };
10344 unsafe { o.contents.result = core::ptr::null_mut() };
10345 CResult_PrivateRouteCreationErrorZPtr { result }
10347 let err = unsafe { o.contents.err };
10348 unsafe { o.contents.err = core::ptr::null_mut(); }
10349 CResult_PrivateRouteCreationErrorZPtr { err }
10353 result_ok: o.result_ok,
10357 impl Clone for CResult_PrivateRouteCreationErrorZ {
10358 fn clone(&self) -> Self {
10359 if self.result_ok {
10360 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
10361 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
10364 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
10365 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10371 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10372 /// but with all dynamically-allocated buffers duplicated in new buffers.
10373 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
10375 /// The contents of CResult_StringErrorZ
10376 pub union CResult_StringErrorZPtr {
10377 /// A pointer to the contents in the success state.
10378 /// Reading from this pointer when `result_ok` is not set is undefined.
10379 pub result: *mut crate::c_types::Str,
10380 /// A pointer to the contents in the error state.
10381 /// Reading from this pointer when `result_ok` is set is undefined.
10382 pub err: *mut crate::c_types::Secp256k1Error,
10385 /// A CResult_StringErrorZ represents the result of a fallible operation,
10386 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10387 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10388 pub struct CResult_StringErrorZ {
10389 /// The contents of this CResult_StringErrorZ, accessible via either
10390 /// `err` or `result` depending on the state of `result_ok`.
10391 pub contents: CResult_StringErrorZPtr,
10392 /// Whether this CResult_StringErrorZ represents a success state.
10393 pub result_ok: bool,
10396 /// Creates a new CResult_StringErrorZ in the success state.
10397 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10398 CResult_StringErrorZ {
10399 contents: CResult_StringErrorZPtr {
10400 result: Box::into_raw(Box::new(o)),
10406 /// Creates a new CResult_StringErrorZ in the error state.
10407 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10408 CResult_StringErrorZ {
10409 contents: CResult_StringErrorZPtr {
10410 err: Box::into_raw(Box::new(e)),
10415 /// Checks if the given object is currently in the success state
10417 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10421 /// Frees any resources used by the CResult_StringErrorZ.
10422 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10423 impl Drop for CResult_StringErrorZ {
10424 fn drop(&mut self) {
10425 if self.result_ok {
10426 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10427 let _ = unsafe { Box::from_raw(self.contents.result) };
10430 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10431 let _ = unsafe { Box::from_raw(self.contents.err) };
10436 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10437 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10438 let contents = if o.result_ok {
10439 let result = unsafe { o.contents.result };
10440 unsafe { o.contents.result = core::ptr::null_mut() };
10441 CResult_StringErrorZPtr { result }
10443 let err = unsafe { o.contents.err };
10444 unsafe { o.contents.err = core::ptr::null_mut(); }
10445 CResult_StringErrorZPtr { err }
10449 result_ok: o.result_ok,
10453 impl Clone for CResult_StringErrorZ {
10454 fn clone(&self) -> Self {
10455 if self.result_ok {
10456 Self { result_ok: true, contents: CResult_StringErrorZPtr {
10457 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10460 Self { result_ok: false, contents: CResult_StringErrorZPtr {
10461 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10467 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10468 /// but with all dynamically-allocated buffers duplicated in new buffers.
10469 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10471 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10472 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10473 /// A pointer to the contents in the success state.
10474 /// Reading from this pointer when `result_ok` is not set is undefined.
10475 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10476 /// A pointer to the contents in the error state.
10477 /// Reading from this pointer when `result_ok` is set is undefined.
10478 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10481 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10482 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10483 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10484 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10485 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10486 /// `err` or `result` depending on the state of `result_ok`.
10487 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10488 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10489 pub result_ok: bool,
10492 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10493 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10494 CResult_ChannelMonitorUpdateDecodeErrorZ {
10495 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10496 result: Box::into_raw(Box::new(o)),
10502 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10503 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10504 CResult_ChannelMonitorUpdateDecodeErrorZ {
10505 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10506 err: Box::into_raw(Box::new(e)),
10511 /// Checks if the given object is currently in the success state
10513 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10517 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10518 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10519 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10520 fn drop(&mut self) {
10521 if self.result_ok {
10522 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10523 let _ = unsafe { Box::from_raw(self.contents.result) };
10526 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10527 let _ = unsafe { Box::from_raw(self.contents.err) };
10532 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10533 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10534 let contents = if o.result_ok {
10535 let result = unsafe { o.contents.result };
10536 unsafe { o.contents.result = core::ptr::null_mut() };
10537 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10539 let err = unsafe { o.contents.err };
10540 unsafe { o.contents.err = core::ptr::null_mut(); }
10541 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10545 result_ok: o.result_ok,
10549 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10550 fn clone(&self) -> Self {
10551 if self.result_ok {
10552 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10553 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10556 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10557 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10563 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10564 /// but with all dynamically-allocated buffers duplicated in new buffers.
10565 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10568 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10569 pub enum COption_MonitorEventZ {
10570 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10571 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10572 /// When we're in this state, this COption_MonitorEventZ contains nothing
10575 impl COption_MonitorEventZ {
10576 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10577 if let Self::None = self { false } else { true }
10579 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10582 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10583 if let Self::Some(v) = self { v } else { unreachable!() }
10587 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10588 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10589 COption_MonitorEventZ::Some(o)
10592 /// Constructs a new COption_MonitorEventZ containing nothing
10593 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10594 COption_MonitorEventZ::None
10597 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10598 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10600 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10601 /// but with all dynamically-allocated buffers duplicated in new buffers.
10602 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10604 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10605 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10606 /// A pointer to the contents in the success state.
10607 /// Reading from this pointer when `result_ok` is not set is undefined.
10608 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10609 /// A pointer to the contents in the error state.
10610 /// Reading from this pointer when `result_ok` is set is undefined.
10611 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10614 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10615 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10617 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10618 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10619 /// `err` or `result` depending on the state of `result_ok`.
10620 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10621 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10622 pub result_ok: bool,
10625 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10626 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10627 CResult_COption_MonitorEventZDecodeErrorZ {
10628 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10629 result: Box::into_raw(Box::new(o)),
10635 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10636 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10637 CResult_COption_MonitorEventZDecodeErrorZ {
10638 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10639 err: Box::into_raw(Box::new(e)),
10644 /// Checks if the given object is currently in the success state
10646 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10650 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10651 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10652 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10653 fn drop(&mut self) {
10654 if self.result_ok {
10655 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10656 let _ = unsafe { Box::from_raw(self.contents.result) };
10659 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10660 let _ = unsafe { Box::from_raw(self.contents.err) };
10665 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10666 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10667 let contents = if o.result_ok {
10668 let result = unsafe { o.contents.result };
10669 unsafe { o.contents.result = core::ptr::null_mut() };
10670 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10672 let err = unsafe { o.contents.err };
10673 unsafe { o.contents.err = core::ptr::null_mut(); }
10674 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10678 result_ok: o.result_ok,
10682 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10683 fn clone(&self) -> Self {
10684 if self.result_ok {
10685 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10686 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10689 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10690 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10696 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10697 /// but with all dynamically-allocated buffers duplicated in new buffers.
10698 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10700 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10701 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10702 /// A pointer to the contents in the success state.
10703 /// Reading from this pointer when `result_ok` is not set is undefined.
10704 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10705 /// A pointer to the contents in the error state.
10706 /// Reading from this pointer when `result_ok` is set is undefined.
10707 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10710 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10711 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10712 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10713 pub struct CResult_HTLCUpdateDecodeErrorZ {
10714 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10715 /// `err` or `result` depending on the state of `result_ok`.
10716 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10717 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10718 pub result_ok: bool,
10721 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10722 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10723 CResult_HTLCUpdateDecodeErrorZ {
10724 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10725 result: Box::into_raw(Box::new(o)),
10731 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10732 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10733 CResult_HTLCUpdateDecodeErrorZ {
10734 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10735 err: Box::into_raw(Box::new(e)),
10740 /// Checks if the given object is currently in the success state
10742 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10746 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10747 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10748 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10749 fn drop(&mut self) {
10750 if self.result_ok {
10751 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10752 let _ = unsafe { Box::from_raw(self.contents.result) };
10755 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10756 let _ = unsafe { Box::from_raw(self.contents.err) };
10761 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10762 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10763 let contents = if o.result_ok {
10764 let result = unsafe { o.contents.result };
10765 unsafe { o.contents.result = core::ptr::null_mut() };
10766 CResult_HTLCUpdateDecodeErrorZPtr { result }
10768 let err = unsafe { o.contents.err };
10769 unsafe { o.contents.err = core::ptr::null_mut(); }
10770 CResult_HTLCUpdateDecodeErrorZPtr { err }
10774 result_ok: o.result_ok,
10778 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10779 fn clone(&self) -> Self {
10780 if self.result_ok {
10781 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10782 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10785 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10786 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10792 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10793 /// but with all dynamically-allocated buffers duplicated in new buffers.
10794 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10796 /// A tuple of 2 elements. See the individual fields for the types contained.
10797 pub struct C2Tuple_OutPointScriptZ {
10798 /// The element at position 0
10799 pub a: crate::lightning::chain::transaction::OutPoint,
10800 /// The element at position 1
10801 pub b: crate::c_types::derived::CVec_u8Z,
10803 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
10804 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10811 impl C2Tuple_OutPointScriptZ {
10812 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10816 impl Clone for C2Tuple_OutPointScriptZ {
10817 fn clone(&self) -> Self {
10819 a: Clone::clone(&self.a),
10820 b: Clone::clone(&self.b),
10825 /// Creates a new tuple which has the same data as `orig`
10826 /// but with all dynamically-allocated buffers duplicated in new buffers.
10827 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
10828 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10830 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
10831 C2Tuple_OutPointScriptZ { a, b, }
10835 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
10836 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
10838 /// A tuple of 2 elements. See the individual fields for the types contained.
10839 pub struct C2Tuple_u32ScriptZ {
10840 /// The element at position 0
10842 /// The element at position 1
10843 pub b: crate::c_types::derived::CVec_u8Z,
10845 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
10846 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10853 impl C2Tuple_u32ScriptZ {
10854 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10858 impl Clone for C2Tuple_u32ScriptZ {
10859 fn clone(&self) -> Self {
10861 a: Clone::clone(&self.a),
10862 b: Clone::clone(&self.b),
10867 /// Creates a new tuple which has the same data as `orig`
10868 /// but with all dynamically-allocated buffers duplicated in new buffers.
10869 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
10870 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
10872 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
10873 C2Tuple_u32ScriptZ { a, b, }
10877 /// Frees any resources used by the C2Tuple_u32ScriptZ.
10878 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
10880 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
10881 /// This corresponds to std::vector in C++
10882 pub struct CVec_C2Tuple_u32ScriptZZ {
10883 /// The elements in the array.
10884 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10885 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
10886 /// The number of elements pointed to by `data`.
10889 impl CVec_C2Tuple_u32ScriptZZ {
10890 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
10891 if self.datalen == 0 { return Vec::new(); }
10892 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10893 self.data = core::ptr::null_mut();
10897 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
10898 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10901 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
10902 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
10903 let datalen = v.len();
10904 let data = Box::into_raw(v.into_boxed_slice());
10905 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10910 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
10911 impl Drop for CVec_C2Tuple_u32ScriptZZ {
10912 fn drop(&mut self) {
10913 if self.datalen == 0 { return; }
10914 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10917 impl Clone for CVec_C2Tuple_u32ScriptZZ {
10918 fn clone(&self) -> Self {
10919 let mut res = Vec::new();
10920 if self.datalen == 0 { return Self::from(res); }
10921 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10926 /// A tuple of 2 elements. See the individual fields for the types contained.
10927 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10928 /// The element at position 0
10929 pub a: crate::c_types::ThirtyTwoBytes,
10930 /// The element at position 1
10931 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
10933 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10934 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
10941 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10942 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
10946 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10947 fn clone(&self) -> Self {
10949 a: Clone::clone(&self.a),
10950 b: Clone::clone(&self.b),
10955 /// Creates a new tuple which has the same data as `orig`
10956 /// but with all dynamically-allocated buffers duplicated in new buffers.
10957 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
10958 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10960 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 {
10961 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
10965 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10966 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
10968 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
10969 /// This corresponds to std::vector in C++
10970 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10971 /// The elements in the array.
10972 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10973 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
10974 /// The number of elements pointed to by `data`.
10977 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10978 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
10979 if self.datalen == 0 { return Vec::new(); }
10980 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10981 self.data = core::ptr::null_mut();
10985 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
10986 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10989 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10990 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
10991 let datalen = v.len();
10992 let data = Box::into_raw(v.into_boxed_slice());
10993 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10997 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10998 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
10999 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11000 fn drop(&mut self) {
11001 if self.datalen == 0 { return; }
11002 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11005 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11006 fn clone(&self) -> Self {
11007 let mut res = Vec::new();
11008 if self.datalen == 0 { return Self::from(res); }
11009 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11014 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11015 /// This corresponds to std::vector in C++
11016 pub struct CVec_EventZ {
11017 /// The elements in the array.
11018 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11019 pub data: *mut crate::lightning::util::events::Event,
11020 /// The number of elements pointed to by `data`.
11024 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11025 if self.datalen == 0 { return Vec::new(); }
11026 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11027 self.data = core::ptr::null_mut();
11031 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11032 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11035 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11036 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11037 let datalen = v.len();
11038 let data = Box::into_raw(v.into_boxed_slice());
11039 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11043 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11044 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11045 impl Drop for CVec_EventZ {
11046 fn drop(&mut self) {
11047 if self.datalen == 0 { return; }
11048 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11051 impl Clone for CVec_EventZ {
11052 fn clone(&self) -> Self {
11053 let mut res = Vec::new();
11054 if self.datalen == 0 { return Self::from(res); }
11055 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11060 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11061 /// This corresponds to std::vector in C++
11062 pub struct CVec_TransactionZ {
11063 /// The elements in the array.
11064 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11065 pub data: *mut crate::c_types::Transaction,
11066 /// The number of elements pointed to by `data`.
11069 impl CVec_TransactionZ {
11070 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11071 if self.datalen == 0 { return Vec::new(); }
11072 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11073 self.data = core::ptr::null_mut();
11077 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11078 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11081 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11082 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11083 let datalen = v.len();
11084 let data = Box::into_raw(v.into_boxed_slice());
11085 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11089 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11090 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11091 impl Drop for CVec_TransactionZ {
11092 fn drop(&mut self) {
11093 if self.datalen == 0 { return; }
11094 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11097 impl Clone for CVec_TransactionZ {
11098 fn clone(&self) -> Self {
11099 let mut res = Vec::new();
11100 if self.datalen == 0 { return Self::from(res); }
11101 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11106 /// A tuple of 2 elements. See the individual fields for the types contained.
11107 pub struct C2Tuple_u32TxOutZ {
11108 /// The element at position 0
11110 /// The element at position 1
11111 pub b: crate::c_types::TxOut,
11113 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11114 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11121 impl C2Tuple_u32TxOutZ {
11122 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11126 impl Clone for C2Tuple_u32TxOutZ {
11127 fn clone(&self) -> Self {
11129 a: Clone::clone(&self.a),
11130 b: Clone::clone(&self.b),
11135 /// Creates a new tuple which has the same data as `orig`
11136 /// but with all dynamically-allocated buffers duplicated in new buffers.
11137 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11138 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11140 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11141 C2Tuple_u32TxOutZ { a, b, }
11145 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11146 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11148 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11149 /// This corresponds to std::vector in C++
11150 pub struct CVec_C2Tuple_u32TxOutZZ {
11151 /// The elements in the array.
11152 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11153 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11154 /// The number of elements pointed to by `data`.
11157 impl CVec_C2Tuple_u32TxOutZZ {
11158 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11159 if self.datalen == 0 { return Vec::new(); }
11160 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11161 self.data = core::ptr::null_mut();
11165 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11166 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11169 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11170 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11171 let datalen = v.len();
11172 let data = Box::into_raw(v.into_boxed_slice());
11173 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11177 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11178 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11179 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11180 fn drop(&mut self) {
11181 if self.datalen == 0 { return; }
11182 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11185 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11186 fn clone(&self) -> Self {
11187 let mut res = Vec::new();
11188 if self.datalen == 0 { return Self::from(res); }
11189 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11194 /// A tuple of 2 elements. See the individual fields for the types contained.
11195 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11196 /// The element at position 0
11197 pub a: crate::c_types::ThirtyTwoBytes,
11198 /// The element at position 1
11199 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11201 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11202 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11209 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11210 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11214 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11215 fn clone(&self) -> Self {
11217 a: Clone::clone(&self.a),
11218 b: Clone::clone(&self.b),
11223 /// Creates a new tuple which has the same data as `orig`
11224 /// but with all dynamically-allocated buffers duplicated in new buffers.
11225 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11226 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11228 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 {
11229 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11233 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11234 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11236 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11237 /// This corresponds to std::vector in C++
11238 pub struct CVec_TransactionOutputsZ {
11239 /// The elements in the array.
11240 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11241 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11242 /// The number of elements pointed to by `data`.
11245 impl CVec_TransactionOutputsZ {
11246 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11247 if self.datalen == 0 { return Vec::new(); }
11248 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11249 self.data = core::ptr::null_mut();
11253 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11254 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11257 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11258 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11259 let datalen = v.len();
11260 let data = Box::into_raw(v.into_boxed_slice());
11261 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11265 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11266 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11267 impl Drop for CVec_TransactionOutputsZ {
11268 fn drop(&mut self) {
11269 if self.datalen == 0 { return; }
11270 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11273 impl Clone for CVec_TransactionOutputsZ {
11274 fn clone(&self) -> Self {
11275 let mut res = Vec::new();
11276 if self.datalen == 0 { return Self::from(res); }
11277 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11282 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11283 /// This corresponds to std::vector in C++
11284 pub struct CVec_BalanceZ {
11285 /// The elements in the array.
11286 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11287 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11288 /// The number of elements pointed to by `data`.
11291 impl CVec_BalanceZ {
11292 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11293 if self.datalen == 0 { return Vec::new(); }
11294 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11295 self.data = core::ptr::null_mut();
11299 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11300 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11303 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11304 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11305 let datalen = v.len();
11306 let data = Box::into_raw(v.into_boxed_slice());
11307 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11311 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11312 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11313 impl Drop for CVec_BalanceZ {
11314 fn drop(&mut self) {
11315 if self.datalen == 0 { return; }
11316 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11319 impl Clone for CVec_BalanceZ {
11320 fn clone(&self) -> Self {
11321 let mut res = Vec::new();
11322 if self.datalen == 0 { return Self::from(res); }
11323 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11328 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11329 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11330 /// A pointer to the contents in the success state.
11331 /// Reading from this pointer when `result_ok` is not set is undefined.
11332 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11333 /// A pointer to the contents in the error state.
11334 /// Reading from this pointer when `result_ok` is set is undefined.
11335 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11338 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11339 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11340 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11341 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11342 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11343 /// `err` or `result` depending on the state of `result_ok`.
11344 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11345 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11346 pub result_ok: bool,
11349 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11350 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11351 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11352 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11353 result: Box::into_raw(Box::new(o)),
11359 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11360 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11361 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11362 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11363 err: Box::into_raw(Box::new(e)),
11368 /// Checks if the given object is currently in the success state
11370 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11374 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11375 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11376 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11377 fn drop(&mut self) {
11378 if self.result_ok {
11379 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11380 let _ = unsafe { Box::from_raw(self.contents.result) };
11383 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11384 let _ = unsafe { Box::from_raw(self.contents.err) };
11389 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11390 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11391 let contents = if o.result_ok {
11392 let result = unsafe { o.contents.result };
11393 unsafe { o.contents.result = core::ptr::null_mut() };
11394 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11396 let err = unsafe { o.contents.err };
11397 unsafe { o.contents.err = core::ptr::null_mut(); }
11398 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11402 result_ok: o.result_ok,
11407 /// A tuple of 2 elements. See the individual fields for the types contained.
11408 pub struct C2Tuple_PublicKeyTypeZ {
11409 /// The element at position 0
11410 pub a: crate::c_types::PublicKey,
11411 /// The element at position 1
11412 pub b: crate::lightning::ln::wire::Type,
11414 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11415 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11422 impl C2Tuple_PublicKeyTypeZ {
11423 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11427 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11429 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11430 C2Tuple_PublicKeyTypeZ { a, b, }
11434 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11435 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11437 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11438 /// This corresponds to std::vector in C++
11439 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11440 /// The elements in the array.
11441 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11442 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11443 /// The number of elements pointed to by `data`.
11446 impl CVec_C2Tuple_PublicKeyTypeZZ {
11447 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11448 if self.datalen == 0 { return Vec::new(); }
11449 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11450 self.data = core::ptr::null_mut();
11454 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11455 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11458 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11459 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11460 let datalen = v.len();
11461 let data = Box::into_raw(v.into_boxed_slice());
11462 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11466 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11467 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11468 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11469 fn drop(&mut self) {
11470 if self.datalen == 0 { return; }
11471 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11476 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11477 pub enum COption_NetAddressZ {
11478 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11479 Some(crate::lightning::ln::msgs::NetAddress),
11480 /// When we're in this state, this COption_NetAddressZ contains nothing
11483 impl COption_NetAddressZ {
11484 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11485 if let Self::None = self { false } else { true }
11487 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11490 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11491 if let Self::Some(v) = self { v } else { unreachable!() }
11495 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11496 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11497 COption_NetAddressZ::Some(o)
11500 /// Constructs a new COption_NetAddressZ containing nothing
11501 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11502 COption_NetAddressZ::None
11505 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11506 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11508 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11509 /// but with all dynamically-allocated buffers duplicated in new buffers.
11510 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11512 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11513 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11514 /// A pointer to the contents in the success state.
11515 /// Reading from this pointer when `result_ok` is not set is undefined.
11516 pub result: *mut crate::c_types::derived::CVec_u8Z,
11517 /// A pointer to the contents in the error state.
11518 /// Reading from this pointer when `result_ok` is set is undefined.
11519 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11522 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11523 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11525 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11526 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11527 /// `err` or `result` depending on the state of `result_ok`.
11528 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11529 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11530 pub result_ok: bool,
11533 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11534 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11535 CResult_CVec_u8ZPeerHandleErrorZ {
11536 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11537 result: Box::into_raw(Box::new(o)),
11543 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11544 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11545 CResult_CVec_u8ZPeerHandleErrorZ {
11546 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11547 err: Box::into_raw(Box::new(e)),
11552 /// Checks if the given object is currently in the success state
11554 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11558 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11559 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11560 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11561 fn drop(&mut self) {
11562 if self.result_ok {
11563 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11564 let _ = unsafe { Box::from_raw(self.contents.result) };
11567 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11568 let _ = unsafe { Box::from_raw(self.contents.err) };
11573 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11574 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11575 let contents = if o.result_ok {
11576 let result = unsafe { o.contents.result };
11577 unsafe { o.contents.result = core::ptr::null_mut() };
11578 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11580 let err = unsafe { o.contents.err };
11581 unsafe { o.contents.err = core::ptr::null_mut(); }
11582 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11586 result_ok: o.result_ok,
11590 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11591 fn clone(&self) -> Self {
11592 if self.result_ok {
11593 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11594 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11597 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11598 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11604 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11605 /// but with all dynamically-allocated buffers duplicated in new buffers.
11606 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11608 /// The contents of CResult_NonePeerHandleErrorZ
11609 pub union CResult_NonePeerHandleErrorZPtr {
11610 /// Note that this value is always NULL, as there are no contents in the OK variant
11611 pub result: *mut core::ffi::c_void,
11612 /// A pointer to the contents in the error state.
11613 /// Reading from this pointer when `result_ok` is set is undefined.
11614 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11617 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11618 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11619 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11620 pub struct CResult_NonePeerHandleErrorZ {
11621 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11622 /// `err` or `result` depending on the state of `result_ok`.
11623 pub contents: CResult_NonePeerHandleErrorZPtr,
11624 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11625 pub result_ok: bool,
11628 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11629 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11630 CResult_NonePeerHandleErrorZ {
11631 contents: CResult_NonePeerHandleErrorZPtr {
11632 result: core::ptr::null_mut(),
11638 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11639 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11640 CResult_NonePeerHandleErrorZ {
11641 contents: CResult_NonePeerHandleErrorZPtr {
11642 err: Box::into_raw(Box::new(e)),
11647 /// Checks if the given object is currently in the success state
11649 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11653 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11654 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11655 impl Drop for CResult_NonePeerHandleErrorZ {
11656 fn drop(&mut self) {
11657 if self.result_ok {
11659 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11660 let _ = unsafe { Box::from_raw(self.contents.err) };
11665 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11666 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11667 let contents = if o.result_ok {
11668 let _ = unsafe { Box::from_raw(o.contents.result) };
11669 o.contents.result = core::ptr::null_mut();
11670 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11672 let err = unsafe { o.contents.err };
11673 unsafe { o.contents.err = core::ptr::null_mut(); }
11674 CResult_NonePeerHandleErrorZPtr { err }
11678 result_ok: o.result_ok,
11682 impl Clone for CResult_NonePeerHandleErrorZ {
11683 fn clone(&self) -> Self {
11684 if self.result_ok {
11685 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11686 result: core::ptr::null_mut()
11689 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11690 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11696 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11697 /// but with all dynamically-allocated buffers duplicated in new buffers.
11698 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11700 /// The contents of CResult_boolPeerHandleErrorZ
11701 pub union CResult_boolPeerHandleErrorZPtr {
11702 /// A pointer to the contents in the success state.
11703 /// Reading from this pointer when `result_ok` is not set is undefined.
11704 pub result: *mut bool,
11705 /// A pointer to the contents in the error state.
11706 /// Reading from this pointer when `result_ok` is set is undefined.
11707 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11710 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11711 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11712 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11713 pub struct CResult_boolPeerHandleErrorZ {
11714 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11715 /// `err` or `result` depending on the state of `result_ok`.
11716 pub contents: CResult_boolPeerHandleErrorZPtr,
11717 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11718 pub result_ok: bool,
11721 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11722 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11723 CResult_boolPeerHandleErrorZ {
11724 contents: CResult_boolPeerHandleErrorZPtr {
11725 result: Box::into_raw(Box::new(o)),
11731 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11732 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
11733 CResult_boolPeerHandleErrorZ {
11734 contents: CResult_boolPeerHandleErrorZPtr {
11735 err: Box::into_raw(Box::new(e)),
11740 /// Checks if the given object is currently in the success state
11742 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
11746 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
11747 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
11748 impl Drop for CResult_boolPeerHandleErrorZ {
11749 fn drop(&mut self) {
11750 if self.result_ok {
11751 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11752 let _ = unsafe { Box::from_raw(self.contents.result) };
11755 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11756 let _ = unsafe { Box::from_raw(self.contents.err) };
11761 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
11762 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11763 let contents = if o.result_ok {
11764 let result = unsafe { o.contents.result };
11765 unsafe { o.contents.result = core::ptr::null_mut() };
11766 CResult_boolPeerHandleErrorZPtr { result }
11768 let err = unsafe { o.contents.err };
11769 unsafe { o.contents.err = core::ptr::null_mut(); }
11770 CResult_boolPeerHandleErrorZPtr { err }
11774 result_ok: o.result_ok,
11778 impl Clone for CResult_boolPeerHandleErrorZ {
11779 fn clone(&self) -> Self {
11780 if self.result_ok {
11781 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
11782 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
11785 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
11786 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11792 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
11793 /// but with all dynamically-allocated buffers duplicated in new buffers.
11794 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
11796 /// The contents of CResult_u32GraphSyncErrorZ
11797 pub union CResult_u32GraphSyncErrorZPtr {
11798 /// A pointer to the contents in the success state.
11799 /// Reading from this pointer when `result_ok` is not set is undefined.
11800 pub result: *mut u32,
11801 /// A pointer to the contents in the error state.
11802 /// Reading from this pointer when `result_ok` is set is undefined.
11803 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
11806 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
11807 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
11808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11809 pub struct CResult_u32GraphSyncErrorZ {
11810 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
11811 /// `err` or `result` depending on the state of `result_ok`.
11812 pub contents: CResult_u32GraphSyncErrorZPtr,
11813 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
11814 pub result_ok: bool,
11817 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
11818 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
11819 CResult_u32GraphSyncErrorZ {
11820 contents: CResult_u32GraphSyncErrorZPtr {
11821 result: Box::into_raw(Box::new(o)),
11827 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
11828 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
11829 CResult_u32GraphSyncErrorZ {
11830 contents: CResult_u32GraphSyncErrorZPtr {
11831 err: Box::into_raw(Box::new(e)),
11836 /// Checks if the given object is currently in the success state
11838 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
11842 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
11843 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
11844 impl Drop for CResult_u32GraphSyncErrorZ {
11845 fn drop(&mut self) {
11846 if self.result_ok {
11847 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11848 let _ = unsafe { Box::from_raw(self.contents.result) };
11851 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11852 let _ = unsafe { Box::from_raw(self.contents.err) };
11857 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
11858 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
11859 let contents = if o.result_ok {
11860 let result = unsafe { o.contents.result };
11861 unsafe { o.contents.result = core::ptr::null_mut() };
11862 CResult_u32GraphSyncErrorZPtr { result }
11864 let err = unsafe { o.contents.err };
11865 unsafe { o.contents.err = core::ptr::null_mut(); }
11866 CResult_u32GraphSyncErrorZPtr { err }
11870 result_ok: o.result_ok,
11875 /// The contents of CResult_NetAddressDecodeErrorZ
11876 pub union CResult_NetAddressDecodeErrorZPtr {
11877 /// A pointer to the contents in the success state.
11878 /// Reading from this pointer when `result_ok` is not set is undefined.
11879 pub result: *mut crate::lightning::ln::msgs::NetAddress,
11880 /// A pointer to the contents in the error state.
11881 /// Reading from this pointer when `result_ok` is set is undefined.
11882 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11885 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11886 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11888 pub struct CResult_NetAddressDecodeErrorZ {
11889 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11890 /// `err` or `result` depending on the state of `result_ok`.
11891 pub contents: CResult_NetAddressDecodeErrorZPtr,
11892 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11893 pub result_ok: bool,
11896 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11897 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11898 CResult_NetAddressDecodeErrorZ {
11899 contents: CResult_NetAddressDecodeErrorZPtr {
11900 result: Box::into_raw(Box::new(o)),
11906 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11907 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11908 CResult_NetAddressDecodeErrorZ {
11909 contents: CResult_NetAddressDecodeErrorZPtr {
11910 err: Box::into_raw(Box::new(e)),
11915 /// Checks if the given object is currently in the success state
11917 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11921 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11922 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11923 impl Drop for CResult_NetAddressDecodeErrorZ {
11924 fn drop(&mut self) {
11925 if self.result_ok {
11926 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11927 let _ = unsafe { Box::from_raw(self.contents.result) };
11930 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11931 let _ = unsafe { Box::from_raw(self.contents.err) };
11936 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11937 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11938 let contents = if o.result_ok {
11939 let result = unsafe { o.contents.result };
11940 unsafe { o.contents.result = core::ptr::null_mut() };
11941 CResult_NetAddressDecodeErrorZPtr { result }
11943 let err = unsafe { o.contents.err };
11944 unsafe { o.contents.err = core::ptr::null_mut(); }
11945 CResult_NetAddressDecodeErrorZPtr { err }
11949 result_ok: o.result_ok,
11953 impl Clone for CResult_NetAddressDecodeErrorZ {
11954 fn clone(&self) -> Self {
11955 if self.result_ok {
11956 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11957 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11960 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11961 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11967 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11968 /// but with all dynamically-allocated buffers duplicated in new buffers.
11969 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11971 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11972 /// This corresponds to std::vector in C++
11973 pub struct CVec_UpdateAddHTLCZ {
11974 /// The elements in the array.
11975 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11976 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11977 /// The number of elements pointed to by `data`.
11980 impl CVec_UpdateAddHTLCZ {
11981 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11982 if self.datalen == 0 { return Vec::new(); }
11983 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11984 self.data = core::ptr::null_mut();
11988 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11989 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11992 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11993 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11994 let datalen = v.len();
11995 let data = Box::into_raw(v.into_boxed_slice());
11996 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12000 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12001 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12002 impl Drop for CVec_UpdateAddHTLCZ {
12003 fn drop(&mut self) {
12004 if self.datalen == 0 { return; }
12005 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12008 impl Clone for CVec_UpdateAddHTLCZ {
12009 fn clone(&self) -> Self {
12010 let mut res = Vec::new();
12011 if self.datalen == 0 { return Self::from(res); }
12012 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12017 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12018 /// This corresponds to std::vector in C++
12019 pub struct CVec_UpdateFulfillHTLCZ {
12020 /// The elements in the array.
12021 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12022 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12023 /// The number of elements pointed to by `data`.
12026 impl CVec_UpdateFulfillHTLCZ {
12027 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12028 if self.datalen == 0 { return Vec::new(); }
12029 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12030 self.data = core::ptr::null_mut();
12034 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12035 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12038 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12039 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12040 let datalen = v.len();
12041 let data = Box::into_raw(v.into_boxed_slice());
12042 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12046 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12047 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12048 impl Drop for CVec_UpdateFulfillHTLCZ {
12049 fn drop(&mut self) {
12050 if self.datalen == 0 { return; }
12051 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12054 impl Clone for CVec_UpdateFulfillHTLCZ {
12055 fn clone(&self) -> Self {
12056 let mut res = Vec::new();
12057 if self.datalen == 0 { return Self::from(res); }
12058 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12063 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12064 /// This corresponds to std::vector in C++
12065 pub struct CVec_UpdateFailHTLCZ {
12066 /// The elements in the array.
12067 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12068 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12069 /// The number of elements pointed to by `data`.
12072 impl CVec_UpdateFailHTLCZ {
12073 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12074 if self.datalen == 0 { return Vec::new(); }
12075 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12076 self.data = core::ptr::null_mut();
12080 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12081 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12084 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12085 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12086 let datalen = v.len();
12087 let data = Box::into_raw(v.into_boxed_slice());
12088 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12092 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12093 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12094 impl Drop for CVec_UpdateFailHTLCZ {
12095 fn drop(&mut self) {
12096 if self.datalen == 0 { return; }
12097 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12100 impl Clone for CVec_UpdateFailHTLCZ {
12101 fn clone(&self) -> Self {
12102 let mut res = Vec::new();
12103 if self.datalen == 0 { return Self::from(res); }
12104 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12109 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12110 /// This corresponds to std::vector in C++
12111 pub struct CVec_UpdateFailMalformedHTLCZ {
12112 /// The elements in the array.
12113 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12114 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12115 /// The number of elements pointed to by `data`.
12118 impl CVec_UpdateFailMalformedHTLCZ {
12119 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12120 if self.datalen == 0 { return Vec::new(); }
12121 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12122 self.data = core::ptr::null_mut();
12126 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12127 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12130 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12131 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12132 let datalen = v.len();
12133 let data = Box::into_raw(v.into_boxed_slice());
12134 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12138 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12139 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12140 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12141 fn drop(&mut self) {
12142 if self.datalen == 0 { return; }
12143 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12146 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12147 fn clone(&self) -> Self {
12148 let mut res = Vec::new();
12149 if self.datalen == 0 { return Self::from(res); }
12150 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12155 /// The contents of CResult_AcceptChannelDecodeErrorZ
12156 pub union CResult_AcceptChannelDecodeErrorZPtr {
12157 /// A pointer to the contents in the success state.
12158 /// Reading from this pointer when `result_ok` is not set is undefined.
12159 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12160 /// A pointer to the contents in the error state.
12161 /// Reading from this pointer when `result_ok` is set is undefined.
12162 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12165 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12166 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12167 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12168 pub struct CResult_AcceptChannelDecodeErrorZ {
12169 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12170 /// `err` or `result` depending on the state of `result_ok`.
12171 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12172 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12173 pub result_ok: bool,
12176 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12177 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12178 CResult_AcceptChannelDecodeErrorZ {
12179 contents: CResult_AcceptChannelDecodeErrorZPtr {
12180 result: Box::into_raw(Box::new(o)),
12186 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12187 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12188 CResult_AcceptChannelDecodeErrorZ {
12189 contents: CResult_AcceptChannelDecodeErrorZPtr {
12190 err: Box::into_raw(Box::new(e)),
12195 /// Checks if the given object is currently in the success state
12197 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12201 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12202 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12203 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12204 fn drop(&mut self) {
12205 if self.result_ok {
12206 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12207 let _ = unsafe { Box::from_raw(self.contents.result) };
12210 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12211 let _ = unsafe { Box::from_raw(self.contents.err) };
12216 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12217 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12218 let contents = if o.result_ok {
12219 let result = unsafe { o.contents.result };
12220 unsafe { o.contents.result = core::ptr::null_mut() };
12221 CResult_AcceptChannelDecodeErrorZPtr { result }
12223 let err = unsafe { o.contents.err };
12224 unsafe { o.contents.err = core::ptr::null_mut(); }
12225 CResult_AcceptChannelDecodeErrorZPtr { err }
12229 result_ok: o.result_ok,
12233 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12234 fn clone(&self) -> Self {
12235 if self.result_ok {
12236 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12237 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12240 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12241 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12247 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12248 /// but with all dynamically-allocated buffers duplicated in new buffers.
12249 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12251 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12252 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12253 /// A pointer to the contents in the success state.
12254 /// Reading from this pointer when `result_ok` is not set is undefined.
12255 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12256 /// A pointer to the contents in the error state.
12257 /// Reading from this pointer when `result_ok` is set is undefined.
12258 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12261 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12262 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12264 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12265 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12266 /// `err` or `result` depending on the state of `result_ok`.
12267 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12268 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12269 pub result_ok: bool,
12272 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12273 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12274 CResult_AnnouncementSignaturesDecodeErrorZ {
12275 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12276 result: Box::into_raw(Box::new(o)),
12282 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12283 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12284 CResult_AnnouncementSignaturesDecodeErrorZ {
12285 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12286 err: Box::into_raw(Box::new(e)),
12291 /// Checks if the given object is currently in the success state
12293 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12297 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12298 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12299 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12300 fn drop(&mut self) {
12301 if self.result_ok {
12302 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12303 let _ = unsafe { Box::from_raw(self.contents.result) };
12306 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12307 let _ = unsafe { Box::from_raw(self.contents.err) };
12312 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12313 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12314 let contents = if o.result_ok {
12315 let result = unsafe { o.contents.result };
12316 unsafe { o.contents.result = core::ptr::null_mut() };
12317 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12319 let err = unsafe { o.contents.err };
12320 unsafe { o.contents.err = core::ptr::null_mut(); }
12321 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12325 result_ok: o.result_ok,
12329 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12330 fn clone(&self) -> Self {
12331 if self.result_ok {
12332 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12333 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12336 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12337 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12343 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12344 /// but with all dynamically-allocated buffers duplicated in new buffers.
12345 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12347 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12348 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12349 /// A pointer to the contents in the success state.
12350 /// Reading from this pointer when `result_ok` is not set is undefined.
12351 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12352 /// A pointer to the contents in the error state.
12353 /// Reading from this pointer when `result_ok` is set is undefined.
12354 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12357 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12358 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12360 pub struct CResult_ChannelReestablishDecodeErrorZ {
12361 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12362 /// `err` or `result` depending on the state of `result_ok`.
12363 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12364 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12365 pub result_ok: bool,
12368 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12369 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12370 CResult_ChannelReestablishDecodeErrorZ {
12371 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12372 result: Box::into_raw(Box::new(o)),
12378 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12379 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12380 CResult_ChannelReestablishDecodeErrorZ {
12381 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12382 err: Box::into_raw(Box::new(e)),
12387 /// Checks if the given object is currently in the success state
12389 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12393 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12394 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12395 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12396 fn drop(&mut self) {
12397 if self.result_ok {
12398 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12399 let _ = unsafe { Box::from_raw(self.contents.result) };
12402 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12403 let _ = unsafe { Box::from_raw(self.contents.err) };
12408 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12409 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12410 let contents = if o.result_ok {
12411 let result = unsafe { o.contents.result };
12412 unsafe { o.contents.result = core::ptr::null_mut() };
12413 CResult_ChannelReestablishDecodeErrorZPtr { result }
12415 let err = unsafe { o.contents.err };
12416 unsafe { o.contents.err = core::ptr::null_mut(); }
12417 CResult_ChannelReestablishDecodeErrorZPtr { err }
12421 result_ok: o.result_ok,
12425 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12426 fn clone(&self) -> Self {
12427 if self.result_ok {
12428 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12429 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12432 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12433 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12439 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12440 /// but with all dynamically-allocated buffers duplicated in new buffers.
12441 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12443 /// The contents of CResult_ClosingSignedDecodeErrorZ
12444 pub union CResult_ClosingSignedDecodeErrorZPtr {
12445 /// A pointer to the contents in the success state.
12446 /// Reading from this pointer when `result_ok` is not set is undefined.
12447 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12448 /// A pointer to the contents in the error state.
12449 /// Reading from this pointer when `result_ok` is set is undefined.
12450 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12453 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12454 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12455 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12456 pub struct CResult_ClosingSignedDecodeErrorZ {
12457 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12458 /// `err` or `result` depending on the state of `result_ok`.
12459 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12460 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12461 pub result_ok: bool,
12464 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12465 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12466 CResult_ClosingSignedDecodeErrorZ {
12467 contents: CResult_ClosingSignedDecodeErrorZPtr {
12468 result: Box::into_raw(Box::new(o)),
12474 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12475 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12476 CResult_ClosingSignedDecodeErrorZ {
12477 contents: CResult_ClosingSignedDecodeErrorZPtr {
12478 err: Box::into_raw(Box::new(e)),
12483 /// Checks if the given object is currently in the success state
12485 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12489 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12490 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12491 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12492 fn drop(&mut self) {
12493 if self.result_ok {
12494 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12495 let _ = unsafe { Box::from_raw(self.contents.result) };
12498 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12499 let _ = unsafe { Box::from_raw(self.contents.err) };
12504 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12505 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12506 let contents = if o.result_ok {
12507 let result = unsafe { o.contents.result };
12508 unsafe { o.contents.result = core::ptr::null_mut() };
12509 CResult_ClosingSignedDecodeErrorZPtr { result }
12511 let err = unsafe { o.contents.err };
12512 unsafe { o.contents.err = core::ptr::null_mut(); }
12513 CResult_ClosingSignedDecodeErrorZPtr { err }
12517 result_ok: o.result_ok,
12521 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12522 fn clone(&self) -> Self {
12523 if self.result_ok {
12524 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12525 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12528 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12529 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12535 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12536 /// but with all dynamically-allocated buffers duplicated in new buffers.
12537 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12539 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12540 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12541 /// A pointer to the contents in the success state.
12542 /// Reading from this pointer when `result_ok` is not set is undefined.
12543 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12544 /// A pointer to the contents in the error state.
12545 /// Reading from this pointer when `result_ok` is set is undefined.
12546 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12549 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12550 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12552 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12553 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12554 /// `err` or `result` depending on the state of `result_ok`.
12555 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12556 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12557 pub result_ok: bool,
12560 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12561 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12562 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12563 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12564 result: Box::into_raw(Box::new(o)),
12570 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12571 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12572 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12573 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12574 err: Box::into_raw(Box::new(e)),
12579 /// Checks if the given object is currently in the success state
12581 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12585 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12586 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12587 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12588 fn drop(&mut self) {
12589 if self.result_ok {
12590 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12591 let _ = unsafe { Box::from_raw(self.contents.result) };
12594 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12595 let _ = unsafe { Box::from_raw(self.contents.err) };
12600 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12601 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12602 let contents = if o.result_ok {
12603 let result = unsafe { o.contents.result };
12604 unsafe { o.contents.result = core::ptr::null_mut() };
12605 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12607 let err = unsafe { o.contents.err };
12608 unsafe { o.contents.err = core::ptr::null_mut(); }
12609 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12613 result_ok: o.result_ok,
12617 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12618 fn clone(&self) -> Self {
12619 if self.result_ok {
12620 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12621 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12624 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12625 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12631 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12632 /// but with all dynamically-allocated buffers duplicated in new buffers.
12633 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12635 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12636 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12637 /// A pointer to the contents in the success state.
12638 /// Reading from this pointer when `result_ok` is not set is undefined.
12639 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12640 /// A pointer to the contents in the error state.
12641 /// Reading from this pointer when `result_ok` is set is undefined.
12642 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12645 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12646 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12648 pub struct CResult_CommitmentSignedDecodeErrorZ {
12649 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12650 /// `err` or `result` depending on the state of `result_ok`.
12651 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12652 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12653 pub result_ok: bool,
12656 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12657 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12658 CResult_CommitmentSignedDecodeErrorZ {
12659 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12660 result: Box::into_raw(Box::new(o)),
12666 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12667 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12668 CResult_CommitmentSignedDecodeErrorZ {
12669 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12670 err: Box::into_raw(Box::new(e)),
12675 /// Checks if the given object is currently in the success state
12677 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12681 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12682 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12683 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12684 fn drop(&mut self) {
12685 if self.result_ok {
12686 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12687 let _ = unsafe { Box::from_raw(self.contents.result) };
12690 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12691 let _ = unsafe { Box::from_raw(self.contents.err) };
12696 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12697 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12698 let contents = if o.result_ok {
12699 let result = unsafe { o.contents.result };
12700 unsafe { o.contents.result = core::ptr::null_mut() };
12701 CResult_CommitmentSignedDecodeErrorZPtr { result }
12703 let err = unsafe { o.contents.err };
12704 unsafe { o.contents.err = core::ptr::null_mut(); }
12705 CResult_CommitmentSignedDecodeErrorZPtr { err }
12709 result_ok: o.result_ok,
12713 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12714 fn clone(&self) -> Self {
12715 if self.result_ok {
12716 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12717 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12720 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12721 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12727 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12728 /// but with all dynamically-allocated buffers duplicated in new buffers.
12729 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12731 /// The contents of CResult_FundingCreatedDecodeErrorZ
12732 pub union CResult_FundingCreatedDecodeErrorZPtr {
12733 /// A pointer to the contents in the success state.
12734 /// Reading from this pointer when `result_ok` is not set is undefined.
12735 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12736 /// A pointer to the contents in the error state.
12737 /// Reading from this pointer when `result_ok` is set is undefined.
12738 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12741 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12742 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12744 pub struct CResult_FundingCreatedDecodeErrorZ {
12745 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12746 /// `err` or `result` depending on the state of `result_ok`.
12747 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12748 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12749 pub result_ok: bool,
12752 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12753 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12754 CResult_FundingCreatedDecodeErrorZ {
12755 contents: CResult_FundingCreatedDecodeErrorZPtr {
12756 result: Box::into_raw(Box::new(o)),
12762 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12763 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12764 CResult_FundingCreatedDecodeErrorZ {
12765 contents: CResult_FundingCreatedDecodeErrorZPtr {
12766 err: Box::into_raw(Box::new(e)),
12771 /// Checks if the given object is currently in the success state
12773 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12777 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12778 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12779 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12780 fn drop(&mut self) {
12781 if self.result_ok {
12782 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12783 let _ = unsafe { Box::from_raw(self.contents.result) };
12786 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12787 let _ = unsafe { Box::from_raw(self.contents.err) };
12792 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12793 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12794 let contents = if o.result_ok {
12795 let result = unsafe { o.contents.result };
12796 unsafe { o.contents.result = core::ptr::null_mut() };
12797 CResult_FundingCreatedDecodeErrorZPtr { result }
12799 let err = unsafe { o.contents.err };
12800 unsafe { o.contents.err = core::ptr::null_mut(); }
12801 CResult_FundingCreatedDecodeErrorZPtr { err }
12805 result_ok: o.result_ok,
12809 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12810 fn clone(&self) -> Self {
12811 if self.result_ok {
12812 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12813 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12816 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12817 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12823 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12824 /// but with all dynamically-allocated buffers duplicated in new buffers.
12825 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12827 /// The contents of CResult_FundingSignedDecodeErrorZ
12828 pub union CResult_FundingSignedDecodeErrorZPtr {
12829 /// A pointer to the contents in the success state.
12830 /// Reading from this pointer when `result_ok` is not set is undefined.
12831 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12832 /// A pointer to the contents in the error state.
12833 /// Reading from this pointer when `result_ok` is set is undefined.
12834 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12837 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12838 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12839 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12840 pub struct CResult_FundingSignedDecodeErrorZ {
12841 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12842 /// `err` or `result` depending on the state of `result_ok`.
12843 pub contents: CResult_FundingSignedDecodeErrorZPtr,
12844 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12845 pub result_ok: bool,
12848 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12849 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12850 CResult_FundingSignedDecodeErrorZ {
12851 contents: CResult_FundingSignedDecodeErrorZPtr {
12852 result: Box::into_raw(Box::new(o)),
12858 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12859 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12860 CResult_FundingSignedDecodeErrorZ {
12861 contents: CResult_FundingSignedDecodeErrorZPtr {
12862 err: Box::into_raw(Box::new(e)),
12867 /// Checks if the given object is currently in the success state
12869 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12873 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12874 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12875 impl Drop for CResult_FundingSignedDecodeErrorZ {
12876 fn drop(&mut self) {
12877 if self.result_ok {
12878 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12879 let _ = unsafe { Box::from_raw(self.contents.result) };
12882 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12883 let _ = unsafe { Box::from_raw(self.contents.err) };
12888 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12889 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12890 let contents = if o.result_ok {
12891 let result = unsafe { o.contents.result };
12892 unsafe { o.contents.result = core::ptr::null_mut() };
12893 CResult_FundingSignedDecodeErrorZPtr { result }
12895 let err = unsafe { o.contents.err };
12896 unsafe { o.contents.err = core::ptr::null_mut(); }
12897 CResult_FundingSignedDecodeErrorZPtr { err }
12901 result_ok: o.result_ok,
12905 impl Clone for CResult_FundingSignedDecodeErrorZ {
12906 fn clone(&self) -> Self {
12907 if self.result_ok {
12908 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12909 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12912 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12913 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12919 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12920 /// but with all dynamically-allocated buffers duplicated in new buffers.
12921 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12923 /// The contents of CResult_ChannelReadyDecodeErrorZ
12924 pub union CResult_ChannelReadyDecodeErrorZPtr {
12925 /// A pointer to the contents in the success state.
12926 /// Reading from this pointer when `result_ok` is not set is undefined.
12927 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
12928 /// A pointer to the contents in the error state.
12929 /// Reading from this pointer when `result_ok` is set is undefined.
12930 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12933 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
12934 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
12935 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12936 pub struct CResult_ChannelReadyDecodeErrorZ {
12937 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
12938 /// `err` or `result` depending on the state of `result_ok`.
12939 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
12940 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
12941 pub result_ok: bool,
12944 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
12945 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
12946 CResult_ChannelReadyDecodeErrorZ {
12947 contents: CResult_ChannelReadyDecodeErrorZPtr {
12948 result: Box::into_raw(Box::new(o)),
12954 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
12955 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
12956 CResult_ChannelReadyDecodeErrorZ {
12957 contents: CResult_ChannelReadyDecodeErrorZPtr {
12958 err: Box::into_raw(Box::new(e)),
12963 /// Checks if the given object is currently in the success state
12965 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
12969 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
12970 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
12971 impl Drop for CResult_ChannelReadyDecodeErrorZ {
12972 fn drop(&mut self) {
12973 if self.result_ok {
12974 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12975 let _ = unsafe { Box::from_raw(self.contents.result) };
12978 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12979 let _ = unsafe { Box::from_raw(self.contents.err) };
12984 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
12985 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
12986 let contents = if o.result_ok {
12987 let result = unsafe { o.contents.result };
12988 unsafe { o.contents.result = core::ptr::null_mut() };
12989 CResult_ChannelReadyDecodeErrorZPtr { result }
12991 let err = unsafe { o.contents.err };
12992 unsafe { o.contents.err = core::ptr::null_mut(); }
12993 CResult_ChannelReadyDecodeErrorZPtr { err }
12997 result_ok: o.result_ok,
13001 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13002 fn clone(&self) -> Self {
13003 if self.result_ok {
13004 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13005 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13008 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13009 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13015 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13016 /// but with all dynamically-allocated buffers duplicated in new buffers.
13017 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13019 /// The contents of CResult_InitDecodeErrorZ
13020 pub union CResult_InitDecodeErrorZPtr {
13021 /// A pointer to the contents in the success state.
13022 /// Reading from this pointer when `result_ok` is not set is undefined.
13023 pub result: *mut crate::lightning::ln::msgs::Init,
13024 /// A pointer to the contents in the error state.
13025 /// Reading from this pointer when `result_ok` is set is undefined.
13026 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13029 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13030 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13032 pub struct CResult_InitDecodeErrorZ {
13033 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13034 /// `err` or `result` depending on the state of `result_ok`.
13035 pub contents: CResult_InitDecodeErrorZPtr,
13036 /// Whether this CResult_InitDecodeErrorZ represents a success state.
13037 pub result_ok: bool,
13040 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13041 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13042 CResult_InitDecodeErrorZ {
13043 contents: CResult_InitDecodeErrorZPtr {
13044 result: Box::into_raw(Box::new(o)),
13050 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13051 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13052 CResult_InitDecodeErrorZ {
13053 contents: CResult_InitDecodeErrorZPtr {
13054 err: Box::into_raw(Box::new(e)),
13059 /// Checks if the given object is currently in the success state
13061 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13065 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13066 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13067 impl Drop for CResult_InitDecodeErrorZ {
13068 fn drop(&mut self) {
13069 if self.result_ok {
13070 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13071 let _ = unsafe { Box::from_raw(self.contents.result) };
13074 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13075 let _ = unsafe { Box::from_raw(self.contents.err) };
13080 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
13081 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
13082 let contents = if o.result_ok {
13083 let result = unsafe { o.contents.result };
13084 unsafe { o.contents.result = core::ptr::null_mut() };
13085 CResult_InitDecodeErrorZPtr { result }
13087 let err = unsafe { o.contents.err };
13088 unsafe { o.contents.err = core::ptr::null_mut(); }
13089 CResult_InitDecodeErrorZPtr { err }
13093 result_ok: o.result_ok,
13097 impl Clone for CResult_InitDecodeErrorZ {
13098 fn clone(&self) -> Self {
13099 if self.result_ok {
13100 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
13101 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
13104 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
13105 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13111 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13112 /// but with all dynamically-allocated buffers duplicated in new buffers.
13113 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
13115 /// The contents of CResult_OpenChannelDecodeErrorZ
13116 pub union CResult_OpenChannelDecodeErrorZPtr {
13117 /// A pointer to the contents in the success state.
13118 /// Reading from this pointer when `result_ok` is not set is undefined.
13119 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
13120 /// A pointer to the contents in the error state.
13121 /// Reading from this pointer when `result_ok` is set is undefined.
13122 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13125 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
13126 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13127 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13128 pub struct CResult_OpenChannelDecodeErrorZ {
13129 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
13130 /// `err` or `result` depending on the state of `result_ok`.
13131 pub contents: CResult_OpenChannelDecodeErrorZPtr,
13132 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
13133 pub result_ok: bool,
13136 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13137 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13138 CResult_OpenChannelDecodeErrorZ {
13139 contents: CResult_OpenChannelDecodeErrorZPtr {
13140 result: Box::into_raw(Box::new(o)),
13146 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13147 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13148 CResult_OpenChannelDecodeErrorZ {
13149 contents: CResult_OpenChannelDecodeErrorZPtr {
13150 err: Box::into_raw(Box::new(e)),
13155 /// Checks if the given object is currently in the success state
13157 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13161 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13162 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13163 impl Drop for CResult_OpenChannelDecodeErrorZ {
13164 fn drop(&mut self) {
13165 if self.result_ok {
13166 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13167 let _ = unsafe { Box::from_raw(self.contents.result) };
13170 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13171 let _ = unsafe { Box::from_raw(self.contents.err) };
13176 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13177 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13178 let contents = if o.result_ok {
13179 let result = unsafe { o.contents.result };
13180 unsafe { o.contents.result = core::ptr::null_mut() };
13181 CResult_OpenChannelDecodeErrorZPtr { result }
13183 let err = unsafe { o.contents.err };
13184 unsafe { o.contents.err = core::ptr::null_mut(); }
13185 CResult_OpenChannelDecodeErrorZPtr { err }
13189 result_ok: o.result_ok,
13193 impl Clone for CResult_OpenChannelDecodeErrorZ {
13194 fn clone(&self) -> Self {
13195 if self.result_ok {
13196 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13197 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13200 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13201 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13207 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13208 /// but with all dynamically-allocated buffers duplicated in new buffers.
13209 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13211 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13212 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13213 /// A pointer to the contents in the success state.
13214 /// Reading from this pointer when `result_ok` is not set is undefined.
13215 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13216 /// A pointer to the contents in the error state.
13217 /// Reading from this pointer when `result_ok` is set is undefined.
13218 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13221 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13222 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13223 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13224 pub struct CResult_RevokeAndACKDecodeErrorZ {
13225 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13226 /// `err` or `result` depending on the state of `result_ok`.
13227 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13228 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13229 pub result_ok: bool,
13232 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13233 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13234 CResult_RevokeAndACKDecodeErrorZ {
13235 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13236 result: Box::into_raw(Box::new(o)),
13242 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13243 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13244 CResult_RevokeAndACKDecodeErrorZ {
13245 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13246 err: Box::into_raw(Box::new(e)),
13251 /// Checks if the given object is currently in the success state
13253 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13257 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13258 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13259 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13260 fn drop(&mut self) {
13261 if self.result_ok {
13262 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13263 let _ = unsafe { Box::from_raw(self.contents.result) };
13266 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13267 let _ = unsafe { Box::from_raw(self.contents.err) };
13272 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13273 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13274 let contents = if o.result_ok {
13275 let result = unsafe { o.contents.result };
13276 unsafe { o.contents.result = core::ptr::null_mut() };
13277 CResult_RevokeAndACKDecodeErrorZPtr { result }
13279 let err = unsafe { o.contents.err };
13280 unsafe { o.contents.err = core::ptr::null_mut(); }
13281 CResult_RevokeAndACKDecodeErrorZPtr { err }
13285 result_ok: o.result_ok,
13289 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13290 fn clone(&self) -> Self {
13291 if self.result_ok {
13292 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13293 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13296 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13297 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13303 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13304 /// but with all dynamically-allocated buffers duplicated in new buffers.
13305 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13307 /// The contents of CResult_ShutdownDecodeErrorZ
13308 pub union CResult_ShutdownDecodeErrorZPtr {
13309 /// A pointer to the contents in the success state.
13310 /// Reading from this pointer when `result_ok` is not set is undefined.
13311 pub result: *mut crate::lightning::ln::msgs::Shutdown,
13312 /// A pointer to the contents in the error state.
13313 /// Reading from this pointer when `result_ok` is set is undefined.
13314 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13317 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13318 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13319 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13320 pub struct CResult_ShutdownDecodeErrorZ {
13321 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13322 /// `err` or `result` depending on the state of `result_ok`.
13323 pub contents: CResult_ShutdownDecodeErrorZPtr,
13324 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13325 pub result_ok: bool,
13328 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13329 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13330 CResult_ShutdownDecodeErrorZ {
13331 contents: CResult_ShutdownDecodeErrorZPtr {
13332 result: Box::into_raw(Box::new(o)),
13338 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13339 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13340 CResult_ShutdownDecodeErrorZ {
13341 contents: CResult_ShutdownDecodeErrorZPtr {
13342 err: Box::into_raw(Box::new(e)),
13347 /// Checks if the given object is currently in the success state
13349 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13353 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13354 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13355 impl Drop for CResult_ShutdownDecodeErrorZ {
13356 fn drop(&mut self) {
13357 if self.result_ok {
13358 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13359 let _ = unsafe { Box::from_raw(self.contents.result) };
13362 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13363 let _ = unsafe { Box::from_raw(self.contents.err) };
13368 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13369 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13370 let contents = if o.result_ok {
13371 let result = unsafe { o.contents.result };
13372 unsafe { o.contents.result = core::ptr::null_mut() };
13373 CResult_ShutdownDecodeErrorZPtr { result }
13375 let err = unsafe { o.contents.err };
13376 unsafe { o.contents.err = core::ptr::null_mut(); }
13377 CResult_ShutdownDecodeErrorZPtr { err }
13381 result_ok: o.result_ok,
13385 impl Clone for CResult_ShutdownDecodeErrorZ {
13386 fn clone(&self) -> Self {
13387 if self.result_ok {
13388 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13389 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13392 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13393 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13399 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13400 /// but with all dynamically-allocated buffers duplicated in new buffers.
13401 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13403 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13404 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13405 /// A pointer to the contents in the success state.
13406 /// Reading from this pointer when `result_ok` is not set is undefined.
13407 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13408 /// A pointer to the contents in the error state.
13409 /// Reading from this pointer when `result_ok` is set is undefined.
13410 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13413 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13414 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13415 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13416 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13417 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13418 /// `err` or `result` depending on the state of `result_ok`.
13419 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13420 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13421 pub result_ok: bool,
13424 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13425 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13426 CResult_UpdateFailHTLCDecodeErrorZ {
13427 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13428 result: Box::into_raw(Box::new(o)),
13434 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13435 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13436 CResult_UpdateFailHTLCDecodeErrorZ {
13437 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13438 err: Box::into_raw(Box::new(e)),
13443 /// Checks if the given object is currently in the success state
13445 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13449 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13450 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13451 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13452 fn drop(&mut self) {
13453 if self.result_ok {
13454 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13455 let _ = unsafe { Box::from_raw(self.contents.result) };
13458 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13459 let _ = unsafe { Box::from_raw(self.contents.err) };
13464 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13465 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13466 let contents = if o.result_ok {
13467 let result = unsafe { o.contents.result };
13468 unsafe { o.contents.result = core::ptr::null_mut() };
13469 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13471 let err = unsafe { o.contents.err };
13472 unsafe { o.contents.err = core::ptr::null_mut(); }
13473 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13477 result_ok: o.result_ok,
13481 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13482 fn clone(&self) -> Self {
13483 if self.result_ok {
13484 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13485 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13488 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13489 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13495 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13496 /// but with all dynamically-allocated buffers duplicated in new buffers.
13497 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13499 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13500 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13501 /// A pointer to the contents in the success state.
13502 /// Reading from this pointer when `result_ok` is not set is undefined.
13503 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13504 /// A pointer to the contents in the error state.
13505 /// Reading from this pointer when `result_ok` is set is undefined.
13506 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13509 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13510 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13512 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13513 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13514 /// `err` or `result` depending on the state of `result_ok`.
13515 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13516 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13517 pub result_ok: bool,
13520 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13521 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13522 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13523 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13524 result: Box::into_raw(Box::new(o)),
13530 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13531 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13532 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13533 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13534 err: Box::into_raw(Box::new(e)),
13539 /// Checks if the given object is currently in the success state
13541 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13545 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13546 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13547 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13548 fn drop(&mut self) {
13549 if self.result_ok {
13550 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13551 let _ = unsafe { Box::from_raw(self.contents.result) };
13554 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13555 let _ = unsafe { Box::from_raw(self.contents.err) };
13560 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13561 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13562 let contents = if o.result_ok {
13563 let result = unsafe { o.contents.result };
13564 unsafe { o.contents.result = core::ptr::null_mut() };
13565 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13567 let err = unsafe { o.contents.err };
13568 unsafe { o.contents.err = core::ptr::null_mut(); }
13569 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13573 result_ok: o.result_ok,
13577 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13578 fn clone(&self) -> Self {
13579 if self.result_ok {
13580 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13581 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13584 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13585 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13591 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13592 /// but with all dynamically-allocated buffers duplicated in new buffers.
13593 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13595 /// The contents of CResult_UpdateFeeDecodeErrorZ
13596 pub union CResult_UpdateFeeDecodeErrorZPtr {
13597 /// A pointer to the contents in the success state.
13598 /// Reading from this pointer when `result_ok` is not set is undefined.
13599 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13600 /// A pointer to the contents in the error state.
13601 /// Reading from this pointer when `result_ok` is set is undefined.
13602 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13605 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13606 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13608 pub struct CResult_UpdateFeeDecodeErrorZ {
13609 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13610 /// `err` or `result` depending on the state of `result_ok`.
13611 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13612 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13613 pub result_ok: bool,
13616 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13617 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13618 CResult_UpdateFeeDecodeErrorZ {
13619 contents: CResult_UpdateFeeDecodeErrorZPtr {
13620 result: Box::into_raw(Box::new(o)),
13626 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13627 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13628 CResult_UpdateFeeDecodeErrorZ {
13629 contents: CResult_UpdateFeeDecodeErrorZPtr {
13630 err: Box::into_raw(Box::new(e)),
13635 /// Checks if the given object is currently in the success state
13637 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13641 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13642 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13643 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13644 fn drop(&mut self) {
13645 if self.result_ok {
13646 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13647 let _ = unsafe { Box::from_raw(self.contents.result) };
13650 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13651 let _ = unsafe { Box::from_raw(self.contents.err) };
13656 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13657 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13658 let contents = if o.result_ok {
13659 let result = unsafe { o.contents.result };
13660 unsafe { o.contents.result = core::ptr::null_mut() };
13661 CResult_UpdateFeeDecodeErrorZPtr { result }
13663 let err = unsafe { o.contents.err };
13664 unsafe { o.contents.err = core::ptr::null_mut(); }
13665 CResult_UpdateFeeDecodeErrorZPtr { err }
13669 result_ok: o.result_ok,
13673 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13674 fn clone(&self) -> Self {
13675 if self.result_ok {
13676 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13677 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13680 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13681 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13687 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13688 /// but with all dynamically-allocated buffers duplicated in new buffers.
13689 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13691 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13692 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13693 /// A pointer to the contents in the success state.
13694 /// Reading from this pointer when `result_ok` is not set is undefined.
13695 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13696 /// A pointer to the contents in the error state.
13697 /// Reading from this pointer when `result_ok` is set is undefined.
13698 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13701 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13702 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13703 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13704 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13705 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13706 /// `err` or `result` depending on the state of `result_ok`.
13707 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13708 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13709 pub result_ok: bool,
13712 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13713 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13714 CResult_UpdateFulfillHTLCDecodeErrorZ {
13715 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13716 result: Box::into_raw(Box::new(o)),
13722 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13723 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13724 CResult_UpdateFulfillHTLCDecodeErrorZ {
13725 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13726 err: Box::into_raw(Box::new(e)),
13731 /// Checks if the given object is currently in the success state
13733 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13737 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13738 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13739 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13740 fn drop(&mut self) {
13741 if self.result_ok {
13742 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13743 let _ = unsafe { Box::from_raw(self.contents.result) };
13746 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13747 let _ = unsafe { Box::from_raw(self.contents.err) };
13752 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13753 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13754 let contents = if o.result_ok {
13755 let result = unsafe { o.contents.result };
13756 unsafe { o.contents.result = core::ptr::null_mut() };
13757 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13759 let err = unsafe { o.contents.err };
13760 unsafe { o.contents.err = core::ptr::null_mut(); }
13761 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13765 result_ok: o.result_ok,
13769 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13770 fn clone(&self) -> Self {
13771 if self.result_ok {
13772 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13773 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13776 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13777 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13783 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13784 /// but with all dynamically-allocated buffers duplicated in new buffers.
13785 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13787 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13788 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13789 /// A pointer to the contents in the success state.
13790 /// Reading from this pointer when `result_ok` is not set is undefined.
13791 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13792 /// A pointer to the contents in the error state.
13793 /// Reading from this pointer when `result_ok` is set is undefined.
13794 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13797 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13798 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13800 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13801 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13802 /// `err` or `result` depending on the state of `result_ok`.
13803 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13804 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13805 pub result_ok: bool,
13808 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13809 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13810 CResult_UpdateAddHTLCDecodeErrorZ {
13811 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13812 result: Box::into_raw(Box::new(o)),
13818 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13819 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13820 CResult_UpdateAddHTLCDecodeErrorZ {
13821 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13822 err: Box::into_raw(Box::new(e)),
13827 /// Checks if the given object is currently in the success state
13829 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13833 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13834 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13835 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13836 fn drop(&mut self) {
13837 if self.result_ok {
13838 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13839 let _ = unsafe { Box::from_raw(self.contents.result) };
13842 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13843 let _ = unsafe { Box::from_raw(self.contents.err) };
13848 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13849 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13850 let contents = if o.result_ok {
13851 let result = unsafe { o.contents.result };
13852 unsafe { o.contents.result = core::ptr::null_mut() };
13853 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13855 let err = unsafe { o.contents.err };
13856 unsafe { o.contents.err = core::ptr::null_mut(); }
13857 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13861 result_ok: o.result_ok,
13865 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13866 fn clone(&self) -> Self {
13867 if self.result_ok {
13868 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13869 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13872 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13873 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13879 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13880 /// but with all dynamically-allocated buffers duplicated in new buffers.
13881 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13883 /// The contents of CResult_PingDecodeErrorZ
13884 pub union CResult_PingDecodeErrorZPtr {
13885 /// A pointer to the contents in the success state.
13886 /// Reading from this pointer when `result_ok` is not set is undefined.
13887 pub result: *mut crate::lightning::ln::msgs::Ping,
13888 /// A pointer to the contents in the error state.
13889 /// Reading from this pointer when `result_ok` is set is undefined.
13890 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13893 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13894 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13896 pub struct CResult_PingDecodeErrorZ {
13897 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13898 /// `err` or `result` depending on the state of `result_ok`.
13899 pub contents: CResult_PingDecodeErrorZPtr,
13900 /// Whether this CResult_PingDecodeErrorZ represents a success state.
13901 pub result_ok: bool,
13904 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13905 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13906 CResult_PingDecodeErrorZ {
13907 contents: CResult_PingDecodeErrorZPtr {
13908 result: Box::into_raw(Box::new(o)),
13914 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13915 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13916 CResult_PingDecodeErrorZ {
13917 contents: CResult_PingDecodeErrorZPtr {
13918 err: Box::into_raw(Box::new(e)),
13923 /// Checks if the given object is currently in the success state
13925 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13929 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13930 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13931 impl Drop for CResult_PingDecodeErrorZ {
13932 fn drop(&mut self) {
13933 if self.result_ok {
13934 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13935 let _ = unsafe { Box::from_raw(self.contents.result) };
13938 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13939 let _ = unsafe { Box::from_raw(self.contents.err) };
13944 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13945 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13946 let contents = if o.result_ok {
13947 let result = unsafe { o.contents.result };
13948 unsafe { o.contents.result = core::ptr::null_mut() };
13949 CResult_PingDecodeErrorZPtr { result }
13951 let err = unsafe { o.contents.err };
13952 unsafe { o.contents.err = core::ptr::null_mut(); }
13953 CResult_PingDecodeErrorZPtr { err }
13957 result_ok: o.result_ok,
13961 impl Clone for CResult_PingDecodeErrorZ {
13962 fn clone(&self) -> Self {
13963 if self.result_ok {
13964 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13965 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13968 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13969 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13975 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13976 /// but with all dynamically-allocated buffers duplicated in new buffers.
13977 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13979 /// The contents of CResult_PongDecodeErrorZ
13980 pub union CResult_PongDecodeErrorZPtr {
13981 /// A pointer to the contents in the success state.
13982 /// Reading from this pointer when `result_ok` is not set is undefined.
13983 pub result: *mut crate::lightning::ln::msgs::Pong,
13984 /// A pointer to the contents in the error state.
13985 /// Reading from this pointer when `result_ok` is set is undefined.
13986 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13989 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13990 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13991 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13992 pub struct CResult_PongDecodeErrorZ {
13993 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13994 /// `err` or `result` depending on the state of `result_ok`.
13995 pub contents: CResult_PongDecodeErrorZPtr,
13996 /// Whether this CResult_PongDecodeErrorZ represents a success state.
13997 pub result_ok: bool,
14000 /// Creates a new CResult_PongDecodeErrorZ in the success state.
14001 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
14002 CResult_PongDecodeErrorZ {
14003 contents: CResult_PongDecodeErrorZPtr {
14004 result: Box::into_raw(Box::new(o)),
14010 /// Creates a new CResult_PongDecodeErrorZ in the error state.
14011 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
14012 CResult_PongDecodeErrorZ {
14013 contents: CResult_PongDecodeErrorZPtr {
14014 err: Box::into_raw(Box::new(e)),
14019 /// Checks if the given object is currently in the success state
14021 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
14025 /// Frees any resources used by the CResult_PongDecodeErrorZ.
14026 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
14027 impl Drop for CResult_PongDecodeErrorZ {
14028 fn drop(&mut self) {
14029 if self.result_ok {
14030 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14031 let _ = unsafe { Box::from_raw(self.contents.result) };
14034 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14035 let _ = unsafe { Box::from_raw(self.contents.err) };
14040 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
14041 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
14042 let contents = if o.result_ok {
14043 let result = unsafe { o.contents.result };
14044 unsafe { o.contents.result = core::ptr::null_mut() };
14045 CResult_PongDecodeErrorZPtr { result }
14047 let err = unsafe { o.contents.err };
14048 unsafe { o.contents.err = core::ptr::null_mut(); }
14049 CResult_PongDecodeErrorZPtr { err }
14053 result_ok: o.result_ok,
14057 impl Clone for CResult_PongDecodeErrorZ {
14058 fn clone(&self) -> Self {
14059 if self.result_ok {
14060 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
14061 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
14064 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
14065 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14071 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
14072 /// but with all dynamically-allocated buffers duplicated in new buffers.
14073 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
14075 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
14076 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14077 /// A pointer to the contents in the success state.
14078 /// Reading from this pointer when `result_ok` is not set is undefined.
14079 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
14080 /// A pointer to the contents in the error state.
14081 /// Reading from this pointer when `result_ok` is set is undefined.
14082 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14085 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14086 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14088 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14089 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
14090 /// `err` or `result` depending on the state of `result_ok`.
14091 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
14092 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
14093 pub result_ok: bool,
14096 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
14097 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14098 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14099 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14100 result: Box::into_raw(Box::new(o)),
14106 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
14107 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14108 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14109 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14110 err: Box::into_raw(Box::new(e)),
14115 /// Checks if the given object is currently in the success state
14117 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
14121 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
14122 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
14123 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14124 fn drop(&mut self) {
14125 if self.result_ok {
14126 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14127 let _ = unsafe { Box::from_raw(self.contents.result) };
14130 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14131 let _ = unsafe { Box::from_raw(self.contents.err) };
14136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14137 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14138 let contents = if o.result_ok {
14139 let result = unsafe { o.contents.result };
14140 unsafe { o.contents.result = core::ptr::null_mut() };
14141 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
14143 let err = unsafe { o.contents.err };
14144 unsafe { o.contents.err = core::ptr::null_mut(); }
14145 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14149 result_ok: o.result_ok,
14153 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14154 fn clone(&self) -> Self {
14155 if self.result_ok {
14156 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14157 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14160 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14161 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14167 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14168 /// but with all dynamically-allocated buffers duplicated in new buffers.
14169 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14171 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14172 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14173 /// A pointer to the contents in the success state.
14174 /// Reading from this pointer when `result_ok` is not set is undefined.
14175 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14176 /// A pointer to the contents in the error state.
14177 /// Reading from this pointer when `result_ok` is set is undefined.
14178 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14181 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14182 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14184 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14185 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14186 /// `err` or `result` depending on the state of `result_ok`.
14187 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14188 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14189 pub result_ok: bool,
14192 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14193 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14194 CResult_ChannelAnnouncementDecodeErrorZ {
14195 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14196 result: Box::into_raw(Box::new(o)),
14202 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14203 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14204 CResult_ChannelAnnouncementDecodeErrorZ {
14205 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14206 err: Box::into_raw(Box::new(e)),
14211 /// Checks if the given object is currently in the success state
14213 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14217 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14218 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14219 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14220 fn drop(&mut self) {
14221 if self.result_ok {
14222 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14223 let _ = unsafe { Box::from_raw(self.contents.result) };
14226 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14227 let _ = unsafe { Box::from_raw(self.contents.err) };
14232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14233 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14234 let contents = if o.result_ok {
14235 let result = unsafe { o.contents.result };
14236 unsafe { o.contents.result = core::ptr::null_mut() };
14237 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14239 let err = unsafe { o.contents.err };
14240 unsafe { o.contents.err = core::ptr::null_mut(); }
14241 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14245 result_ok: o.result_ok,
14249 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14250 fn clone(&self) -> Self {
14251 if self.result_ok {
14252 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14253 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14256 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14257 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14263 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14264 /// but with all dynamically-allocated buffers duplicated in new buffers.
14265 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14267 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14268 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14269 /// A pointer to the contents in the success state.
14270 /// Reading from this pointer when `result_ok` is not set is undefined.
14271 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14272 /// A pointer to the contents in the error state.
14273 /// Reading from this pointer when `result_ok` is set is undefined.
14274 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14277 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14278 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14279 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14280 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14281 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14282 /// `err` or `result` depending on the state of `result_ok`.
14283 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14284 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14285 pub result_ok: bool,
14288 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14289 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14290 CResult_UnsignedChannelUpdateDecodeErrorZ {
14291 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14292 result: Box::into_raw(Box::new(o)),
14298 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14299 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14300 CResult_UnsignedChannelUpdateDecodeErrorZ {
14301 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14302 err: Box::into_raw(Box::new(e)),
14307 /// Checks if the given object is currently in the success state
14309 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14313 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14314 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14315 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14316 fn drop(&mut self) {
14317 if self.result_ok {
14318 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14319 let _ = unsafe { Box::from_raw(self.contents.result) };
14322 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14323 let _ = unsafe { Box::from_raw(self.contents.err) };
14328 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14329 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14330 let contents = if o.result_ok {
14331 let result = unsafe { o.contents.result };
14332 unsafe { o.contents.result = core::ptr::null_mut() };
14333 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14335 let err = unsafe { o.contents.err };
14336 unsafe { o.contents.err = core::ptr::null_mut(); }
14337 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14341 result_ok: o.result_ok,
14345 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14346 fn clone(&self) -> Self {
14347 if self.result_ok {
14348 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14349 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14352 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14353 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14359 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14360 /// but with all dynamically-allocated buffers duplicated in new buffers.
14361 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14363 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14364 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14365 /// A pointer to the contents in the success state.
14366 /// Reading from this pointer when `result_ok` is not set is undefined.
14367 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14368 /// A pointer to the contents in the error state.
14369 /// Reading from this pointer when `result_ok` is set is undefined.
14370 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14373 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14374 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14375 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14376 pub struct CResult_ChannelUpdateDecodeErrorZ {
14377 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14378 /// `err` or `result` depending on the state of `result_ok`.
14379 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14380 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14381 pub result_ok: bool,
14384 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14385 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14386 CResult_ChannelUpdateDecodeErrorZ {
14387 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14388 result: Box::into_raw(Box::new(o)),
14394 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14395 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14396 CResult_ChannelUpdateDecodeErrorZ {
14397 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14398 err: Box::into_raw(Box::new(e)),
14403 /// Checks if the given object is currently in the success state
14405 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14409 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14410 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14411 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14412 fn drop(&mut self) {
14413 if self.result_ok {
14414 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14415 let _ = unsafe { Box::from_raw(self.contents.result) };
14418 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14419 let _ = unsafe { Box::from_raw(self.contents.err) };
14424 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14425 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14426 let contents = if o.result_ok {
14427 let result = unsafe { o.contents.result };
14428 unsafe { o.contents.result = core::ptr::null_mut() };
14429 CResult_ChannelUpdateDecodeErrorZPtr { result }
14431 let err = unsafe { o.contents.err };
14432 unsafe { o.contents.err = core::ptr::null_mut(); }
14433 CResult_ChannelUpdateDecodeErrorZPtr { err }
14437 result_ok: o.result_ok,
14441 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14442 fn clone(&self) -> Self {
14443 if self.result_ok {
14444 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14445 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14448 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14449 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14455 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14456 /// but with all dynamically-allocated buffers duplicated in new buffers.
14457 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14459 /// The contents of CResult_ErrorMessageDecodeErrorZ
14460 pub union CResult_ErrorMessageDecodeErrorZPtr {
14461 /// A pointer to the contents in the success state.
14462 /// Reading from this pointer when `result_ok` is not set is undefined.
14463 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14464 /// A pointer to the contents in the error state.
14465 /// Reading from this pointer when `result_ok` is set is undefined.
14466 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14469 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14470 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14471 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14472 pub struct CResult_ErrorMessageDecodeErrorZ {
14473 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14474 /// `err` or `result` depending on the state of `result_ok`.
14475 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14476 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14477 pub result_ok: bool,
14480 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14481 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14482 CResult_ErrorMessageDecodeErrorZ {
14483 contents: CResult_ErrorMessageDecodeErrorZPtr {
14484 result: Box::into_raw(Box::new(o)),
14490 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14491 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14492 CResult_ErrorMessageDecodeErrorZ {
14493 contents: CResult_ErrorMessageDecodeErrorZPtr {
14494 err: Box::into_raw(Box::new(e)),
14499 /// Checks if the given object is currently in the success state
14501 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14505 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14506 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14507 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14508 fn drop(&mut self) {
14509 if self.result_ok {
14510 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14511 let _ = unsafe { Box::from_raw(self.contents.result) };
14514 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14515 let _ = unsafe { Box::from_raw(self.contents.err) };
14520 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14521 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14522 let contents = if o.result_ok {
14523 let result = unsafe { o.contents.result };
14524 unsafe { o.contents.result = core::ptr::null_mut() };
14525 CResult_ErrorMessageDecodeErrorZPtr { result }
14527 let err = unsafe { o.contents.err };
14528 unsafe { o.contents.err = core::ptr::null_mut(); }
14529 CResult_ErrorMessageDecodeErrorZPtr { err }
14533 result_ok: o.result_ok,
14537 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14538 fn clone(&self) -> Self {
14539 if self.result_ok {
14540 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14541 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14544 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14545 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14551 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14552 /// but with all dynamically-allocated buffers duplicated in new buffers.
14553 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14555 /// The contents of CResult_WarningMessageDecodeErrorZ
14556 pub union CResult_WarningMessageDecodeErrorZPtr {
14557 /// A pointer to the contents in the success state.
14558 /// Reading from this pointer when `result_ok` is not set is undefined.
14559 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14560 /// A pointer to the contents in the error state.
14561 /// Reading from this pointer when `result_ok` is set is undefined.
14562 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14565 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14566 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14568 pub struct CResult_WarningMessageDecodeErrorZ {
14569 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14570 /// `err` or `result` depending on the state of `result_ok`.
14571 pub contents: CResult_WarningMessageDecodeErrorZPtr,
14572 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14573 pub result_ok: bool,
14576 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14577 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14578 CResult_WarningMessageDecodeErrorZ {
14579 contents: CResult_WarningMessageDecodeErrorZPtr {
14580 result: Box::into_raw(Box::new(o)),
14586 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14587 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14588 CResult_WarningMessageDecodeErrorZ {
14589 contents: CResult_WarningMessageDecodeErrorZPtr {
14590 err: Box::into_raw(Box::new(e)),
14595 /// Checks if the given object is currently in the success state
14597 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14601 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14602 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14603 impl Drop for CResult_WarningMessageDecodeErrorZ {
14604 fn drop(&mut self) {
14605 if self.result_ok {
14606 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14607 let _ = unsafe { Box::from_raw(self.contents.result) };
14610 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14611 let _ = unsafe { Box::from_raw(self.contents.err) };
14616 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14617 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14618 let contents = if o.result_ok {
14619 let result = unsafe { o.contents.result };
14620 unsafe { o.contents.result = core::ptr::null_mut() };
14621 CResult_WarningMessageDecodeErrorZPtr { result }
14623 let err = unsafe { o.contents.err };
14624 unsafe { o.contents.err = core::ptr::null_mut(); }
14625 CResult_WarningMessageDecodeErrorZPtr { err }
14629 result_ok: o.result_ok,
14633 impl Clone for CResult_WarningMessageDecodeErrorZ {
14634 fn clone(&self) -> Self {
14635 if self.result_ok {
14636 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14637 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14640 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14641 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14647 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14648 /// but with all dynamically-allocated buffers duplicated in new buffers.
14649 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14651 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14652 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14653 /// A pointer to the contents in the success state.
14654 /// Reading from this pointer when `result_ok` is not set is undefined.
14655 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14656 /// A pointer to the contents in the error state.
14657 /// Reading from this pointer when `result_ok` is set is undefined.
14658 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14661 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14662 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14663 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14664 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14665 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14666 /// `err` or `result` depending on the state of `result_ok`.
14667 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14668 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14669 pub result_ok: bool,
14672 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14673 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14674 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14675 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14676 result: Box::into_raw(Box::new(o)),
14682 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14683 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14684 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14685 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14686 err: Box::into_raw(Box::new(e)),
14691 /// Checks if the given object is currently in the success state
14693 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14697 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14698 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14699 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14700 fn drop(&mut self) {
14701 if self.result_ok {
14702 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14703 let _ = unsafe { Box::from_raw(self.contents.result) };
14706 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14707 let _ = unsafe { Box::from_raw(self.contents.err) };
14712 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14713 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14714 let contents = if o.result_ok {
14715 let result = unsafe { o.contents.result };
14716 unsafe { o.contents.result = core::ptr::null_mut() };
14717 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14719 let err = unsafe { o.contents.err };
14720 unsafe { o.contents.err = core::ptr::null_mut(); }
14721 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14725 result_ok: o.result_ok,
14729 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14730 fn clone(&self) -> Self {
14731 if self.result_ok {
14732 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14733 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14736 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14737 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14743 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14744 /// but with all dynamically-allocated buffers duplicated in new buffers.
14745 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14747 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14748 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14749 /// A pointer to the contents in the success state.
14750 /// Reading from this pointer when `result_ok` is not set is undefined.
14751 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14752 /// A pointer to the contents in the error state.
14753 /// Reading from this pointer when `result_ok` is set is undefined.
14754 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14757 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14758 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14760 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14761 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14762 /// `err` or `result` depending on the state of `result_ok`.
14763 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14764 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14765 pub result_ok: bool,
14768 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14769 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14770 CResult_NodeAnnouncementDecodeErrorZ {
14771 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14772 result: Box::into_raw(Box::new(o)),
14778 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14779 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14780 CResult_NodeAnnouncementDecodeErrorZ {
14781 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14782 err: Box::into_raw(Box::new(e)),
14787 /// Checks if the given object is currently in the success state
14789 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14793 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14794 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14795 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14796 fn drop(&mut self) {
14797 if self.result_ok {
14798 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14799 let _ = unsafe { Box::from_raw(self.contents.result) };
14802 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14803 let _ = unsafe { Box::from_raw(self.contents.err) };
14808 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14809 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14810 let contents = if o.result_ok {
14811 let result = unsafe { o.contents.result };
14812 unsafe { o.contents.result = core::ptr::null_mut() };
14813 CResult_NodeAnnouncementDecodeErrorZPtr { result }
14815 let err = unsafe { o.contents.err };
14816 unsafe { o.contents.err = core::ptr::null_mut(); }
14817 CResult_NodeAnnouncementDecodeErrorZPtr { err }
14821 result_ok: o.result_ok,
14825 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14826 fn clone(&self) -> Self {
14827 if self.result_ok {
14828 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14829 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14832 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14833 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14839 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14840 /// but with all dynamically-allocated buffers duplicated in new buffers.
14841 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14843 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14844 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14845 /// A pointer to the contents in the success state.
14846 /// Reading from this pointer when `result_ok` is not set is undefined.
14847 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14848 /// A pointer to the contents in the error state.
14849 /// Reading from this pointer when `result_ok` is set is undefined.
14850 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14853 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14854 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14856 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14857 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14858 /// `err` or `result` depending on the state of `result_ok`.
14859 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14860 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14861 pub result_ok: bool,
14864 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14865 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14866 CResult_QueryShortChannelIdsDecodeErrorZ {
14867 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14868 result: Box::into_raw(Box::new(o)),
14874 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14875 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14876 CResult_QueryShortChannelIdsDecodeErrorZ {
14877 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14878 err: Box::into_raw(Box::new(e)),
14883 /// Checks if the given object is currently in the success state
14885 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14889 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14890 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14891 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14892 fn drop(&mut self) {
14893 if self.result_ok {
14894 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14895 let _ = unsafe { Box::from_raw(self.contents.result) };
14898 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14899 let _ = unsafe { Box::from_raw(self.contents.err) };
14904 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14905 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14906 let contents = if o.result_ok {
14907 let result = unsafe { o.contents.result };
14908 unsafe { o.contents.result = core::ptr::null_mut() };
14909 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14911 let err = unsafe { o.contents.err };
14912 unsafe { o.contents.err = core::ptr::null_mut(); }
14913 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14917 result_ok: o.result_ok,
14921 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14922 fn clone(&self) -> Self {
14923 if self.result_ok {
14924 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14925 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14928 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14929 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14935 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14936 /// but with all dynamically-allocated buffers duplicated in new buffers.
14937 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14939 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14940 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14941 /// A pointer to the contents in the success state.
14942 /// Reading from this pointer when `result_ok` is not set is undefined.
14943 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14944 /// A pointer to the contents in the error state.
14945 /// Reading from this pointer when `result_ok` is set is undefined.
14946 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14949 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14950 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14952 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14953 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14954 /// `err` or `result` depending on the state of `result_ok`.
14955 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14956 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14957 pub result_ok: bool,
14960 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14961 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14962 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14963 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14964 result: Box::into_raw(Box::new(o)),
14970 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14971 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14972 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14973 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14974 err: Box::into_raw(Box::new(e)),
14979 /// Checks if the given object is currently in the success state
14981 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14985 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14986 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14987 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14988 fn drop(&mut self) {
14989 if self.result_ok {
14990 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14991 let _ = unsafe { Box::from_raw(self.contents.result) };
14994 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14995 let _ = unsafe { Box::from_raw(self.contents.err) };
15000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15001 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
15002 let contents = if o.result_ok {
15003 let result = unsafe { o.contents.result };
15004 unsafe { o.contents.result = core::ptr::null_mut() };
15005 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
15007 let err = unsafe { o.contents.err };
15008 unsafe { o.contents.err = core::ptr::null_mut(); }
15009 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
15013 result_ok: o.result_ok,
15017 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15018 fn clone(&self) -> Self {
15019 if self.result_ok {
15020 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15021 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
15024 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15025 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15031 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15032 /// but with all dynamically-allocated buffers duplicated in new buffers.
15033 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
15035 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
15036 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
15037 /// A pointer to the contents in the success state.
15038 /// Reading from this pointer when `result_ok` is not set is undefined.
15039 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
15040 /// A pointer to the contents in the error state.
15041 /// Reading from this pointer when `result_ok` is set is undefined.
15042 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15045 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
15046 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15047 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15048 pub struct CResult_QueryChannelRangeDecodeErrorZ {
15049 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
15050 /// `err` or `result` depending on the state of `result_ok`.
15051 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
15052 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
15053 pub result_ok: bool,
15056 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
15057 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
15058 CResult_QueryChannelRangeDecodeErrorZ {
15059 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15060 result: Box::into_raw(Box::new(o)),
15066 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
15067 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
15068 CResult_QueryChannelRangeDecodeErrorZ {
15069 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15070 err: Box::into_raw(Box::new(e)),
15075 /// Checks if the given object is currently in the success state
15077 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
15081 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
15082 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
15083 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
15084 fn drop(&mut self) {
15085 if self.result_ok {
15086 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15087 let _ = unsafe { Box::from_raw(self.contents.result) };
15090 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15091 let _ = unsafe { Box::from_raw(self.contents.err) };
15096 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
15097 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15098 let contents = if o.result_ok {
15099 let result = unsafe { o.contents.result };
15100 unsafe { o.contents.result = core::ptr::null_mut() };
15101 CResult_QueryChannelRangeDecodeErrorZPtr { result }
15103 let err = unsafe { o.contents.err };
15104 unsafe { o.contents.err = core::ptr::null_mut(); }
15105 CResult_QueryChannelRangeDecodeErrorZPtr { err }
15109 result_ok: o.result_ok,
15113 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
15114 fn clone(&self) -> Self {
15115 if self.result_ok {
15116 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15117 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
15120 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15121 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15127 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
15128 /// but with all dynamically-allocated buffers duplicated in new buffers.
15129 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15131 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
15132 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
15133 /// A pointer to the contents in the success state.
15134 /// Reading from this pointer when `result_ok` is not set is undefined.
15135 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
15136 /// A pointer to the contents in the error state.
15137 /// Reading from this pointer when `result_ok` is set is undefined.
15138 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15141 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
15142 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15144 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
15145 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
15146 /// `err` or `result` depending on the state of `result_ok`.
15147 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15148 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15149 pub result_ok: bool,
15152 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15153 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15154 CResult_ReplyChannelRangeDecodeErrorZ {
15155 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15156 result: Box::into_raw(Box::new(o)),
15162 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15163 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15164 CResult_ReplyChannelRangeDecodeErrorZ {
15165 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15166 err: Box::into_raw(Box::new(e)),
15171 /// Checks if the given object is currently in the success state
15173 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15177 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15178 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15179 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15180 fn drop(&mut self) {
15181 if self.result_ok {
15182 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15183 let _ = unsafe { Box::from_raw(self.contents.result) };
15186 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15187 let _ = unsafe { Box::from_raw(self.contents.err) };
15192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15193 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15194 let contents = if o.result_ok {
15195 let result = unsafe { o.contents.result };
15196 unsafe { o.contents.result = core::ptr::null_mut() };
15197 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15199 let err = unsafe { o.contents.err };
15200 unsafe { o.contents.err = core::ptr::null_mut(); }
15201 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15205 result_ok: o.result_ok,
15209 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15210 fn clone(&self) -> Self {
15211 if self.result_ok {
15212 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15213 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15216 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15217 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15223 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15224 /// but with all dynamically-allocated buffers duplicated in new buffers.
15225 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15227 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15228 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15229 /// A pointer to the contents in the success state.
15230 /// Reading from this pointer when `result_ok` is not set is undefined.
15231 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15232 /// A pointer to the contents in the error state.
15233 /// Reading from this pointer when `result_ok` is set is undefined.
15234 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15237 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15238 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15240 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15241 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15242 /// `err` or `result` depending on the state of `result_ok`.
15243 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15244 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15245 pub result_ok: bool,
15248 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15249 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15250 CResult_GossipTimestampFilterDecodeErrorZ {
15251 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15252 result: Box::into_raw(Box::new(o)),
15258 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15259 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15260 CResult_GossipTimestampFilterDecodeErrorZ {
15261 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15262 err: Box::into_raw(Box::new(e)),
15267 /// Checks if the given object is currently in the success state
15269 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15273 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15274 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15275 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15276 fn drop(&mut self) {
15277 if self.result_ok {
15278 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15279 let _ = unsafe { Box::from_raw(self.contents.result) };
15282 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15283 let _ = unsafe { Box::from_raw(self.contents.err) };
15288 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15289 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15290 let contents = if o.result_ok {
15291 let result = unsafe { o.contents.result };
15292 unsafe { o.contents.result = core::ptr::null_mut() };
15293 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15295 let err = unsafe { o.contents.err };
15296 unsafe { o.contents.err = core::ptr::null_mut(); }
15297 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15301 result_ok: o.result_ok,
15305 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15306 fn clone(&self) -> Self {
15307 if self.result_ok {
15308 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15309 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15312 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15313 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15319 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15320 /// but with all dynamically-allocated buffers duplicated in new buffers.
15321 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15323 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15324 /// This corresponds to std::vector in C++
15325 pub struct CVec_PhantomRouteHintsZ {
15326 /// The elements in the array.
15327 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15328 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15329 /// The number of elements pointed to by `data`.
15332 impl CVec_PhantomRouteHintsZ {
15333 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15334 if self.datalen == 0 { return Vec::new(); }
15335 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15336 self.data = core::ptr::null_mut();
15340 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15341 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15344 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15345 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15346 let datalen = v.len();
15347 let data = Box::into_raw(v.into_boxed_slice());
15348 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15352 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15353 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15354 impl Drop for CVec_PhantomRouteHintsZ {
15355 fn drop(&mut self) {
15356 if self.datalen == 0 { return; }
15357 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15360 impl Clone for CVec_PhantomRouteHintsZ {
15361 fn clone(&self) -> Self {
15362 let mut res = Vec::new();
15363 if self.datalen == 0 { return Self::from(res); }
15364 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15369 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15370 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15371 /// A pointer to the contents in the success state.
15372 /// Reading from this pointer when `result_ok` is not set is undefined.
15373 pub result: *mut crate::lightning_invoice::Invoice,
15374 /// A pointer to the contents in the error state.
15375 /// Reading from this pointer when `result_ok` is set is undefined.
15376 pub err: *mut crate::lightning_invoice::SignOrCreationError,
15379 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15380 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15382 pub struct CResult_InvoiceSignOrCreationErrorZ {
15383 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15384 /// `err` or `result` depending on the state of `result_ok`.
15385 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15386 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15387 pub result_ok: bool,
15390 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15391 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15392 CResult_InvoiceSignOrCreationErrorZ {
15393 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15394 result: Box::into_raw(Box::new(o)),
15400 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15401 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15402 CResult_InvoiceSignOrCreationErrorZ {
15403 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15404 err: Box::into_raw(Box::new(e)),
15409 /// Checks if the given object is currently in the success state
15411 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15415 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15416 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15417 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15418 fn drop(&mut self) {
15419 if self.result_ok {
15420 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15421 let _ = unsafe { Box::from_raw(self.contents.result) };
15424 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15425 let _ = unsafe { Box::from_raw(self.contents.err) };
15430 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15431 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15432 let contents = if o.result_ok {
15433 let result = unsafe { o.contents.result };
15434 unsafe { o.contents.result = core::ptr::null_mut() };
15435 CResult_InvoiceSignOrCreationErrorZPtr { result }
15437 let err = unsafe { o.contents.err };
15438 unsafe { o.contents.err = core::ptr::null_mut(); }
15439 CResult_InvoiceSignOrCreationErrorZPtr { err }
15443 result_ok: o.result_ok,
15447 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15448 fn clone(&self) -> Self {
15449 if self.result_ok {
15450 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15451 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15454 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15455 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15461 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15462 /// but with all dynamically-allocated buffers duplicated in new buffers.
15463 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15465 /// An enum which can either contain a crate::lightning::chain::Filter or not
15466 pub enum COption_FilterZ {
15467 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15468 Some(crate::lightning::chain::Filter),
15469 /// When we're in this state, this COption_FilterZ contains nothing
15472 impl COption_FilterZ {
15473 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15474 if let Self::None = self { false } else { true }
15476 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15479 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15480 if let Self::Some(v) = self { v } else { unreachable!() }
15484 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15485 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15486 COption_FilterZ::Some(o)
15489 /// Constructs a new COption_FilterZ containing nothing
15490 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15491 COption_FilterZ::None
15494 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15495 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15497 /// The contents of CResult_LockedChannelMonitorNoneZ
15498 pub union CResult_LockedChannelMonitorNoneZPtr {
15499 /// A pointer to the contents in the success state.
15500 /// Reading from this pointer when `result_ok` is not set is undefined.
15501 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15502 /// Note that this value is always NULL, as there are no contents in the Err variant
15503 pub err: *mut core::ffi::c_void,
15506 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15507 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15508 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15509 pub struct CResult_LockedChannelMonitorNoneZ {
15510 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15511 /// `err` or `result` depending on the state of `result_ok`.
15512 pub contents: CResult_LockedChannelMonitorNoneZPtr,
15513 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15514 pub result_ok: bool,
15517 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15518 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15519 CResult_LockedChannelMonitorNoneZ {
15520 contents: CResult_LockedChannelMonitorNoneZPtr {
15521 result: Box::into_raw(Box::new(o)),
15527 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15528 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15529 CResult_LockedChannelMonitorNoneZ {
15530 contents: CResult_LockedChannelMonitorNoneZPtr {
15531 err: core::ptr::null_mut(),
15536 /// Checks if the given object is currently in the success state
15538 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15542 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15543 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15544 impl Drop for CResult_LockedChannelMonitorNoneZ {
15545 fn drop(&mut self) {
15546 if self.result_ok {
15547 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15548 let _ = unsafe { Box::from_raw(self.contents.result) };
15554 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15555 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15556 let contents = if o.result_ok {
15557 let result = unsafe { o.contents.result };
15558 unsafe { o.contents.result = core::ptr::null_mut() };
15559 CResult_LockedChannelMonitorNoneZPtr { result }
15561 let _ = unsafe { Box::from_raw(o.contents.err) };
15562 o.contents.err = core::ptr::null_mut();
15563 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15567 result_ok: o.result_ok,
15572 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15573 /// This corresponds to std::vector in C++
15574 pub struct CVec_OutPointZ {
15575 /// The elements in the array.
15576 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15577 pub data: *mut crate::lightning::chain::transaction::OutPoint,
15578 /// The number of elements pointed to by `data`.
15581 impl CVec_OutPointZ {
15582 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15583 if self.datalen == 0 { return Vec::new(); }
15584 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15585 self.data = core::ptr::null_mut();
15589 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15590 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15593 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15594 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15595 let datalen = v.len();
15596 let data = Box::into_raw(v.into_boxed_slice());
15597 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15601 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15602 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15603 impl Drop for CVec_OutPointZ {
15604 fn drop(&mut self) {
15605 if self.datalen == 0 { return; }
15606 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15609 impl Clone for CVec_OutPointZ {
15610 fn clone(&self) -> Self {
15611 let mut res = Vec::new();
15612 if self.datalen == 0 { return Self::from(res); }
15613 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });