2 use alloc::str::FromStr;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
11 /// The contents of CResult_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13 /// Note that this value is always NULL, as there are no contents in the OK variant
14 pub result: *mut core::ffi::c_void,
15 /// Note that this value is always NULL, as there are no contents in the Err variant
16 pub err: *mut core::ffi::c_void,
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23 /// The contents of this CResult_NoneNoneZ, accessible via either
24 /// `err` or `result` depending on the state of `result_ok`.
25 pub contents: CResult_NoneNoneZPtr,
26 /// Whether this CResult_NoneNoneZ represents a success state.
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
33 contents: CResult_NoneNoneZPtr {
34 result: core::ptr::null_mut(),
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
43 contents: CResult_NoneNoneZPtr {
44 err: core::ptr::null_mut(),
49 /// Checks if the given object is currently in the success state
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66 let contents = if o.result_ok {
67 let _ = unsafe { Box::from_raw(o.contents.result) };
68 o.contents.result = core::ptr::null_mut();
69 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
71 let _ = unsafe { Box::from_raw(o.contents.err) };
72 o.contents.err = core::ptr::null_mut();
73 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
77 result_ok: o.result_ok,
81 impl Clone for CResult_NoneNoneZ {
82 fn clone(&self) -> Self {
84 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85 result: core::ptr::null_mut()
88 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89 err: core::ptr::null_mut()
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101 /// A pointer to the contents in the success state.
102 /// Reading from this pointer when `result_ok` is not set is undefined.
103 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104 /// A pointer to the contents in the error state.
105 /// Reading from this pointer when `result_ok` is set is undefined.
106 pub err: *mut crate::lightning::ln::msgs::DecodeError,
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114 /// `err` or `result` depending on the state of `result_ok`.
115 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124 result: Box::into_raw(Box::new(o)),
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134 err: Box::into_raw(Box::new(e)),
139 /// Checks if the given object is currently in the success state
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
150 if unsafe { !(self.contents.result as *mut ()).is_null() } {
151 let _ = unsafe { Box::from_raw(self.contents.result) };
154 if unsafe { !(self.contents.err as *mut ()).is_null() } {
155 let _ = unsafe { Box::from_raw(self.contents.err) };
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162 let contents = if o.result_ok {
163 let result = unsafe { o.contents.result };
164 unsafe { o.contents.result = core::ptr::null_mut() };
165 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
167 let err = unsafe { o.contents.err };
168 unsafe { o.contents.err = core::ptr::null_mut(); }
169 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
173 result_ok: o.result_ok,
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178 fn clone(&self) -> Self {
180 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
184 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197 /// A pointer to the contents in the success state.
198 /// Reading from this pointer when `result_ok` is not set is undefined.
199 pub result: *mut crate::c_types::SecretKey,
200 /// A pointer to the contents in the error state.
201 /// Reading from this pointer when `result_ok` is set is undefined.
202 pub err: *mut crate::c_types::Secp256k1Error,
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210 /// `err` or `result` depending on the state of `result_ok`.
211 pub contents: CResult_SecretKeyErrorZPtr,
212 /// Whether this CResult_SecretKeyErrorZ represents a success state.
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218 CResult_SecretKeyErrorZ {
219 contents: CResult_SecretKeyErrorZPtr {
220 result: Box::into_raw(Box::new(o)),
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228 CResult_SecretKeyErrorZ {
229 contents: CResult_SecretKeyErrorZPtr {
230 err: Box::into_raw(Box::new(e)),
235 /// Checks if the given object is currently in the success state
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
247 let _ = unsafe { Box::from_raw(self.contents.result) };
250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
251 let _ = unsafe { Box::from_raw(self.contents.err) };
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258 let contents = if o.result_ok {
259 let result = unsafe { o.contents.result };
260 unsafe { o.contents.result = core::ptr::null_mut() };
261 CResult_SecretKeyErrorZPtr { result }
263 let err = unsafe { o.contents.err };
264 unsafe { o.contents.err = core::ptr::null_mut(); }
265 CResult_SecretKeyErrorZPtr { err }
269 result_ok: o.result_ok,
273 impl Clone for CResult_SecretKeyErrorZ {
274 fn clone(&self) -> Self {
276 Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
280 Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293 /// A pointer to the contents in the success state.
294 /// Reading from this pointer when `result_ok` is not set is undefined.
295 pub result: *mut crate::c_types::PublicKey,
296 /// A pointer to the contents in the error state.
297 /// Reading from this pointer when `result_ok` is set is undefined.
298 pub err: *mut crate::c_types::Secp256k1Error,
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306 /// `err` or `result` depending on the state of `result_ok`.
307 pub contents: CResult_PublicKeyErrorZPtr,
308 /// Whether this CResult_PublicKeyErrorZ represents a success state.
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314 CResult_PublicKeyErrorZ {
315 contents: CResult_PublicKeyErrorZPtr {
316 result: Box::into_raw(Box::new(o)),
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324 CResult_PublicKeyErrorZ {
325 contents: CResult_PublicKeyErrorZPtr {
326 err: Box::into_raw(Box::new(e)),
331 /// Checks if the given object is currently in the success state
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
343 let _ = unsafe { Box::from_raw(self.contents.result) };
346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
347 let _ = unsafe { Box::from_raw(self.contents.err) };
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354 let contents = if o.result_ok {
355 let result = unsafe { o.contents.result };
356 unsafe { o.contents.result = core::ptr::null_mut() };
357 CResult_PublicKeyErrorZPtr { result }
359 let err = unsafe { o.contents.err };
360 unsafe { o.contents.err = core::ptr::null_mut(); }
361 CResult_PublicKeyErrorZPtr { err }
365 result_ok: o.result_ok,
369 impl Clone for CResult_PublicKeyErrorZ {
370 fn clone(&self) -> Self {
372 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
376 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389 /// A pointer to the contents in the success state.
390 /// Reading from this pointer when `result_ok` is not set is undefined.
391 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392 /// A pointer to the contents in the error state.
393 /// Reading from this pointer when `result_ok` is set is undefined.
394 pub err: *mut crate::lightning::ln::msgs::DecodeError,
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402 /// `err` or `result` depending on the state of `result_ok`.
403 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410 CResult_TxCreationKeysDecodeErrorZ {
411 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412 result: Box::into_raw(Box::new(o)),
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420 CResult_TxCreationKeysDecodeErrorZ {
421 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422 err: Box::into_raw(Box::new(e)),
427 /// Checks if the given object is currently in the success state
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
438 if unsafe { !(self.contents.result as *mut ()).is_null() } {
439 let _ = unsafe { Box::from_raw(self.contents.result) };
442 if unsafe { !(self.contents.err as *mut ()).is_null() } {
443 let _ = unsafe { Box::from_raw(self.contents.err) };
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450 let contents = if o.result_ok {
451 let result = unsafe { o.contents.result };
452 unsafe { o.contents.result = core::ptr::null_mut() };
453 CResult_TxCreationKeysDecodeErrorZPtr { result }
455 let err = unsafe { o.contents.err };
456 unsafe { o.contents.err = core::ptr::null_mut(); }
457 CResult_TxCreationKeysDecodeErrorZPtr { err }
461 result_ok: o.result_ok,
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466 fn clone(&self) -> Self {
468 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
472 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485 /// A pointer to the contents in the success state.
486 /// Reading from this pointer when `result_ok` is not set is undefined.
487 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488 /// A pointer to the contents in the error state.
489 /// Reading from this pointer when `result_ok` is set is undefined.
490 pub err: *mut crate::lightning::ln::msgs::DecodeError,
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498 /// `err` or `result` depending on the state of `result_ok`.
499 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506 CResult_ChannelPublicKeysDecodeErrorZ {
507 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508 result: Box::into_raw(Box::new(o)),
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516 CResult_ChannelPublicKeysDecodeErrorZ {
517 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518 err: Box::into_raw(Box::new(e)),
523 /// Checks if the given object is currently in the success state
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
534 if unsafe { !(self.contents.result as *mut ()).is_null() } {
535 let _ = unsafe { Box::from_raw(self.contents.result) };
538 if unsafe { !(self.contents.err as *mut ()).is_null() } {
539 let _ = unsafe { Box::from_raw(self.contents.err) };
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546 let contents = if o.result_ok {
547 let result = unsafe { o.contents.result };
548 unsafe { o.contents.result = core::ptr::null_mut() };
549 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
551 let err = unsafe { o.contents.err };
552 unsafe { o.contents.err = core::ptr::null_mut(); }
553 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
557 result_ok: o.result_ok,
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562 fn clone(&self) -> Self {
564 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
568 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581 /// A pointer to the contents in the success state.
582 /// Reading from this pointer when `result_ok` is not set is undefined.
583 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584 /// A pointer to the contents in the error state.
585 /// Reading from this pointer when `result_ok` is set is undefined.
586 pub err: *mut crate::c_types::Secp256k1Error,
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594 /// `err` or `result` depending on the state of `result_ok`.
595 pub contents: CResult_TxCreationKeysErrorZPtr,
596 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602 CResult_TxCreationKeysErrorZ {
603 contents: CResult_TxCreationKeysErrorZPtr {
604 result: Box::into_raw(Box::new(o)),
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612 CResult_TxCreationKeysErrorZ {
613 contents: CResult_TxCreationKeysErrorZPtr {
614 err: Box::into_raw(Box::new(e)),
619 /// Checks if the given object is currently in the success state
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
630 if unsafe { !(self.contents.result as *mut ()).is_null() } {
631 let _ = unsafe { Box::from_raw(self.contents.result) };
634 if unsafe { !(self.contents.err as *mut ()).is_null() } {
635 let _ = unsafe { Box::from_raw(self.contents.err) };
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642 let contents = if o.result_ok {
643 let result = unsafe { o.contents.result };
644 unsafe { o.contents.result = core::ptr::null_mut() };
645 CResult_TxCreationKeysErrorZPtr { result }
647 let err = unsafe { o.contents.err };
648 unsafe { o.contents.err = core::ptr::null_mut(); }
649 CResult_TxCreationKeysErrorZPtr { err }
653 result_ok: o.result_ok,
657 impl Clone for CResult_TxCreationKeysErrorZ {
658 fn clone(&self) -> Self {
660 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
664 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678 /// When we're in this state, this COption_u32Z contains a u32
680 /// When we're in this state, this COption_u32Z contains nothing
684 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685 if let Self::None = self { false } else { true }
687 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
690 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691 if let Self::Some(v) = self { v } else { unreachable!() }
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697 COption_u32Z::Some(o)
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714 /// A pointer to the contents in the success state.
715 /// Reading from this pointer when `result_ok` is not set is undefined.
716 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717 /// A pointer to the contents in the error state.
718 /// Reading from this pointer when `result_ok` is set is undefined.
719 pub err: *mut crate::lightning::ln::msgs::DecodeError,
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727 /// `err` or `result` depending on the state of `result_ok`.
728 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735 CResult_HTLCOutputInCommitmentDecodeErrorZ {
736 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737 result: Box::into_raw(Box::new(o)),
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745 CResult_HTLCOutputInCommitmentDecodeErrorZ {
746 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747 err: Box::into_raw(Box::new(e)),
752 /// Checks if the given object is currently in the success state
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
763 if unsafe { !(self.contents.result as *mut ()).is_null() } {
764 let _ = unsafe { Box::from_raw(self.contents.result) };
767 if unsafe { !(self.contents.err as *mut ()).is_null() } {
768 let _ = unsafe { Box::from_raw(self.contents.err) };
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775 let contents = if o.result_ok {
776 let result = unsafe { o.contents.result };
777 unsafe { o.contents.result = core::ptr::null_mut() };
778 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
780 let err = unsafe { o.contents.err };
781 unsafe { o.contents.err = core::ptr::null_mut(); }
782 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
786 result_ok: o.result_ok,
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791 fn clone(&self) -> Self {
793 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
797 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
808 /// An enum which can either contain a or not
809 pub enum COption_NoneZ {
810 /// When we're in this state, this COption_NoneZ contains a
812 /// When we're in this state, this COption_NoneZ contains nothing
816 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817 if let Self::None = self { false } else { true }
819 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
824 /// Constructs a new COption_NoneZ containing a
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839 /// A pointer to the contents in the success state.
840 /// Reading from this pointer when `result_ok` is not set is undefined.
841 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842 /// A pointer to the contents in the error state.
843 /// Reading from this pointer when `result_ok` is set is undefined.
844 pub err: *mut crate::lightning::ln::msgs::DecodeError,
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852 /// `err` or `result` depending on the state of `result_ok`.
853 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862 result: Box::into_raw(Box::new(o)),
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872 err: Box::into_raw(Box::new(e)),
877 /// Checks if the given object is currently in the success state
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
888 if unsafe { !(self.contents.result as *mut ()).is_null() } {
889 let _ = unsafe { Box::from_raw(self.contents.result) };
892 if unsafe { !(self.contents.err as *mut ()).is_null() } {
893 let _ = unsafe { Box::from_raw(self.contents.err) };
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900 let contents = if o.result_ok {
901 let result = unsafe { o.contents.result };
902 unsafe { o.contents.result = core::ptr::null_mut() };
903 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
905 let err = unsafe { o.contents.err };
906 unsafe { o.contents.err = core::ptr::null_mut(); }
907 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
911 result_ok: o.result_ok,
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916 fn clone(&self) -> Self {
918 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
922 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935 /// A pointer to the contents in the success state.
936 /// Reading from this pointer when `result_ok` is not set is undefined.
937 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938 /// A pointer to the contents in the error state.
939 /// Reading from this pointer when `result_ok` is set is undefined.
940 pub err: *mut crate::lightning::ln::msgs::DecodeError,
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948 /// `err` or `result` depending on the state of `result_ok`.
949 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956 CResult_ChannelTransactionParametersDecodeErrorZ {
957 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958 result: Box::into_raw(Box::new(o)),
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966 CResult_ChannelTransactionParametersDecodeErrorZ {
967 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968 err: Box::into_raw(Box::new(e)),
973 /// Checks if the given object is currently in the success state
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
984 if unsafe { !(self.contents.result as *mut ()).is_null() } {
985 let _ = unsafe { Box::from_raw(self.contents.result) };
988 if unsafe { !(self.contents.err as *mut ()).is_null() } {
989 let _ = unsafe { Box::from_raw(self.contents.err) };
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996 let contents = if o.result_ok {
997 let result = unsafe { o.contents.result };
998 unsafe { o.contents.result = core::ptr::null_mut() };
999 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1001 let err = unsafe { o.contents.err };
1002 unsafe { o.contents.err = core::ptr::null_mut(); }
1003 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1007 result_ok: o.result_ok,
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012 fn clone(&self) -> Self {
1014 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1018 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032 /// The elements in the array.
1033 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034 pub data: *mut crate::c_types::Signature,
1035 /// The number of elements pointed to by `data`.
1038 impl CVec_SignatureZ {
1039 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040 if self.datalen == 0 { return Vec::new(); }
1041 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042 self.data = core::ptr::null_mut();
1046 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051 fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052 let datalen = v.len();
1053 let data = Box::into_raw(v.into_boxed_slice());
1054 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061 fn drop(&mut self) {
1062 if self.datalen == 0 { return; }
1063 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1066 impl Clone for CVec_SignatureZ {
1067 fn clone(&self) -> Self {
1068 let mut res = Vec::new();
1069 if self.datalen == 0 { return Self::from(res); }
1070 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077 /// A pointer to the contents in the success state.
1078 /// Reading from this pointer when `result_ok` is not set is undefined.
1079 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080 /// A pointer to the contents in the error state.
1081 /// Reading from this pointer when `result_ok` is set is undefined.
1082 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090 /// `err` or `result` depending on the state of `result_ok`.
1091 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093 pub result_ok: bool,
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098 CResult_HolderCommitmentTransactionDecodeErrorZ {
1099 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100 result: Box::into_raw(Box::new(o)),
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108 CResult_HolderCommitmentTransactionDecodeErrorZ {
1109 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110 err: Box::into_raw(Box::new(e)),
1115 /// Checks if the given object is currently in the success state
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124 fn drop(&mut self) {
1126 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127 let _ = unsafe { Box::from_raw(self.contents.result) };
1130 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131 let _ = unsafe { Box::from_raw(self.contents.err) };
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138 let contents = if o.result_ok {
1139 let result = unsafe { o.contents.result };
1140 unsafe { o.contents.result = core::ptr::null_mut() };
1141 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1143 let err = unsafe { o.contents.err };
1144 unsafe { o.contents.err = core::ptr::null_mut(); }
1145 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1149 result_ok: o.result_ok,
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154 fn clone(&self) -> Self {
1156 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1160 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173 /// A pointer to the contents in the success state.
1174 /// Reading from this pointer when `result_ok` is not set is undefined.
1175 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176 /// A pointer to the contents in the error state.
1177 /// Reading from this pointer when `result_ok` is set is undefined.
1178 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186 /// `err` or `result` depending on the state of `result_ok`.
1187 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189 pub result_ok: bool,
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196 result: Box::into_raw(Box::new(o)),
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206 err: Box::into_raw(Box::new(e)),
1211 /// Checks if the given object is currently in the success state
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220 fn drop(&mut self) {
1222 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223 let _ = unsafe { Box::from_raw(self.contents.result) };
1226 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227 let _ = unsafe { Box::from_raw(self.contents.err) };
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234 let contents = if o.result_ok {
1235 let result = unsafe { o.contents.result };
1236 unsafe { o.contents.result = core::ptr::null_mut() };
1237 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1239 let err = unsafe { o.contents.err };
1240 unsafe { o.contents.err = core::ptr::null_mut(); }
1241 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1245 result_ok: o.result_ok,
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250 fn clone(&self) -> Self {
1252 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1256 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269 /// A pointer to the contents in the success state.
1270 /// Reading from this pointer when `result_ok` is not set is undefined.
1271 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272 /// Note that this value is always NULL, as there are no contents in the Err variant
1273 pub err: *mut core::ffi::c_void,
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281 /// `err` or `result` depending on the state of `result_ok`.
1282 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284 pub result_ok: bool,
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289 CResult_TrustedClosingTransactionNoneZ {
1290 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291 result: Box::into_raw(Box::new(o)),
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299 CResult_TrustedClosingTransactionNoneZ {
1300 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301 err: core::ptr::null_mut(),
1306 /// Checks if the given object is currently in the success state
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315 fn drop(&mut self) {
1317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318 let _ = unsafe { Box::from_raw(self.contents.result) };
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326 let contents = if o.result_ok {
1327 let result = unsafe { o.contents.result };
1328 unsafe { o.contents.result = core::ptr::null_mut() };
1329 CResult_TrustedClosingTransactionNoneZPtr { result }
1331 let _ = unsafe { Box::from_raw(o.contents.err) };
1332 o.contents.err = core::ptr::null_mut();
1333 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1337 result_ok: o.result_ok,
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344 /// A pointer to the contents in the success state.
1345 /// Reading from this pointer when `result_ok` is not set is undefined.
1346 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347 /// A pointer to the contents in the error state.
1348 /// Reading from this pointer when `result_ok` is set is undefined.
1349 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357 /// `err` or `result` depending on the state of `result_ok`.
1358 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360 pub result_ok: bool,
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365 CResult_CommitmentTransactionDecodeErrorZ {
1366 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367 result: Box::into_raw(Box::new(o)),
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375 CResult_CommitmentTransactionDecodeErrorZ {
1376 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377 err: Box::into_raw(Box::new(e)),
1382 /// Checks if the given object is currently in the success state
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391 fn drop(&mut self) {
1393 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394 let _ = unsafe { Box::from_raw(self.contents.result) };
1397 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398 let _ = unsafe { Box::from_raw(self.contents.err) };
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405 let contents = if o.result_ok {
1406 let result = unsafe { o.contents.result };
1407 unsafe { o.contents.result = core::ptr::null_mut() };
1408 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1410 let err = unsafe { o.contents.err };
1411 unsafe { o.contents.err = core::ptr::null_mut(); }
1412 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1416 result_ok: o.result_ok,
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421 fn clone(&self) -> Self {
1423 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1427 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440 /// A pointer to the contents in the success state.
1441 /// Reading from this pointer when `result_ok` is not set is undefined.
1442 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443 /// Note that this value is always NULL, as there are no contents in the Err variant
1444 pub err: *mut core::ffi::c_void,
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452 /// `err` or `result` depending on the state of `result_ok`.
1453 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455 pub result_ok: bool,
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460 CResult_TrustedCommitmentTransactionNoneZ {
1461 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462 result: Box::into_raw(Box::new(o)),
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470 CResult_TrustedCommitmentTransactionNoneZ {
1471 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472 err: core::ptr::null_mut(),
1477 /// Checks if the given object is currently in the success state
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486 fn drop(&mut self) {
1488 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489 let _ = unsafe { Box::from_raw(self.contents.result) };
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497 let contents = if o.result_ok {
1498 let result = unsafe { o.contents.result };
1499 unsafe { o.contents.result = core::ptr::null_mut() };
1500 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1502 let _ = unsafe { Box::from_raw(o.contents.err) };
1503 o.contents.err = core::ptr::null_mut();
1504 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1508 result_ok: o.result_ok,
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515 /// A pointer to the contents in the success state.
1516 /// Reading from this pointer when `result_ok` is not set is undefined.
1517 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518 /// Note that this value is always NULL, as there are no contents in the Err variant
1519 pub err: *mut core::ffi::c_void,
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527 /// `err` or `result` depending on the state of `result_ok`.
1528 pub contents: CResult_CVec_SignatureZNoneZPtr,
1529 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530 pub result_ok: bool,
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535 CResult_CVec_SignatureZNoneZ {
1536 contents: CResult_CVec_SignatureZNoneZPtr {
1537 result: Box::into_raw(Box::new(o)),
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545 CResult_CVec_SignatureZNoneZ {
1546 contents: CResult_CVec_SignatureZNoneZPtr {
1547 err: core::ptr::null_mut(),
1552 /// Checks if the given object is currently in the success state
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561 fn drop(&mut self) {
1563 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564 let _ = unsafe { Box::from_raw(self.contents.result) };
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572 let contents = if o.result_ok {
1573 let result = unsafe { o.contents.result };
1574 unsafe { o.contents.result = core::ptr::null_mut() };
1575 CResult_CVec_SignatureZNoneZPtr { result }
1577 let _ = unsafe { Box::from_raw(o.contents.err) };
1578 o.contents.err = core::ptr::null_mut();
1579 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1583 result_ok: o.result_ok,
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588 fn clone(&self) -> Self {
1590 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1594 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595 err: core::ptr::null_mut()
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607 /// A pointer to the contents in the success state.
1608 /// Reading from this pointer when `result_ok` is not set is undefined.
1609 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610 /// A pointer to the contents in the error state.
1611 /// Reading from this pointer when `result_ok` is set is undefined.
1612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620 /// `err` or `result` depending on the state of `result_ok`.
1621 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623 pub result_ok: bool,
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628 CResult_ShutdownScriptDecodeErrorZ {
1629 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630 result: Box::into_raw(Box::new(o)),
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638 CResult_ShutdownScriptDecodeErrorZ {
1639 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640 err: Box::into_raw(Box::new(e)),
1645 /// Checks if the given object is currently in the success state
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654 fn drop(&mut self) {
1656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657 let _ = unsafe { Box::from_raw(self.contents.result) };
1660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661 let _ = unsafe { Box::from_raw(self.contents.err) };
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668 let contents = if o.result_ok {
1669 let result = unsafe { o.contents.result };
1670 unsafe { o.contents.result = core::ptr::null_mut() };
1671 CResult_ShutdownScriptDecodeErrorZPtr { result }
1673 let err = unsafe { o.contents.err };
1674 unsafe { o.contents.err = core::ptr::null_mut(); }
1675 CResult_ShutdownScriptDecodeErrorZPtr { err }
1679 result_ok: o.result_ok,
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684 fn clone(&self) -> Self {
1686 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1690 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703 /// A pointer to the contents in the success state.
1704 /// Reading from this pointer when `result_ok` is not set is undefined.
1705 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706 /// A pointer to the contents in the error state.
1707 /// Reading from this pointer when `result_ok` is set is undefined.
1708 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716 /// `err` or `result` depending on the state of `result_ok`.
1717 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719 pub result_ok: bool,
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724 CResult_ShutdownScriptInvalidShutdownScriptZ {
1725 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726 result: Box::into_raw(Box::new(o)),
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734 CResult_ShutdownScriptInvalidShutdownScriptZ {
1735 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736 err: Box::into_raw(Box::new(e)),
1741 /// Checks if the given object is currently in the success state
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750 fn drop(&mut self) {
1752 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753 let _ = unsafe { Box::from_raw(self.contents.result) };
1756 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757 let _ = unsafe { Box::from_raw(self.contents.err) };
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764 let contents = if o.result_ok {
1765 let result = unsafe { o.contents.result };
1766 unsafe { o.contents.result = core::ptr::null_mut() };
1767 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1769 let err = unsafe { o.contents.err };
1770 unsafe { o.contents.err = core::ptr::null_mut(); }
1771 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1775 result_ok: o.result_ok,
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780 fn clone(&self) -> Self {
1782 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1786 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799 /// Note that this value is always NULL, as there are no contents in the OK variant
1800 pub result: *mut core::ffi::c_void,
1801 /// A pointer to the contents in the error state.
1802 /// Reading from this pointer when `result_ok` is set is undefined.
1803 pub err: *mut crate::c_types::IOError,
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810 /// The contents of this CResult_NoneErrorZ, accessible via either
1811 /// `err` or `result` depending on the state of `result_ok`.
1812 pub contents: CResult_NoneErrorZPtr,
1813 /// Whether this CResult_NoneErrorZ represents a success state.
1814 pub result_ok: bool,
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819 CResult_NoneErrorZ {
1820 contents: CResult_NoneErrorZPtr {
1821 result: core::ptr::null_mut(),
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829 CResult_NoneErrorZ {
1830 contents: CResult_NoneErrorZPtr {
1831 err: Box::into_raw(Box::new(e)),
1836 /// Checks if the given object is currently in the success state
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845 fn drop(&mut self) {
1848 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849 let _ = unsafe { Box::from_raw(self.contents.err) };
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856 let contents = if o.result_ok {
1857 let _ = unsafe { Box::from_raw(o.contents.result) };
1858 o.contents.result = core::ptr::null_mut();
1859 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1861 let err = unsafe { o.contents.err };
1862 unsafe { o.contents.err = core::ptr::null_mut(); }
1863 CResult_NoneErrorZPtr { err }
1867 result_ok: o.result_ok,
1871 impl Clone for CResult_NoneErrorZ {
1872 fn clone(&self) -> Self {
1874 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875 result: core::ptr::null_mut()
1878 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891 /// A pointer to the contents in the success state.
1892 /// Reading from this pointer when `result_ok` is not set is undefined.
1893 pub result: *mut crate::lightning::routing::router::RouteHop,
1894 /// A pointer to the contents in the error state.
1895 /// Reading from this pointer when `result_ok` is set is undefined.
1896 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904 /// `err` or `result` depending on the state of `result_ok`.
1905 pub contents: CResult_RouteHopDecodeErrorZPtr,
1906 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907 pub result_ok: bool,
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912 CResult_RouteHopDecodeErrorZ {
1913 contents: CResult_RouteHopDecodeErrorZPtr {
1914 result: Box::into_raw(Box::new(o)),
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922 CResult_RouteHopDecodeErrorZ {
1923 contents: CResult_RouteHopDecodeErrorZPtr {
1924 err: Box::into_raw(Box::new(e)),
1929 /// Checks if the given object is currently in the success state
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938 fn drop(&mut self) {
1940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941 let _ = unsafe { Box::from_raw(self.contents.result) };
1944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945 let _ = unsafe { Box::from_raw(self.contents.err) };
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952 let contents = if o.result_ok {
1953 let result = unsafe { o.contents.result };
1954 unsafe { o.contents.result = core::ptr::null_mut() };
1955 CResult_RouteHopDecodeErrorZPtr { result }
1957 let err = unsafe { o.contents.err };
1958 unsafe { o.contents.err = core::ptr::null_mut(); }
1959 CResult_RouteHopDecodeErrorZPtr { err }
1963 result_ok: o.result_ok,
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968 fn clone(&self) -> Self {
1970 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1974 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988 /// The elements in the array.
1989 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990 pub data: *mut crate::lightning::routing::router::RouteHop,
1991 /// The number of elements pointed to by `data`.
1994 impl CVec_RouteHopZ {
1995 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996 if self.datalen == 0 { return Vec::new(); }
1997 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998 self.data = core::ptr::null_mut();
2002 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008 let datalen = v.len();
2009 let data = Box::into_raw(v.into_boxed_slice());
2010 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017 fn drop(&mut self) {
2018 if self.datalen == 0 { return; }
2019 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2022 impl Clone for CVec_RouteHopZ {
2023 fn clone(&self) -> Self {
2024 let mut res = Vec::new();
2025 if self.datalen == 0 { return Self::from(res); }
2026 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034 /// The elements in the array.
2035 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037 /// The number of elements pointed to by `data`.
2040 impl CVec_CVec_RouteHopZZ {
2041 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042 if self.datalen == 0 { return Vec::new(); }
2043 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044 self.data = core::ptr::null_mut();
2048 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054 let datalen = v.len();
2055 let data = Box::into_raw(v.into_boxed_slice());
2056 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063 fn drop(&mut self) {
2064 if self.datalen == 0 { return; }
2065 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069 fn clone(&self) -> Self {
2070 let mut res = Vec::new();
2071 if self.datalen == 0 { return Self::from(res); }
2072 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079 /// A pointer to the contents in the success state.
2080 /// Reading from this pointer when `result_ok` is not set is undefined.
2081 pub result: *mut crate::lightning::routing::router::Route,
2082 /// A pointer to the contents in the error state.
2083 /// Reading from this pointer when `result_ok` is set is undefined.
2084 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092 /// `err` or `result` depending on the state of `result_ok`.
2093 pub contents: CResult_RouteDecodeErrorZPtr,
2094 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095 pub result_ok: bool,
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100 CResult_RouteDecodeErrorZ {
2101 contents: CResult_RouteDecodeErrorZPtr {
2102 result: Box::into_raw(Box::new(o)),
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110 CResult_RouteDecodeErrorZ {
2111 contents: CResult_RouteDecodeErrorZPtr {
2112 err: Box::into_raw(Box::new(e)),
2117 /// Checks if the given object is currently in the success state
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126 fn drop(&mut self) {
2128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129 let _ = unsafe { Box::from_raw(self.contents.result) };
2132 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133 let _ = unsafe { Box::from_raw(self.contents.err) };
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140 let contents = if o.result_ok {
2141 let result = unsafe { o.contents.result };
2142 unsafe { o.contents.result = core::ptr::null_mut() };
2143 CResult_RouteDecodeErrorZPtr { result }
2145 let err = unsafe { o.contents.err };
2146 unsafe { o.contents.err = core::ptr::null_mut(); }
2147 CResult_RouteDecodeErrorZPtr { err }
2151 result_ok: o.result_ok,
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156 fn clone(&self) -> Self {
2158 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2162 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175 /// A pointer to the contents in the success state.
2176 /// Reading from this pointer when `result_ok` is not set is undefined.
2177 pub result: *mut crate::lightning::routing::router::RouteParameters,
2178 /// A pointer to the contents in the error state.
2179 /// Reading from this pointer when `result_ok` is set is undefined.
2180 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188 /// `err` or `result` depending on the state of `result_ok`.
2189 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191 pub result_ok: bool,
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196 CResult_RouteParametersDecodeErrorZ {
2197 contents: CResult_RouteParametersDecodeErrorZPtr {
2198 result: Box::into_raw(Box::new(o)),
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206 CResult_RouteParametersDecodeErrorZ {
2207 contents: CResult_RouteParametersDecodeErrorZPtr {
2208 err: Box::into_raw(Box::new(e)),
2213 /// Checks if the given object is currently in the success state
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222 fn drop(&mut self) {
2224 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225 let _ = unsafe { Box::from_raw(self.contents.result) };
2228 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229 let _ = unsafe { Box::from_raw(self.contents.err) };
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236 let contents = if o.result_ok {
2237 let result = unsafe { o.contents.result };
2238 unsafe { o.contents.result = core::ptr::null_mut() };
2239 CResult_RouteParametersDecodeErrorZPtr { result }
2241 let err = unsafe { o.contents.err };
2242 unsafe { o.contents.err = core::ptr::null_mut(); }
2243 CResult_RouteParametersDecodeErrorZPtr { err }
2247 result_ok: o.result_ok,
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252 fn clone(&self) -> Self {
2254 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2258 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272 /// The elements in the array.
2273 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274 pub data: *mut crate::lightning::routing::router::RouteHint,
2275 /// The number of elements pointed to by `data`.
2278 impl CVec_RouteHintZ {
2279 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280 if self.datalen == 0 { return Vec::new(); }
2281 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282 self.data = core::ptr::null_mut();
2286 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292 let datalen = v.len();
2293 let data = Box::into_raw(v.into_boxed_slice());
2294 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301 fn drop(&mut self) {
2302 if self.datalen == 0 { return; }
2303 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2306 impl Clone for CVec_RouteHintZ {
2307 fn clone(&self) -> Self {
2308 let mut res = Vec::new();
2309 if self.datalen == 0 { return Self::from(res); }
2310 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318 /// When we're in this state, this COption_u64Z contains a u64
2320 /// When we're in this state, this COption_u64Z contains nothing
2324 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325 if let Self::None = self { false } else { true }
2327 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2330 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331 if let Self::Some(v) = self { v } else { unreachable!() }
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337 COption_u64Z::Some(o)
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354 /// A pointer to the contents in the success state.
2355 /// Reading from this pointer when `result_ok` is not set is undefined.
2356 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357 /// A pointer to the contents in the error state.
2358 /// Reading from this pointer when `result_ok` is set is undefined.
2359 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367 /// `err` or `result` depending on the state of `result_ok`.
2368 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370 pub result_ok: bool,
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375 CResult_PaymentParametersDecodeErrorZ {
2376 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377 result: Box::into_raw(Box::new(o)),
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385 CResult_PaymentParametersDecodeErrorZ {
2386 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387 err: Box::into_raw(Box::new(e)),
2392 /// Checks if the given object is currently in the success state
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401 fn drop(&mut self) {
2403 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404 let _ = unsafe { Box::from_raw(self.contents.result) };
2407 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408 let _ = unsafe { Box::from_raw(self.contents.err) };
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415 let contents = if o.result_ok {
2416 let result = unsafe { o.contents.result };
2417 unsafe { o.contents.result = core::ptr::null_mut() };
2418 CResult_PaymentParametersDecodeErrorZPtr { result }
2420 let err = unsafe { o.contents.err };
2421 unsafe { o.contents.err = core::ptr::null_mut(); }
2422 CResult_PaymentParametersDecodeErrorZPtr { err }
2426 result_ok: o.result_ok,
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431 fn clone(&self) -> Self {
2433 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2437 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451 /// The elements in the array.
2452 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454 /// The number of elements pointed to by `data`.
2457 impl CVec_RouteHintHopZ {
2458 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459 if self.datalen == 0 { return Vec::new(); }
2460 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461 self.data = core::ptr::null_mut();
2465 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471 let datalen = v.len();
2472 let data = Box::into_raw(v.into_boxed_slice());
2473 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480 fn drop(&mut self) {
2481 if self.datalen == 0 { return; }
2482 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2485 impl Clone for CVec_RouteHintHopZ {
2486 fn clone(&self) -> Self {
2487 let mut res = Vec::new();
2488 if self.datalen == 0 { return Self::from(res); }
2489 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496 /// A pointer to the contents in the success state.
2497 /// Reading from this pointer when `result_ok` is not set is undefined.
2498 pub result: *mut crate::lightning::routing::router::RouteHint,
2499 /// A pointer to the contents in the error state.
2500 /// Reading from this pointer when `result_ok` is set is undefined.
2501 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509 /// `err` or `result` depending on the state of `result_ok`.
2510 pub contents: CResult_RouteHintDecodeErrorZPtr,
2511 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512 pub result_ok: bool,
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517 CResult_RouteHintDecodeErrorZ {
2518 contents: CResult_RouteHintDecodeErrorZPtr {
2519 result: Box::into_raw(Box::new(o)),
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527 CResult_RouteHintDecodeErrorZ {
2528 contents: CResult_RouteHintDecodeErrorZPtr {
2529 err: Box::into_raw(Box::new(e)),
2534 /// Checks if the given object is currently in the success state
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543 fn drop(&mut self) {
2545 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546 let _ = unsafe { Box::from_raw(self.contents.result) };
2549 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550 let _ = unsafe { Box::from_raw(self.contents.err) };
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557 let contents = if o.result_ok {
2558 let result = unsafe { o.contents.result };
2559 unsafe { o.contents.result = core::ptr::null_mut() };
2560 CResult_RouteHintDecodeErrorZPtr { result }
2562 let err = unsafe { o.contents.err };
2563 unsafe { o.contents.err = core::ptr::null_mut(); }
2564 CResult_RouteHintDecodeErrorZPtr { err }
2568 result_ok: o.result_ok,
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573 fn clone(&self) -> Self {
2575 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2579 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592 /// A pointer to the contents in the success state.
2593 /// Reading from this pointer when `result_ok` is not set is undefined.
2594 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595 /// A pointer to the contents in the error state.
2596 /// Reading from this pointer when `result_ok` is set is undefined.
2597 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605 /// `err` or `result` depending on the state of `result_ok`.
2606 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608 pub result_ok: bool,
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613 CResult_RouteHintHopDecodeErrorZ {
2614 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615 result: Box::into_raw(Box::new(o)),
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623 CResult_RouteHintHopDecodeErrorZ {
2624 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625 err: Box::into_raw(Box::new(e)),
2630 /// Checks if the given object is currently in the success state
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639 fn drop(&mut self) {
2641 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642 let _ = unsafe { Box::from_raw(self.contents.result) };
2645 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646 let _ = unsafe { Box::from_raw(self.contents.err) };
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653 let contents = if o.result_ok {
2654 let result = unsafe { o.contents.result };
2655 unsafe { o.contents.result = core::ptr::null_mut() };
2656 CResult_RouteHintHopDecodeErrorZPtr { result }
2658 let err = unsafe { o.contents.err };
2659 unsafe { o.contents.err = core::ptr::null_mut(); }
2660 CResult_RouteHintHopDecodeErrorZPtr { err }
2664 result_ok: o.result_ok,
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669 fn clone(&self) -> Self {
2671 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2675 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689 /// The elements in the array.
2690 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692 /// The number of elements pointed to by `data`.
2695 impl CVec_ChannelDetailsZ {
2696 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697 if self.datalen == 0 { return Vec::new(); }
2698 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699 self.data = core::ptr::null_mut();
2703 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709 let datalen = v.len();
2710 let data = Box::into_raw(v.into_boxed_slice());
2711 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718 fn drop(&mut self) {
2719 if self.datalen == 0 { return; }
2720 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2723 impl Clone for CVec_ChannelDetailsZ {
2724 fn clone(&self) -> Self {
2725 let mut res = Vec::new();
2726 if self.datalen == 0 { return Self::from(res); }
2727 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734 /// A pointer to the contents in the success state.
2735 /// Reading from this pointer when `result_ok` is not set is undefined.
2736 pub result: *mut crate::lightning::routing::router::Route,
2737 /// A pointer to the contents in the error state.
2738 /// Reading from this pointer when `result_ok` is set is undefined.
2739 pub err: *mut crate::lightning::ln::msgs::LightningError,
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747 /// `err` or `result` depending on the state of `result_ok`.
2748 pub contents: CResult_RouteLightningErrorZPtr,
2749 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750 pub result_ok: bool,
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755 CResult_RouteLightningErrorZ {
2756 contents: CResult_RouteLightningErrorZPtr {
2757 result: Box::into_raw(Box::new(o)),
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765 CResult_RouteLightningErrorZ {
2766 contents: CResult_RouteLightningErrorZPtr {
2767 err: Box::into_raw(Box::new(e)),
2772 /// Checks if the given object is currently in the success state
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781 fn drop(&mut self) {
2783 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784 let _ = unsafe { Box::from_raw(self.contents.result) };
2787 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788 let _ = unsafe { Box::from_raw(self.contents.err) };
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795 let contents = if o.result_ok {
2796 let result = unsafe { o.contents.result };
2797 unsafe { o.contents.result = core::ptr::null_mut() };
2798 CResult_RouteLightningErrorZPtr { result }
2800 let err = unsafe { o.contents.err };
2801 unsafe { o.contents.err = core::ptr::null_mut(); }
2802 CResult_RouteLightningErrorZPtr { err }
2806 result_ok: o.result_ok,
2810 impl Clone for CResult_RouteLightningErrorZ {
2811 fn clone(&self) -> Self {
2813 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2817 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2828 /// The contents of CResult_TxOutAccessErrorZ
2829 pub union CResult_TxOutAccessErrorZPtr {
2830 /// A pointer to the contents in the success state.
2831 /// Reading from this pointer when `result_ok` is not set is undefined.
2832 pub result: *mut crate::c_types::TxOut,
2833 /// A pointer to the contents in the error state.
2834 /// Reading from this pointer when `result_ok` is set is undefined.
2835 pub err: *mut crate::lightning::chain::AccessError,
2838 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2839 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2841 pub struct CResult_TxOutAccessErrorZ {
2842 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2843 /// `err` or `result` depending on the state of `result_ok`.
2844 pub contents: CResult_TxOutAccessErrorZPtr,
2845 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2846 pub result_ok: bool,
2849 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2850 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2851 CResult_TxOutAccessErrorZ {
2852 contents: CResult_TxOutAccessErrorZPtr {
2853 result: Box::into_raw(Box::new(o)),
2859 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2860 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2861 CResult_TxOutAccessErrorZ {
2862 contents: CResult_TxOutAccessErrorZPtr {
2863 err: Box::into_raw(Box::new(e)),
2868 /// Checks if the given object is currently in the success state
2870 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2874 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2875 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2876 impl Drop for CResult_TxOutAccessErrorZ {
2877 fn drop(&mut self) {
2879 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2880 let _ = unsafe { Box::from_raw(self.contents.result) };
2883 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2884 let _ = unsafe { Box::from_raw(self.contents.err) };
2889 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2890 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2891 let contents = if o.result_ok {
2892 let result = unsafe { o.contents.result };
2893 unsafe { o.contents.result = core::ptr::null_mut() };
2894 CResult_TxOutAccessErrorZPtr { result }
2896 let err = unsafe { o.contents.err };
2897 unsafe { o.contents.err = core::ptr::null_mut(); }
2898 CResult_TxOutAccessErrorZPtr { err }
2902 result_ok: o.result_ok,
2906 impl Clone for CResult_TxOutAccessErrorZ {
2907 fn clone(&self) -> Self {
2909 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2910 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2913 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2914 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2920 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2921 /// but with all dynamically-allocated buffers duplicated in new buffers.
2922 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2924 /// A tuple of 2 elements. See the individual fields for the types contained.
2925 pub struct C2Tuple_usizeTransactionZ {
2926 /// The element at position 0
2928 /// The element at position 1
2929 pub b: crate::c_types::Transaction,
2931 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2932 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2939 impl C2Tuple_usizeTransactionZ {
2940 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2944 impl Clone for C2Tuple_usizeTransactionZ {
2945 fn clone(&self) -> Self {
2947 a: Clone::clone(&self.a),
2948 b: Clone::clone(&self.b),
2953 /// Creates a new tuple which has the same data as `orig`
2954 /// but with all dynamically-allocated buffers duplicated in new buffers.
2955 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2956 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2958 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2959 C2Tuple_usizeTransactionZ { a, b, }
2963 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2964 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2967 /// This corresponds to std::vector in C++
2968 pub struct CVec_C2Tuple_usizeTransactionZZ {
2969 /// The elements in the array.
2970 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2971 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2972 /// The number of elements pointed to by `data`.
2975 impl CVec_C2Tuple_usizeTransactionZZ {
2976 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2977 if self.datalen == 0 { return Vec::new(); }
2978 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2979 self.data = core::ptr::null_mut();
2983 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2984 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2987 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2988 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2989 let datalen = v.len();
2990 let data = Box::into_raw(v.into_boxed_slice());
2991 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2996 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2997 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2998 fn drop(&mut self) {
2999 if self.datalen == 0 { return; }
3000 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3003 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3004 fn clone(&self) -> Self {
3005 let mut res = Vec::new();
3006 if self.datalen == 0 { return Self::from(res); }
3007 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3012 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3013 /// This corresponds to std::vector in C++
3014 pub struct CVec_TxidZ {
3015 /// The elements in the array.
3016 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3017 pub data: *mut crate::c_types::ThirtyTwoBytes,
3018 /// The number of elements pointed to by `data`.
3022 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3023 if self.datalen == 0 { return Vec::new(); }
3024 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3025 self.data = core::ptr::null_mut();
3029 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3030 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3033 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3034 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3035 let datalen = v.len();
3036 let data = Box::into_raw(v.into_boxed_slice());
3037 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3042 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3043 impl Drop for CVec_TxidZ {
3044 fn drop(&mut self) {
3045 if self.datalen == 0 { return; }
3046 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3049 impl Clone for CVec_TxidZ {
3050 fn clone(&self) -> Self {
3051 let mut res = Vec::new();
3052 if self.datalen == 0 { return Self::from(res); }
3053 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3058 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3059 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3060 /// Note that this value is always NULL, as there are no contents in the OK variant
3061 pub result: *mut core::ffi::c_void,
3062 /// A pointer to the contents in the error state.
3063 /// Reading from this pointer when `result_ok` is set is undefined.
3064 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3067 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3068 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3070 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3071 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3072 /// `err` or `result` depending on the state of `result_ok`.
3073 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3074 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3075 pub result_ok: bool,
3078 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3079 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3080 CResult_NoneChannelMonitorUpdateErrZ {
3081 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3082 result: core::ptr::null_mut(),
3088 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3089 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3090 CResult_NoneChannelMonitorUpdateErrZ {
3091 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3092 err: Box::into_raw(Box::new(e)),
3097 /// Checks if the given object is currently in the success state
3099 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3103 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3104 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3105 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3106 fn drop(&mut self) {
3109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3110 let _ = unsafe { Box::from_raw(self.contents.err) };
3115 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3116 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3117 let contents = if o.result_ok {
3118 let _ = unsafe { Box::from_raw(o.contents.result) };
3119 o.contents.result = core::ptr::null_mut();
3120 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3122 let err = unsafe { o.contents.err };
3123 unsafe { o.contents.err = core::ptr::null_mut(); }
3124 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3128 result_ok: o.result_ok,
3132 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3133 fn clone(&self) -> Self {
3135 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3136 result: core::ptr::null_mut()
3139 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3140 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3146 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3147 /// but with all dynamically-allocated buffers duplicated in new buffers.
3148 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3150 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3151 /// This corresponds to std::vector in C++
3152 pub struct CVec_MonitorEventZ {
3153 /// The elements in the array.
3154 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3155 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3156 /// The number of elements pointed to by `data`.
3159 impl CVec_MonitorEventZ {
3160 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3161 if self.datalen == 0 { return Vec::new(); }
3162 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3163 self.data = core::ptr::null_mut();
3167 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3168 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3171 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3172 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3173 let datalen = v.len();
3174 let data = Box::into_raw(v.into_boxed_slice());
3175 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3180 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3181 impl Drop for CVec_MonitorEventZ {
3182 fn drop(&mut self) {
3183 if self.datalen == 0 { return; }
3184 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3187 impl Clone for CVec_MonitorEventZ {
3188 fn clone(&self) -> Self {
3189 let mut res = Vec::new();
3190 if self.datalen == 0 { return Self::from(res); }
3191 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3197 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3198 pub enum COption_C2Tuple_usizeTransactionZZ {
3199 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3201 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3204 impl COption_C2Tuple_usizeTransactionZZ {
3205 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3206 if let Self::None = self { false } else { true }
3208 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3211 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3212 if let Self::Some(v) = self { v } else { unreachable!() }
3216 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3217 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3218 COption_C2Tuple_usizeTransactionZZ::Some(o)
3221 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3222 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3223 COption_C2Tuple_usizeTransactionZZ::None
3226 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3227 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3229 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3230 /// but with all dynamically-allocated buffers duplicated in new buffers.
3231 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3234 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3235 pub enum COption_ClosureReasonZ {
3236 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3237 Some(crate::lightning::util::events::ClosureReason),
3238 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3241 impl COption_ClosureReasonZ {
3242 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243 if let Self::None = self { false } else { true }
3245 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3248 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3249 if let Self::Some(v) = self { v } else { unreachable!() }
3253 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3254 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3255 COption_ClosureReasonZ::Some(o)
3258 /// Constructs a new COption_ClosureReasonZ containing nothing
3259 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3260 COption_ClosureReasonZ::None
3263 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3264 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3266 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3267 /// but with all dynamically-allocated buffers duplicated in new buffers.
3268 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3270 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3271 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3272 /// A pointer to the contents in the success state.
3273 /// Reading from this pointer when `result_ok` is not set is undefined.
3274 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3275 /// A pointer to the contents in the error state.
3276 /// Reading from this pointer when `result_ok` is set is undefined.
3277 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3280 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3281 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3283 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3284 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3285 /// `err` or `result` depending on the state of `result_ok`.
3286 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3287 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3288 pub result_ok: bool,
3291 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3292 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3293 CResult_COption_ClosureReasonZDecodeErrorZ {
3294 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295 result: Box::into_raw(Box::new(o)),
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3302 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3303 CResult_COption_ClosureReasonZDecodeErrorZ {
3304 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3305 err: Box::into_raw(Box::new(e)),
3310 /// Checks if the given object is currently in the success state
3312 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3316 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3317 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3318 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3319 fn drop(&mut self) {
3321 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3322 let _ = unsafe { Box::from_raw(self.contents.result) };
3325 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3326 let _ = unsafe { Box::from_raw(self.contents.err) };
3331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3332 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3333 let contents = if o.result_ok {
3334 let result = unsafe { o.contents.result };
3335 unsafe { o.contents.result = core::ptr::null_mut() };
3336 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3338 let err = unsafe { o.contents.err };
3339 unsafe { o.contents.err = core::ptr::null_mut(); }
3340 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3344 result_ok: o.result_ok,
3348 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3349 fn clone(&self) -> Self {
3351 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3352 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3355 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3356 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3362 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3363 /// but with all dynamically-allocated buffers duplicated in new buffers.
3364 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3367 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3368 pub enum COption_NetworkUpdateZ {
3369 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3370 Some(crate::lightning::routing::network_graph::NetworkUpdate),
3371 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3374 impl COption_NetworkUpdateZ {
3375 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376 if let Self::None = self { false } else { true }
3378 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3381 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3382 if let Self::Some(v) = self { v } else { unreachable!() }
3386 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3387 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3388 COption_NetworkUpdateZ::Some(o)
3391 /// Constructs a new COption_NetworkUpdateZ containing nothing
3392 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3393 COption_NetworkUpdateZ::None
3396 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3397 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3399 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3403 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_SpendableOutputDescriptorZ {
3406 /// The elements in the array.
3407 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3409 /// The number of elements pointed to by `data`.
3412 impl CVec_SpendableOutputDescriptorZ {
3413 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3414 if self.datalen == 0 { return Vec::new(); }
3415 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416 self.data = core::ptr::null_mut();
3420 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3421 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3424 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3425 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3426 let datalen = v.len();
3427 let data = Box::into_raw(v.into_boxed_slice());
3428 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3434 impl Drop for CVec_SpendableOutputDescriptorZ {
3435 fn drop(&mut self) {
3436 if self.datalen == 0 { return; }
3437 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3440 impl Clone for CVec_SpendableOutputDescriptorZ {
3441 fn clone(&self) -> Self {
3442 let mut res = Vec::new();
3443 if self.datalen == 0 { return Self::from(res); }
3444 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3450 /// An enum which can either contain a crate::lightning::util::events::Event or not
3451 pub enum COption_EventZ {
3452 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3453 Some(crate::lightning::util::events::Event),
3454 /// When we're in this state, this COption_EventZ contains nothing
3457 impl COption_EventZ {
3458 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3459 if let Self::None = self { false } else { true }
3461 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3464 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3465 if let Self::Some(v) = self { v } else { unreachable!() }
3469 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3470 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3471 COption_EventZ::Some(o)
3474 /// Constructs a new COption_EventZ containing nothing
3475 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3476 COption_EventZ::None
3479 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3480 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3482 /// Creates a new COption_EventZ which has the same data as `orig`
3483 /// but with all dynamically-allocated buffers duplicated in new buffers.
3484 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3486 /// The contents of CResult_COption_EventZDecodeErrorZ
3487 pub union CResult_COption_EventZDecodeErrorZPtr {
3488 /// A pointer to the contents in the success state.
3489 /// Reading from this pointer when `result_ok` is not set is undefined.
3490 pub result: *mut crate::c_types::derived::COption_EventZ,
3491 /// A pointer to the contents in the error state.
3492 /// Reading from this pointer when `result_ok` is set is undefined.
3493 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3496 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3497 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3499 pub struct CResult_COption_EventZDecodeErrorZ {
3500 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3501 /// `err` or `result` depending on the state of `result_ok`.
3502 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3503 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3504 pub result_ok: bool,
3507 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3508 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3509 CResult_COption_EventZDecodeErrorZ {
3510 contents: CResult_COption_EventZDecodeErrorZPtr {
3511 result: Box::into_raw(Box::new(o)),
3517 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3518 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3519 CResult_COption_EventZDecodeErrorZ {
3520 contents: CResult_COption_EventZDecodeErrorZPtr {
3521 err: Box::into_raw(Box::new(e)),
3526 /// Checks if the given object is currently in the success state
3528 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3532 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3533 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3534 impl Drop for CResult_COption_EventZDecodeErrorZ {
3535 fn drop(&mut self) {
3537 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3538 let _ = unsafe { Box::from_raw(self.contents.result) };
3541 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3542 let _ = unsafe { Box::from_raw(self.contents.err) };
3547 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3548 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3549 let contents = if o.result_ok {
3550 let result = unsafe { o.contents.result };
3551 unsafe { o.contents.result = core::ptr::null_mut() };
3552 CResult_COption_EventZDecodeErrorZPtr { result }
3554 let err = unsafe { o.contents.err };
3555 unsafe { o.contents.err = core::ptr::null_mut(); }
3556 CResult_COption_EventZDecodeErrorZPtr { err }
3560 result_ok: o.result_ok,
3564 impl Clone for CResult_COption_EventZDecodeErrorZ {
3565 fn clone(&self) -> Self {
3567 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3568 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3571 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3572 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3578 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3579 /// but with all dynamically-allocated buffers duplicated in new buffers.
3580 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3582 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3583 /// This corresponds to std::vector in C++
3584 pub struct CVec_MessageSendEventZ {
3585 /// The elements in the array.
3586 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3587 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3588 /// The number of elements pointed to by `data`.
3591 impl CVec_MessageSendEventZ {
3592 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3593 if self.datalen == 0 { return Vec::new(); }
3594 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3595 self.data = core::ptr::null_mut();
3599 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3600 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3603 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3604 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3605 let datalen = v.len();
3606 let data = Box::into_raw(v.into_boxed_slice());
3607 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3612 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3613 impl Drop for CVec_MessageSendEventZ {
3614 fn drop(&mut self) {
3615 if self.datalen == 0 { return; }
3616 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3619 impl Clone for CVec_MessageSendEventZ {
3620 fn clone(&self) -> Self {
3621 let mut res = Vec::new();
3622 if self.datalen == 0 { return Self::from(res); }
3623 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3628 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3629 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3630 /// A pointer to the contents in the success state.
3631 /// Reading from this pointer when `result_ok` is not set is undefined.
3632 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3633 /// A pointer to the contents in the error state.
3634 /// Reading from this pointer when `result_ok` is set is undefined.
3635 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3638 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3639 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3640 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3641 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3642 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3643 /// `err` or `result` depending on the state of `result_ok`.
3644 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3645 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3646 pub result_ok: bool,
3649 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3650 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3651 CResult_FixedPenaltyScorerDecodeErrorZ {
3652 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3653 result: Box::into_raw(Box::new(o)),
3659 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3660 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3661 CResult_FixedPenaltyScorerDecodeErrorZ {
3662 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3663 err: Box::into_raw(Box::new(e)),
3668 /// Checks if the given object is currently in the success state
3670 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3674 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3675 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3676 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3677 fn drop(&mut self) {
3679 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3680 let _ = unsafe { Box::from_raw(self.contents.result) };
3683 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3684 let _ = unsafe { Box::from_raw(self.contents.err) };
3689 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3690 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3691 let contents = if o.result_ok {
3692 let result = unsafe { o.contents.result };
3693 unsafe { o.contents.result = core::ptr::null_mut() };
3694 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3696 let err = unsafe { o.contents.err };
3697 unsafe { o.contents.err = core::ptr::null_mut(); }
3698 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3702 result_ok: o.result_ok,
3707 /// The contents of CResult_ScoringParametersDecodeErrorZ
3708 pub union CResult_ScoringParametersDecodeErrorZPtr {
3709 /// A pointer to the contents in the success state.
3710 /// Reading from this pointer when `result_ok` is not set is undefined.
3711 pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3712 /// A pointer to the contents in the error state.
3713 /// Reading from this pointer when `result_ok` is set is undefined.
3714 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3717 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3718 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3720 pub struct CResult_ScoringParametersDecodeErrorZ {
3721 /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3722 /// `err` or `result` depending on the state of `result_ok`.
3723 pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3724 /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3725 pub result_ok: bool,
3728 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3729 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3730 CResult_ScoringParametersDecodeErrorZ {
3731 contents: CResult_ScoringParametersDecodeErrorZPtr {
3732 result: Box::into_raw(Box::new(o)),
3738 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3739 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3740 CResult_ScoringParametersDecodeErrorZ {
3741 contents: CResult_ScoringParametersDecodeErrorZPtr {
3742 err: Box::into_raw(Box::new(e)),
3747 /// Checks if the given object is currently in the success state
3749 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3753 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3754 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3755 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3756 fn drop(&mut self) {
3758 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3759 let _ = unsafe { Box::from_raw(self.contents.result) };
3762 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3763 let _ = unsafe { Box::from_raw(self.contents.err) };
3768 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3769 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3770 let contents = if o.result_ok {
3771 let result = unsafe { o.contents.result };
3772 unsafe { o.contents.result = core::ptr::null_mut() };
3773 CResult_ScoringParametersDecodeErrorZPtr { result }
3775 let err = unsafe { o.contents.err };
3776 unsafe { o.contents.err = core::ptr::null_mut(); }
3777 CResult_ScoringParametersDecodeErrorZPtr { err }
3781 result_ok: o.result_ok,
3786 /// The contents of CResult_ScorerDecodeErrorZ
3787 pub union CResult_ScorerDecodeErrorZPtr {
3788 /// A pointer to the contents in the success state.
3789 /// Reading from this pointer when `result_ok` is not set is undefined.
3790 pub result: *mut crate::lightning::routing::scoring::Scorer,
3791 /// A pointer to the contents in the error state.
3792 /// Reading from this pointer when `result_ok` is set is undefined.
3793 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3796 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3797 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3799 pub struct CResult_ScorerDecodeErrorZ {
3800 /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3801 /// `err` or `result` depending on the state of `result_ok`.
3802 pub contents: CResult_ScorerDecodeErrorZPtr,
3803 /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3804 pub result_ok: bool,
3807 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3808 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3809 CResult_ScorerDecodeErrorZ {
3810 contents: CResult_ScorerDecodeErrorZPtr {
3811 result: Box::into_raw(Box::new(o)),
3817 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3818 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3819 CResult_ScorerDecodeErrorZ {
3820 contents: CResult_ScorerDecodeErrorZPtr {
3821 err: Box::into_raw(Box::new(e)),
3826 /// Checks if the given object is currently in the success state
3828 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3832 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3833 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3834 impl Drop for CResult_ScorerDecodeErrorZ {
3835 fn drop(&mut self) {
3837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3838 let _ = unsafe { Box::from_raw(self.contents.result) };
3841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3842 let _ = unsafe { Box::from_raw(self.contents.err) };
3847 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3848 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3849 let contents = if o.result_ok {
3850 let result = unsafe { o.contents.result };
3851 unsafe { o.contents.result = core::ptr::null_mut() };
3852 CResult_ScorerDecodeErrorZPtr { result }
3854 let err = unsafe { o.contents.err };
3855 unsafe { o.contents.err = core::ptr::null_mut(); }
3856 CResult_ScorerDecodeErrorZPtr { err }
3860 result_ok: o.result_ok,
3865 /// The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
3866 pub union CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3867 /// A pointer to the contents in the success state.
3868 /// Reading from this pointer when `result_ok` is not set is undefined.
3869 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3870 /// A pointer to the contents in the error state.
3871 /// Reading from this pointer when `result_ok` is set is undefined.
3872 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3875 /// A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
3876 /// containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3878 pub struct CResult_ProbabilisticScoringParametersDecodeErrorZ {
3879 /// The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
3880 /// `err` or `result` depending on the state of `result_ok`.
3881 pub contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr,
3882 /// Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
3883 pub result_ok: bool,
3886 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
3887 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScoringParameters) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3888 CResult_ProbabilisticScoringParametersDecodeErrorZ {
3889 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3890 result: Box::into_raw(Box::new(o)),
3896 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
3897 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3898 CResult_ProbabilisticScoringParametersDecodeErrorZ {
3899 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3900 err: Box::into_raw(Box::new(e)),
3905 /// Checks if the given object is currently in the success state
3907 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> bool {
3911 /// Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
3912 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res: CResult_ProbabilisticScoringParametersDecodeErrorZ) { }
3913 impl Drop for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3914 fn drop(&mut self) {
3916 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3917 let _ = unsafe { Box::from_raw(self.contents.result) };
3920 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3921 let _ = unsafe { Box::from_raw(self.contents.err) };
3926 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3927 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3928 let contents = if o.result_ok {
3929 let result = unsafe { o.contents.result };
3930 unsafe { o.contents.result = core::ptr::null_mut() };
3931 CResult_ProbabilisticScoringParametersDecodeErrorZPtr { result }
3933 let err = unsafe { o.contents.err };
3934 unsafe { o.contents.err = core::ptr::null_mut(); }
3935 CResult_ProbabilisticScoringParametersDecodeErrorZPtr { err }
3939 result_ok: o.result_ok,
3943 impl Clone for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3944 fn clone(&self) -> Self {
3946 Self { result_ok: true, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3947 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ProbabilisticScoringParameters>::clone(unsafe { &*self.contents.result })))
3950 Self { result_ok: false, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3951 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3957 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
3958 /// but with all dynamically-allocated buffers duplicated in new buffers.
3959 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> CResult_ProbabilisticScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3961 /// A tuple of 2 elements. See the individual fields for the types contained.
3962 pub struct C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3963 /// The element at position 0
3964 pub a: crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3965 /// The element at position 1
3966 pub b: &'static crate::lightning::routing::network_graph::NetworkGraph,
3968 impl From<(crate::lightning::routing::scoring::ProbabilisticScoringParameters, &'static crate::lightning::routing::network_graph::NetworkGraph)> for C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3969 fn from (tup: (crate::lightning::routing::scoring::ProbabilisticScoringParameters, &'static crate::lightning::routing::network_graph::NetworkGraph)) -> Self {
3976 impl C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3977 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::routing::scoring::ProbabilisticScoringParameters, &'static crate::lightning::routing::network_graph::NetworkGraph) {
3981 /// Creates a new C2Tuple_ProbabilisticScoringParametersNetworkGraphZ from the contained elements.
3983 pub extern "C" fn C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a: crate::lightning::routing::scoring::ProbabilisticScoringParameters, b: &'static crate::lightning::routing::network_graph::NetworkGraph) -> C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3984 C2Tuple_ProbabilisticScoringParametersNetworkGraphZ { a, b, }
3988 /// Frees any resources used by the C2Tuple_ProbabilisticScoringParametersNetworkGraphZ.
3989 pub extern "C" fn C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(_res: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ) { }
3991 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3992 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3993 /// A pointer to the contents in the success state.
3994 /// Reading from this pointer when `result_ok` is not set is undefined.
3995 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3996 /// A pointer to the contents in the error state.
3997 /// Reading from this pointer when `result_ok` is set is undefined.
3998 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4001 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4002 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4004 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4005 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4006 /// `err` or `result` depending on the state of `result_ok`.
4007 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4008 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4009 pub result_ok: bool,
4012 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4013 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4014 CResult_ProbabilisticScorerDecodeErrorZ {
4015 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4016 result: Box::into_raw(Box::new(o)),
4022 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4023 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4024 CResult_ProbabilisticScorerDecodeErrorZ {
4025 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4026 err: Box::into_raw(Box::new(e)),
4031 /// Checks if the given object is currently in the success state
4033 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4037 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4038 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4039 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4040 fn drop(&mut self) {
4042 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4043 let _ = unsafe { Box::from_raw(self.contents.result) };
4046 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4047 let _ = unsafe { Box::from_raw(self.contents.err) };
4052 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4053 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4054 let contents = if o.result_ok {
4055 let result = unsafe { o.contents.result };
4056 unsafe { o.contents.result = core::ptr::null_mut() };
4057 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4059 let err = unsafe { o.contents.err };
4060 unsafe { o.contents.err = core::ptr::null_mut(); }
4061 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4065 result_ok: o.result_ok,
4070 /// The contents of CResult_InitFeaturesDecodeErrorZ
4071 pub union CResult_InitFeaturesDecodeErrorZPtr {
4072 /// A pointer to the contents in the success state.
4073 /// Reading from this pointer when `result_ok` is not set is undefined.
4074 pub result: *mut crate::lightning::ln::features::InitFeatures,
4075 /// A pointer to the contents in the error state.
4076 /// Reading from this pointer when `result_ok` is set is undefined.
4077 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4080 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4081 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4083 pub struct CResult_InitFeaturesDecodeErrorZ {
4084 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4085 /// `err` or `result` depending on the state of `result_ok`.
4086 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4087 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4088 pub result_ok: bool,
4091 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4092 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4093 CResult_InitFeaturesDecodeErrorZ {
4094 contents: CResult_InitFeaturesDecodeErrorZPtr {
4095 result: Box::into_raw(Box::new(o)),
4101 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4102 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4103 CResult_InitFeaturesDecodeErrorZ {
4104 contents: CResult_InitFeaturesDecodeErrorZPtr {
4105 err: Box::into_raw(Box::new(e)),
4110 /// Checks if the given object is currently in the success state
4112 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4116 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4117 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4118 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4119 fn drop(&mut self) {
4121 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4122 let _ = unsafe { Box::from_raw(self.contents.result) };
4125 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4126 let _ = unsafe { Box::from_raw(self.contents.err) };
4131 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4132 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4133 let contents = if o.result_ok {
4134 let result = unsafe { o.contents.result };
4135 unsafe { o.contents.result = core::ptr::null_mut() };
4136 CResult_InitFeaturesDecodeErrorZPtr { result }
4138 let err = unsafe { o.contents.err };
4139 unsafe { o.contents.err = core::ptr::null_mut(); }
4140 CResult_InitFeaturesDecodeErrorZPtr { err }
4144 result_ok: o.result_ok,
4149 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4150 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4151 /// A pointer to the contents in the success state.
4152 /// Reading from this pointer when `result_ok` is not set is undefined.
4153 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4154 /// A pointer to the contents in the error state.
4155 /// Reading from this pointer when `result_ok` is set is undefined.
4156 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4159 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4160 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4162 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4163 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4164 /// `err` or `result` depending on the state of `result_ok`.
4165 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4166 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4167 pub result_ok: bool,
4170 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4171 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4172 CResult_ChannelFeaturesDecodeErrorZ {
4173 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4174 result: Box::into_raw(Box::new(o)),
4180 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4181 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4182 CResult_ChannelFeaturesDecodeErrorZ {
4183 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4184 err: Box::into_raw(Box::new(e)),
4189 /// Checks if the given object is currently in the success state
4191 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4195 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4196 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4197 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4198 fn drop(&mut self) {
4200 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4201 let _ = unsafe { Box::from_raw(self.contents.result) };
4204 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4205 let _ = unsafe { Box::from_raw(self.contents.err) };
4210 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4211 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4212 let contents = if o.result_ok {
4213 let result = unsafe { o.contents.result };
4214 unsafe { o.contents.result = core::ptr::null_mut() };
4215 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4217 let err = unsafe { o.contents.err };
4218 unsafe { o.contents.err = core::ptr::null_mut(); }
4219 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4223 result_ok: o.result_ok,
4228 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4229 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4230 /// A pointer to the contents in the success state.
4231 /// Reading from this pointer when `result_ok` is not set is undefined.
4232 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4233 /// A pointer to the contents in the error state.
4234 /// Reading from this pointer when `result_ok` is set is undefined.
4235 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4238 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4239 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4240 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4241 pub struct CResult_NodeFeaturesDecodeErrorZ {
4242 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4243 /// `err` or `result` depending on the state of `result_ok`.
4244 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4245 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4246 pub result_ok: bool,
4249 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4250 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4251 CResult_NodeFeaturesDecodeErrorZ {
4252 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4253 result: Box::into_raw(Box::new(o)),
4259 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4260 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4261 CResult_NodeFeaturesDecodeErrorZ {
4262 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4263 err: Box::into_raw(Box::new(e)),
4268 /// Checks if the given object is currently in the success state
4270 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4274 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4275 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4276 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4277 fn drop(&mut self) {
4279 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4280 let _ = unsafe { Box::from_raw(self.contents.result) };
4283 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4284 let _ = unsafe { Box::from_raw(self.contents.err) };
4289 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4290 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4291 let contents = if o.result_ok {
4292 let result = unsafe { o.contents.result };
4293 unsafe { o.contents.result = core::ptr::null_mut() };
4294 CResult_NodeFeaturesDecodeErrorZPtr { result }
4296 let err = unsafe { o.contents.err };
4297 unsafe { o.contents.err = core::ptr::null_mut(); }
4298 CResult_NodeFeaturesDecodeErrorZPtr { err }
4302 result_ok: o.result_ok,
4307 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4308 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4309 /// A pointer to the contents in the success state.
4310 /// Reading from this pointer when `result_ok` is not set is undefined.
4311 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4312 /// A pointer to the contents in the error state.
4313 /// Reading from this pointer when `result_ok` is set is undefined.
4314 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4317 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4318 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4319 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4320 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4321 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4322 /// `err` or `result` depending on the state of `result_ok`.
4323 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4324 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4325 pub result_ok: bool,
4328 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4329 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4330 CResult_InvoiceFeaturesDecodeErrorZ {
4331 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4332 result: Box::into_raw(Box::new(o)),
4338 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4339 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4340 CResult_InvoiceFeaturesDecodeErrorZ {
4341 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4342 err: Box::into_raw(Box::new(e)),
4347 /// Checks if the given object is currently in the success state
4349 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4353 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4354 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4355 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4356 fn drop(&mut self) {
4358 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4359 let _ = unsafe { Box::from_raw(self.contents.result) };
4362 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4363 let _ = unsafe { Box::from_raw(self.contents.err) };
4368 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4369 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4370 let contents = if o.result_ok {
4371 let result = unsafe { o.contents.result };
4372 unsafe { o.contents.result = core::ptr::null_mut() };
4373 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4375 let err = unsafe { o.contents.err };
4376 unsafe { o.contents.err = core::ptr::null_mut(); }
4377 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4381 result_ok: o.result_ok,
4386 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4387 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4388 /// A pointer to the contents in the success state.
4389 /// Reading from this pointer when `result_ok` is not set is undefined.
4390 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4391 /// A pointer to the contents in the error state.
4392 /// Reading from this pointer when `result_ok` is set is undefined.
4393 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4396 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4397 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4399 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4400 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4401 /// `err` or `result` depending on the state of `result_ok`.
4402 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4403 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4404 pub result_ok: bool,
4407 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4408 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4409 CResult_ChannelTypeFeaturesDecodeErrorZ {
4410 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4411 result: Box::into_raw(Box::new(o)),
4417 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4418 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4419 CResult_ChannelTypeFeaturesDecodeErrorZ {
4420 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4421 err: Box::into_raw(Box::new(e)),
4426 /// Checks if the given object is currently in the success state
4428 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4432 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4433 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4434 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4435 fn drop(&mut self) {
4437 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4438 let _ = unsafe { Box::from_raw(self.contents.result) };
4441 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4442 let _ = unsafe { Box::from_raw(self.contents.err) };
4447 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4448 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4449 let contents = if o.result_ok {
4450 let result = unsafe { o.contents.result };
4451 unsafe { o.contents.result = core::ptr::null_mut() };
4452 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4454 let err = unsafe { o.contents.err };
4455 unsafe { o.contents.err = core::ptr::null_mut(); }
4456 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4460 result_ok: o.result_ok,
4465 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4466 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4467 /// A pointer to the contents in the success state.
4468 /// Reading from this pointer when `result_ok` is not set is undefined.
4469 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4470 /// A pointer to the contents in the error state.
4471 /// Reading from this pointer when `result_ok` is set is undefined.
4472 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4475 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4476 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4478 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4479 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4480 /// `err` or `result` depending on the state of `result_ok`.
4481 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4482 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4483 pub result_ok: bool,
4486 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4487 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4488 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4489 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4490 result: Box::into_raw(Box::new(o)),
4496 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4497 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4498 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4499 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4500 err: Box::into_raw(Box::new(e)),
4505 /// Checks if the given object is currently in the success state
4507 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4511 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4512 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4513 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4514 fn drop(&mut self) {
4516 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4517 let _ = unsafe { Box::from_raw(self.contents.result) };
4520 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4521 let _ = unsafe { Box::from_raw(self.contents.err) };
4526 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4527 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4528 let contents = if o.result_ok {
4529 let result = unsafe { o.contents.result };
4530 unsafe { o.contents.result = core::ptr::null_mut() };
4531 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4533 let err = unsafe { o.contents.err };
4534 unsafe { o.contents.err = core::ptr::null_mut(); }
4535 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4539 result_ok: o.result_ok,
4543 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4544 fn clone(&self) -> Self {
4546 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4547 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4550 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4551 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4557 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4558 /// but with all dynamically-allocated buffers duplicated in new buffers.
4559 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4561 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4562 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4563 /// A pointer to the contents in the success state.
4564 /// Reading from this pointer when `result_ok` is not set is undefined.
4565 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4566 /// A pointer to the contents in the error state.
4567 /// Reading from this pointer when `result_ok` is set is undefined.
4568 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4571 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4572 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4574 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4575 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4576 /// `err` or `result` depending on the state of `result_ok`.
4577 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4578 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4579 pub result_ok: bool,
4582 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4583 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4584 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4585 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4586 result: Box::into_raw(Box::new(o)),
4592 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4593 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4594 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4595 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4596 err: Box::into_raw(Box::new(e)),
4601 /// Checks if the given object is currently in the success state
4603 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4607 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4608 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4609 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4610 fn drop(&mut self) {
4612 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4613 let _ = unsafe { Box::from_raw(self.contents.result) };
4616 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4617 let _ = unsafe { Box::from_raw(self.contents.err) };
4622 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4623 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4624 let contents = if o.result_ok {
4625 let result = unsafe { o.contents.result };
4626 unsafe { o.contents.result = core::ptr::null_mut() };
4627 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4629 let err = unsafe { o.contents.err };
4630 unsafe { o.contents.err = core::ptr::null_mut(); }
4631 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4635 result_ok: o.result_ok,
4639 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4640 fn clone(&self) -> Self {
4642 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4643 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4646 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4647 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4653 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4654 /// but with all dynamically-allocated buffers duplicated in new buffers.
4655 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4657 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4658 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4659 /// A pointer to the contents in the success state.
4660 /// Reading from this pointer when `result_ok` is not set is undefined.
4661 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4662 /// A pointer to the contents in the error state.
4663 /// Reading from this pointer when `result_ok` is set is undefined.
4664 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4667 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4668 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4670 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4671 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4672 /// `err` or `result` depending on the state of `result_ok`.
4673 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4674 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4675 pub result_ok: bool,
4678 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4679 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4680 CResult_SpendableOutputDescriptorDecodeErrorZ {
4681 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4682 result: Box::into_raw(Box::new(o)),
4688 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4689 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4690 CResult_SpendableOutputDescriptorDecodeErrorZ {
4691 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4692 err: Box::into_raw(Box::new(e)),
4697 /// Checks if the given object is currently in the success state
4699 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4703 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4704 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4705 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4706 fn drop(&mut self) {
4708 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4709 let _ = unsafe { Box::from_raw(self.contents.result) };
4712 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4713 let _ = unsafe { Box::from_raw(self.contents.err) };
4718 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4719 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4720 let contents = if o.result_ok {
4721 let result = unsafe { o.contents.result };
4722 unsafe { o.contents.result = core::ptr::null_mut() };
4723 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4725 let err = unsafe { o.contents.err };
4726 unsafe { o.contents.err = core::ptr::null_mut(); }
4727 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4731 result_ok: o.result_ok,
4735 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4736 fn clone(&self) -> Self {
4738 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4739 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4742 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4743 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4749 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4750 /// but with all dynamically-allocated buffers duplicated in new buffers.
4751 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4753 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4754 /// This corresponds to std::vector in C++
4755 pub struct CVec_PaymentPreimageZ {
4756 /// The elements in the array.
4757 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4758 pub data: *mut crate::c_types::ThirtyTwoBytes,
4759 /// The number of elements pointed to by `data`.
4762 impl CVec_PaymentPreimageZ {
4763 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4764 if self.datalen == 0 { return Vec::new(); }
4765 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4766 self.data = core::ptr::null_mut();
4770 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4771 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4774 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4775 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4776 let datalen = v.len();
4777 let data = Box::into_raw(v.into_boxed_slice());
4778 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4782 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4783 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4784 impl Drop for CVec_PaymentPreimageZ {
4785 fn drop(&mut self) {
4786 if self.datalen == 0 { return; }
4787 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4790 impl Clone for CVec_PaymentPreimageZ {
4791 fn clone(&self) -> Self {
4792 let mut res = Vec::new();
4793 if self.datalen == 0 { return Self::from(res); }
4794 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4799 /// A tuple of 2 elements. See the individual fields for the types contained.
4800 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4801 /// The element at position 0
4802 pub a: crate::c_types::Signature,
4803 /// The element at position 1
4804 pub b: crate::c_types::derived::CVec_SignatureZ,
4806 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4807 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4814 impl C2Tuple_SignatureCVec_SignatureZZ {
4815 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4819 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4820 fn clone(&self) -> Self {
4822 a: Clone::clone(&self.a),
4823 b: Clone::clone(&self.b),
4828 /// Creates a new tuple which has the same data as `orig`
4829 /// but with all dynamically-allocated buffers duplicated in new buffers.
4830 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4831 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4833 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4834 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4838 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4839 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4841 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4842 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4843 /// A pointer to the contents in the success state.
4844 /// Reading from this pointer when `result_ok` is not set is undefined.
4845 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4846 /// Note that this value is always NULL, as there are no contents in the Err variant
4847 pub err: *mut core::ffi::c_void,
4850 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4851 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4853 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4854 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4855 /// `err` or `result` depending on the state of `result_ok`.
4856 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4857 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4858 pub result_ok: bool,
4861 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4862 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4863 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4864 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4865 result: Box::into_raw(Box::new(o)),
4871 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4872 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4873 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4874 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4875 err: core::ptr::null_mut(),
4880 /// Checks if the given object is currently in the success state
4882 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4886 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4887 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4888 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4889 fn drop(&mut self) {
4891 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4892 let _ = unsafe { Box::from_raw(self.contents.result) };
4898 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4899 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4900 let contents = if o.result_ok {
4901 let result = unsafe { o.contents.result };
4902 unsafe { o.contents.result = core::ptr::null_mut() };
4903 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4905 let _ = unsafe { Box::from_raw(o.contents.err) };
4906 o.contents.err = core::ptr::null_mut();
4907 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4911 result_ok: o.result_ok,
4915 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4916 fn clone(&self) -> Self {
4918 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4919 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4922 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4923 err: core::ptr::null_mut()
4929 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4930 /// but with all dynamically-allocated buffers duplicated in new buffers.
4931 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4933 /// The contents of CResult_SignatureNoneZ
4934 pub union CResult_SignatureNoneZPtr {
4935 /// A pointer to the contents in the success state.
4936 /// Reading from this pointer when `result_ok` is not set is undefined.
4937 pub result: *mut crate::c_types::Signature,
4938 /// Note that this value is always NULL, as there are no contents in the Err variant
4939 pub err: *mut core::ffi::c_void,
4942 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4943 /// containing a crate::c_types::Signature on success and a () on failure.
4944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4945 pub struct CResult_SignatureNoneZ {
4946 /// The contents of this CResult_SignatureNoneZ, accessible via either
4947 /// `err` or `result` depending on the state of `result_ok`.
4948 pub contents: CResult_SignatureNoneZPtr,
4949 /// Whether this CResult_SignatureNoneZ represents a success state.
4950 pub result_ok: bool,
4953 /// Creates a new CResult_SignatureNoneZ in the success state.
4954 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4955 CResult_SignatureNoneZ {
4956 contents: CResult_SignatureNoneZPtr {
4957 result: Box::into_raw(Box::new(o)),
4963 /// Creates a new CResult_SignatureNoneZ in the error state.
4964 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4965 CResult_SignatureNoneZ {
4966 contents: CResult_SignatureNoneZPtr {
4967 err: core::ptr::null_mut(),
4972 /// Checks if the given object is currently in the success state
4974 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4978 /// Frees any resources used by the CResult_SignatureNoneZ.
4979 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4980 impl Drop for CResult_SignatureNoneZ {
4981 fn drop(&mut self) {
4983 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4984 let _ = unsafe { Box::from_raw(self.contents.result) };
4990 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4991 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4992 let contents = if o.result_ok {
4993 let result = unsafe { o.contents.result };
4994 unsafe { o.contents.result = core::ptr::null_mut() };
4995 CResult_SignatureNoneZPtr { result }
4997 let _ = unsafe { Box::from_raw(o.contents.err) };
4998 o.contents.err = core::ptr::null_mut();
4999 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
5003 result_ok: o.result_ok,
5007 impl Clone for CResult_SignatureNoneZ {
5008 fn clone(&self) -> Self {
5010 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
5011 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
5014 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
5015 err: core::ptr::null_mut()
5021 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
5022 /// but with all dynamically-allocated buffers duplicated in new buffers.
5023 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
5025 /// A tuple of 2 elements. See the individual fields for the types contained.
5026 pub struct C2Tuple_SignatureSignatureZ {
5027 /// The element at position 0
5028 pub a: crate::c_types::Signature,
5029 /// The element at position 1
5030 pub b: crate::c_types::Signature,
5032 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
5033 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
5040 impl C2Tuple_SignatureSignatureZ {
5041 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
5045 impl Clone for C2Tuple_SignatureSignatureZ {
5046 fn clone(&self) -> Self {
5048 a: Clone::clone(&self.a),
5049 b: Clone::clone(&self.b),
5054 /// Creates a new tuple which has the same data as `orig`
5055 /// but with all dynamically-allocated buffers duplicated in new buffers.
5056 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
5057 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
5059 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
5060 C2Tuple_SignatureSignatureZ { a, b, }
5064 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
5065 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
5067 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
5068 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5069 /// A pointer to the contents in the success state.
5070 /// Reading from this pointer when `result_ok` is not set is undefined.
5071 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
5072 /// Note that this value is always NULL, as there are no contents in the Err variant
5073 pub err: *mut core::ffi::c_void,
5076 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
5077 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
5078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5079 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
5080 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
5081 /// `err` or `result` depending on the state of `result_ok`.
5082 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
5083 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
5084 pub result_ok: bool,
5087 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
5088 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5089 CResult_C2Tuple_SignatureSignatureZNoneZ {
5090 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5091 result: Box::into_raw(Box::new(o)),
5097 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
5098 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5099 CResult_C2Tuple_SignatureSignatureZNoneZ {
5100 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5101 err: core::ptr::null_mut(),
5106 /// Checks if the given object is currently in the success state
5108 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
5112 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
5113 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
5114 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
5115 fn drop(&mut self) {
5117 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5118 let _ = unsafe { Box::from_raw(self.contents.result) };
5124 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
5125 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> 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_C2Tuple_SignatureSignatureZNoneZPtr { result }
5131 let _ = unsafe { Box::from_raw(o.contents.err) };
5132 o.contents.err = core::ptr::null_mut();
5133 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5137 result_ok: o.result_ok,
5141 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5142 fn clone(&self) -> Self {
5144 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5145 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5148 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5149 err: core::ptr::null_mut()
5155 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5156 /// but with all dynamically-allocated buffers duplicated in new buffers.
5157 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5159 /// The contents of CResult_SecretKeyNoneZ
5160 pub union CResult_SecretKeyNoneZPtr {
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::c_types::SecretKey,
5164 /// Note that this value is always NULL, as there are no contents in the Err variant
5165 pub err: *mut core::ffi::c_void,
5168 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5169 /// containing a crate::c_types::SecretKey on success and a () on failure.
5170 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5171 pub struct CResult_SecretKeyNoneZ {
5172 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5173 /// `err` or `result` depending on the state of `result_ok`.
5174 pub contents: CResult_SecretKeyNoneZPtr,
5175 /// Whether this CResult_SecretKeyNoneZ represents a success state.
5176 pub result_ok: bool,
5179 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5180 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5181 CResult_SecretKeyNoneZ {
5182 contents: CResult_SecretKeyNoneZPtr {
5183 result: Box::into_raw(Box::new(o)),
5189 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5190 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5191 CResult_SecretKeyNoneZ {
5192 contents: CResult_SecretKeyNoneZPtr {
5193 err: core::ptr::null_mut(),
5198 /// Checks if the given object is currently in the success state
5200 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5204 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5205 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5206 impl Drop for CResult_SecretKeyNoneZ {
5207 fn drop(&mut self) {
5209 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5210 let _ = unsafe { Box::from_raw(self.contents.result) };
5216 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5217 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5218 let contents = if o.result_ok {
5219 let result = unsafe { o.contents.result };
5220 unsafe { o.contents.result = core::ptr::null_mut() };
5221 CResult_SecretKeyNoneZPtr { result }
5223 let _ = unsafe { Box::from_raw(o.contents.err) };
5224 o.contents.err = core::ptr::null_mut();
5225 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5229 result_ok: o.result_ok,
5233 impl Clone for CResult_SecretKeyNoneZ {
5234 fn clone(&self) -> Self {
5236 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
5237 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
5240 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
5241 err: core::ptr::null_mut()
5247 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
5248 /// but with all dynamically-allocated buffers duplicated in new buffers.
5249 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
5251 /// The contents of CResult_SignDecodeErrorZ
5252 pub union CResult_SignDecodeErrorZPtr {
5253 /// A pointer to the contents in the success state.
5254 /// Reading from this pointer when `result_ok` is not set is undefined.
5255 pub result: *mut crate::lightning::chain::keysinterface::Sign,
5256 /// A pointer to the contents in the error state.
5257 /// Reading from this pointer when `result_ok` is set is undefined.
5258 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5261 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5262 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5264 pub struct CResult_SignDecodeErrorZ {
5265 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5266 /// `err` or `result` depending on the state of `result_ok`.
5267 pub contents: CResult_SignDecodeErrorZPtr,
5268 /// Whether this CResult_SignDecodeErrorZ represents a success state.
5269 pub result_ok: bool,
5272 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5273 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5274 CResult_SignDecodeErrorZ {
5275 contents: CResult_SignDecodeErrorZPtr {
5276 result: Box::into_raw(Box::new(o)),
5282 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5283 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5284 CResult_SignDecodeErrorZ {
5285 contents: CResult_SignDecodeErrorZPtr {
5286 err: Box::into_raw(Box::new(e)),
5291 /// Checks if the given object is currently in the success state
5293 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5297 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5298 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5299 impl Drop for CResult_SignDecodeErrorZ {
5300 fn drop(&mut self) {
5302 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5303 let _ = unsafe { Box::from_raw(self.contents.result) };
5306 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5307 let _ = unsafe { Box::from_raw(self.contents.err) };
5312 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5313 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5314 let contents = if o.result_ok {
5315 let result = unsafe { o.contents.result };
5316 unsafe { o.contents.result = core::ptr::null_mut() };
5317 CResult_SignDecodeErrorZPtr { result }
5319 let err = unsafe { o.contents.err };
5320 unsafe { o.contents.err = core::ptr::null_mut(); }
5321 CResult_SignDecodeErrorZPtr { err }
5325 result_ok: o.result_ok,
5329 impl Clone for CResult_SignDecodeErrorZ {
5330 fn clone(&self) -> Self {
5332 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5333 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5336 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5337 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5343 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5344 /// but with all dynamically-allocated buffers duplicated in new buffers.
5345 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5347 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5348 /// This corresponds to std::vector in C++
5349 pub struct CVec_u5Z {
5350 /// The elements in the array.
5351 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5352 pub data: *mut crate::c_types::u5,
5353 /// The number of elements pointed to by `data`.
5357 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5358 if self.datalen == 0 { return Vec::new(); }
5359 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5360 self.data = core::ptr::null_mut();
5364 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5365 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5368 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5369 fn from(v: Vec<crate::c_types::u5>) -> Self {
5370 let datalen = v.len();
5371 let data = Box::into_raw(v.into_boxed_slice());
5372 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5376 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5377 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5378 impl Drop for CVec_u5Z {
5379 fn drop(&mut self) {
5380 if self.datalen == 0 { return; }
5381 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5384 impl Clone for CVec_u5Z {
5385 fn clone(&self) -> Self {
5386 let mut res = Vec::new();
5387 if self.datalen == 0 { return Self::from(res); }
5388 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5393 /// The contents of CResult_RecoverableSignatureNoneZ
5394 pub union CResult_RecoverableSignatureNoneZPtr {
5395 /// A pointer to the contents in the success state.
5396 /// Reading from this pointer when `result_ok` is not set is undefined.
5397 pub result: *mut crate::c_types::RecoverableSignature,
5398 /// Note that this value is always NULL, as there are no contents in the Err variant
5399 pub err: *mut core::ffi::c_void,
5402 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5403 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5404 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5405 pub struct CResult_RecoverableSignatureNoneZ {
5406 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5407 /// `err` or `result` depending on the state of `result_ok`.
5408 pub contents: CResult_RecoverableSignatureNoneZPtr,
5409 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5410 pub result_ok: bool,
5413 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5414 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5415 CResult_RecoverableSignatureNoneZ {
5416 contents: CResult_RecoverableSignatureNoneZPtr {
5417 result: Box::into_raw(Box::new(o)),
5423 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5424 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5425 CResult_RecoverableSignatureNoneZ {
5426 contents: CResult_RecoverableSignatureNoneZPtr {
5427 err: core::ptr::null_mut(),
5432 /// Checks if the given object is currently in the success state
5434 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5438 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5439 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5440 impl Drop for CResult_RecoverableSignatureNoneZ {
5441 fn drop(&mut self) {
5443 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5444 let _ = unsafe { Box::from_raw(self.contents.result) };
5450 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5451 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5452 let contents = if o.result_ok {
5453 let result = unsafe { o.contents.result };
5454 unsafe { o.contents.result = core::ptr::null_mut() };
5455 CResult_RecoverableSignatureNoneZPtr { result }
5457 let _ = unsafe { Box::from_raw(o.contents.err) };
5458 o.contents.err = core::ptr::null_mut();
5459 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5463 result_ok: o.result_ok,
5467 impl Clone for CResult_RecoverableSignatureNoneZ {
5468 fn clone(&self) -> Self {
5470 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5471 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5474 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5475 err: core::ptr::null_mut()
5481 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5482 /// but with all dynamically-allocated buffers duplicated in new buffers.
5483 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5485 /// A dynamically-allocated array of u8s of arbitrary size.
5486 /// This corresponds to std::vector in C++
5487 pub struct CVec_u8Z {
5488 /// The elements in the array.
5489 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5491 /// The number of elements pointed to by `data`.
5495 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5496 if self.datalen == 0 { return Vec::new(); }
5497 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5498 self.data = core::ptr::null_mut();
5502 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5503 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5506 impl From<Vec<u8>> for CVec_u8Z {
5507 fn from(v: Vec<u8>) -> Self {
5508 let datalen = v.len();
5509 let data = Box::into_raw(v.into_boxed_slice());
5510 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5514 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5515 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5516 impl Drop for CVec_u8Z {
5517 fn drop(&mut self) {
5518 if self.datalen == 0 { return; }
5519 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5522 impl Clone for CVec_u8Z {
5523 fn clone(&self) -> Self {
5524 let mut res = Vec::new();
5525 if self.datalen == 0 { return Self::from(res); }
5526 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5531 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5532 /// This corresponds to std::vector in C++
5533 pub struct CVec_CVec_u8ZZ {
5534 /// The elements in the array.
5535 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5536 pub data: *mut crate::c_types::derived::CVec_u8Z,
5537 /// The number of elements pointed to by `data`.
5540 impl CVec_CVec_u8ZZ {
5541 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5542 if self.datalen == 0 { return Vec::new(); }
5543 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5544 self.data = core::ptr::null_mut();
5548 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5549 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5552 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5553 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5554 let datalen = v.len();
5555 let data = Box::into_raw(v.into_boxed_slice());
5556 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5560 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5561 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5562 impl Drop for CVec_CVec_u8ZZ {
5563 fn drop(&mut self) {
5564 if self.datalen == 0 { return; }
5565 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5568 impl Clone for CVec_CVec_u8ZZ {
5569 fn clone(&self) -> Self {
5570 let mut res = Vec::new();
5571 if self.datalen == 0 { return Self::from(res); }
5572 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5577 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5578 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5579 /// A pointer to the contents in the success state.
5580 /// Reading from this pointer when `result_ok` is not set is undefined.
5581 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5582 /// Note that this value is always NULL, as there are no contents in the Err variant
5583 pub err: *mut core::ffi::c_void,
5586 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5587 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5588 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5589 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5590 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5591 /// `err` or `result` depending on the state of `result_ok`.
5592 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5593 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5594 pub result_ok: bool,
5597 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5598 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5599 CResult_CVec_CVec_u8ZZNoneZ {
5600 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5601 result: Box::into_raw(Box::new(o)),
5607 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5608 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5609 CResult_CVec_CVec_u8ZZNoneZ {
5610 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5611 err: core::ptr::null_mut(),
5616 /// Checks if the given object is currently in the success state
5618 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5622 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5623 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5624 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5625 fn drop(&mut self) {
5627 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5628 let _ = unsafe { Box::from_raw(self.contents.result) };
5634 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5635 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5636 let contents = if o.result_ok {
5637 let result = unsafe { o.contents.result };
5638 unsafe { o.contents.result = core::ptr::null_mut() };
5639 CResult_CVec_CVec_u8ZZNoneZPtr { result }
5641 let _ = unsafe { Box::from_raw(o.contents.err) };
5642 o.contents.err = core::ptr::null_mut();
5643 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5647 result_ok: o.result_ok,
5651 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5652 fn clone(&self) -> Self {
5654 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5655 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5658 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5659 err: core::ptr::null_mut()
5665 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5666 /// but with all dynamically-allocated buffers duplicated in new buffers.
5667 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5669 /// The contents of CResult_InMemorySignerDecodeErrorZ
5670 pub union CResult_InMemorySignerDecodeErrorZPtr {
5671 /// A pointer to the contents in the success state.
5672 /// Reading from this pointer when `result_ok` is not set is undefined.
5673 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5674 /// A pointer to the contents in the error state.
5675 /// Reading from this pointer when `result_ok` is set is undefined.
5676 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5679 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5680 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5682 pub struct CResult_InMemorySignerDecodeErrorZ {
5683 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5684 /// `err` or `result` depending on the state of `result_ok`.
5685 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5686 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5687 pub result_ok: bool,
5690 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5691 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5692 CResult_InMemorySignerDecodeErrorZ {
5693 contents: CResult_InMemorySignerDecodeErrorZPtr {
5694 result: Box::into_raw(Box::new(o)),
5700 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5701 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5702 CResult_InMemorySignerDecodeErrorZ {
5703 contents: CResult_InMemorySignerDecodeErrorZPtr {
5704 err: Box::into_raw(Box::new(e)),
5709 /// Checks if the given object is currently in the success state
5711 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5715 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5716 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5717 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5718 fn drop(&mut self) {
5720 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5721 let _ = unsafe { Box::from_raw(self.contents.result) };
5724 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5725 let _ = unsafe { Box::from_raw(self.contents.err) };
5730 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5731 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5732 let contents = if o.result_ok {
5733 let result = unsafe { o.contents.result };
5734 unsafe { o.contents.result = core::ptr::null_mut() };
5735 CResult_InMemorySignerDecodeErrorZPtr { result }
5737 let err = unsafe { o.contents.err };
5738 unsafe { o.contents.err = core::ptr::null_mut(); }
5739 CResult_InMemorySignerDecodeErrorZPtr { err }
5743 result_ok: o.result_ok,
5747 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5748 fn clone(&self) -> Self {
5750 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5751 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5754 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5755 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5761 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5762 /// but with all dynamically-allocated buffers duplicated in new buffers.
5763 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5765 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5766 /// This corresponds to std::vector in C++
5767 pub struct CVec_TxOutZ {
5768 /// The elements in the array.
5769 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5770 pub data: *mut crate::c_types::TxOut,
5771 /// The number of elements pointed to by `data`.
5775 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5776 if self.datalen == 0 { return Vec::new(); }
5777 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5778 self.data = core::ptr::null_mut();
5782 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5783 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5786 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5787 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5788 let datalen = v.len();
5789 let data = Box::into_raw(v.into_boxed_slice());
5790 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5794 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5795 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5796 impl Drop for CVec_TxOutZ {
5797 fn drop(&mut self) {
5798 if self.datalen == 0 { return; }
5799 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5802 impl Clone for CVec_TxOutZ {
5803 fn clone(&self) -> Self {
5804 let mut res = Vec::new();
5805 if self.datalen == 0 { return Self::from(res); }
5806 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5811 /// The contents of CResult_TransactionNoneZ
5812 pub union CResult_TransactionNoneZPtr {
5813 /// A pointer to the contents in the success state.
5814 /// Reading from this pointer when `result_ok` is not set is undefined.
5815 pub result: *mut crate::c_types::Transaction,
5816 /// Note that this value is always NULL, as there are no contents in the Err variant
5817 pub err: *mut core::ffi::c_void,
5820 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5821 /// containing a crate::c_types::Transaction on success and a () on failure.
5822 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5823 pub struct CResult_TransactionNoneZ {
5824 /// The contents of this CResult_TransactionNoneZ, accessible via either
5825 /// `err` or `result` depending on the state of `result_ok`.
5826 pub contents: CResult_TransactionNoneZPtr,
5827 /// Whether this CResult_TransactionNoneZ represents a success state.
5828 pub result_ok: bool,
5831 /// Creates a new CResult_TransactionNoneZ in the success state.
5832 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5833 CResult_TransactionNoneZ {
5834 contents: CResult_TransactionNoneZPtr {
5835 result: Box::into_raw(Box::new(o)),
5841 /// Creates a new CResult_TransactionNoneZ in the error state.
5842 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5843 CResult_TransactionNoneZ {
5844 contents: CResult_TransactionNoneZPtr {
5845 err: core::ptr::null_mut(),
5850 /// Checks if the given object is currently in the success state
5852 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5856 /// Frees any resources used by the CResult_TransactionNoneZ.
5857 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5858 impl Drop for CResult_TransactionNoneZ {
5859 fn drop(&mut self) {
5861 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5862 let _ = unsafe { Box::from_raw(self.contents.result) };
5868 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5869 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5870 let contents = if o.result_ok {
5871 let result = unsafe { o.contents.result };
5872 unsafe { o.contents.result = core::ptr::null_mut() };
5873 CResult_TransactionNoneZPtr { result }
5875 let _ = unsafe { Box::from_raw(o.contents.err) };
5876 o.contents.err = core::ptr::null_mut();
5877 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5881 result_ok: o.result_ok,
5885 impl Clone for CResult_TransactionNoneZ {
5886 fn clone(&self) -> Self {
5888 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5889 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5892 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5893 err: core::ptr::null_mut()
5899 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5900 /// but with all dynamically-allocated buffers duplicated in new buffers.
5901 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5903 /// A tuple of 2 elements. See the individual fields for the types contained.
5904 pub struct C2Tuple_BlockHashChannelMonitorZ {
5905 /// The element at position 0
5906 pub a: crate::c_types::ThirtyTwoBytes,
5907 /// The element at position 1
5908 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5910 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5911 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5918 impl C2Tuple_BlockHashChannelMonitorZ {
5919 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5923 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5925 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5926 C2Tuple_BlockHashChannelMonitorZ { a, b, }
5930 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5931 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5933 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5934 /// This corresponds to std::vector in C++
5935 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5936 /// The elements in the array.
5937 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5938 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5939 /// The number of elements pointed to by `data`.
5942 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5943 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5944 if self.datalen == 0 { return Vec::new(); }
5945 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5946 self.data = core::ptr::null_mut();
5950 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5951 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5954 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5955 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5956 let datalen = v.len();
5957 let data = Box::into_raw(v.into_boxed_slice());
5958 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5962 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5963 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5964 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5965 fn drop(&mut self) {
5966 if self.datalen == 0 { return; }
5967 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5971 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5972 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5973 /// A pointer to the contents in the success state.
5974 /// Reading from this pointer when `result_ok` is not set is undefined.
5975 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5976 /// A pointer to the contents in the error state.
5977 /// Reading from this pointer when `result_ok` is set is undefined.
5978 pub err: *mut crate::c_types::IOError,
5981 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5982 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5984 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5985 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5986 /// `err` or `result` depending on the state of `result_ok`.
5987 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5988 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5989 pub result_ok: bool,
5992 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5993 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5994 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5995 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5996 result: Box::into_raw(Box::new(o)),
6002 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
6003 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6004 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6005 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6006 err: Box::into_raw(Box::new(e)),
6011 /// Checks if the given object is currently in the success state
6013 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
6017 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
6018 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
6019 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6020 fn drop(&mut self) {
6022 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6023 let _ = unsafe { Box::from_raw(self.contents.result) };
6026 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6027 let _ = unsafe { Box::from_raw(self.contents.err) };
6032 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6033 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
6034 let contents = if o.result_ok {
6035 let result = unsafe { o.contents.result };
6036 unsafe { o.contents.result = core::ptr::null_mut() };
6037 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
6039 let err = unsafe { o.contents.err };
6040 unsafe { o.contents.err = core::ptr::null_mut(); }
6041 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
6045 result_ok: o.result_ok,
6051 /// An enum which can either contain a u16 or not
6052 pub enum COption_u16Z {
6053 /// When we're in this state, this COption_u16Z contains a u16
6055 /// When we're in this state, this COption_u16Z contains nothing
6059 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6060 if let Self::None = self { false } else { true }
6062 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6065 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
6066 if let Self::Some(v) = self { v } else { unreachable!() }
6070 /// Constructs a new COption_u16Z containing a u16
6071 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
6072 COption_u16Z::Some(o)
6075 /// Constructs a new COption_u16Z containing nothing
6076 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
6080 /// Frees any resources associated with the u16, if we are in the Some state
6081 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
6083 /// Creates a new COption_u16Z which has the same data as `orig`
6084 /// but with all dynamically-allocated buffers duplicated in new buffers.
6085 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
6087 /// The contents of CResult_NoneAPIErrorZ
6088 pub union CResult_NoneAPIErrorZPtr {
6089 /// Note that this value is always NULL, as there are no contents in the OK variant
6090 pub result: *mut core::ffi::c_void,
6091 /// A pointer to the contents in the error state.
6092 /// Reading from this pointer when `result_ok` is set is undefined.
6093 pub err: *mut crate::lightning::util::errors::APIError,
6096 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6097 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
6098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6099 pub struct CResult_NoneAPIErrorZ {
6100 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
6101 /// `err` or `result` depending on the state of `result_ok`.
6102 pub contents: CResult_NoneAPIErrorZPtr,
6103 /// Whether this CResult_NoneAPIErrorZ represents a success state.
6104 pub result_ok: bool,
6107 /// Creates a new CResult_NoneAPIErrorZ in the success state.
6108 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
6109 CResult_NoneAPIErrorZ {
6110 contents: CResult_NoneAPIErrorZPtr {
6111 result: core::ptr::null_mut(),
6117 /// Creates a new CResult_NoneAPIErrorZ in the error state.
6118 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
6119 CResult_NoneAPIErrorZ {
6120 contents: CResult_NoneAPIErrorZPtr {
6121 err: Box::into_raw(Box::new(e)),
6126 /// Checks if the given object is currently in the success state
6128 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
6132 /// Frees any resources used by the CResult_NoneAPIErrorZ.
6133 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
6134 impl Drop for CResult_NoneAPIErrorZ {
6135 fn drop(&mut self) {
6138 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6139 let _ = unsafe { Box::from_raw(self.contents.err) };
6144 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6145 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6146 let contents = if o.result_ok {
6147 let _ = unsafe { Box::from_raw(o.contents.result) };
6148 o.contents.result = core::ptr::null_mut();
6149 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6151 let err = unsafe { o.contents.err };
6152 unsafe { o.contents.err = core::ptr::null_mut(); }
6153 CResult_NoneAPIErrorZPtr { err }
6157 result_ok: o.result_ok,
6161 impl Clone for CResult_NoneAPIErrorZ {
6162 fn clone(&self) -> Self {
6164 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6165 result: core::ptr::null_mut()
6168 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6169 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6175 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6176 /// but with all dynamically-allocated buffers duplicated in new buffers.
6177 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6179 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6180 /// This corresponds to std::vector in C++
6181 pub struct CVec_CResult_NoneAPIErrorZZ {
6182 /// The elements in the array.
6183 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6184 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6185 /// The number of elements pointed to by `data`.
6188 impl CVec_CResult_NoneAPIErrorZZ {
6189 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6190 if self.datalen == 0 { return Vec::new(); }
6191 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6192 self.data = core::ptr::null_mut();
6196 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6197 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6200 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6201 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6202 let datalen = v.len();
6203 let data = Box::into_raw(v.into_boxed_slice());
6204 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6208 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6209 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6210 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6211 fn drop(&mut self) {
6212 if self.datalen == 0 { return; }
6213 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6216 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6217 fn clone(&self) -> Self {
6218 let mut res = Vec::new();
6219 if self.datalen == 0 { return Self::from(res); }
6220 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6225 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6226 /// This corresponds to std::vector in C++
6227 pub struct CVec_APIErrorZ {
6228 /// The elements in the array.
6229 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6230 pub data: *mut crate::lightning::util::errors::APIError,
6231 /// The number of elements pointed to by `data`.
6234 impl CVec_APIErrorZ {
6235 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6236 if self.datalen == 0 { return Vec::new(); }
6237 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6238 self.data = core::ptr::null_mut();
6242 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6243 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6246 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6247 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6248 let datalen = v.len();
6249 let data = Box::into_raw(v.into_boxed_slice());
6250 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6254 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6255 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6256 impl Drop for CVec_APIErrorZ {
6257 fn drop(&mut self) {
6258 if self.datalen == 0 { return; }
6259 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6262 impl Clone for CVec_APIErrorZ {
6263 fn clone(&self) -> Self {
6264 let mut res = Vec::new();
6265 if self.datalen == 0 { return Self::from(res); }
6266 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6271 /// The contents of CResult__u832APIErrorZ
6272 pub union CResult__u832APIErrorZPtr {
6273 /// A pointer to the contents in the success state.
6274 /// Reading from this pointer when `result_ok` is not set is undefined.
6275 pub result: *mut crate::c_types::ThirtyTwoBytes,
6276 /// A pointer to the contents in the error state.
6277 /// Reading from this pointer when `result_ok` is set is undefined.
6278 pub err: *mut crate::lightning::util::errors::APIError,
6281 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6282 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6284 pub struct CResult__u832APIErrorZ {
6285 /// The contents of this CResult__u832APIErrorZ, accessible via either
6286 /// `err` or `result` depending on the state of `result_ok`.
6287 pub contents: CResult__u832APIErrorZPtr,
6288 /// Whether this CResult__u832APIErrorZ represents a success state.
6289 pub result_ok: bool,
6292 /// Creates a new CResult__u832APIErrorZ in the success state.
6293 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6294 CResult__u832APIErrorZ {
6295 contents: CResult__u832APIErrorZPtr {
6296 result: Box::into_raw(Box::new(o)),
6302 /// Creates a new CResult__u832APIErrorZ in the error state.
6303 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6304 CResult__u832APIErrorZ {
6305 contents: CResult__u832APIErrorZPtr {
6306 err: Box::into_raw(Box::new(e)),
6311 /// Checks if the given object is currently in the success state
6313 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6317 /// Frees any resources used by the CResult__u832APIErrorZ.
6318 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6319 impl Drop for CResult__u832APIErrorZ {
6320 fn drop(&mut self) {
6322 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6323 let _ = unsafe { Box::from_raw(self.contents.result) };
6326 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6327 let _ = unsafe { Box::from_raw(self.contents.err) };
6332 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6333 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6334 let contents = if o.result_ok {
6335 let result = unsafe { o.contents.result };
6336 unsafe { o.contents.result = core::ptr::null_mut() };
6337 CResult__u832APIErrorZPtr { result }
6339 let err = unsafe { o.contents.err };
6340 unsafe { o.contents.err = core::ptr::null_mut(); }
6341 CResult__u832APIErrorZPtr { err }
6345 result_ok: o.result_ok,
6349 impl Clone for CResult__u832APIErrorZ {
6350 fn clone(&self) -> Self {
6352 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6353 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6356 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6357 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6363 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6364 /// but with all dynamically-allocated buffers duplicated in new buffers.
6365 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6367 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6368 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6369 /// A pointer to the contents in the success state.
6370 /// Reading from this pointer when `result_ok` is not set is undefined.
6371 pub result: *mut crate::c_types::ThirtyTwoBytes,
6372 /// A pointer to the contents in the error state.
6373 /// Reading from this pointer when `result_ok` is set is undefined.
6374 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6377 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6378 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6380 pub struct CResult_PaymentIdPaymentSendFailureZ {
6381 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6382 /// `err` or `result` depending on the state of `result_ok`.
6383 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6384 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6385 pub result_ok: bool,
6388 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6389 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6390 CResult_PaymentIdPaymentSendFailureZ {
6391 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6392 result: Box::into_raw(Box::new(o)),
6398 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6399 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6400 CResult_PaymentIdPaymentSendFailureZ {
6401 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6402 err: Box::into_raw(Box::new(e)),
6407 /// Checks if the given object is currently in the success state
6409 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6413 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6414 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6415 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6416 fn drop(&mut self) {
6418 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6419 let _ = unsafe { Box::from_raw(self.contents.result) };
6422 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6423 let _ = unsafe { Box::from_raw(self.contents.err) };
6428 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6429 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6430 let contents = if o.result_ok {
6431 let result = unsafe { o.contents.result };
6432 unsafe { o.contents.result = core::ptr::null_mut() };
6433 CResult_PaymentIdPaymentSendFailureZPtr { result }
6435 let err = unsafe { o.contents.err };
6436 unsafe { o.contents.err = core::ptr::null_mut(); }
6437 CResult_PaymentIdPaymentSendFailureZPtr { err }
6441 result_ok: o.result_ok,
6445 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6446 fn clone(&self) -> Self {
6448 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6449 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6452 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6453 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6459 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6460 /// but with all dynamically-allocated buffers duplicated in new buffers.
6461 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6463 /// The contents of CResult_NonePaymentSendFailureZ
6464 pub union CResult_NonePaymentSendFailureZPtr {
6465 /// Note that this value is always NULL, as there are no contents in the OK variant
6466 pub result: *mut core::ffi::c_void,
6467 /// A pointer to the contents in the error state.
6468 /// Reading from this pointer when `result_ok` is set is undefined.
6469 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6472 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6473 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6474 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6475 pub struct CResult_NonePaymentSendFailureZ {
6476 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6477 /// `err` or `result` depending on the state of `result_ok`.
6478 pub contents: CResult_NonePaymentSendFailureZPtr,
6479 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6480 pub result_ok: bool,
6483 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6484 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6485 CResult_NonePaymentSendFailureZ {
6486 contents: CResult_NonePaymentSendFailureZPtr {
6487 result: core::ptr::null_mut(),
6493 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6494 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6495 CResult_NonePaymentSendFailureZ {
6496 contents: CResult_NonePaymentSendFailureZPtr {
6497 err: Box::into_raw(Box::new(e)),
6502 /// Checks if the given object is currently in the success state
6504 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6508 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6509 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6510 impl Drop for CResult_NonePaymentSendFailureZ {
6511 fn drop(&mut self) {
6514 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6515 let _ = unsafe { Box::from_raw(self.contents.err) };
6520 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6521 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6522 let contents = if o.result_ok {
6523 let _ = unsafe { Box::from_raw(o.contents.result) };
6524 o.contents.result = core::ptr::null_mut();
6525 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6527 let err = unsafe { o.contents.err };
6528 unsafe { o.contents.err = core::ptr::null_mut(); }
6529 CResult_NonePaymentSendFailureZPtr { err }
6533 result_ok: o.result_ok,
6537 impl Clone for CResult_NonePaymentSendFailureZ {
6538 fn clone(&self) -> Self {
6540 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6541 result: core::ptr::null_mut()
6544 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6545 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6551 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6552 /// but with all dynamically-allocated buffers duplicated in new buffers.
6553 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6555 /// A tuple of 2 elements. See the individual fields for the types contained.
6556 pub struct C2Tuple_PaymentHashPaymentIdZ {
6557 /// The element at position 0
6558 pub a: crate::c_types::ThirtyTwoBytes,
6559 /// The element at position 1
6560 pub b: crate::c_types::ThirtyTwoBytes,
6562 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6563 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6570 impl C2Tuple_PaymentHashPaymentIdZ {
6571 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6575 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6576 fn clone(&self) -> Self {
6578 a: Clone::clone(&self.a),
6579 b: Clone::clone(&self.b),
6584 /// Creates a new tuple which has the same data as `orig`
6585 /// but with all dynamically-allocated buffers duplicated in new buffers.
6586 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6587 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6589 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6590 C2Tuple_PaymentHashPaymentIdZ { a, b, }
6594 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6595 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6597 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6598 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6599 /// A pointer to the contents in the success state.
6600 /// Reading from this pointer when `result_ok` is not set is undefined.
6601 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6602 /// A pointer to the contents in the error state.
6603 /// Reading from this pointer when `result_ok` is set is undefined.
6604 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6607 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6608 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6609 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6610 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6611 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6612 /// `err` or `result` depending on the state of `result_ok`.
6613 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6614 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6615 pub result_ok: bool,
6618 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6619 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6620 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6621 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6622 result: Box::into_raw(Box::new(o)),
6628 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6629 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6630 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6631 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6632 err: Box::into_raw(Box::new(e)),
6637 /// Checks if the given object is currently in the success state
6639 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6643 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6644 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6645 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6646 fn drop(&mut self) {
6648 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6649 let _ = unsafe { Box::from_raw(self.contents.result) };
6652 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6653 let _ = unsafe { Box::from_raw(self.contents.err) };
6658 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6659 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6660 let contents = if o.result_ok {
6661 let result = unsafe { o.contents.result };
6662 unsafe { o.contents.result = core::ptr::null_mut() };
6663 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6665 let err = unsafe { o.contents.err };
6666 unsafe { o.contents.err = core::ptr::null_mut(); }
6667 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6671 result_ok: o.result_ok,
6675 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6676 fn clone(&self) -> Self {
6678 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6679 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6682 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6683 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6689 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6690 /// but with all dynamically-allocated buffers duplicated in new buffers.
6691 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6693 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6694 /// This corresponds to std::vector in C++
6695 pub struct CVec_NetAddressZ {
6696 /// The elements in the array.
6697 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6698 pub data: *mut crate::lightning::ln::msgs::NetAddress,
6699 /// The number of elements pointed to by `data`.
6702 impl CVec_NetAddressZ {
6703 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6704 if self.datalen == 0 { return Vec::new(); }
6705 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6706 self.data = core::ptr::null_mut();
6710 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6711 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6714 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6715 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6716 let datalen = v.len();
6717 let data = Box::into_raw(v.into_boxed_slice());
6718 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6722 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6723 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6724 impl Drop for CVec_NetAddressZ {
6725 fn drop(&mut self) {
6726 if self.datalen == 0 { return; }
6727 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6730 impl Clone for CVec_NetAddressZ {
6731 fn clone(&self) -> Self {
6732 let mut res = Vec::new();
6733 if self.datalen == 0 { return Self::from(res); }
6734 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6739 /// A tuple of 2 elements. See the individual fields for the types contained.
6740 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6741 /// The element at position 0
6742 pub a: crate::c_types::ThirtyTwoBytes,
6743 /// The element at position 1
6744 pub b: crate::c_types::ThirtyTwoBytes,
6746 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6747 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6754 impl C2Tuple_PaymentHashPaymentSecretZ {
6755 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6759 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6760 fn clone(&self) -> Self {
6762 a: Clone::clone(&self.a),
6763 b: Clone::clone(&self.b),
6768 /// Creates a new tuple which has the same data as `orig`
6769 /// but with all dynamically-allocated buffers duplicated in new buffers.
6770 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6771 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6773 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6774 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6778 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6779 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6781 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6782 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6783 /// A pointer to the contents in the success state.
6784 /// Reading from this pointer when `result_ok` is not set is undefined.
6785 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6786 /// Note that this value is always NULL, as there are no contents in the Err variant
6787 pub err: *mut core::ffi::c_void,
6790 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6791 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6792 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6793 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6794 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6795 /// `err` or `result` depending on the state of `result_ok`.
6796 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6797 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6798 pub result_ok: bool,
6801 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6802 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6803 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6804 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6805 result: Box::into_raw(Box::new(o)),
6811 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6812 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6813 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6814 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6815 err: core::ptr::null_mut(),
6820 /// Checks if the given object is currently in the success state
6822 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6826 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6827 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6828 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6829 fn drop(&mut self) {
6831 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6832 let _ = unsafe { Box::from_raw(self.contents.result) };
6838 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6839 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6840 let contents = if o.result_ok {
6841 let result = unsafe { o.contents.result };
6842 unsafe { o.contents.result = core::ptr::null_mut() };
6843 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6845 let _ = unsafe { Box::from_raw(o.contents.err) };
6846 o.contents.err = core::ptr::null_mut();
6847 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6851 result_ok: o.result_ok,
6855 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6856 fn clone(&self) -> Self {
6858 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6859 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6862 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6863 err: core::ptr::null_mut()
6869 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6870 /// but with all dynamically-allocated buffers duplicated in new buffers.
6871 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6873 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6874 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6875 /// A pointer to the contents in the success state.
6876 /// Reading from this pointer when `result_ok` is not set is undefined.
6877 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6878 /// A pointer to the contents in the error state.
6879 /// Reading from this pointer when `result_ok` is set is undefined.
6880 pub err: *mut crate::lightning::util::errors::APIError,
6883 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6884 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6886 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6887 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6888 /// `err` or `result` depending on the state of `result_ok`.
6889 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6890 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6891 pub result_ok: bool,
6894 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6895 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6896 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6897 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6898 result: Box::into_raw(Box::new(o)),
6904 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6905 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6906 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6907 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6908 err: Box::into_raw(Box::new(e)),
6913 /// Checks if the given object is currently in the success state
6915 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6919 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6920 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6921 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6922 fn drop(&mut self) {
6924 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6925 let _ = unsafe { Box::from_raw(self.contents.result) };
6928 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6929 let _ = unsafe { Box::from_raw(self.contents.err) };
6934 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6935 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6936 let contents = if o.result_ok {
6937 let result = unsafe { o.contents.result };
6938 unsafe { o.contents.result = core::ptr::null_mut() };
6939 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6941 let err = unsafe { o.contents.err };
6942 unsafe { o.contents.err = core::ptr::null_mut(); }
6943 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6947 result_ok: o.result_ok,
6951 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6952 fn clone(&self) -> Self {
6954 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6955 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6958 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6959 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6965 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6966 /// but with all dynamically-allocated buffers duplicated in new buffers.
6967 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6969 /// The contents of CResult_PaymentSecretNoneZ
6970 pub union CResult_PaymentSecretNoneZPtr {
6971 /// A pointer to the contents in the success state.
6972 /// Reading from this pointer when `result_ok` is not set is undefined.
6973 pub result: *mut crate::c_types::ThirtyTwoBytes,
6974 /// Note that this value is always NULL, as there are no contents in the Err variant
6975 pub err: *mut core::ffi::c_void,
6978 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6979 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6981 pub struct CResult_PaymentSecretNoneZ {
6982 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6983 /// `err` or `result` depending on the state of `result_ok`.
6984 pub contents: CResult_PaymentSecretNoneZPtr,
6985 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6986 pub result_ok: bool,
6989 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6990 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6991 CResult_PaymentSecretNoneZ {
6992 contents: CResult_PaymentSecretNoneZPtr {
6993 result: Box::into_raw(Box::new(o)),
6999 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
7000 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
7001 CResult_PaymentSecretNoneZ {
7002 contents: CResult_PaymentSecretNoneZPtr {
7003 err: core::ptr::null_mut(),
7008 /// Checks if the given object is currently in the success state
7010 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
7014 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
7015 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
7016 impl Drop for CResult_PaymentSecretNoneZ {
7017 fn drop(&mut self) {
7019 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7020 let _ = unsafe { Box::from_raw(self.contents.result) };
7026 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
7027 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7028 let contents = if o.result_ok {
7029 let result = unsafe { o.contents.result };
7030 unsafe { o.contents.result = core::ptr::null_mut() };
7031 CResult_PaymentSecretNoneZPtr { result }
7033 let _ = unsafe { Box::from_raw(o.contents.err) };
7034 o.contents.err = core::ptr::null_mut();
7035 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
7039 result_ok: o.result_ok,
7043 impl Clone for CResult_PaymentSecretNoneZ {
7044 fn clone(&self) -> Self {
7046 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
7047 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7050 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
7051 err: core::ptr::null_mut()
7057 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
7058 /// but with all dynamically-allocated buffers duplicated in new buffers.
7059 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
7061 /// The contents of CResult_PaymentSecretAPIErrorZ
7062 pub union CResult_PaymentSecretAPIErrorZPtr {
7063 /// A pointer to the contents in the success state.
7064 /// Reading from this pointer when `result_ok` is not set is undefined.
7065 pub result: *mut crate::c_types::ThirtyTwoBytes,
7066 /// A pointer to the contents in the error state.
7067 /// Reading from this pointer when `result_ok` is set is undefined.
7068 pub err: *mut crate::lightning::util::errors::APIError,
7071 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7072 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7073 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7074 pub struct CResult_PaymentSecretAPIErrorZ {
7075 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7076 /// `err` or `result` depending on the state of `result_ok`.
7077 pub contents: CResult_PaymentSecretAPIErrorZPtr,
7078 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7079 pub result_ok: bool,
7082 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
7083 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
7084 CResult_PaymentSecretAPIErrorZ {
7085 contents: CResult_PaymentSecretAPIErrorZPtr {
7086 result: Box::into_raw(Box::new(o)),
7092 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
7093 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
7094 CResult_PaymentSecretAPIErrorZ {
7095 contents: CResult_PaymentSecretAPIErrorZPtr {
7096 err: Box::into_raw(Box::new(e)),
7101 /// Checks if the given object is currently in the success state
7103 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
7107 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
7108 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
7109 impl Drop for CResult_PaymentSecretAPIErrorZ {
7110 fn drop(&mut self) {
7112 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7113 let _ = unsafe { Box::from_raw(self.contents.result) };
7116 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7117 let _ = unsafe { Box::from_raw(self.contents.err) };
7122 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
7123 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7124 let contents = if o.result_ok {
7125 let result = unsafe { o.contents.result };
7126 unsafe { o.contents.result = core::ptr::null_mut() };
7127 CResult_PaymentSecretAPIErrorZPtr { result }
7129 let err = unsafe { o.contents.err };
7130 unsafe { o.contents.err = core::ptr::null_mut(); }
7131 CResult_PaymentSecretAPIErrorZPtr { err }
7135 result_ok: o.result_ok,
7139 impl Clone for CResult_PaymentSecretAPIErrorZ {
7140 fn clone(&self) -> Self {
7142 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7143 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7146 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7147 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7153 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7154 /// but with all dynamically-allocated buffers duplicated in new buffers.
7155 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7157 /// The contents of CResult_PaymentPreimageAPIErrorZ
7158 pub union CResult_PaymentPreimageAPIErrorZPtr {
7159 /// A pointer to the contents in the success state.
7160 /// Reading from this pointer when `result_ok` is not set is undefined.
7161 pub result: *mut crate::c_types::ThirtyTwoBytes,
7162 /// A pointer to the contents in the error state.
7163 /// Reading from this pointer when `result_ok` is set is undefined.
7164 pub err: *mut crate::lightning::util::errors::APIError,
7167 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7168 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7169 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7170 pub struct CResult_PaymentPreimageAPIErrorZ {
7171 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7172 /// `err` or `result` depending on the state of `result_ok`.
7173 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7174 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7175 pub result_ok: bool,
7178 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7179 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7180 CResult_PaymentPreimageAPIErrorZ {
7181 contents: CResult_PaymentPreimageAPIErrorZPtr {
7182 result: Box::into_raw(Box::new(o)),
7188 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7189 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7190 CResult_PaymentPreimageAPIErrorZ {
7191 contents: CResult_PaymentPreimageAPIErrorZPtr {
7192 err: Box::into_raw(Box::new(e)),
7197 /// Checks if the given object is currently in the success state
7199 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7203 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7204 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7205 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7206 fn drop(&mut self) {
7208 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7209 let _ = unsafe { Box::from_raw(self.contents.result) };
7212 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7213 let _ = unsafe { Box::from_raw(self.contents.err) };
7218 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7219 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7220 let contents = if o.result_ok {
7221 let result = unsafe { o.contents.result };
7222 unsafe { o.contents.result = core::ptr::null_mut() };
7223 CResult_PaymentPreimageAPIErrorZPtr { result }
7225 let err = unsafe { o.contents.err };
7226 unsafe { o.contents.err = core::ptr::null_mut(); }
7227 CResult_PaymentPreimageAPIErrorZPtr { err }
7231 result_ok: o.result_ok,
7235 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7236 fn clone(&self) -> Self {
7238 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7239 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7242 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7243 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7249 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7250 /// but with all dynamically-allocated buffers duplicated in new buffers.
7251 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7253 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7254 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7255 /// A pointer to the contents in the success state.
7256 /// Reading from this pointer when `result_ok` is not set is undefined.
7257 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7258 /// A pointer to the contents in the error state.
7259 /// Reading from this pointer when `result_ok` is set is undefined.
7260 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7263 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7264 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7265 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7266 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7267 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7268 /// `err` or `result` depending on the state of `result_ok`.
7269 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7270 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7271 pub result_ok: bool,
7274 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7275 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7276 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7277 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7278 result: Box::into_raw(Box::new(o)),
7284 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7285 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7286 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7287 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7288 err: Box::into_raw(Box::new(e)),
7293 /// Checks if the given object is currently in the success state
7295 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7299 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7300 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7301 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7302 fn drop(&mut self) {
7304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7305 let _ = unsafe { Box::from_raw(self.contents.result) };
7308 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7309 let _ = unsafe { Box::from_raw(self.contents.err) };
7314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7315 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7316 let contents = if o.result_ok {
7317 let result = unsafe { o.contents.result };
7318 unsafe { o.contents.result = core::ptr::null_mut() };
7319 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7321 let err = unsafe { o.contents.err };
7322 unsafe { o.contents.err = core::ptr::null_mut(); }
7323 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7327 result_ok: o.result_ok,
7331 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7332 fn clone(&self) -> Self {
7334 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7335 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7338 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7339 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7345 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7346 /// but with all dynamically-allocated buffers duplicated in new buffers.
7347 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7349 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7350 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7351 /// A pointer to the contents in the success state.
7352 /// Reading from this pointer when `result_ok` is not set is undefined.
7353 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7354 /// A pointer to the contents in the error state.
7355 /// Reading from this pointer when `result_ok` is set is undefined.
7356 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7359 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7360 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7362 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7363 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7364 /// `err` or `result` depending on the state of `result_ok`.
7365 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7366 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7367 pub result_ok: bool,
7370 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7371 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7372 CResult_ChannelCounterpartyDecodeErrorZ {
7373 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7374 result: Box::into_raw(Box::new(o)),
7380 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7381 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7382 CResult_ChannelCounterpartyDecodeErrorZ {
7383 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7384 err: Box::into_raw(Box::new(e)),
7389 /// Checks if the given object is currently in the success state
7391 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7395 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7396 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7397 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7398 fn drop(&mut self) {
7400 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7401 let _ = unsafe { Box::from_raw(self.contents.result) };
7404 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7405 let _ = unsafe { Box::from_raw(self.contents.err) };
7410 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7411 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7412 let contents = if o.result_ok {
7413 let result = unsafe { o.contents.result };
7414 unsafe { o.contents.result = core::ptr::null_mut() };
7415 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7417 let err = unsafe { o.contents.err };
7418 unsafe { o.contents.err = core::ptr::null_mut(); }
7419 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7423 result_ok: o.result_ok,
7427 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7428 fn clone(&self) -> Self {
7430 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7431 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7434 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7435 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7441 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7442 /// but with all dynamically-allocated buffers duplicated in new buffers.
7443 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7445 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7446 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7447 /// A pointer to the contents in the success state.
7448 /// Reading from this pointer when `result_ok` is not set is undefined.
7449 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7450 /// A pointer to the contents in the error state.
7451 /// Reading from this pointer when `result_ok` is set is undefined.
7452 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7455 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7456 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7457 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7458 pub struct CResult_ChannelDetailsDecodeErrorZ {
7459 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7460 /// `err` or `result` depending on the state of `result_ok`.
7461 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7462 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7463 pub result_ok: bool,
7466 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7467 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7468 CResult_ChannelDetailsDecodeErrorZ {
7469 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7470 result: Box::into_raw(Box::new(o)),
7476 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7477 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7478 CResult_ChannelDetailsDecodeErrorZ {
7479 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7480 err: Box::into_raw(Box::new(e)),
7485 /// Checks if the given object is currently in the success state
7487 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7491 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7492 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7493 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7494 fn drop(&mut self) {
7496 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7497 let _ = unsafe { Box::from_raw(self.contents.result) };
7500 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7501 let _ = unsafe { Box::from_raw(self.contents.err) };
7506 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7507 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7508 let contents = if o.result_ok {
7509 let result = unsafe { o.contents.result };
7510 unsafe { o.contents.result = core::ptr::null_mut() };
7511 CResult_ChannelDetailsDecodeErrorZPtr { result }
7513 let err = unsafe { o.contents.err };
7514 unsafe { o.contents.err = core::ptr::null_mut(); }
7515 CResult_ChannelDetailsDecodeErrorZPtr { err }
7519 result_ok: o.result_ok,
7523 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7524 fn clone(&self) -> Self {
7526 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7527 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7530 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7531 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7537 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7538 /// but with all dynamically-allocated buffers duplicated in new buffers.
7539 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7541 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7542 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7543 /// A pointer to the contents in the success state.
7544 /// Reading from this pointer when `result_ok` is not set is undefined.
7545 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7546 /// A pointer to the contents in the error state.
7547 /// Reading from this pointer when `result_ok` is set is undefined.
7548 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7551 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7552 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7553 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7554 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7555 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7556 /// `err` or `result` depending on the state of `result_ok`.
7557 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7558 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7559 pub result_ok: bool,
7562 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7563 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7564 CResult_PhantomRouteHintsDecodeErrorZ {
7565 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7566 result: Box::into_raw(Box::new(o)),
7572 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7573 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7574 CResult_PhantomRouteHintsDecodeErrorZ {
7575 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7576 err: Box::into_raw(Box::new(e)),
7581 /// Checks if the given object is currently in the success state
7583 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7587 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7588 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7589 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7590 fn drop(&mut self) {
7592 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7593 let _ = unsafe { Box::from_raw(self.contents.result) };
7596 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7597 let _ = unsafe { Box::from_raw(self.contents.err) };
7602 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7603 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7604 let contents = if o.result_ok {
7605 let result = unsafe { o.contents.result };
7606 unsafe { o.contents.result = core::ptr::null_mut() };
7607 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7609 let err = unsafe { o.contents.err };
7610 unsafe { o.contents.err = core::ptr::null_mut(); }
7611 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7615 result_ok: o.result_ok,
7620 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7621 /// This corresponds to std::vector in C++
7622 pub struct CVec_ChannelMonitorZ {
7623 /// The elements in the array.
7624 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7625 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7626 /// The number of elements pointed to by `data`.
7629 impl CVec_ChannelMonitorZ {
7630 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7631 if self.datalen == 0 { return Vec::new(); }
7632 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7633 self.data = core::ptr::null_mut();
7637 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7638 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7641 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7642 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7643 let datalen = v.len();
7644 let data = Box::into_raw(v.into_boxed_slice());
7645 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7649 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7650 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7651 impl Drop for CVec_ChannelMonitorZ {
7652 fn drop(&mut self) {
7653 if self.datalen == 0 { return; }
7654 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7658 /// A tuple of 2 elements. See the individual fields for the types contained.
7659 pub struct C2Tuple_BlockHashChannelManagerZ {
7660 /// The element at position 0
7661 pub a: crate::c_types::ThirtyTwoBytes,
7662 /// The element at position 1
7663 pub b: crate::lightning::ln::channelmanager::ChannelManager,
7665 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7666 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7673 impl C2Tuple_BlockHashChannelManagerZ {
7674 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7678 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7680 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7681 C2Tuple_BlockHashChannelManagerZ { a, b, }
7685 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7686 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7688 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7689 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7690 /// A pointer to the contents in the success state.
7691 /// Reading from this pointer when `result_ok` is not set is undefined.
7692 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7693 /// A pointer to the contents in the error state.
7694 /// Reading from this pointer when `result_ok` is set is undefined.
7695 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7698 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7699 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7701 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7702 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7703 /// `err` or `result` depending on the state of `result_ok`.
7704 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7705 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7706 pub result_ok: bool,
7709 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7710 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7711 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7712 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7713 result: Box::into_raw(Box::new(o)),
7719 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7720 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7721 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7722 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7723 err: Box::into_raw(Box::new(e)),
7728 /// Checks if the given object is currently in the success state
7730 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7734 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7735 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7736 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7737 fn drop(&mut self) {
7739 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7740 let _ = unsafe { Box::from_raw(self.contents.result) };
7743 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7744 let _ = unsafe { Box::from_raw(self.contents.err) };
7749 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7750 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7751 let contents = if o.result_ok {
7752 let result = unsafe { o.contents.result };
7753 unsafe { o.contents.result = core::ptr::null_mut() };
7754 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7756 let err = unsafe { o.contents.err };
7757 unsafe { o.contents.err = core::ptr::null_mut(); }
7758 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7762 result_ok: o.result_ok,
7767 /// The contents of CResult_ChannelConfigDecodeErrorZ
7768 pub union CResult_ChannelConfigDecodeErrorZPtr {
7769 /// A pointer to the contents in the success state.
7770 /// Reading from this pointer when `result_ok` is not set is undefined.
7771 pub result: *mut crate::lightning::util::config::ChannelConfig,
7772 /// A pointer to the contents in the error state.
7773 /// Reading from this pointer when `result_ok` is set is undefined.
7774 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7777 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7778 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7779 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7780 pub struct CResult_ChannelConfigDecodeErrorZ {
7781 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7782 /// `err` or `result` depending on the state of `result_ok`.
7783 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7784 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7785 pub result_ok: bool,
7788 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7789 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7790 CResult_ChannelConfigDecodeErrorZ {
7791 contents: CResult_ChannelConfigDecodeErrorZPtr {
7792 result: Box::into_raw(Box::new(o)),
7798 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7799 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7800 CResult_ChannelConfigDecodeErrorZ {
7801 contents: CResult_ChannelConfigDecodeErrorZPtr {
7802 err: Box::into_raw(Box::new(e)),
7807 /// Checks if the given object is currently in the success state
7809 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7813 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7814 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7815 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7816 fn drop(&mut self) {
7818 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7819 let _ = unsafe { Box::from_raw(self.contents.result) };
7822 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7823 let _ = unsafe { Box::from_raw(self.contents.err) };
7828 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7829 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7830 let contents = if o.result_ok {
7831 let result = unsafe { o.contents.result };
7832 unsafe { o.contents.result = core::ptr::null_mut() };
7833 CResult_ChannelConfigDecodeErrorZPtr { result }
7835 let err = unsafe { o.contents.err };
7836 unsafe { o.contents.err = core::ptr::null_mut(); }
7837 CResult_ChannelConfigDecodeErrorZPtr { err }
7841 result_ok: o.result_ok,
7845 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7846 fn clone(&self) -> Self {
7848 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7849 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7852 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7853 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7859 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7860 /// but with all dynamically-allocated buffers duplicated in new buffers.
7861 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7863 /// The contents of CResult_OutPointDecodeErrorZ
7864 pub union CResult_OutPointDecodeErrorZPtr {
7865 /// A pointer to the contents in the success state.
7866 /// Reading from this pointer when `result_ok` is not set is undefined.
7867 pub result: *mut crate::lightning::chain::transaction::OutPoint,
7868 /// A pointer to the contents in the error state.
7869 /// Reading from this pointer when `result_ok` is set is undefined.
7870 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7873 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7874 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7875 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7876 pub struct CResult_OutPointDecodeErrorZ {
7877 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7878 /// `err` or `result` depending on the state of `result_ok`.
7879 pub contents: CResult_OutPointDecodeErrorZPtr,
7880 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7881 pub result_ok: bool,
7884 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7885 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7886 CResult_OutPointDecodeErrorZ {
7887 contents: CResult_OutPointDecodeErrorZPtr {
7888 result: Box::into_raw(Box::new(o)),
7894 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7895 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7896 CResult_OutPointDecodeErrorZ {
7897 contents: CResult_OutPointDecodeErrorZPtr {
7898 err: Box::into_raw(Box::new(e)),
7903 /// Checks if the given object is currently in the success state
7905 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7909 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7910 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7911 impl Drop for CResult_OutPointDecodeErrorZ {
7912 fn drop(&mut self) {
7914 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7915 let _ = unsafe { Box::from_raw(self.contents.result) };
7918 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7919 let _ = unsafe { Box::from_raw(self.contents.err) };
7924 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7925 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7926 let contents = if o.result_ok {
7927 let result = unsafe { o.contents.result };
7928 unsafe { o.contents.result = core::ptr::null_mut() };
7929 CResult_OutPointDecodeErrorZPtr { result }
7931 let err = unsafe { o.contents.err };
7932 unsafe { o.contents.err = core::ptr::null_mut(); }
7933 CResult_OutPointDecodeErrorZPtr { err }
7937 result_ok: o.result_ok,
7941 impl Clone for CResult_OutPointDecodeErrorZ {
7942 fn clone(&self) -> Self {
7944 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7945 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7948 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7949 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7955 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7956 /// but with all dynamically-allocated buffers duplicated in new buffers.
7957 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7959 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7960 pub enum COption_TypeZ {
7961 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7962 Some(crate::lightning::ln::wire::Type),
7963 /// When we're in this state, this COption_TypeZ contains nothing
7966 impl COption_TypeZ {
7967 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7968 if let Self::None = self { false } else { true }
7970 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7973 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7974 if let Self::Some(v) = self { v } else { unreachable!() }
7978 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7979 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7980 COption_TypeZ::Some(o)
7983 /// Constructs a new COption_TypeZ containing nothing
7984 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7988 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
7989 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
7991 /// The contents of CResult_COption_TypeZDecodeErrorZ
7992 pub union CResult_COption_TypeZDecodeErrorZPtr {
7993 /// A pointer to the contents in the success state.
7994 /// Reading from this pointer when `result_ok` is not set is undefined.
7995 pub result: *mut crate::c_types::derived::COption_TypeZ,
7996 /// A pointer to the contents in the error state.
7997 /// Reading from this pointer when `result_ok` is set is undefined.
7998 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8001 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
8002 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8004 pub struct CResult_COption_TypeZDecodeErrorZ {
8005 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
8006 /// `err` or `result` depending on the state of `result_ok`.
8007 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
8008 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
8009 pub result_ok: bool,
8012 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
8013 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
8014 CResult_COption_TypeZDecodeErrorZ {
8015 contents: CResult_COption_TypeZDecodeErrorZPtr {
8016 result: Box::into_raw(Box::new(o)),
8022 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
8023 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
8024 CResult_COption_TypeZDecodeErrorZ {
8025 contents: CResult_COption_TypeZDecodeErrorZPtr {
8026 err: Box::into_raw(Box::new(e)),
8031 /// Checks if the given object is currently in the success state
8033 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
8037 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
8038 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
8039 impl Drop for CResult_COption_TypeZDecodeErrorZ {
8040 fn drop(&mut self) {
8042 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8043 let _ = unsafe { Box::from_raw(self.contents.result) };
8046 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8047 let _ = unsafe { Box::from_raw(self.contents.err) };
8052 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
8053 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8054 let contents = if o.result_ok {
8055 let result = unsafe { o.contents.result };
8056 unsafe { o.contents.result = core::ptr::null_mut() };
8057 CResult_COption_TypeZDecodeErrorZPtr { result }
8059 let err = unsafe { o.contents.err };
8060 unsafe { o.contents.err = core::ptr::null_mut(); }
8061 CResult_COption_TypeZDecodeErrorZPtr { err }
8065 result_ok: o.result_ok,
8070 /// The contents of CResult_PaymentIdPaymentErrorZ
8071 pub union CResult_PaymentIdPaymentErrorZPtr {
8072 /// A pointer to the contents in the success state.
8073 /// Reading from this pointer when `result_ok` is not set is undefined.
8074 pub result: *mut crate::c_types::ThirtyTwoBytes,
8075 /// A pointer to the contents in the error state.
8076 /// Reading from this pointer when `result_ok` is set is undefined.
8077 pub err: *mut crate::lightning_invoice::payment::PaymentError,
8080 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8081 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8083 pub struct CResult_PaymentIdPaymentErrorZ {
8084 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8085 /// `err` or `result` depending on the state of `result_ok`.
8086 pub contents: CResult_PaymentIdPaymentErrorZPtr,
8087 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8088 pub result_ok: bool,
8091 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
8092 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
8093 CResult_PaymentIdPaymentErrorZ {
8094 contents: CResult_PaymentIdPaymentErrorZPtr {
8095 result: Box::into_raw(Box::new(o)),
8101 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
8102 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
8103 CResult_PaymentIdPaymentErrorZ {
8104 contents: CResult_PaymentIdPaymentErrorZPtr {
8105 err: Box::into_raw(Box::new(e)),
8110 /// Checks if the given object is currently in the success state
8112 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
8116 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
8117 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
8118 impl Drop for CResult_PaymentIdPaymentErrorZ {
8119 fn drop(&mut self) {
8121 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8122 let _ = unsafe { Box::from_raw(self.contents.result) };
8125 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8126 let _ = unsafe { Box::from_raw(self.contents.err) };
8131 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
8132 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
8133 let contents = if o.result_ok {
8134 let result = unsafe { o.contents.result };
8135 unsafe { o.contents.result = core::ptr::null_mut() };
8136 CResult_PaymentIdPaymentErrorZPtr { result }
8138 let err = unsafe { o.contents.err };
8139 unsafe { o.contents.err = core::ptr::null_mut(); }
8140 CResult_PaymentIdPaymentErrorZPtr { err }
8144 result_ok: o.result_ok,
8148 impl Clone for CResult_PaymentIdPaymentErrorZ {
8149 fn clone(&self) -> Self {
8151 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8152 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8155 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8156 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8162 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8163 /// but with all dynamically-allocated buffers duplicated in new buffers.
8164 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8166 /// The contents of CResult_SiPrefixNoneZ
8167 pub union CResult_SiPrefixNoneZPtr {
8168 /// A pointer to the contents in the success state.
8169 /// Reading from this pointer when `result_ok` is not set is undefined.
8170 pub result: *mut crate::lightning_invoice::SiPrefix,
8171 /// Note that this value is always NULL, as there are no contents in the Err variant
8172 pub err: *mut core::ffi::c_void,
8175 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
8176 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
8177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8178 pub struct CResult_SiPrefixNoneZ {
8179 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
8180 /// `err` or `result` depending on the state of `result_ok`.
8181 pub contents: CResult_SiPrefixNoneZPtr,
8182 /// Whether this CResult_SiPrefixNoneZ represents a success state.
8183 pub result_ok: bool,
8186 /// Creates a new CResult_SiPrefixNoneZ in the success state.
8187 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
8188 CResult_SiPrefixNoneZ {
8189 contents: CResult_SiPrefixNoneZPtr {
8190 result: Box::into_raw(Box::new(o)),
8196 /// Creates a new CResult_SiPrefixNoneZ in the error state.
8197 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
8198 CResult_SiPrefixNoneZ {
8199 contents: CResult_SiPrefixNoneZPtr {
8200 err: core::ptr::null_mut(),
8205 /// Checks if the given object is currently in the success state
8207 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
8211 /// Frees any resources used by the CResult_SiPrefixNoneZ.
8212 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
8213 impl Drop for CResult_SiPrefixNoneZ {
8214 fn drop(&mut self) {
8216 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8217 let _ = unsafe { Box::from_raw(self.contents.result) };
8223 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
8224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
8225 let contents = if o.result_ok {
8226 let result = unsafe { o.contents.result };
8227 unsafe { o.contents.result = core::ptr::null_mut() };
8228 CResult_SiPrefixNoneZPtr { result }
8230 let _ = unsafe { Box::from_raw(o.contents.err) };
8231 o.contents.err = core::ptr::null_mut();
8232 CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
8236 result_ok: o.result_ok,
8240 impl Clone for CResult_SiPrefixNoneZ {
8241 fn clone(&self) -> Self {
8243 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
8244 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8247 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
8248 err: core::ptr::null_mut()
8254 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
8255 /// but with all dynamically-allocated buffers duplicated in new buffers.
8256 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
8258 /// The contents of CResult_InvoiceNoneZ
8259 pub union CResult_InvoiceNoneZPtr {
8260 /// A pointer to the contents in the success state.
8261 /// Reading from this pointer when `result_ok` is not set is undefined.
8262 pub result: *mut crate::lightning_invoice::Invoice,
8263 /// Note that this value is always NULL, as there are no contents in the Err variant
8264 pub err: *mut core::ffi::c_void,
8267 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
8268 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
8269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8270 pub struct CResult_InvoiceNoneZ {
8271 /// The contents of this CResult_InvoiceNoneZ, accessible via either
8272 /// `err` or `result` depending on the state of `result_ok`.
8273 pub contents: CResult_InvoiceNoneZPtr,
8274 /// Whether this CResult_InvoiceNoneZ represents a success state.
8275 pub result_ok: bool,
8278 /// Creates a new CResult_InvoiceNoneZ in the success state.
8279 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
8280 CResult_InvoiceNoneZ {
8281 contents: CResult_InvoiceNoneZPtr {
8282 result: Box::into_raw(Box::new(o)),
8288 /// Creates a new CResult_InvoiceNoneZ in the error state.
8289 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
8290 CResult_InvoiceNoneZ {
8291 contents: CResult_InvoiceNoneZPtr {
8292 err: core::ptr::null_mut(),
8297 /// Checks if the given object is currently in the success state
8299 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
8303 /// Frees any resources used by the CResult_InvoiceNoneZ.
8304 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
8305 impl Drop for CResult_InvoiceNoneZ {
8306 fn drop(&mut self) {
8308 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8309 let _ = unsafe { Box::from_raw(self.contents.result) };
8315 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
8316 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
8317 let contents = if o.result_ok {
8318 let result = unsafe { o.contents.result };
8319 unsafe { o.contents.result = core::ptr::null_mut() };
8320 CResult_InvoiceNoneZPtr { result }
8322 let _ = unsafe { Box::from_raw(o.contents.err) };
8323 o.contents.err = core::ptr::null_mut();
8324 CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
8328 result_ok: o.result_ok,
8332 impl Clone for CResult_InvoiceNoneZ {
8333 fn clone(&self) -> Self {
8335 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
8336 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8339 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
8340 err: core::ptr::null_mut()
8346 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
8347 /// but with all dynamically-allocated buffers duplicated in new buffers.
8348 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
8350 /// The contents of CResult_SignedRawInvoiceNoneZ
8351 pub union CResult_SignedRawInvoiceNoneZPtr {
8352 /// A pointer to the contents in the success state.
8353 /// Reading from this pointer when `result_ok` is not set is undefined.
8354 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8355 /// Note that this value is always NULL, as there are no contents in the Err variant
8356 pub err: *mut core::ffi::c_void,
8359 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
8360 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
8361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8362 pub struct CResult_SignedRawInvoiceNoneZ {
8363 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
8364 /// `err` or `result` depending on the state of `result_ok`.
8365 pub contents: CResult_SignedRawInvoiceNoneZPtr,
8366 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
8367 pub result_ok: bool,
8370 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
8371 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
8372 CResult_SignedRawInvoiceNoneZ {
8373 contents: CResult_SignedRawInvoiceNoneZPtr {
8374 result: Box::into_raw(Box::new(o)),
8380 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
8381 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
8382 CResult_SignedRawInvoiceNoneZ {
8383 contents: CResult_SignedRawInvoiceNoneZPtr {
8384 err: core::ptr::null_mut(),
8389 /// Checks if the given object is currently in the success state
8391 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
8395 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
8396 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
8397 impl Drop for CResult_SignedRawInvoiceNoneZ {
8398 fn drop(&mut self) {
8400 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8401 let _ = unsafe { Box::from_raw(self.contents.result) };
8407 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
8408 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
8409 let contents = if o.result_ok {
8410 let result = unsafe { o.contents.result };
8411 unsafe { o.contents.result = core::ptr::null_mut() };
8412 CResult_SignedRawInvoiceNoneZPtr { result }
8414 let _ = unsafe { Box::from_raw(o.contents.err) };
8415 o.contents.err = core::ptr::null_mut();
8416 CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
8420 result_ok: o.result_ok,
8424 impl Clone for CResult_SignedRawInvoiceNoneZ {
8425 fn clone(&self) -> Self {
8427 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
8428 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8431 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
8432 err: core::ptr::null_mut()
8438 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
8439 /// but with all dynamically-allocated buffers duplicated in new buffers.
8440 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
8442 /// A tuple of 3 elements. See the individual fields for the types contained.
8443 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8444 /// The element at position 0
8445 pub a: crate::lightning_invoice::RawInvoice,
8446 /// The element at position 1
8447 pub b: crate::c_types::ThirtyTwoBytes,
8448 /// The element at position 2
8449 pub c: crate::lightning_invoice::InvoiceSignature,
8451 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8452 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8460 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8461 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8462 (self.a, self.b, self.c)
8465 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8466 fn clone(&self) -> Self {
8468 a: Clone::clone(&self.a),
8469 b: Clone::clone(&self.b),
8470 c: Clone::clone(&self.c),
8475 /// Creates a new tuple which has the same data as `orig`
8476 /// but with all dynamically-allocated buffers duplicated in new buffers.
8477 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8478 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8480 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 {
8481 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8485 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8486 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8488 /// The contents of CResult_PayeePubKeyErrorZ
8489 pub union CResult_PayeePubKeyErrorZPtr {
8490 /// A pointer to the contents in the success state.
8491 /// Reading from this pointer when `result_ok` is not set is undefined.
8492 pub result: *mut crate::lightning_invoice::PayeePubKey,
8493 /// A pointer to the contents in the error state.
8494 /// Reading from this pointer when `result_ok` is set is undefined.
8495 pub err: *mut crate::c_types::Secp256k1Error,
8498 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8499 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8500 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8501 pub struct CResult_PayeePubKeyErrorZ {
8502 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8503 /// `err` or `result` depending on the state of `result_ok`.
8504 pub contents: CResult_PayeePubKeyErrorZPtr,
8505 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8506 pub result_ok: bool,
8509 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8510 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8511 CResult_PayeePubKeyErrorZ {
8512 contents: CResult_PayeePubKeyErrorZPtr {
8513 result: Box::into_raw(Box::new(o)),
8519 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8520 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8521 CResult_PayeePubKeyErrorZ {
8522 contents: CResult_PayeePubKeyErrorZPtr {
8523 err: Box::into_raw(Box::new(e)),
8528 /// Checks if the given object is currently in the success state
8530 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8534 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8535 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8536 impl Drop for CResult_PayeePubKeyErrorZ {
8537 fn drop(&mut self) {
8539 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8540 let _ = unsafe { Box::from_raw(self.contents.result) };
8543 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8544 let _ = unsafe { Box::from_raw(self.contents.err) };
8549 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8550 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8551 let contents = if o.result_ok {
8552 let result = unsafe { o.contents.result };
8553 unsafe { o.contents.result = core::ptr::null_mut() };
8554 CResult_PayeePubKeyErrorZPtr { result }
8556 let err = unsafe { o.contents.err };
8557 unsafe { o.contents.err = core::ptr::null_mut(); }
8558 CResult_PayeePubKeyErrorZPtr { err }
8562 result_ok: o.result_ok,
8566 impl Clone for CResult_PayeePubKeyErrorZ {
8567 fn clone(&self) -> Self {
8569 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8570 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8573 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8574 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8580 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8581 /// but with all dynamically-allocated buffers duplicated in new buffers.
8582 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8584 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8585 /// This corresponds to std::vector in C++
8586 pub struct CVec_PrivateRouteZ {
8587 /// The elements in the array.
8588 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8589 pub data: *mut crate::lightning_invoice::PrivateRoute,
8590 /// The number of elements pointed to by `data`.
8593 impl CVec_PrivateRouteZ {
8594 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8595 if self.datalen == 0 { return Vec::new(); }
8596 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8597 self.data = core::ptr::null_mut();
8601 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8602 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8605 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8606 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8607 let datalen = v.len();
8608 let data = Box::into_raw(v.into_boxed_slice());
8609 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8613 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8614 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8615 impl Drop for CVec_PrivateRouteZ {
8616 fn drop(&mut self) {
8617 if self.datalen == 0 { return; }
8618 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8621 impl Clone for CVec_PrivateRouteZ {
8622 fn clone(&self) -> Self {
8623 let mut res = Vec::new();
8624 if self.datalen == 0 { return Self::from(res); }
8625 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8630 /// The contents of CResult_PositiveTimestampCreationErrorZ
8631 pub union CResult_PositiveTimestampCreationErrorZPtr {
8632 /// A pointer to the contents in the success state.
8633 /// Reading from this pointer when `result_ok` is not set is undefined.
8634 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8635 /// A pointer to the contents in the error state.
8636 /// Reading from this pointer when `result_ok` is set is undefined.
8637 pub err: *mut crate::lightning_invoice::CreationError,
8640 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8641 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8642 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8643 pub struct CResult_PositiveTimestampCreationErrorZ {
8644 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8645 /// `err` or `result` depending on the state of `result_ok`.
8646 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8647 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8648 pub result_ok: bool,
8651 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8652 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8653 CResult_PositiveTimestampCreationErrorZ {
8654 contents: CResult_PositiveTimestampCreationErrorZPtr {
8655 result: Box::into_raw(Box::new(o)),
8661 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8662 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8663 CResult_PositiveTimestampCreationErrorZ {
8664 contents: CResult_PositiveTimestampCreationErrorZPtr {
8665 err: Box::into_raw(Box::new(e)),
8670 /// Checks if the given object is currently in the success state
8672 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8676 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8677 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8678 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8679 fn drop(&mut self) {
8681 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8682 let _ = unsafe { Box::from_raw(self.contents.result) };
8685 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8686 let _ = unsafe { Box::from_raw(self.contents.err) };
8691 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8692 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8693 let contents = if o.result_ok {
8694 let result = unsafe { o.contents.result };
8695 unsafe { o.contents.result = core::ptr::null_mut() };
8696 CResult_PositiveTimestampCreationErrorZPtr { result }
8698 let err = unsafe { o.contents.err };
8699 unsafe { o.contents.err = core::ptr::null_mut(); }
8700 CResult_PositiveTimestampCreationErrorZPtr { err }
8704 result_ok: o.result_ok,
8708 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8709 fn clone(&self) -> Self {
8711 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8712 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8715 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8716 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8722 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8723 /// but with all dynamically-allocated buffers duplicated in new buffers.
8724 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8726 /// The contents of CResult_NoneSemanticErrorZ
8727 pub union CResult_NoneSemanticErrorZPtr {
8728 /// Note that this value is always NULL, as there are no contents in the OK variant
8729 pub result: *mut core::ffi::c_void,
8730 /// A pointer to the contents in the error state.
8731 /// Reading from this pointer when `result_ok` is set is undefined.
8732 pub err: *mut crate::lightning_invoice::SemanticError,
8735 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8736 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8738 pub struct CResult_NoneSemanticErrorZ {
8739 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8740 /// `err` or `result` depending on the state of `result_ok`.
8741 pub contents: CResult_NoneSemanticErrorZPtr,
8742 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8743 pub result_ok: bool,
8746 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8747 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8748 CResult_NoneSemanticErrorZ {
8749 contents: CResult_NoneSemanticErrorZPtr {
8750 result: core::ptr::null_mut(),
8756 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8757 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8758 CResult_NoneSemanticErrorZ {
8759 contents: CResult_NoneSemanticErrorZPtr {
8760 err: Box::into_raw(Box::new(e)),
8765 /// Checks if the given object is currently in the success state
8767 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8771 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8772 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8773 impl Drop for CResult_NoneSemanticErrorZ {
8774 fn drop(&mut self) {
8777 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8778 let _ = unsafe { Box::from_raw(self.contents.err) };
8783 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8784 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8785 let contents = if o.result_ok {
8786 let _ = unsafe { Box::from_raw(o.contents.result) };
8787 o.contents.result = core::ptr::null_mut();
8788 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8790 let err = unsafe { o.contents.err };
8791 unsafe { o.contents.err = core::ptr::null_mut(); }
8792 CResult_NoneSemanticErrorZPtr { err }
8796 result_ok: o.result_ok,
8800 impl Clone for CResult_NoneSemanticErrorZ {
8801 fn clone(&self) -> Self {
8803 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8804 result: core::ptr::null_mut()
8807 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8808 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8814 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8815 /// but with all dynamically-allocated buffers duplicated in new buffers.
8816 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8818 /// The contents of CResult_InvoiceSemanticErrorZ
8819 pub union CResult_InvoiceSemanticErrorZPtr {
8820 /// A pointer to the contents in the success state.
8821 /// Reading from this pointer when `result_ok` is not set is undefined.
8822 pub result: *mut crate::lightning_invoice::Invoice,
8823 /// A pointer to the contents in the error state.
8824 /// Reading from this pointer when `result_ok` is set is undefined.
8825 pub err: *mut crate::lightning_invoice::SemanticError,
8828 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8829 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8830 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8831 pub struct CResult_InvoiceSemanticErrorZ {
8832 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8833 /// `err` or `result` depending on the state of `result_ok`.
8834 pub contents: CResult_InvoiceSemanticErrorZPtr,
8835 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8836 pub result_ok: bool,
8839 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8840 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8841 CResult_InvoiceSemanticErrorZ {
8842 contents: CResult_InvoiceSemanticErrorZPtr {
8843 result: Box::into_raw(Box::new(o)),
8849 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8850 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8851 CResult_InvoiceSemanticErrorZ {
8852 contents: CResult_InvoiceSemanticErrorZPtr {
8853 err: Box::into_raw(Box::new(e)),
8858 /// Checks if the given object is currently in the success state
8860 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8864 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8865 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8866 impl Drop for CResult_InvoiceSemanticErrorZ {
8867 fn drop(&mut self) {
8869 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8870 let _ = unsafe { Box::from_raw(self.contents.result) };
8873 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8874 let _ = unsafe { Box::from_raw(self.contents.err) };
8879 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8880 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8881 let contents = if o.result_ok {
8882 let result = unsafe { o.contents.result };
8883 unsafe { o.contents.result = core::ptr::null_mut() };
8884 CResult_InvoiceSemanticErrorZPtr { result }
8886 let err = unsafe { o.contents.err };
8887 unsafe { o.contents.err = core::ptr::null_mut(); }
8888 CResult_InvoiceSemanticErrorZPtr { err }
8892 result_ok: o.result_ok,
8896 impl Clone for CResult_InvoiceSemanticErrorZ {
8897 fn clone(&self) -> Self {
8899 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8900 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8903 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8904 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8910 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8911 /// but with all dynamically-allocated buffers duplicated in new buffers.
8912 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8914 /// The contents of CResult_DescriptionCreationErrorZ
8915 pub union CResult_DescriptionCreationErrorZPtr {
8916 /// A pointer to the contents in the success state.
8917 /// Reading from this pointer when `result_ok` is not set is undefined.
8918 pub result: *mut crate::lightning_invoice::Description,
8919 /// A pointer to the contents in the error state.
8920 /// Reading from this pointer when `result_ok` is set is undefined.
8921 pub err: *mut crate::lightning_invoice::CreationError,
8924 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8925 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8926 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8927 pub struct CResult_DescriptionCreationErrorZ {
8928 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8929 /// `err` or `result` depending on the state of `result_ok`.
8930 pub contents: CResult_DescriptionCreationErrorZPtr,
8931 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8932 pub result_ok: bool,
8935 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8936 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8937 CResult_DescriptionCreationErrorZ {
8938 contents: CResult_DescriptionCreationErrorZPtr {
8939 result: Box::into_raw(Box::new(o)),
8945 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8946 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8947 CResult_DescriptionCreationErrorZ {
8948 contents: CResult_DescriptionCreationErrorZPtr {
8949 err: Box::into_raw(Box::new(e)),
8954 /// Checks if the given object is currently in the success state
8956 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8960 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8961 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8962 impl Drop for CResult_DescriptionCreationErrorZ {
8963 fn drop(&mut self) {
8965 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8966 let _ = unsafe { Box::from_raw(self.contents.result) };
8969 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8970 let _ = unsafe { Box::from_raw(self.contents.err) };
8975 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8976 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8977 let contents = if o.result_ok {
8978 let result = unsafe { o.contents.result };
8979 unsafe { o.contents.result = core::ptr::null_mut() };
8980 CResult_DescriptionCreationErrorZPtr { result }
8982 let err = unsafe { o.contents.err };
8983 unsafe { o.contents.err = core::ptr::null_mut(); }
8984 CResult_DescriptionCreationErrorZPtr { err }
8988 result_ok: o.result_ok,
8992 impl Clone for CResult_DescriptionCreationErrorZ {
8993 fn clone(&self) -> Self {
8995 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
8996 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
8999 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
9000 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9006 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
9007 /// but with all dynamically-allocated buffers duplicated in new buffers.
9008 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
9010 /// The contents of CResult_PrivateRouteCreationErrorZ
9011 pub union CResult_PrivateRouteCreationErrorZPtr {
9012 /// A pointer to the contents in the success state.
9013 /// Reading from this pointer when `result_ok` is not set is undefined.
9014 pub result: *mut crate::lightning_invoice::PrivateRoute,
9015 /// A pointer to the contents in the error state.
9016 /// Reading from this pointer when `result_ok` is set is undefined.
9017 pub err: *mut crate::lightning_invoice::CreationError,
9020 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
9021 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
9022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9023 pub struct CResult_PrivateRouteCreationErrorZ {
9024 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
9025 /// `err` or `result` depending on the state of `result_ok`.
9026 pub contents: CResult_PrivateRouteCreationErrorZPtr,
9027 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
9028 pub result_ok: bool,
9031 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
9032 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
9033 CResult_PrivateRouteCreationErrorZ {
9034 contents: CResult_PrivateRouteCreationErrorZPtr {
9035 result: Box::into_raw(Box::new(o)),
9041 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
9042 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
9043 CResult_PrivateRouteCreationErrorZ {
9044 contents: CResult_PrivateRouteCreationErrorZPtr {
9045 err: Box::into_raw(Box::new(e)),
9050 /// Checks if the given object is currently in the success state
9052 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
9056 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
9057 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
9058 impl Drop for CResult_PrivateRouteCreationErrorZ {
9059 fn drop(&mut self) {
9061 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9062 let _ = unsafe { Box::from_raw(self.contents.result) };
9065 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9066 let _ = unsafe { Box::from_raw(self.contents.err) };
9071 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
9072 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
9073 let contents = if o.result_ok {
9074 let result = unsafe { o.contents.result };
9075 unsafe { o.contents.result = core::ptr::null_mut() };
9076 CResult_PrivateRouteCreationErrorZPtr { result }
9078 let err = unsafe { o.contents.err };
9079 unsafe { o.contents.err = core::ptr::null_mut(); }
9080 CResult_PrivateRouteCreationErrorZPtr { err }
9084 result_ok: o.result_ok,
9088 impl Clone for CResult_PrivateRouteCreationErrorZ {
9089 fn clone(&self) -> Self {
9091 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
9092 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
9095 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
9096 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9102 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
9103 /// but with all dynamically-allocated buffers duplicated in new buffers.
9104 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
9106 /// The contents of CResult_StringErrorZ
9107 pub union CResult_StringErrorZPtr {
9108 /// A pointer to the contents in the success state.
9109 /// Reading from this pointer when `result_ok` is not set is undefined.
9110 pub result: *mut crate::c_types::Str,
9111 /// A pointer to the contents in the error state.
9112 /// Reading from this pointer when `result_ok` is set is undefined.
9113 pub err: *mut crate::c_types::Secp256k1Error,
9116 /// A CResult_StringErrorZ represents the result of a fallible operation,
9117 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9118 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9119 pub struct CResult_StringErrorZ {
9120 /// The contents of this CResult_StringErrorZ, accessible via either
9121 /// `err` or `result` depending on the state of `result_ok`.
9122 pub contents: CResult_StringErrorZPtr,
9123 /// Whether this CResult_StringErrorZ represents a success state.
9124 pub result_ok: bool,
9127 /// Creates a new CResult_StringErrorZ in the success state.
9128 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
9129 CResult_StringErrorZ {
9130 contents: CResult_StringErrorZPtr {
9131 result: Box::into_raw(Box::new(o)),
9137 /// Creates a new CResult_StringErrorZ in the error state.
9138 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
9139 CResult_StringErrorZ {
9140 contents: CResult_StringErrorZPtr {
9141 err: Box::into_raw(Box::new(e)),
9146 /// Checks if the given object is currently in the success state
9148 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9152 /// Frees any resources used by the CResult_StringErrorZ.
9153 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9154 impl Drop for CResult_StringErrorZ {
9155 fn drop(&mut self) {
9157 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9158 let _ = unsafe { Box::from_raw(self.contents.result) };
9161 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9162 let _ = unsafe { Box::from_raw(self.contents.err) };
9167 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9168 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9169 let contents = if o.result_ok {
9170 let result = unsafe { o.contents.result };
9171 unsafe { o.contents.result = core::ptr::null_mut() };
9172 CResult_StringErrorZPtr { result }
9174 let err = unsafe { o.contents.err };
9175 unsafe { o.contents.err = core::ptr::null_mut(); }
9176 CResult_StringErrorZPtr { err }
9180 result_ok: o.result_ok,
9185 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9186 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9187 /// A pointer to the contents in the success state.
9188 /// Reading from this pointer when `result_ok` is not set is undefined.
9189 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9190 /// A pointer to the contents in the error state.
9191 /// Reading from this pointer when `result_ok` is set is undefined.
9192 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9195 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9196 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9198 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9199 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9200 /// `err` or `result` depending on the state of `result_ok`.
9201 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9202 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9203 pub result_ok: bool,
9206 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9207 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9208 CResult_ChannelMonitorUpdateDecodeErrorZ {
9209 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9210 result: Box::into_raw(Box::new(o)),
9216 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9217 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9218 CResult_ChannelMonitorUpdateDecodeErrorZ {
9219 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9220 err: Box::into_raw(Box::new(e)),
9225 /// Checks if the given object is currently in the success state
9227 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9231 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9232 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9233 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9234 fn drop(&mut self) {
9236 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9237 let _ = unsafe { Box::from_raw(self.contents.result) };
9240 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9241 let _ = unsafe { Box::from_raw(self.contents.err) };
9246 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9247 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9248 let contents = if o.result_ok {
9249 let result = unsafe { o.contents.result };
9250 unsafe { o.contents.result = core::ptr::null_mut() };
9251 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9253 let err = unsafe { o.contents.err };
9254 unsafe { o.contents.err = core::ptr::null_mut(); }
9255 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9259 result_ok: o.result_ok,
9263 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9264 fn clone(&self) -> Self {
9266 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9267 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9270 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9271 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9277 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9278 /// but with all dynamically-allocated buffers duplicated in new buffers.
9279 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9282 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9283 pub enum COption_MonitorEventZ {
9284 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9285 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9286 /// When we're in this state, this COption_MonitorEventZ contains nothing
9289 impl COption_MonitorEventZ {
9290 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9291 if let Self::None = self { false } else { true }
9293 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9296 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9297 if let Self::Some(v) = self { v } else { unreachable!() }
9301 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9302 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9303 COption_MonitorEventZ::Some(o)
9306 /// Constructs a new COption_MonitorEventZ containing nothing
9307 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9308 COption_MonitorEventZ::None
9311 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9312 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9314 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9315 /// but with all dynamically-allocated buffers duplicated in new buffers.
9316 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9318 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9319 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9320 /// A pointer to the contents in the success state.
9321 /// Reading from this pointer when `result_ok` is not set is undefined.
9322 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9323 /// A pointer to the contents in the error state.
9324 /// Reading from this pointer when `result_ok` is set is undefined.
9325 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9328 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9329 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9331 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9332 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9333 /// `err` or `result` depending on the state of `result_ok`.
9334 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9335 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9336 pub result_ok: bool,
9339 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9340 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9341 CResult_COption_MonitorEventZDecodeErrorZ {
9342 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9343 result: Box::into_raw(Box::new(o)),
9349 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9350 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9351 CResult_COption_MonitorEventZDecodeErrorZ {
9352 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9353 err: Box::into_raw(Box::new(e)),
9358 /// Checks if the given object is currently in the success state
9360 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9364 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9365 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9366 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9367 fn drop(&mut self) {
9369 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9370 let _ = unsafe { Box::from_raw(self.contents.result) };
9373 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9374 let _ = unsafe { Box::from_raw(self.contents.err) };
9379 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9380 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9381 let contents = if o.result_ok {
9382 let result = unsafe { o.contents.result };
9383 unsafe { o.contents.result = core::ptr::null_mut() };
9384 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9386 let err = unsafe { o.contents.err };
9387 unsafe { o.contents.err = core::ptr::null_mut(); }
9388 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9392 result_ok: o.result_ok,
9396 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9397 fn clone(&self) -> Self {
9399 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9400 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9403 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9404 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9410 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9411 /// but with all dynamically-allocated buffers duplicated in new buffers.
9412 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9414 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9415 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9416 /// A pointer to the contents in the success state.
9417 /// Reading from this pointer when `result_ok` is not set is undefined.
9418 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9419 /// A pointer to the contents in the error state.
9420 /// Reading from this pointer when `result_ok` is set is undefined.
9421 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9424 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9425 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9427 pub struct CResult_HTLCUpdateDecodeErrorZ {
9428 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9429 /// `err` or `result` depending on the state of `result_ok`.
9430 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9431 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9432 pub result_ok: bool,
9435 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9436 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9437 CResult_HTLCUpdateDecodeErrorZ {
9438 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9439 result: Box::into_raw(Box::new(o)),
9445 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9446 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9447 CResult_HTLCUpdateDecodeErrorZ {
9448 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9449 err: Box::into_raw(Box::new(e)),
9454 /// Checks if the given object is currently in the success state
9456 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9460 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9461 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9462 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9463 fn drop(&mut self) {
9465 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9466 let _ = unsafe { Box::from_raw(self.contents.result) };
9469 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9470 let _ = unsafe { Box::from_raw(self.contents.err) };
9475 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9476 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9477 let contents = if o.result_ok {
9478 let result = unsafe { o.contents.result };
9479 unsafe { o.contents.result = core::ptr::null_mut() };
9480 CResult_HTLCUpdateDecodeErrorZPtr { result }
9482 let err = unsafe { o.contents.err };
9483 unsafe { o.contents.err = core::ptr::null_mut(); }
9484 CResult_HTLCUpdateDecodeErrorZPtr { err }
9488 result_ok: o.result_ok,
9492 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9493 fn clone(&self) -> Self {
9495 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9496 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9499 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9500 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9506 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9507 /// but with all dynamically-allocated buffers duplicated in new buffers.
9508 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9510 /// A tuple of 2 elements. See the individual fields for the types contained.
9511 pub struct C2Tuple_OutPointScriptZ {
9512 /// The element at position 0
9513 pub a: crate::lightning::chain::transaction::OutPoint,
9514 /// The element at position 1
9515 pub b: crate::c_types::derived::CVec_u8Z,
9517 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9518 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9525 impl C2Tuple_OutPointScriptZ {
9526 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9530 impl Clone for C2Tuple_OutPointScriptZ {
9531 fn clone(&self) -> Self {
9533 a: Clone::clone(&self.a),
9534 b: Clone::clone(&self.b),
9539 /// Creates a new tuple which has the same data as `orig`
9540 /// but with all dynamically-allocated buffers duplicated in new buffers.
9541 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9542 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9544 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9545 C2Tuple_OutPointScriptZ { a, b, }
9549 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9550 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9552 /// A tuple of 2 elements. See the individual fields for the types contained.
9553 pub struct C2Tuple_u32ScriptZ {
9554 /// The element at position 0
9556 /// The element at position 1
9557 pub b: crate::c_types::derived::CVec_u8Z,
9559 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9560 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9567 impl C2Tuple_u32ScriptZ {
9568 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9572 impl Clone for C2Tuple_u32ScriptZ {
9573 fn clone(&self) -> Self {
9575 a: Clone::clone(&self.a),
9576 b: Clone::clone(&self.b),
9581 /// Creates a new tuple which has the same data as `orig`
9582 /// but with all dynamically-allocated buffers duplicated in new buffers.
9583 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9584 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9586 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9587 C2Tuple_u32ScriptZ { a, b, }
9591 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9592 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9594 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9595 /// This corresponds to std::vector in C++
9596 pub struct CVec_C2Tuple_u32ScriptZZ {
9597 /// The elements in the array.
9598 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9599 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9600 /// The number of elements pointed to by `data`.
9603 impl CVec_C2Tuple_u32ScriptZZ {
9604 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9605 if self.datalen == 0 { return Vec::new(); }
9606 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9607 self.data = core::ptr::null_mut();
9611 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9612 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9615 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9616 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9617 let datalen = v.len();
9618 let data = Box::into_raw(v.into_boxed_slice());
9619 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9623 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9624 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9625 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9626 fn drop(&mut self) {
9627 if self.datalen == 0 { return; }
9628 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9631 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9632 fn clone(&self) -> Self {
9633 let mut res = Vec::new();
9634 if self.datalen == 0 { return Self::from(res); }
9635 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9640 /// A tuple of 2 elements. See the individual fields for the types contained.
9641 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9642 /// The element at position 0
9643 pub a: crate::c_types::ThirtyTwoBytes,
9644 /// The element at position 1
9645 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9647 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9648 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9655 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9656 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9660 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9661 fn clone(&self) -> Self {
9663 a: Clone::clone(&self.a),
9664 b: Clone::clone(&self.b),
9669 /// Creates a new tuple which has the same data as `orig`
9670 /// but with all dynamically-allocated buffers duplicated in new buffers.
9671 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9672 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9674 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 {
9675 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9679 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9680 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9682 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9683 /// This corresponds to std::vector in C++
9684 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9685 /// The elements in the array.
9686 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9687 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9688 /// The number of elements pointed to by `data`.
9691 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9692 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9693 if self.datalen == 0 { return Vec::new(); }
9694 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9695 self.data = core::ptr::null_mut();
9699 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9700 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9703 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9704 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9705 let datalen = v.len();
9706 let data = Box::into_raw(v.into_boxed_slice());
9707 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9711 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9712 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9713 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9714 fn drop(&mut self) {
9715 if self.datalen == 0 { return; }
9716 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9719 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9720 fn clone(&self) -> Self {
9721 let mut res = Vec::new();
9722 if self.datalen == 0 { return Self::from(res); }
9723 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9728 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9729 /// This corresponds to std::vector in C++
9730 pub struct CVec_EventZ {
9731 /// The elements in the array.
9732 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9733 pub data: *mut crate::lightning::util::events::Event,
9734 /// The number of elements pointed to by `data`.
9738 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9739 if self.datalen == 0 { return Vec::new(); }
9740 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9741 self.data = core::ptr::null_mut();
9745 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9746 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9749 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9750 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9751 let datalen = v.len();
9752 let data = Box::into_raw(v.into_boxed_slice());
9753 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9757 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9758 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9759 impl Drop for CVec_EventZ {
9760 fn drop(&mut self) {
9761 if self.datalen == 0 { return; }
9762 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9765 impl Clone for CVec_EventZ {
9766 fn clone(&self) -> Self {
9767 let mut res = Vec::new();
9768 if self.datalen == 0 { return Self::from(res); }
9769 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9774 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9775 /// This corresponds to std::vector in C++
9776 pub struct CVec_TransactionZ {
9777 /// The elements in the array.
9778 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9779 pub data: *mut crate::c_types::Transaction,
9780 /// The number of elements pointed to by `data`.
9783 impl CVec_TransactionZ {
9784 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9785 if self.datalen == 0 { return Vec::new(); }
9786 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9787 self.data = core::ptr::null_mut();
9791 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9792 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9795 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9796 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9797 let datalen = v.len();
9798 let data = Box::into_raw(v.into_boxed_slice());
9799 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9803 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9804 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9805 impl Drop for CVec_TransactionZ {
9806 fn drop(&mut self) {
9807 if self.datalen == 0 { return; }
9808 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9811 impl Clone for CVec_TransactionZ {
9812 fn clone(&self) -> Self {
9813 let mut res = Vec::new();
9814 if self.datalen == 0 { return Self::from(res); }
9815 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9820 /// A tuple of 2 elements. See the individual fields for the types contained.
9821 pub struct C2Tuple_u32TxOutZ {
9822 /// The element at position 0
9824 /// The element at position 1
9825 pub b: crate::c_types::TxOut,
9827 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9828 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9835 impl C2Tuple_u32TxOutZ {
9836 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9840 impl Clone for C2Tuple_u32TxOutZ {
9841 fn clone(&self) -> Self {
9843 a: Clone::clone(&self.a),
9844 b: Clone::clone(&self.b),
9849 /// Creates a new tuple which has the same data as `orig`
9850 /// but with all dynamically-allocated buffers duplicated in new buffers.
9851 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9852 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9854 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9855 C2Tuple_u32TxOutZ { a, b, }
9859 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9860 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9862 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9863 /// This corresponds to std::vector in C++
9864 pub struct CVec_C2Tuple_u32TxOutZZ {
9865 /// The elements in the array.
9866 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9867 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9868 /// The number of elements pointed to by `data`.
9871 impl CVec_C2Tuple_u32TxOutZZ {
9872 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9873 if self.datalen == 0 { return Vec::new(); }
9874 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9875 self.data = core::ptr::null_mut();
9879 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9880 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9883 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9884 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9885 let datalen = v.len();
9886 let data = Box::into_raw(v.into_boxed_slice());
9887 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9891 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9892 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9893 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9894 fn drop(&mut self) {
9895 if self.datalen == 0 { return; }
9896 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9899 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9900 fn clone(&self) -> Self {
9901 let mut res = Vec::new();
9902 if self.datalen == 0 { return Self::from(res); }
9903 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9908 /// A tuple of 2 elements. See the individual fields for the types contained.
9909 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9910 /// The element at position 0
9911 pub a: crate::c_types::ThirtyTwoBytes,
9912 /// The element at position 1
9913 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9915 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9916 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9923 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9924 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9928 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9929 fn clone(&self) -> Self {
9931 a: Clone::clone(&self.a),
9932 b: Clone::clone(&self.b),
9937 /// Creates a new tuple which has the same data as `orig`
9938 /// but with all dynamically-allocated buffers duplicated in new buffers.
9939 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9940 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9942 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 {
9943 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9947 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9948 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9950 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9951 /// This corresponds to std::vector in C++
9952 pub struct CVec_TransactionOutputsZ {
9953 /// The elements in the array.
9954 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9955 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9956 /// The number of elements pointed to by `data`.
9959 impl CVec_TransactionOutputsZ {
9960 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9961 if self.datalen == 0 { return Vec::new(); }
9962 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9963 self.data = core::ptr::null_mut();
9967 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9968 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9971 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9972 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9973 let datalen = v.len();
9974 let data = Box::into_raw(v.into_boxed_slice());
9975 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9979 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9980 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9981 impl Drop for CVec_TransactionOutputsZ {
9982 fn drop(&mut self) {
9983 if self.datalen == 0 { return; }
9984 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9987 impl Clone for CVec_TransactionOutputsZ {
9988 fn clone(&self) -> Self {
9989 let mut res = Vec::new();
9990 if self.datalen == 0 { return Self::from(res); }
9991 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9996 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9997 /// This corresponds to std::vector in C++
9998 pub struct CVec_BalanceZ {
9999 /// The elements in the array.
10000 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10001 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
10002 /// The number of elements pointed to by `data`.
10005 impl CVec_BalanceZ {
10006 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
10007 if self.datalen == 0 { return Vec::new(); }
10008 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10009 self.data = core::ptr::null_mut();
10013 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
10014 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10017 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
10018 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
10019 let datalen = v.len();
10020 let data = Box::into_raw(v.into_boxed_slice());
10021 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10025 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10026 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
10027 impl Drop for CVec_BalanceZ {
10028 fn drop(&mut self) {
10029 if self.datalen == 0 { return; }
10030 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10033 impl Clone for CVec_BalanceZ {
10034 fn clone(&self) -> Self {
10035 let mut res = Vec::new();
10036 if self.datalen == 0 { return Self::from(res); }
10037 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10042 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
10043 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10044 /// A pointer to the contents in the success state.
10045 /// Reading from this pointer when `result_ok` is not set is undefined.
10046 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
10047 /// A pointer to the contents in the error state.
10048 /// Reading from this pointer when `result_ok` is set is undefined.
10049 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10052 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
10053 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10055 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10056 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
10057 /// `err` or `result` depending on the state of `result_ok`.
10058 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
10059 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
10060 pub result_ok: bool,
10063 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10064 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10065 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10066 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10067 result: Box::into_raw(Box::new(o)),
10073 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10074 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10075 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10076 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10077 err: Box::into_raw(Box::new(e)),
10082 /// Checks if the given object is currently in the success state
10084 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10088 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10089 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10090 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10091 fn drop(&mut self) {
10092 if self.result_ok {
10093 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10094 let _ = unsafe { Box::from_raw(self.contents.result) };
10097 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10098 let _ = unsafe { Box::from_raw(self.contents.err) };
10103 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10104 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10105 let contents = if o.result_ok {
10106 let result = unsafe { o.contents.result };
10107 unsafe { o.contents.result = core::ptr::null_mut() };
10108 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10110 let err = unsafe { o.contents.err };
10111 unsafe { o.contents.err = core::ptr::null_mut(); }
10112 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10116 result_ok: o.result_ok,
10121 /// The contents of CResult_NoneLightningErrorZ
10122 pub union CResult_NoneLightningErrorZPtr {
10123 /// Note that this value is always NULL, as there are no contents in the OK variant
10124 pub result: *mut core::ffi::c_void,
10125 /// A pointer to the contents in the error state.
10126 /// Reading from this pointer when `result_ok` is set is undefined.
10127 pub err: *mut crate::lightning::ln::msgs::LightningError,
10130 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
10131 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
10132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10133 pub struct CResult_NoneLightningErrorZ {
10134 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
10135 /// `err` or `result` depending on the state of `result_ok`.
10136 pub contents: CResult_NoneLightningErrorZPtr,
10137 /// Whether this CResult_NoneLightningErrorZ represents a success state.
10138 pub result_ok: bool,
10141 /// Creates a new CResult_NoneLightningErrorZ in the success state.
10142 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10143 CResult_NoneLightningErrorZ {
10144 contents: CResult_NoneLightningErrorZPtr {
10145 result: core::ptr::null_mut(),
10151 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10152 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10153 CResult_NoneLightningErrorZ {
10154 contents: CResult_NoneLightningErrorZPtr {
10155 err: Box::into_raw(Box::new(e)),
10160 /// Checks if the given object is currently in the success state
10162 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10166 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10167 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10168 impl Drop for CResult_NoneLightningErrorZ {
10169 fn drop(&mut self) {
10170 if self.result_ok {
10172 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10173 let _ = unsafe { Box::from_raw(self.contents.err) };
10178 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10179 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10180 let contents = if o.result_ok {
10181 let _ = unsafe { Box::from_raw(o.contents.result) };
10182 o.contents.result = core::ptr::null_mut();
10183 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10185 let err = unsafe { o.contents.err };
10186 unsafe { o.contents.err = core::ptr::null_mut(); }
10187 CResult_NoneLightningErrorZPtr { err }
10191 result_ok: o.result_ok,
10195 impl Clone for CResult_NoneLightningErrorZ {
10196 fn clone(&self) -> Self {
10197 if self.result_ok {
10198 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10199 result: core::ptr::null_mut()
10202 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10203 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10209 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10210 /// but with all dynamically-allocated buffers duplicated in new buffers.
10211 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10213 /// A tuple of 2 elements. See the individual fields for the types contained.
10214 pub struct C2Tuple_PublicKeyTypeZ {
10215 /// The element at position 0
10216 pub a: crate::c_types::PublicKey,
10217 /// The element at position 1
10218 pub b: crate::lightning::ln::wire::Type,
10220 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10221 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10228 impl C2Tuple_PublicKeyTypeZ {
10229 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10233 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10235 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10236 C2Tuple_PublicKeyTypeZ { a, b, }
10240 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10241 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10243 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10244 /// This corresponds to std::vector in C++
10245 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10246 /// The elements in the array.
10247 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10248 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10249 /// The number of elements pointed to by `data`.
10252 impl CVec_C2Tuple_PublicKeyTypeZZ {
10253 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10254 if self.datalen == 0 { return Vec::new(); }
10255 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10256 self.data = core::ptr::null_mut();
10260 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10261 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10264 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10265 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10266 let datalen = v.len();
10267 let data = Box::into_raw(v.into_boxed_slice());
10268 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10272 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10273 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10274 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10275 fn drop(&mut self) {
10276 if self.datalen == 0 { return; }
10277 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10281 /// The contents of CResult_boolLightningErrorZ
10282 pub union CResult_boolLightningErrorZPtr {
10283 /// A pointer to the contents in the success state.
10284 /// Reading from this pointer when `result_ok` is not set is undefined.
10285 pub result: *mut bool,
10286 /// A pointer to the contents in the error state.
10287 /// Reading from this pointer when `result_ok` is set is undefined.
10288 pub err: *mut crate::lightning::ln::msgs::LightningError,
10291 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10292 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10294 pub struct CResult_boolLightningErrorZ {
10295 /// The contents of this CResult_boolLightningErrorZ, accessible via either
10296 /// `err` or `result` depending on the state of `result_ok`.
10297 pub contents: CResult_boolLightningErrorZPtr,
10298 /// Whether this CResult_boolLightningErrorZ represents a success state.
10299 pub result_ok: bool,
10302 /// Creates a new CResult_boolLightningErrorZ in the success state.
10303 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10304 CResult_boolLightningErrorZ {
10305 contents: CResult_boolLightningErrorZPtr {
10306 result: Box::into_raw(Box::new(o)),
10312 /// Creates a new CResult_boolLightningErrorZ in the error state.
10313 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10314 CResult_boolLightningErrorZ {
10315 contents: CResult_boolLightningErrorZPtr {
10316 err: Box::into_raw(Box::new(e)),
10321 /// Checks if the given object is currently in the success state
10323 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10327 /// Frees any resources used by the CResult_boolLightningErrorZ.
10328 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10329 impl Drop for CResult_boolLightningErrorZ {
10330 fn drop(&mut self) {
10331 if self.result_ok {
10332 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10333 let _ = unsafe { Box::from_raw(self.contents.result) };
10336 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10337 let _ = unsafe { Box::from_raw(self.contents.err) };
10342 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10343 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10344 let contents = if o.result_ok {
10345 let result = unsafe { o.contents.result };
10346 unsafe { o.contents.result = core::ptr::null_mut() };
10347 CResult_boolLightningErrorZPtr { result }
10349 let err = unsafe { o.contents.err };
10350 unsafe { o.contents.err = core::ptr::null_mut(); }
10351 CResult_boolLightningErrorZPtr { err }
10355 result_ok: o.result_ok,
10359 impl Clone for CResult_boolLightningErrorZ {
10360 fn clone(&self) -> Self {
10361 if self.result_ok {
10362 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10363 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10366 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10367 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10373 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10374 /// but with all dynamically-allocated buffers duplicated in new buffers.
10375 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10377 /// A tuple of 3 elements. See the individual fields for the types contained.
10378 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10379 /// The element at position 0
10380 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10381 /// The element at position 1
10382 pub b: crate::lightning::ln::msgs::ChannelUpdate,
10383 /// The element at position 2
10384 pub c: crate::lightning::ln::msgs::ChannelUpdate,
10386 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10387 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10395 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10396 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10397 (self.a, self.b, self.c)
10400 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10401 fn clone(&self) -> Self {
10403 a: Clone::clone(&self.a),
10404 b: Clone::clone(&self.b),
10405 c: Clone::clone(&self.c),
10410 /// Creates a new tuple which has the same data as `orig`
10411 /// but with all dynamically-allocated buffers duplicated in new buffers.
10412 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10413 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10415 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 {
10416 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10420 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10421 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10423 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10424 /// This corresponds to std::vector in C++
10425 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10426 /// The elements in the array.
10427 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10428 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10429 /// The number of elements pointed to by `data`.
10432 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10433 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10434 if self.datalen == 0 { return Vec::new(); }
10435 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10436 self.data = core::ptr::null_mut();
10440 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10441 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10444 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10445 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10446 let datalen = v.len();
10447 let data = Box::into_raw(v.into_boxed_slice());
10448 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10452 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10453 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10454 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10455 fn drop(&mut self) {
10456 if self.datalen == 0 { return; }
10457 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10460 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10461 fn clone(&self) -> Self {
10462 let mut res = Vec::new();
10463 if self.datalen == 0 { return Self::from(res); }
10464 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10469 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10470 /// This corresponds to std::vector in C++
10471 pub struct CVec_NodeAnnouncementZ {
10472 /// The elements in the array.
10473 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10474 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10475 /// The number of elements pointed to by `data`.
10478 impl CVec_NodeAnnouncementZ {
10479 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10480 if self.datalen == 0 { return Vec::new(); }
10481 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10482 self.data = core::ptr::null_mut();
10486 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10487 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10490 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10491 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10492 let datalen = v.len();
10493 let data = Box::into_raw(v.into_boxed_slice());
10494 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10498 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10499 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10500 impl Drop for CVec_NodeAnnouncementZ {
10501 fn drop(&mut self) {
10502 if self.datalen == 0 { return; }
10503 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10506 impl Clone for CVec_NodeAnnouncementZ {
10507 fn clone(&self) -> Self {
10508 let mut res = Vec::new();
10509 if self.datalen == 0 { return Self::from(res); }
10510 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10515 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10516 /// This corresponds to std::vector in C++
10517 pub struct CVec_PublicKeyZ {
10518 /// The elements in the array.
10519 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10520 pub data: *mut crate::c_types::PublicKey,
10521 /// The number of elements pointed to by `data`.
10524 impl CVec_PublicKeyZ {
10525 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10526 if self.datalen == 0 { return Vec::new(); }
10527 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10528 self.data = core::ptr::null_mut();
10532 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10533 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10536 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10537 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10538 let datalen = v.len();
10539 let data = Box::into_raw(v.into_boxed_slice());
10540 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10544 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10545 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10546 impl Drop for CVec_PublicKeyZ {
10547 fn drop(&mut self) {
10548 if self.datalen == 0 { return; }
10549 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10552 impl Clone for CVec_PublicKeyZ {
10553 fn clone(&self) -> Self {
10554 let mut res = Vec::new();
10555 if self.datalen == 0 { return Self::from(res); }
10556 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10561 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10562 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10563 /// A pointer to the contents in the success state.
10564 /// Reading from this pointer when `result_ok` is not set is undefined.
10565 pub result: *mut crate::c_types::derived::CVec_u8Z,
10566 /// A pointer to the contents in the error state.
10567 /// Reading from this pointer when `result_ok` is set is undefined.
10568 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10571 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10572 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10574 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10575 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10576 /// `err` or `result` depending on the state of `result_ok`.
10577 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10578 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10579 pub result_ok: bool,
10582 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10583 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10584 CResult_CVec_u8ZPeerHandleErrorZ {
10585 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10586 result: Box::into_raw(Box::new(o)),
10592 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10593 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10594 CResult_CVec_u8ZPeerHandleErrorZ {
10595 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10596 err: Box::into_raw(Box::new(e)),
10601 /// Checks if the given object is currently in the success state
10603 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10607 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10608 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10609 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10610 fn drop(&mut self) {
10611 if self.result_ok {
10612 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10613 let _ = unsafe { Box::from_raw(self.contents.result) };
10616 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10617 let _ = unsafe { Box::from_raw(self.contents.err) };
10622 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10623 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10624 let contents = if o.result_ok {
10625 let result = unsafe { o.contents.result };
10626 unsafe { o.contents.result = core::ptr::null_mut() };
10627 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10629 let err = unsafe { o.contents.err };
10630 unsafe { o.contents.err = core::ptr::null_mut(); }
10631 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10635 result_ok: o.result_ok,
10639 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10640 fn clone(&self) -> Self {
10641 if self.result_ok {
10642 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10643 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10646 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10647 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10653 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10654 /// but with all dynamically-allocated buffers duplicated in new buffers.
10655 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10657 /// The contents of CResult_NonePeerHandleErrorZ
10658 pub union CResult_NonePeerHandleErrorZPtr {
10659 /// Note that this value is always NULL, as there are no contents in the OK variant
10660 pub result: *mut core::ffi::c_void,
10661 /// A pointer to the contents in the error state.
10662 /// Reading from this pointer when `result_ok` is set is undefined.
10663 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10666 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10667 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10669 pub struct CResult_NonePeerHandleErrorZ {
10670 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10671 /// `err` or `result` depending on the state of `result_ok`.
10672 pub contents: CResult_NonePeerHandleErrorZPtr,
10673 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10674 pub result_ok: bool,
10677 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10678 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10679 CResult_NonePeerHandleErrorZ {
10680 contents: CResult_NonePeerHandleErrorZPtr {
10681 result: core::ptr::null_mut(),
10687 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10688 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10689 CResult_NonePeerHandleErrorZ {
10690 contents: CResult_NonePeerHandleErrorZPtr {
10691 err: Box::into_raw(Box::new(e)),
10696 /// Checks if the given object is currently in the success state
10698 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10702 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10703 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10704 impl Drop for CResult_NonePeerHandleErrorZ {
10705 fn drop(&mut self) {
10706 if self.result_ok {
10708 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10709 let _ = unsafe { Box::from_raw(self.contents.err) };
10714 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10715 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10716 let contents = if o.result_ok {
10717 let _ = unsafe { Box::from_raw(o.contents.result) };
10718 o.contents.result = core::ptr::null_mut();
10719 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10721 let err = unsafe { o.contents.err };
10722 unsafe { o.contents.err = core::ptr::null_mut(); }
10723 CResult_NonePeerHandleErrorZPtr { err }
10727 result_ok: o.result_ok,
10731 impl Clone for CResult_NonePeerHandleErrorZ {
10732 fn clone(&self) -> Self {
10733 if self.result_ok {
10734 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10735 result: core::ptr::null_mut()
10738 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10739 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10745 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10746 /// but with all dynamically-allocated buffers duplicated in new buffers.
10747 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10749 /// The contents of CResult_boolPeerHandleErrorZ
10750 pub union CResult_boolPeerHandleErrorZPtr {
10751 /// A pointer to the contents in the success state.
10752 /// Reading from this pointer when `result_ok` is not set is undefined.
10753 pub result: *mut bool,
10754 /// A pointer to the contents in the error state.
10755 /// Reading from this pointer when `result_ok` is set is undefined.
10756 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10759 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10760 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10761 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10762 pub struct CResult_boolPeerHandleErrorZ {
10763 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10764 /// `err` or `result` depending on the state of `result_ok`.
10765 pub contents: CResult_boolPeerHandleErrorZPtr,
10766 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10767 pub result_ok: bool,
10770 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10771 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10772 CResult_boolPeerHandleErrorZ {
10773 contents: CResult_boolPeerHandleErrorZPtr {
10774 result: Box::into_raw(Box::new(o)),
10780 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10781 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10782 CResult_boolPeerHandleErrorZ {
10783 contents: CResult_boolPeerHandleErrorZPtr {
10784 err: Box::into_raw(Box::new(e)),
10789 /// Checks if the given object is currently in the success state
10791 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10795 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10796 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10797 impl Drop for CResult_boolPeerHandleErrorZ {
10798 fn drop(&mut self) {
10799 if self.result_ok {
10800 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10801 let _ = unsafe { Box::from_raw(self.contents.result) };
10804 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10805 let _ = unsafe { Box::from_raw(self.contents.err) };
10810 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10811 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10812 let contents = if o.result_ok {
10813 let result = unsafe { o.contents.result };
10814 unsafe { o.contents.result = core::ptr::null_mut() };
10815 CResult_boolPeerHandleErrorZPtr { result }
10817 let err = unsafe { o.contents.err };
10818 unsafe { o.contents.err = core::ptr::null_mut(); }
10819 CResult_boolPeerHandleErrorZPtr { err }
10823 result_ok: o.result_ok,
10827 impl Clone for CResult_boolPeerHandleErrorZ {
10828 fn clone(&self) -> Self {
10829 if self.result_ok {
10830 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10831 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10834 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10835 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10841 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10842 /// but with all dynamically-allocated buffers duplicated in new buffers.
10843 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10845 /// The contents of CResult_NodeIdDecodeErrorZ
10846 pub union CResult_NodeIdDecodeErrorZPtr {
10847 /// A pointer to the contents in the success state.
10848 /// Reading from this pointer when `result_ok` is not set is undefined.
10849 pub result: *mut crate::lightning::routing::network_graph::NodeId,
10850 /// A pointer to the contents in the error state.
10851 /// Reading from this pointer when `result_ok` is set is undefined.
10852 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10855 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10856 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10857 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10858 pub struct CResult_NodeIdDecodeErrorZ {
10859 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10860 /// `err` or `result` depending on the state of `result_ok`.
10861 pub contents: CResult_NodeIdDecodeErrorZPtr,
10862 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10863 pub result_ok: bool,
10866 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10867 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10868 CResult_NodeIdDecodeErrorZ {
10869 contents: CResult_NodeIdDecodeErrorZPtr {
10870 result: Box::into_raw(Box::new(o)),
10876 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10877 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10878 CResult_NodeIdDecodeErrorZ {
10879 contents: CResult_NodeIdDecodeErrorZPtr {
10880 err: Box::into_raw(Box::new(e)),
10885 /// Checks if the given object is currently in the success state
10887 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10891 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10892 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10893 impl Drop for CResult_NodeIdDecodeErrorZ {
10894 fn drop(&mut self) {
10895 if self.result_ok {
10896 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10897 let _ = unsafe { Box::from_raw(self.contents.result) };
10900 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10901 let _ = unsafe { Box::from_raw(self.contents.err) };
10906 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10907 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10908 let contents = if o.result_ok {
10909 let result = unsafe { o.contents.result };
10910 unsafe { o.contents.result = core::ptr::null_mut() };
10911 CResult_NodeIdDecodeErrorZPtr { result }
10913 let err = unsafe { o.contents.err };
10914 unsafe { o.contents.err = core::ptr::null_mut(); }
10915 CResult_NodeIdDecodeErrorZPtr { err }
10919 result_ok: o.result_ok,
10923 impl Clone for CResult_NodeIdDecodeErrorZ {
10924 fn clone(&self) -> Self {
10925 if self.result_ok {
10926 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10927 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10930 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10931 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10937 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10938 /// but with all dynamically-allocated buffers duplicated in new buffers.
10939 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10941 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10942 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10943 /// A pointer to the contents in the success state.
10944 /// Reading from this pointer when `result_ok` is not set is undefined.
10945 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10946 /// A pointer to the contents in the error state.
10947 /// Reading from this pointer when `result_ok` is set is undefined.
10948 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10951 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10952 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10953 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10954 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10955 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10956 /// `err` or `result` depending on the state of `result_ok`.
10957 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10958 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10959 pub result_ok: bool,
10962 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10963 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10964 CResult_COption_NetworkUpdateZDecodeErrorZ {
10965 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10966 result: Box::into_raw(Box::new(o)),
10972 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10973 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10974 CResult_COption_NetworkUpdateZDecodeErrorZ {
10975 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10976 err: Box::into_raw(Box::new(e)),
10981 /// Checks if the given object is currently in the success state
10983 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10987 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10988 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10989 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10990 fn drop(&mut self) {
10991 if self.result_ok {
10992 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10993 let _ = unsafe { Box::from_raw(self.contents.result) };
10996 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10997 let _ = unsafe { Box::from_raw(self.contents.err) };
11002 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
11003 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11004 let contents = if o.result_ok {
11005 let result = unsafe { o.contents.result };
11006 unsafe { o.contents.result = core::ptr::null_mut() };
11007 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
11009 let err = unsafe { o.contents.err };
11010 unsafe { o.contents.err = core::ptr::null_mut(); }
11011 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
11015 result_ok: o.result_ok,
11019 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
11020 fn clone(&self) -> Self {
11021 if self.result_ok {
11022 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
11023 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
11026 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
11027 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11033 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
11034 /// but with all dynamically-allocated buffers duplicated in new buffers.
11035 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
11037 /// An enum which can either contain a crate::lightning::chain::Access or not
11038 pub enum COption_AccessZ {
11039 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
11040 Some(crate::lightning::chain::Access),
11041 /// When we're in this state, this COption_AccessZ contains nothing
11044 impl COption_AccessZ {
11045 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11046 if let Self::None = self { false } else { true }
11048 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11051 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
11052 if let Self::Some(v) = self { v } else { unreachable!() }
11056 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11057 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
11058 COption_AccessZ::Some(o)
11061 /// Constructs a new COption_AccessZ containing nothing
11062 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
11063 COption_AccessZ::None
11066 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11067 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
11069 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
11070 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
11071 /// A pointer to the contents in the success state.
11072 /// Reading from this pointer when `result_ok` is not set is undefined.
11073 pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
11074 /// A pointer to the contents in the error state.
11075 /// Reading from this pointer when `result_ok` is set is undefined.
11076 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11079 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
11080 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11082 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
11083 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
11084 /// `err` or `result` depending on the state of `result_ok`.
11085 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
11086 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
11087 pub result_ok: bool,
11090 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
11091 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11092 CResult_ChannelUpdateInfoDecodeErrorZ {
11093 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11094 result: Box::into_raw(Box::new(o)),
11100 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
11101 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11102 CResult_ChannelUpdateInfoDecodeErrorZ {
11103 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11104 err: Box::into_raw(Box::new(e)),
11109 /// Checks if the given object is currently in the success state
11111 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
11115 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
11116 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
11117 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
11118 fn drop(&mut self) {
11119 if self.result_ok {
11120 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11121 let _ = unsafe { Box::from_raw(self.contents.result) };
11124 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11125 let _ = unsafe { Box::from_raw(self.contents.err) };
11130 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
11131 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11132 let contents = if o.result_ok {
11133 let result = unsafe { o.contents.result };
11134 unsafe { o.contents.result = core::ptr::null_mut() };
11135 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
11137 let err = unsafe { o.contents.err };
11138 unsafe { o.contents.err = core::ptr::null_mut(); }
11139 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11143 result_ok: o.result_ok,
11147 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11148 fn clone(&self) -> Self {
11149 if self.result_ok {
11150 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11151 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11154 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11155 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11161 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11162 /// but with all dynamically-allocated buffers duplicated in new buffers.
11163 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11165 /// The contents of CResult_ChannelInfoDecodeErrorZ
11166 pub union CResult_ChannelInfoDecodeErrorZPtr {
11167 /// A pointer to the contents in the success state.
11168 /// Reading from this pointer when `result_ok` is not set is undefined.
11169 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11170 /// A pointer to the contents in the error state.
11171 /// Reading from this pointer when `result_ok` is set is undefined.
11172 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11175 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11176 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11178 pub struct CResult_ChannelInfoDecodeErrorZ {
11179 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11180 /// `err` or `result` depending on the state of `result_ok`.
11181 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11182 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11183 pub result_ok: bool,
11186 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11187 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11188 CResult_ChannelInfoDecodeErrorZ {
11189 contents: CResult_ChannelInfoDecodeErrorZPtr {
11190 result: Box::into_raw(Box::new(o)),
11196 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11197 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11198 CResult_ChannelInfoDecodeErrorZ {
11199 contents: CResult_ChannelInfoDecodeErrorZPtr {
11200 err: Box::into_raw(Box::new(e)),
11205 /// Checks if the given object is currently in the success state
11207 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11211 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11212 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11213 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11214 fn drop(&mut self) {
11215 if self.result_ok {
11216 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11217 let _ = unsafe { Box::from_raw(self.contents.result) };
11220 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11221 let _ = unsafe { Box::from_raw(self.contents.err) };
11226 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11227 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11228 let contents = if o.result_ok {
11229 let result = unsafe { o.contents.result };
11230 unsafe { o.contents.result = core::ptr::null_mut() };
11231 CResult_ChannelInfoDecodeErrorZPtr { result }
11233 let err = unsafe { o.contents.err };
11234 unsafe { o.contents.err = core::ptr::null_mut(); }
11235 CResult_ChannelInfoDecodeErrorZPtr { err }
11239 result_ok: o.result_ok,
11243 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11244 fn clone(&self) -> Self {
11245 if self.result_ok {
11246 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11247 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11250 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11251 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11257 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11258 /// but with all dynamically-allocated buffers duplicated in new buffers.
11259 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11261 /// The contents of CResult_RoutingFeesDecodeErrorZ
11262 pub union CResult_RoutingFeesDecodeErrorZPtr {
11263 /// A pointer to the contents in the success state.
11264 /// Reading from this pointer when `result_ok` is not set is undefined.
11265 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11266 /// A pointer to the contents in the error state.
11267 /// Reading from this pointer when `result_ok` is set is undefined.
11268 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11271 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11272 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11274 pub struct CResult_RoutingFeesDecodeErrorZ {
11275 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11276 /// `err` or `result` depending on the state of `result_ok`.
11277 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11278 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11279 pub result_ok: bool,
11282 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11283 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11284 CResult_RoutingFeesDecodeErrorZ {
11285 contents: CResult_RoutingFeesDecodeErrorZPtr {
11286 result: Box::into_raw(Box::new(o)),
11292 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11293 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11294 CResult_RoutingFeesDecodeErrorZ {
11295 contents: CResult_RoutingFeesDecodeErrorZPtr {
11296 err: Box::into_raw(Box::new(e)),
11301 /// Checks if the given object is currently in the success state
11303 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11307 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11308 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11309 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11310 fn drop(&mut self) {
11311 if self.result_ok {
11312 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11313 let _ = unsafe { Box::from_raw(self.contents.result) };
11316 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11317 let _ = unsafe { Box::from_raw(self.contents.err) };
11322 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11323 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11324 let contents = if o.result_ok {
11325 let result = unsafe { o.contents.result };
11326 unsafe { o.contents.result = core::ptr::null_mut() };
11327 CResult_RoutingFeesDecodeErrorZPtr { result }
11329 let err = unsafe { o.contents.err };
11330 unsafe { o.contents.err = core::ptr::null_mut(); }
11331 CResult_RoutingFeesDecodeErrorZPtr { err }
11335 result_ok: o.result_ok,
11339 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11340 fn clone(&self) -> Self {
11341 if self.result_ok {
11342 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11343 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11346 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11347 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11353 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11354 /// but with all dynamically-allocated buffers duplicated in new buffers.
11355 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11357 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11358 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11359 /// A pointer to the contents in the success state.
11360 /// Reading from this pointer when `result_ok` is not set is undefined.
11361 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11362 /// A pointer to the contents in the error state.
11363 /// Reading from this pointer when `result_ok` is set is undefined.
11364 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11367 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11368 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11369 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11370 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11371 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11372 /// `err` or `result` depending on the state of `result_ok`.
11373 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11374 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11375 pub result_ok: bool,
11378 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11379 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11380 CResult_NodeAnnouncementInfoDecodeErrorZ {
11381 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11382 result: Box::into_raw(Box::new(o)),
11388 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11389 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11390 CResult_NodeAnnouncementInfoDecodeErrorZ {
11391 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11392 err: Box::into_raw(Box::new(e)),
11397 /// Checks if the given object is currently in the success state
11399 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11403 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11404 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11405 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11406 fn drop(&mut self) {
11407 if self.result_ok {
11408 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11409 let _ = unsafe { Box::from_raw(self.contents.result) };
11412 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11413 let _ = unsafe { Box::from_raw(self.contents.err) };
11418 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11419 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11420 let contents = if o.result_ok {
11421 let result = unsafe { o.contents.result };
11422 unsafe { o.contents.result = core::ptr::null_mut() };
11423 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11425 let err = unsafe { o.contents.err };
11426 unsafe { o.contents.err = core::ptr::null_mut(); }
11427 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11431 result_ok: o.result_ok,
11435 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11436 fn clone(&self) -> Self {
11437 if self.result_ok {
11438 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11439 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11442 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11443 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11449 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11450 /// but with all dynamically-allocated buffers duplicated in new buffers.
11451 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11453 /// A dynamically-allocated array of u64s of arbitrary size.
11454 /// This corresponds to std::vector in C++
11455 pub struct CVec_u64Z {
11456 /// The elements in the array.
11457 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11458 pub data: *mut u64,
11459 /// The number of elements pointed to by `data`.
11463 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11464 if self.datalen == 0 { return Vec::new(); }
11465 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11466 self.data = core::ptr::null_mut();
11470 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11471 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11474 impl From<Vec<u64>> for CVec_u64Z {
11475 fn from(v: Vec<u64>) -> Self {
11476 let datalen = v.len();
11477 let data = Box::into_raw(v.into_boxed_slice());
11478 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11482 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11483 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11484 impl Drop for CVec_u64Z {
11485 fn drop(&mut self) {
11486 if self.datalen == 0 { return; }
11487 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11490 impl Clone for CVec_u64Z {
11491 fn clone(&self) -> Self {
11492 let mut res = Vec::new();
11493 if self.datalen == 0 { return Self::from(res); }
11494 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11499 /// The contents of CResult_NodeInfoDecodeErrorZ
11500 pub union CResult_NodeInfoDecodeErrorZPtr {
11501 /// A pointer to the contents in the success state.
11502 /// Reading from this pointer when `result_ok` is not set is undefined.
11503 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11504 /// A pointer to the contents in the error state.
11505 /// Reading from this pointer when `result_ok` is set is undefined.
11506 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11509 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11510 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11512 pub struct CResult_NodeInfoDecodeErrorZ {
11513 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11514 /// `err` or `result` depending on the state of `result_ok`.
11515 pub contents: CResult_NodeInfoDecodeErrorZPtr,
11516 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11517 pub result_ok: bool,
11520 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11521 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11522 CResult_NodeInfoDecodeErrorZ {
11523 contents: CResult_NodeInfoDecodeErrorZPtr {
11524 result: Box::into_raw(Box::new(o)),
11530 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11531 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11532 CResult_NodeInfoDecodeErrorZ {
11533 contents: CResult_NodeInfoDecodeErrorZPtr {
11534 err: Box::into_raw(Box::new(e)),
11539 /// Checks if the given object is currently in the success state
11541 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11545 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11546 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11547 impl Drop for CResult_NodeInfoDecodeErrorZ {
11548 fn drop(&mut self) {
11549 if self.result_ok {
11550 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11551 let _ = unsafe { Box::from_raw(self.contents.result) };
11554 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11555 let _ = unsafe { Box::from_raw(self.contents.err) };
11560 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11561 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11562 let contents = if o.result_ok {
11563 let result = unsafe { o.contents.result };
11564 unsafe { o.contents.result = core::ptr::null_mut() };
11565 CResult_NodeInfoDecodeErrorZPtr { result }
11567 let err = unsafe { o.contents.err };
11568 unsafe { o.contents.err = core::ptr::null_mut(); }
11569 CResult_NodeInfoDecodeErrorZPtr { err }
11573 result_ok: o.result_ok,
11577 impl Clone for CResult_NodeInfoDecodeErrorZ {
11578 fn clone(&self) -> Self {
11579 if self.result_ok {
11580 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11581 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11584 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11585 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11591 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11592 /// but with all dynamically-allocated buffers duplicated in new buffers.
11593 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11595 /// The contents of CResult_NetworkGraphDecodeErrorZ
11596 pub union CResult_NetworkGraphDecodeErrorZPtr {
11597 /// A pointer to the contents in the success state.
11598 /// Reading from this pointer when `result_ok` is not set is undefined.
11599 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11600 /// A pointer to the contents in the error state.
11601 /// Reading from this pointer when `result_ok` is set is undefined.
11602 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11605 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11606 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11608 pub struct CResult_NetworkGraphDecodeErrorZ {
11609 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11610 /// `err` or `result` depending on the state of `result_ok`.
11611 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11612 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11613 pub result_ok: bool,
11616 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11617 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11618 CResult_NetworkGraphDecodeErrorZ {
11619 contents: CResult_NetworkGraphDecodeErrorZPtr {
11620 result: Box::into_raw(Box::new(o)),
11626 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11627 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11628 CResult_NetworkGraphDecodeErrorZ {
11629 contents: CResult_NetworkGraphDecodeErrorZPtr {
11630 err: Box::into_raw(Box::new(e)),
11635 /// Checks if the given object is currently in the success state
11637 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11641 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11642 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11643 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11644 fn drop(&mut self) {
11645 if self.result_ok {
11646 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11647 let _ = unsafe { Box::from_raw(self.contents.result) };
11650 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11651 let _ = unsafe { Box::from_raw(self.contents.err) };
11656 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11657 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11658 let contents = if o.result_ok {
11659 let result = unsafe { o.contents.result };
11660 unsafe { o.contents.result = core::ptr::null_mut() };
11661 CResult_NetworkGraphDecodeErrorZPtr { result }
11663 let err = unsafe { o.contents.err };
11664 unsafe { o.contents.err = core::ptr::null_mut(); }
11665 CResult_NetworkGraphDecodeErrorZPtr { err }
11669 result_ok: o.result_ok,
11673 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11674 fn clone(&self) -> Self {
11675 if self.result_ok {
11676 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11677 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11680 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11681 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11687 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11688 /// but with all dynamically-allocated buffers duplicated in new buffers.
11689 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11692 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11693 pub enum COption_CVec_NetAddressZZ {
11694 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11695 Some(crate::c_types::derived::CVec_NetAddressZ),
11696 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11699 impl COption_CVec_NetAddressZZ {
11700 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11701 if let Self::None = self { false } else { true }
11703 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11706 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11707 if let Self::Some(v) = self { v } else { unreachable!() }
11711 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11712 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11713 COption_CVec_NetAddressZZ::Some(o)
11716 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11717 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11718 COption_CVec_NetAddressZZ::None
11721 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11722 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11724 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11725 /// but with all dynamically-allocated buffers duplicated in new buffers.
11726 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11728 /// The contents of CResult_NetAddressDecodeErrorZ
11729 pub union CResult_NetAddressDecodeErrorZPtr {
11730 /// A pointer to the contents in the success state.
11731 /// Reading from this pointer when `result_ok` is not set is undefined.
11732 pub result: *mut crate::lightning::ln::msgs::NetAddress,
11733 /// A pointer to the contents in the error state.
11734 /// Reading from this pointer when `result_ok` is set is undefined.
11735 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11738 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11739 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11741 pub struct CResult_NetAddressDecodeErrorZ {
11742 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11743 /// `err` or `result` depending on the state of `result_ok`.
11744 pub contents: CResult_NetAddressDecodeErrorZPtr,
11745 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11746 pub result_ok: bool,
11749 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11750 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11751 CResult_NetAddressDecodeErrorZ {
11752 contents: CResult_NetAddressDecodeErrorZPtr {
11753 result: Box::into_raw(Box::new(o)),
11759 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11760 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11761 CResult_NetAddressDecodeErrorZ {
11762 contents: CResult_NetAddressDecodeErrorZPtr {
11763 err: Box::into_raw(Box::new(e)),
11768 /// Checks if the given object is currently in the success state
11770 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11774 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11775 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11776 impl Drop for CResult_NetAddressDecodeErrorZ {
11777 fn drop(&mut self) {
11778 if self.result_ok {
11779 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11780 let _ = unsafe { Box::from_raw(self.contents.result) };
11783 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11784 let _ = unsafe { Box::from_raw(self.contents.err) };
11789 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11790 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11791 let contents = if o.result_ok {
11792 let result = unsafe { o.contents.result };
11793 unsafe { o.contents.result = core::ptr::null_mut() };
11794 CResult_NetAddressDecodeErrorZPtr { result }
11796 let err = unsafe { o.contents.err };
11797 unsafe { o.contents.err = core::ptr::null_mut(); }
11798 CResult_NetAddressDecodeErrorZPtr { err }
11802 result_ok: o.result_ok,
11806 impl Clone for CResult_NetAddressDecodeErrorZ {
11807 fn clone(&self) -> Self {
11808 if self.result_ok {
11809 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11810 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11813 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11814 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11820 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11821 /// but with all dynamically-allocated buffers duplicated in new buffers.
11822 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11824 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11825 /// This corresponds to std::vector in C++
11826 pub struct CVec_UpdateAddHTLCZ {
11827 /// The elements in the array.
11828 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11829 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11830 /// The number of elements pointed to by `data`.
11833 impl CVec_UpdateAddHTLCZ {
11834 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11835 if self.datalen == 0 { return Vec::new(); }
11836 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11837 self.data = core::ptr::null_mut();
11841 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11842 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11845 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11846 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11847 let datalen = v.len();
11848 let data = Box::into_raw(v.into_boxed_slice());
11849 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11853 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11854 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11855 impl Drop for CVec_UpdateAddHTLCZ {
11856 fn drop(&mut self) {
11857 if self.datalen == 0 { return; }
11858 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11861 impl Clone for CVec_UpdateAddHTLCZ {
11862 fn clone(&self) -> Self {
11863 let mut res = Vec::new();
11864 if self.datalen == 0 { return Self::from(res); }
11865 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11870 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11871 /// This corresponds to std::vector in C++
11872 pub struct CVec_UpdateFulfillHTLCZ {
11873 /// The elements in the array.
11874 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11875 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11876 /// The number of elements pointed to by `data`.
11879 impl CVec_UpdateFulfillHTLCZ {
11880 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11881 if self.datalen == 0 { return Vec::new(); }
11882 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11883 self.data = core::ptr::null_mut();
11887 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11888 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11891 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11892 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11893 let datalen = v.len();
11894 let data = Box::into_raw(v.into_boxed_slice());
11895 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11899 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11900 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11901 impl Drop for CVec_UpdateFulfillHTLCZ {
11902 fn drop(&mut self) {
11903 if self.datalen == 0 { return; }
11904 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11907 impl Clone for CVec_UpdateFulfillHTLCZ {
11908 fn clone(&self) -> Self {
11909 let mut res = Vec::new();
11910 if self.datalen == 0 { return Self::from(res); }
11911 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11916 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11917 /// This corresponds to std::vector in C++
11918 pub struct CVec_UpdateFailHTLCZ {
11919 /// The elements in the array.
11920 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11921 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11922 /// The number of elements pointed to by `data`.
11925 impl CVec_UpdateFailHTLCZ {
11926 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11927 if self.datalen == 0 { return Vec::new(); }
11928 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11929 self.data = core::ptr::null_mut();
11933 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11934 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11937 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11938 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11939 let datalen = v.len();
11940 let data = Box::into_raw(v.into_boxed_slice());
11941 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11945 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11946 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11947 impl Drop for CVec_UpdateFailHTLCZ {
11948 fn drop(&mut self) {
11949 if self.datalen == 0 { return; }
11950 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11953 impl Clone for CVec_UpdateFailHTLCZ {
11954 fn clone(&self) -> Self {
11955 let mut res = Vec::new();
11956 if self.datalen == 0 { return Self::from(res); }
11957 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11962 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11963 /// This corresponds to std::vector in C++
11964 pub struct CVec_UpdateFailMalformedHTLCZ {
11965 /// The elements in the array.
11966 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11967 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11968 /// The number of elements pointed to by `data`.
11971 impl CVec_UpdateFailMalformedHTLCZ {
11972 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11973 if self.datalen == 0 { return Vec::new(); }
11974 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11975 self.data = core::ptr::null_mut();
11979 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11980 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11983 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11984 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11985 let datalen = v.len();
11986 let data = Box::into_raw(v.into_boxed_slice());
11987 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11991 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11992 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11993 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11994 fn drop(&mut self) {
11995 if self.datalen == 0 { return; }
11996 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11999 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12000 fn clone(&self) -> Self {
12001 let mut res = Vec::new();
12002 if self.datalen == 0 { return Self::from(res); }
12003 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12008 /// The contents of CResult_AcceptChannelDecodeErrorZ
12009 pub union CResult_AcceptChannelDecodeErrorZPtr {
12010 /// A pointer to the contents in the success state.
12011 /// Reading from this pointer when `result_ok` is not set is undefined.
12012 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12013 /// A pointer to the contents in the error state.
12014 /// Reading from this pointer when `result_ok` is set is undefined.
12015 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12018 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12019 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12020 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12021 pub struct CResult_AcceptChannelDecodeErrorZ {
12022 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12023 /// `err` or `result` depending on the state of `result_ok`.
12024 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12025 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12026 pub result_ok: bool,
12029 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12030 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12031 CResult_AcceptChannelDecodeErrorZ {
12032 contents: CResult_AcceptChannelDecodeErrorZPtr {
12033 result: Box::into_raw(Box::new(o)),
12039 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12040 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12041 CResult_AcceptChannelDecodeErrorZ {
12042 contents: CResult_AcceptChannelDecodeErrorZPtr {
12043 err: Box::into_raw(Box::new(e)),
12048 /// Checks if the given object is currently in the success state
12050 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12054 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12055 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12056 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12057 fn drop(&mut self) {
12058 if self.result_ok {
12059 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12060 let _ = unsafe { Box::from_raw(self.contents.result) };
12063 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12064 let _ = unsafe { Box::from_raw(self.contents.err) };
12069 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12070 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12071 let contents = if o.result_ok {
12072 let result = unsafe { o.contents.result };
12073 unsafe { o.contents.result = core::ptr::null_mut() };
12074 CResult_AcceptChannelDecodeErrorZPtr { result }
12076 let err = unsafe { o.contents.err };
12077 unsafe { o.contents.err = core::ptr::null_mut(); }
12078 CResult_AcceptChannelDecodeErrorZPtr { err }
12082 result_ok: o.result_ok,
12086 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12087 fn clone(&self) -> Self {
12088 if self.result_ok {
12089 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12090 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12093 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12094 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12100 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12101 /// but with all dynamically-allocated buffers duplicated in new buffers.
12102 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12104 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12105 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12106 /// A pointer to the contents in the success state.
12107 /// Reading from this pointer when `result_ok` is not set is undefined.
12108 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12109 /// A pointer to the contents in the error state.
12110 /// Reading from this pointer when `result_ok` is set is undefined.
12111 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12114 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12115 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12116 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12117 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12118 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12119 /// `err` or `result` depending on the state of `result_ok`.
12120 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12121 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12122 pub result_ok: bool,
12125 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12126 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12127 CResult_AnnouncementSignaturesDecodeErrorZ {
12128 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12129 result: Box::into_raw(Box::new(o)),
12135 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12136 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12137 CResult_AnnouncementSignaturesDecodeErrorZ {
12138 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12139 err: Box::into_raw(Box::new(e)),
12144 /// Checks if the given object is currently in the success state
12146 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12150 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12151 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12152 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12153 fn drop(&mut self) {
12154 if self.result_ok {
12155 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12156 let _ = unsafe { Box::from_raw(self.contents.result) };
12159 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12160 let _ = unsafe { Box::from_raw(self.contents.err) };
12165 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12166 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12167 let contents = if o.result_ok {
12168 let result = unsafe { o.contents.result };
12169 unsafe { o.contents.result = core::ptr::null_mut() };
12170 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12172 let err = unsafe { o.contents.err };
12173 unsafe { o.contents.err = core::ptr::null_mut(); }
12174 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12178 result_ok: o.result_ok,
12182 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12183 fn clone(&self) -> Self {
12184 if self.result_ok {
12185 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12186 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12189 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12190 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12196 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12197 /// but with all dynamically-allocated buffers duplicated in new buffers.
12198 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12200 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12201 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12202 /// A pointer to the contents in the success state.
12203 /// Reading from this pointer when `result_ok` is not set is undefined.
12204 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12205 /// A pointer to the contents in the error state.
12206 /// Reading from this pointer when `result_ok` is set is undefined.
12207 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12210 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12211 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12213 pub struct CResult_ChannelReestablishDecodeErrorZ {
12214 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12215 /// `err` or `result` depending on the state of `result_ok`.
12216 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12217 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12218 pub result_ok: bool,
12221 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12222 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12223 CResult_ChannelReestablishDecodeErrorZ {
12224 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12225 result: Box::into_raw(Box::new(o)),
12231 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12232 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12233 CResult_ChannelReestablishDecodeErrorZ {
12234 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12235 err: Box::into_raw(Box::new(e)),
12240 /// Checks if the given object is currently in the success state
12242 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12246 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12247 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12248 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12249 fn drop(&mut self) {
12250 if self.result_ok {
12251 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12252 let _ = unsafe { Box::from_raw(self.contents.result) };
12255 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12256 let _ = unsafe { Box::from_raw(self.contents.err) };
12261 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12262 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12263 let contents = if o.result_ok {
12264 let result = unsafe { o.contents.result };
12265 unsafe { o.contents.result = core::ptr::null_mut() };
12266 CResult_ChannelReestablishDecodeErrorZPtr { result }
12268 let err = unsafe { o.contents.err };
12269 unsafe { o.contents.err = core::ptr::null_mut(); }
12270 CResult_ChannelReestablishDecodeErrorZPtr { err }
12274 result_ok: o.result_ok,
12278 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12279 fn clone(&self) -> Self {
12280 if self.result_ok {
12281 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12282 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12285 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12286 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12292 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12293 /// but with all dynamically-allocated buffers duplicated in new buffers.
12294 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12296 /// The contents of CResult_ClosingSignedDecodeErrorZ
12297 pub union CResult_ClosingSignedDecodeErrorZPtr {
12298 /// A pointer to the contents in the success state.
12299 /// Reading from this pointer when `result_ok` is not set is undefined.
12300 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12301 /// A pointer to the contents in the error state.
12302 /// Reading from this pointer when `result_ok` is set is undefined.
12303 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12306 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12307 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12308 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12309 pub struct CResult_ClosingSignedDecodeErrorZ {
12310 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12311 /// `err` or `result` depending on the state of `result_ok`.
12312 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12313 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12314 pub result_ok: bool,
12317 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12318 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12319 CResult_ClosingSignedDecodeErrorZ {
12320 contents: CResult_ClosingSignedDecodeErrorZPtr {
12321 result: Box::into_raw(Box::new(o)),
12327 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12328 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12329 CResult_ClosingSignedDecodeErrorZ {
12330 contents: CResult_ClosingSignedDecodeErrorZPtr {
12331 err: Box::into_raw(Box::new(e)),
12336 /// Checks if the given object is currently in the success state
12338 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12342 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12343 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12344 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12345 fn drop(&mut self) {
12346 if self.result_ok {
12347 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12348 let _ = unsafe { Box::from_raw(self.contents.result) };
12351 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12352 let _ = unsafe { Box::from_raw(self.contents.err) };
12357 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12358 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12359 let contents = if o.result_ok {
12360 let result = unsafe { o.contents.result };
12361 unsafe { o.contents.result = core::ptr::null_mut() };
12362 CResult_ClosingSignedDecodeErrorZPtr { result }
12364 let err = unsafe { o.contents.err };
12365 unsafe { o.contents.err = core::ptr::null_mut(); }
12366 CResult_ClosingSignedDecodeErrorZPtr { err }
12370 result_ok: o.result_ok,
12374 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12375 fn clone(&self) -> Self {
12376 if self.result_ok {
12377 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12378 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12381 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12382 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12388 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12389 /// but with all dynamically-allocated buffers duplicated in new buffers.
12390 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12392 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12393 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12394 /// A pointer to the contents in the success state.
12395 /// Reading from this pointer when `result_ok` is not set is undefined.
12396 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12397 /// A pointer to the contents in the error state.
12398 /// Reading from this pointer when `result_ok` is set is undefined.
12399 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12402 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12403 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12404 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12405 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12406 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12407 /// `err` or `result` depending on the state of `result_ok`.
12408 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12409 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12410 pub result_ok: bool,
12413 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12414 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12415 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12416 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12417 result: Box::into_raw(Box::new(o)),
12423 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12424 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12425 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12426 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12427 err: Box::into_raw(Box::new(e)),
12432 /// Checks if the given object is currently in the success state
12434 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12438 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12439 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12440 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12441 fn drop(&mut self) {
12442 if self.result_ok {
12443 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12444 let _ = unsafe { Box::from_raw(self.contents.result) };
12447 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12448 let _ = unsafe { Box::from_raw(self.contents.err) };
12453 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12454 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12455 let contents = if o.result_ok {
12456 let result = unsafe { o.contents.result };
12457 unsafe { o.contents.result = core::ptr::null_mut() };
12458 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12460 let err = unsafe { o.contents.err };
12461 unsafe { o.contents.err = core::ptr::null_mut(); }
12462 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12466 result_ok: o.result_ok,
12470 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12471 fn clone(&self) -> Self {
12472 if self.result_ok {
12473 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12474 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12477 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12478 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12484 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12485 /// but with all dynamically-allocated buffers duplicated in new buffers.
12486 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12488 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12489 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12490 /// A pointer to the contents in the success state.
12491 /// Reading from this pointer when `result_ok` is not set is undefined.
12492 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12493 /// A pointer to the contents in the error state.
12494 /// Reading from this pointer when `result_ok` is set is undefined.
12495 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12498 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12499 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12500 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12501 pub struct CResult_CommitmentSignedDecodeErrorZ {
12502 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12503 /// `err` or `result` depending on the state of `result_ok`.
12504 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12505 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12506 pub result_ok: bool,
12509 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12510 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12511 CResult_CommitmentSignedDecodeErrorZ {
12512 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12513 result: Box::into_raw(Box::new(o)),
12519 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12520 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12521 CResult_CommitmentSignedDecodeErrorZ {
12522 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12523 err: Box::into_raw(Box::new(e)),
12528 /// Checks if the given object is currently in the success state
12530 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12534 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12535 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12536 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12537 fn drop(&mut self) {
12538 if self.result_ok {
12539 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12540 let _ = unsafe { Box::from_raw(self.contents.result) };
12543 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12544 let _ = unsafe { Box::from_raw(self.contents.err) };
12549 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12550 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12551 let contents = if o.result_ok {
12552 let result = unsafe { o.contents.result };
12553 unsafe { o.contents.result = core::ptr::null_mut() };
12554 CResult_CommitmentSignedDecodeErrorZPtr { result }
12556 let err = unsafe { o.contents.err };
12557 unsafe { o.contents.err = core::ptr::null_mut(); }
12558 CResult_CommitmentSignedDecodeErrorZPtr { err }
12562 result_ok: o.result_ok,
12566 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12567 fn clone(&self) -> Self {
12568 if self.result_ok {
12569 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12570 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12573 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12574 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12580 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12581 /// but with all dynamically-allocated buffers duplicated in new buffers.
12582 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12584 /// The contents of CResult_FundingCreatedDecodeErrorZ
12585 pub union CResult_FundingCreatedDecodeErrorZPtr {
12586 /// A pointer to the contents in the success state.
12587 /// Reading from this pointer when `result_ok` is not set is undefined.
12588 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12589 /// A pointer to the contents in the error state.
12590 /// Reading from this pointer when `result_ok` is set is undefined.
12591 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12594 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12595 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12596 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12597 pub struct CResult_FundingCreatedDecodeErrorZ {
12598 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12599 /// `err` or `result` depending on the state of `result_ok`.
12600 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12601 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12602 pub result_ok: bool,
12605 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12606 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12607 CResult_FundingCreatedDecodeErrorZ {
12608 contents: CResult_FundingCreatedDecodeErrorZPtr {
12609 result: Box::into_raw(Box::new(o)),
12615 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12616 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12617 CResult_FundingCreatedDecodeErrorZ {
12618 contents: CResult_FundingCreatedDecodeErrorZPtr {
12619 err: Box::into_raw(Box::new(e)),
12624 /// Checks if the given object is currently in the success state
12626 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12630 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12631 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12632 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12633 fn drop(&mut self) {
12634 if self.result_ok {
12635 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12636 let _ = unsafe { Box::from_raw(self.contents.result) };
12639 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12640 let _ = unsafe { Box::from_raw(self.contents.err) };
12645 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12646 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12647 let contents = if o.result_ok {
12648 let result = unsafe { o.contents.result };
12649 unsafe { o.contents.result = core::ptr::null_mut() };
12650 CResult_FundingCreatedDecodeErrorZPtr { result }
12652 let err = unsafe { o.contents.err };
12653 unsafe { o.contents.err = core::ptr::null_mut(); }
12654 CResult_FundingCreatedDecodeErrorZPtr { err }
12658 result_ok: o.result_ok,
12662 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12663 fn clone(&self) -> Self {
12664 if self.result_ok {
12665 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12666 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12669 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12670 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12676 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12677 /// but with all dynamically-allocated buffers duplicated in new buffers.
12678 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12680 /// The contents of CResult_FundingSignedDecodeErrorZ
12681 pub union CResult_FundingSignedDecodeErrorZPtr {
12682 /// A pointer to the contents in the success state.
12683 /// Reading from this pointer when `result_ok` is not set is undefined.
12684 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12685 /// A pointer to the contents in the error state.
12686 /// Reading from this pointer when `result_ok` is set is undefined.
12687 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12690 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12691 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12692 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12693 pub struct CResult_FundingSignedDecodeErrorZ {
12694 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12695 /// `err` or `result` depending on the state of `result_ok`.
12696 pub contents: CResult_FundingSignedDecodeErrorZPtr,
12697 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12698 pub result_ok: bool,
12701 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12702 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12703 CResult_FundingSignedDecodeErrorZ {
12704 contents: CResult_FundingSignedDecodeErrorZPtr {
12705 result: Box::into_raw(Box::new(o)),
12711 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12712 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12713 CResult_FundingSignedDecodeErrorZ {
12714 contents: CResult_FundingSignedDecodeErrorZPtr {
12715 err: Box::into_raw(Box::new(e)),
12720 /// Checks if the given object is currently in the success state
12722 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12726 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12727 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12728 impl Drop for CResult_FundingSignedDecodeErrorZ {
12729 fn drop(&mut self) {
12730 if self.result_ok {
12731 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12732 let _ = unsafe { Box::from_raw(self.contents.result) };
12735 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12736 let _ = unsafe { Box::from_raw(self.contents.err) };
12741 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12742 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12743 let contents = if o.result_ok {
12744 let result = unsafe { o.contents.result };
12745 unsafe { o.contents.result = core::ptr::null_mut() };
12746 CResult_FundingSignedDecodeErrorZPtr { result }
12748 let err = unsafe { o.contents.err };
12749 unsafe { o.contents.err = core::ptr::null_mut(); }
12750 CResult_FundingSignedDecodeErrorZPtr { err }
12754 result_ok: o.result_ok,
12758 impl Clone for CResult_FundingSignedDecodeErrorZ {
12759 fn clone(&self) -> Self {
12760 if self.result_ok {
12761 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12762 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12765 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12766 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12772 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12773 /// but with all dynamically-allocated buffers duplicated in new buffers.
12774 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12776 /// The contents of CResult_FundingLockedDecodeErrorZ
12777 pub union CResult_FundingLockedDecodeErrorZPtr {
12778 /// A pointer to the contents in the success state.
12779 /// Reading from this pointer when `result_ok` is not set is undefined.
12780 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12781 /// A pointer to the contents in the error state.
12782 /// Reading from this pointer when `result_ok` is set is undefined.
12783 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12786 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12787 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12788 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12789 pub struct CResult_FundingLockedDecodeErrorZ {
12790 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12791 /// `err` or `result` depending on the state of `result_ok`.
12792 pub contents: CResult_FundingLockedDecodeErrorZPtr,
12793 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12794 pub result_ok: bool,
12797 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12798 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12799 CResult_FundingLockedDecodeErrorZ {
12800 contents: CResult_FundingLockedDecodeErrorZPtr {
12801 result: Box::into_raw(Box::new(o)),
12807 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12808 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12809 CResult_FundingLockedDecodeErrorZ {
12810 contents: CResult_FundingLockedDecodeErrorZPtr {
12811 err: Box::into_raw(Box::new(e)),
12816 /// Checks if the given object is currently in the success state
12818 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12822 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12823 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12824 impl Drop for CResult_FundingLockedDecodeErrorZ {
12825 fn drop(&mut self) {
12826 if self.result_ok {
12827 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12828 let _ = unsafe { Box::from_raw(self.contents.result) };
12831 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12832 let _ = unsafe { Box::from_raw(self.contents.err) };
12837 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12838 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12839 let contents = if o.result_ok {
12840 let result = unsafe { o.contents.result };
12841 unsafe { o.contents.result = core::ptr::null_mut() };
12842 CResult_FundingLockedDecodeErrorZPtr { result }
12844 let err = unsafe { o.contents.err };
12845 unsafe { o.contents.err = core::ptr::null_mut(); }
12846 CResult_FundingLockedDecodeErrorZPtr { err }
12850 result_ok: o.result_ok,
12854 impl Clone for CResult_FundingLockedDecodeErrorZ {
12855 fn clone(&self) -> Self {
12856 if self.result_ok {
12857 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12858 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12861 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12862 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12868 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12869 /// but with all dynamically-allocated buffers duplicated in new buffers.
12870 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12872 /// The contents of CResult_InitDecodeErrorZ
12873 pub union CResult_InitDecodeErrorZPtr {
12874 /// A pointer to the contents in the success state.
12875 /// Reading from this pointer when `result_ok` is not set is undefined.
12876 pub result: *mut crate::lightning::ln::msgs::Init,
12877 /// A pointer to the contents in the error state.
12878 /// Reading from this pointer when `result_ok` is set is undefined.
12879 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12882 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12883 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12884 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12885 pub struct CResult_InitDecodeErrorZ {
12886 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12887 /// `err` or `result` depending on the state of `result_ok`.
12888 pub contents: CResult_InitDecodeErrorZPtr,
12889 /// Whether this CResult_InitDecodeErrorZ represents a success state.
12890 pub result_ok: bool,
12893 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12894 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12895 CResult_InitDecodeErrorZ {
12896 contents: CResult_InitDecodeErrorZPtr {
12897 result: Box::into_raw(Box::new(o)),
12903 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12904 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12905 CResult_InitDecodeErrorZ {
12906 contents: CResult_InitDecodeErrorZPtr {
12907 err: Box::into_raw(Box::new(e)),
12912 /// Checks if the given object is currently in the success state
12914 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12918 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12919 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12920 impl Drop for CResult_InitDecodeErrorZ {
12921 fn drop(&mut self) {
12922 if self.result_ok {
12923 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12924 let _ = unsafe { Box::from_raw(self.contents.result) };
12927 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12928 let _ = unsafe { Box::from_raw(self.contents.err) };
12933 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12934 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12935 let contents = if o.result_ok {
12936 let result = unsafe { o.contents.result };
12937 unsafe { o.contents.result = core::ptr::null_mut() };
12938 CResult_InitDecodeErrorZPtr { result }
12940 let err = unsafe { o.contents.err };
12941 unsafe { o.contents.err = core::ptr::null_mut(); }
12942 CResult_InitDecodeErrorZPtr { err }
12946 result_ok: o.result_ok,
12950 impl Clone for CResult_InitDecodeErrorZ {
12951 fn clone(&self) -> Self {
12952 if self.result_ok {
12953 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12954 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12957 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12958 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12964 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12965 /// but with all dynamically-allocated buffers duplicated in new buffers.
12966 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12968 /// The contents of CResult_OpenChannelDecodeErrorZ
12969 pub union CResult_OpenChannelDecodeErrorZPtr {
12970 /// A pointer to the contents in the success state.
12971 /// Reading from this pointer when `result_ok` is not set is undefined.
12972 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12973 /// A pointer to the contents in the error state.
12974 /// Reading from this pointer when `result_ok` is set is undefined.
12975 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12978 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12979 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12981 pub struct CResult_OpenChannelDecodeErrorZ {
12982 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12983 /// `err` or `result` depending on the state of `result_ok`.
12984 pub contents: CResult_OpenChannelDecodeErrorZPtr,
12985 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12986 pub result_ok: bool,
12989 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12990 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12991 CResult_OpenChannelDecodeErrorZ {
12992 contents: CResult_OpenChannelDecodeErrorZPtr {
12993 result: Box::into_raw(Box::new(o)),
12999 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13000 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13001 CResult_OpenChannelDecodeErrorZ {
13002 contents: CResult_OpenChannelDecodeErrorZPtr {
13003 err: Box::into_raw(Box::new(e)),
13008 /// Checks if the given object is currently in the success state
13010 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13014 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13015 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13016 impl Drop for CResult_OpenChannelDecodeErrorZ {
13017 fn drop(&mut self) {
13018 if self.result_ok {
13019 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13020 let _ = unsafe { Box::from_raw(self.contents.result) };
13023 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13024 let _ = unsafe { Box::from_raw(self.contents.err) };
13029 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13030 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13031 let contents = if o.result_ok {
13032 let result = unsafe { o.contents.result };
13033 unsafe { o.contents.result = core::ptr::null_mut() };
13034 CResult_OpenChannelDecodeErrorZPtr { result }
13036 let err = unsafe { o.contents.err };
13037 unsafe { o.contents.err = core::ptr::null_mut(); }
13038 CResult_OpenChannelDecodeErrorZPtr { err }
13042 result_ok: o.result_ok,
13046 impl Clone for CResult_OpenChannelDecodeErrorZ {
13047 fn clone(&self) -> Self {
13048 if self.result_ok {
13049 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13050 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13053 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13054 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13060 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13061 /// but with all dynamically-allocated buffers duplicated in new buffers.
13062 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13064 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13065 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13066 /// A pointer to the contents in the success state.
13067 /// Reading from this pointer when `result_ok` is not set is undefined.
13068 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13069 /// A pointer to the contents in the error state.
13070 /// Reading from this pointer when `result_ok` is set is undefined.
13071 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13074 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13075 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13076 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13077 pub struct CResult_RevokeAndACKDecodeErrorZ {
13078 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13079 /// `err` or `result` depending on the state of `result_ok`.
13080 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13081 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13082 pub result_ok: bool,
13085 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13086 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13087 CResult_RevokeAndACKDecodeErrorZ {
13088 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13089 result: Box::into_raw(Box::new(o)),
13095 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13096 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13097 CResult_RevokeAndACKDecodeErrorZ {
13098 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13099 err: Box::into_raw(Box::new(e)),
13104 /// Checks if the given object is currently in the success state
13106 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13110 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13111 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13112 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13113 fn drop(&mut self) {
13114 if self.result_ok {
13115 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13116 let _ = unsafe { Box::from_raw(self.contents.result) };
13119 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13120 let _ = unsafe { Box::from_raw(self.contents.err) };
13125 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13126 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13127 let contents = if o.result_ok {
13128 let result = unsafe { o.contents.result };
13129 unsafe { o.contents.result = core::ptr::null_mut() };
13130 CResult_RevokeAndACKDecodeErrorZPtr { result }
13132 let err = unsafe { o.contents.err };
13133 unsafe { o.contents.err = core::ptr::null_mut(); }
13134 CResult_RevokeAndACKDecodeErrorZPtr { err }
13138 result_ok: o.result_ok,
13142 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13143 fn clone(&self) -> Self {
13144 if self.result_ok {
13145 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13146 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13149 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13150 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13156 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13157 /// but with all dynamically-allocated buffers duplicated in new buffers.
13158 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13160 /// The contents of CResult_ShutdownDecodeErrorZ
13161 pub union CResult_ShutdownDecodeErrorZPtr {
13162 /// A pointer to the contents in the success state.
13163 /// Reading from this pointer when `result_ok` is not set is undefined.
13164 pub result: *mut crate::lightning::ln::msgs::Shutdown,
13165 /// A pointer to the contents in the error state.
13166 /// Reading from this pointer when `result_ok` is set is undefined.
13167 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13170 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13171 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13173 pub struct CResult_ShutdownDecodeErrorZ {
13174 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13175 /// `err` or `result` depending on the state of `result_ok`.
13176 pub contents: CResult_ShutdownDecodeErrorZPtr,
13177 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13178 pub result_ok: bool,
13181 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13182 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13183 CResult_ShutdownDecodeErrorZ {
13184 contents: CResult_ShutdownDecodeErrorZPtr {
13185 result: Box::into_raw(Box::new(o)),
13191 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13192 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13193 CResult_ShutdownDecodeErrorZ {
13194 contents: CResult_ShutdownDecodeErrorZPtr {
13195 err: Box::into_raw(Box::new(e)),
13200 /// Checks if the given object is currently in the success state
13202 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13206 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13207 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13208 impl Drop for CResult_ShutdownDecodeErrorZ {
13209 fn drop(&mut self) {
13210 if self.result_ok {
13211 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13212 let _ = unsafe { Box::from_raw(self.contents.result) };
13215 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13216 let _ = unsafe { Box::from_raw(self.contents.err) };
13221 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13222 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13223 let contents = if o.result_ok {
13224 let result = unsafe { o.contents.result };
13225 unsafe { o.contents.result = core::ptr::null_mut() };
13226 CResult_ShutdownDecodeErrorZPtr { result }
13228 let err = unsafe { o.contents.err };
13229 unsafe { o.contents.err = core::ptr::null_mut(); }
13230 CResult_ShutdownDecodeErrorZPtr { err }
13234 result_ok: o.result_ok,
13238 impl Clone for CResult_ShutdownDecodeErrorZ {
13239 fn clone(&self) -> Self {
13240 if self.result_ok {
13241 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13242 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13245 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13246 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13252 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13253 /// but with all dynamically-allocated buffers duplicated in new buffers.
13254 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13256 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13257 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13258 /// A pointer to the contents in the success state.
13259 /// Reading from this pointer when `result_ok` is not set is undefined.
13260 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13261 /// A pointer to the contents in the error state.
13262 /// Reading from this pointer when `result_ok` is set is undefined.
13263 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13266 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13267 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13268 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13269 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13270 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13271 /// `err` or `result` depending on the state of `result_ok`.
13272 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13273 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13274 pub result_ok: bool,
13277 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13278 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13279 CResult_UpdateFailHTLCDecodeErrorZ {
13280 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13281 result: Box::into_raw(Box::new(o)),
13287 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13288 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13289 CResult_UpdateFailHTLCDecodeErrorZ {
13290 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13291 err: Box::into_raw(Box::new(e)),
13296 /// Checks if the given object is currently in the success state
13298 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13302 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13303 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13304 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13305 fn drop(&mut self) {
13306 if self.result_ok {
13307 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13308 let _ = unsafe { Box::from_raw(self.contents.result) };
13311 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13312 let _ = unsafe { Box::from_raw(self.contents.err) };
13317 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13318 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13319 let contents = if o.result_ok {
13320 let result = unsafe { o.contents.result };
13321 unsafe { o.contents.result = core::ptr::null_mut() };
13322 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13324 let err = unsafe { o.contents.err };
13325 unsafe { o.contents.err = core::ptr::null_mut(); }
13326 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13330 result_ok: o.result_ok,
13334 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13335 fn clone(&self) -> Self {
13336 if self.result_ok {
13337 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13338 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13341 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13342 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13348 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13349 /// but with all dynamically-allocated buffers duplicated in new buffers.
13350 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13352 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13353 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13354 /// A pointer to the contents in the success state.
13355 /// Reading from this pointer when `result_ok` is not set is undefined.
13356 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13357 /// A pointer to the contents in the error state.
13358 /// Reading from this pointer when `result_ok` is set is undefined.
13359 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13362 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13363 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13365 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13366 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13367 /// `err` or `result` depending on the state of `result_ok`.
13368 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13369 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13370 pub result_ok: bool,
13373 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13374 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13375 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13376 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13377 result: Box::into_raw(Box::new(o)),
13383 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13384 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13385 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13386 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13387 err: Box::into_raw(Box::new(e)),
13392 /// Checks if the given object is currently in the success state
13394 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13398 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13399 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13400 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13401 fn drop(&mut self) {
13402 if self.result_ok {
13403 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13404 let _ = unsafe { Box::from_raw(self.contents.result) };
13407 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13408 let _ = unsafe { Box::from_raw(self.contents.err) };
13413 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13414 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13415 let contents = if o.result_ok {
13416 let result = unsafe { o.contents.result };
13417 unsafe { o.contents.result = core::ptr::null_mut() };
13418 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13420 let err = unsafe { o.contents.err };
13421 unsafe { o.contents.err = core::ptr::null_mut(); }
13422 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13426 result_ok: o.result_ok,
13430 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13431 fn clone(&self) -> Self {
13432 if self.result_ok {
13433 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13434 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13437 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13438 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13444 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13445 /// but with all dynamically-allocated buffers duplicated in new buffers.
13446 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13448 /// The contents of CResult_UpdateFeeDecodeErrorZ
13449 pub union CResult_UpdateFeeDecodeErrorZPtr {
13450 /// A pointer to the contents in the success state.
13451 /// Reading from this pointer when `result_ok` is not set is undefined.
13452 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13453 /// A pointer to the contents in the error state.
13454 /// Reading from this pointer when `result_ok` is set is undefined.
13455 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13458 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13459 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13460 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13461 pub struct CResult_UpdateFeeDecodeErrorZ {
13462 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13463 /// `err` or `result` depending on the state of `result_ok`.
13464 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13465 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13466 pub result_ok: bool,
13469 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13470 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13471 CResult_UpdateFeeDecodeErrorZ {
13472 contents: CResult_UpdateFeeDecodeErrorZPtr {
13473 result: Box::into_raw(Box::new(o)),
13479 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13480 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13481 CResult_UpdateFeeDecodeErrorZ {
13482 contents: CResult_UpdateFeeDecodeErrorZPtr {
13483 err: Box::into_raw(Box::new(e)),
13488 /// Checks if the given object is currently in the success state
13490 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13494 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13495 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13496 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13497 fn drop(&mut self) {
13498 if self.result_ok {
13499 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13500 let _ = unsafe { Box::from_raw(self.contents.result) };
13503 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13504 let _ = unsafe { Box::from_raw(self.contents.err) };
13509 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13510 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13511 let contents = if o.result_ok {
13512 let result = unsafe { o.contents.result };
13513 unsafe { o.contents.result = core::ptr::null_mut() };
13514 CResult_UpdateFeeDecodeErrorZPtr { result }
13516 let err = unsafe { o.contents.err };
13517 unsafe { o.contents.err = core::ptr::null_mut(); }
13518 CResult_UpdateFeeDecodeErrorZPtr { err }
13522 result_ok: o.result_ok,
13526 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13527 fn clone(&self) -> Self {
13528 if self.result_ok {
13529 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13530 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13533 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13534 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13540 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13541 /// but with all dynamically-allocated buffers duplicated in new buffers.
13542 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13544 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13545 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13546 /// A pointer to the contents in the success state.
13547 /// Reading from this pointer when `result_ok` is not set is undefined.
13548 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13549 /// A pointer to the contents in the error state.
13550 /// Reading from this pointer when `result_ok` is set is undefined.
13551 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13554 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13555 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13557 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13558 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13559 /// `err` or `result` depending on the state of `result_ok`.
13560 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13561 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13562 pub result_ok: bool,
13565 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13566 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13567 CResult_UpdateFulfillHTLCDecodeErrorZ {
13568 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13569 result: Box::into_raw(Box::new(o)),
13575 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13576 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13577 CResult_UpdateFulfillHTLCDecodeErrorZ {
13578 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13579 err: Box::into_raw(Box::new(e)),
13584 /// Checks if the given object is currently in the success state
13586 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13590 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13591 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13592 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13593 fn drop(&mut self) {
13594 if self.result_ok {
13595 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13596 let _ = unsafe { Box::from_raw(self.contents.result) };
13599 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13600 let _ = unsafe { Box::from_raw(self.contents.err) };
13605 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13606 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13607 let contents = if o.result_ok {
13608 let result = unsafe { o.contents.result };
13609 unsafe { o.contents.result = core::ptr::null_mut() };
13610 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13612 let err = unsafe { o.contents.err };
13613 unsafe { o.contents.err = core::ptr::null_mut(); }
13614 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13618 result_ok: o.result_ok,
13622 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13623 fn clone(&self) -> Self {
13624 if self.result_ok {
13625 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13626 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13629 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13630 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13636 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13637 /// but with all dynamically-allocated buffers duplicated in new buffers.
13638 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13640 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13641 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13642 /// A pointer to the contents in the success state.
13643 /// Reading from this pointer when `result_ok` is not set is undefined.
13644 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13645 /// A pointer to the contents in the error state.
13646 /// Reading from this pointer when `result_ok` is set is undefined.
13647 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13650 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13651 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13653 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13654 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13655 /// `err` or `result` depending on the state of `result_ok`.
13656 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13657 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13658 pub result_ok: bool,
13661 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13662 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13663 CResult_UpdateAddHTLCDecodeErrorZ {
13664 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13665 result: Box::into_raw(Box::new(o)),
13671 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13672 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13673 CResult_UpdateAddHTLCDecodeErrorZ {
13674 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13675 err: Box::into_raw(Box::new(e)),
13680 /// Checks if the given object is currently in the success state
13682 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13686 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13687 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13688 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13689 fn drop(&mut self) {
13690 if self.result_ok {
13691 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13692 let _ = unsafe { Box::from_raw(self.contents.result) };
13695 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13696 let _ = unsafe { Box::from_raw(self.contents.err) };
13701 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13702 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13703 let contents = if o.result_ok {
13704 let result = unsafe { o.contents.result };
13705 unsafe { o.contents.result = core::ptr::null_mut() };
13706 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13708 let err = unsafe { o.contents.err };
13709 unsafe { o.contents.err = core::ptr::null_mut(); }
13710 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13714 result_ok: o.result_ok,
13718 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13719 fn clone(&self) -> Self {
13720 if self.result_ok {
13721 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13722 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13725 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13726 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13732 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13733 /// but with all dynamically-allocated buffers duplicated in new buffers.
13734 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13736 /// The contents of CResult_PingDecodeErrorZ
13737 pub union CResult_PingDecodeErrorZPtr {
13738 /// A pointer to the contents in the success state.
13739 /// Reading from this pointer when `result_ok` is not set is undefined.
13740 pub result: *mut crate::lightning::ln::msgs::Ping,
13741 /// A pointer to the contents in the error state.
13742 /// Reading from this pointer when `result_ok` is set is undefined.
13743 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13746 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13747 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13749 pub struct CResult_PingDecodeErrorZ {
13750 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13751 /// `err` or `result` depending on the state of `result_ok`.
13752 pub contents: CResult_PingDecodeErrorZPtr,
13753 /// Whether this CResult_PingDecodeErrorZ represents a success state.
13754 pub result_ok: bool,
13757 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13758 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13759 CResult_PingDecodeErrorZ {
13760 contents: CResult_PingDecodeErrorZPtr {
13761 result: Box::into_raw(Box::new(o)),
13767 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13768 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13769 CResult_PingDecodeErrorZ {
13770 contents: CResult_PingDecodeErrorZPtr {
13771 err: Box::into_raw(Box::new(e)),
13776 /// Checks if the given object is currently in the success state
13778 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13782 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13783 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13784 impl Drop for CResult_PingDecodeErrorZ {
13785 fn drop(&mut self) {
13786 if self.result_ok {
13787 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13788 let _ = unsafe { Box::from_raw(self.contents.result) };
13791 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13792 let _ = unsafe { Box::from_raw(self.contents.err) };
13797 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13798 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13799 let contents = if o.result_ok {
13800 let result = unsafe { o.contents.result };
13801 unsafe { o.contents.result = core::ptr::null_mut() };
13802 CResult_PingDecodeErrorZPtr { result }
13804 let err = unsafe { o.contents.err };
13805 unsafe { o.contents.err = core::ptr::null_mut(); }
13806 CResult_PingDecodeErrorZPtr { err }
13810 result_ok: o.result_ok,
13814 impl Clone for CResult_PingDecodeErrorZ {
13815 fn clone(&self) -> Self {
13816 if self.result_ok {
13817 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13818 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13821 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13822 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13828 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13829 /// but with all dynamically-allocated buffers duplicated in new buffers.
13830 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13832 /// The contents of CResult_PongDecodeErrorZ
13833 pub union CResult_PongDecodeErrorZPtr {
13834 /// A pointer to the contents in the success state.
13835 /// Reading from this pointer when `result_ok` is not set is undefined.
13836 pub result: *mut crate::lightning::ln::msgs::Pong,
13837 /// A pointer to the contents in the error state.
13838 /// Reading from this pointer when `result_ok` is set is undefined.
13839 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13842 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13843 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13844 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13845 pub struct CResult_PongDecodeErrorZ {
13846 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13847 /// `err` or `result` depending on the state of `result_ok`.
13848 pub contents: CResult_PongDecodeErrorZPtr,
13849 /// Whether this CResult_PongDecodeErrorZ represents a success state.
13850 pub result_ok: bool,
13853 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13854 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13855 CResult_PongDecodeErrorZ {
13856 contents: CResult_PongDecodeErrorZPtr {
13857 result: Box::into_raw(Box::new(o)),
13863 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13864 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13865 CResult_PongDecodeErrorZ {
13866 contents: CResult_PongDecodeErrorZPtr {
13867 err: Box::into_raw(Box::new(e)),
13872 /// Checks if the given object is currently in the success state
13874 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13878 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13879 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13880 impl Drop for CResult_PongDecodeErrorZ {
13881 fn drop(&mut self) {
13882 if self.result_ok {
13883 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13884 let _ = unsafe { Box::from_raw(self.contents.result) };
13887 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13888 let _ = unsafe { Box::from_raw(self.contents.err) };
13893 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13894 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13895 let contents = if o.result_ok {
13896 let result = unsafe { o.contents.result };
13897 unsafe { o.contents.result = core::ptr::null_mut() };
13898 CResult_PongDecodeErrorZPtr { result }
13900 let err = unsafe { o.contents.err };
13901 unsafe { o.contents.err = core::ptr::null_mut(); }
13902 CResult_PongDecodeErrorZPtr { err }
13906 result_ok: o.result_ok,
13910 impl Clone for CResult_PongDecodeErrorZ {
13911 fn clone(&self) -> Self {
13912 if self.result_ok {
13913 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13914 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13917 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13918 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13924 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13925 /// but with all dynamically-allocated buffers duplicated in new buffers.
13926 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13928 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13929 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13930 /// A pointer to the contents in the success state.
13931 /// Reading from this pointer when `result_ok` is not set is undefined.
13932 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13933 /// A pointer to the contents in the error state.
13934 /// Reading from this pointer when `result_ok` is set is undefined.
13935 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13938 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13939 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13941 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13942 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13943 /// `err` or `result` depending on the state of `result_ok`.
13944 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13945 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13946 pub result_ok: bool,
13949 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13950 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13951 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13952 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13953 result: Box::into_raw(Box::new(o)),
13959 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13960 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13961 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13962 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13963 err: Box::into_raw(Box::new(e)),
13968 /// Checks if the given object is currently in the success state
13970 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13974 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13975 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13976 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13977 fn drop(&mut self) {
13978 if self.result_ok {
13979 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13980 let _ = unsafe { Box::from_raw(self.contents.result) };
13983 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13984 let _ = unsafe { Box::from_raw(self.contents.err) };
13989 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13990 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13991 let contents = if o.result_ok {
13992 let result = unsafe { o.contents.result };
13993 unsafe { o.contents.result = core::ptr::null_mut() };
13994 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13996 let err = unsafe { o.contents.err };
13997 unsafe { o.contents.err = core::ptr::null_mut(); }
13998 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14002 result_ok: o.result_ok,
14006 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14007 fn clone(&self) -> Self {
14008 if self.result_ok {
14009 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14010 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14013 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14014 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14020 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14021 /// but with all dynamically-allocated buffers duplicated in new buffers.
14022 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14024 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14025 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14026 /// A pointer to the contents in the success state.
14027 /// Reading from this pointer when `result_ok` is not set is undefined.
14028 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14029 /// A pointer to the contents in the error state.
14030 /// Reading from this pointer when `result_ok` is set is undefined.
14031 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14034 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14035 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14037 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14038 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14039 /// `err` or `result` depending on the state of `result_ok`.
14040 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14041 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14042 pub result_ok: bool,
14045 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14046 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14047 CResult_ChannelAnnouncementDecodeErrorZ {
14048 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14049 result: Box::into_raw(Box::new(o)),
14055 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14056 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14057 CResult_ChannelAnnouncementDecodeErrorZ {
14058 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14059 err: Box::into_raw(Box::new(e)),
14064 /// Checks if the given object is currently in the success state
14066 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14070 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14071 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14072 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14073 fn drop(&mut self) {
14074 if self.result_ok {
14075 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14076 let _ = unsafe { Box::from_raw(self.contents.result) };
14079 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14080 let _ = unsafe { Box::from_raw(self.contents.err) };
14085 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14086 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14087 let contents = if o.result_ok {
14088 let result = unsafe { o.contents.result };
14089 unsafe { o.contents.result = core::ptr::null_mut() };
14090 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14092 let err = unsafe { o.contents.err };
14093 unsafe { o.contents.err = core::ptr::null_mut(); }
14094 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14098 result_ok: o.result_ok,
14102 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14103 fn clone(&self) -> Self {
14104 if self.result_ok {
14105 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14106 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14109 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14110 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14116 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14117 /// but with all dynamically-allocated buffers duplicated in new buffers.
14118 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14120 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14121 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14122 /// A pointer to the contents in the success state.
14123 /// Reading from this pointer when `result_ok` is not set is undefined.
14124 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14125 /// A pointer to the contents in the error state.
14126 /// Reading from this pointer when `result_ok` is set is undefined.
14127 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14130 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14131 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14133 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14134 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14135 /// `err` or `result` depending on the state of `result_ok`.
14136 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14137 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14138 pub result_ok: bool,
14141 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14142 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14143 CResult_UnsignedChannelUpdateDecodeErrorZ {
14144 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14145 result: Box::into_raw(Box::new(o)),
14151 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14152 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14153 CResult_UnsignedChannelUpdateDecodeErrorZ {
14154 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14155 err: Box::into_raw(Box::new(e)),
14160 /// Checks if the given object is currently in the success state
14162 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14166 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14167 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14168 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14169 fn drop(&mut self) {
14170 if self.result_ok {
14171 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14172 let _ = unsafe { Box::from_raw(self.contents.result) };
14175 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14176 let _ = unsafe { Box::from_raw(self.contents.err) };
14181 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14182 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14183 let contents = if o.result_ok {
14184 let result = unsafe { o.contents.result };
14185 unsafe { o.contents.result = core::ptr::null_mut() };
14186 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14188 let err = unsafe { o.contents.err };
14189 unsafe { o.contents.err = core::ptr::null_mut(); }
14190 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14194 result_ok: o.result_ok,
14198 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14199 fn clone(&self) -> Self {
14200 if self.result_ok {
14201 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14202 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14205 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14206 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14212 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14213 /// but with all dynamically-allocated buffers duplicated in new buffers.
14214 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14216 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14217 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14218 /// A pointer to the contents in the success state.
14219 /// Reading from this pointer when `result_ok` is not set is undefined.
14220 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14221 /// A pointer to the contents in the error state.
14222 /// Reading from this pointer when `result_ok` is set is undefined.
14223 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14226 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14227 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14228 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14229 pub struct CResult_ChannelUpdateDecodeErrorZ {
14230 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14231 /// `err` or `result` depending on the state of `result_ok`.
14232 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14233 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14234 pub result_ok: bool,
14237 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14238 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14239 CResult_ChannelUpdateDecodeErrorZ {
14240 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14241 result: Box::into_raw(Box::new(o)),
14247 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14248 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14249 CResult_ChannelUpdateDecodeErrorZ {
14250 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14251 err: Box::into_raw(Box::new(e)),
14256 /// Checks if the given object is currently in the success state
14258 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14262 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14263 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14264 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14265 fn drop(&mut self) {
14266 if self.result_ok {
14267 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14268 let _ = unsafe { Box::from_raw(self.contents.result) };
14271 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14272 let _ = unsafe { Box::from_raw(self.contents.err) };
14277 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14278 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14279 let contents = if o.result_ok {
14280 let result = unsafe { o.contents.result };
14281 unsafe { o.contents.result = core::ptr::null_mut() };
14282 CResult_ChannelUpdateDecodeErrorZPtr { result }
14284 let err = unsafe { o.contents.err };
14285 unsafe { o.contents.err = core::ptr::null_mut(); }
14286 CResult_ChannelUpdateDecodeErrorZPtr { err }
14290 result_ok: o.result_ok,
14294 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14295 fn clone(&self) -> Self {
14296 if self.result_ok {
14297 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14298 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14301 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14302 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14308 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14309 /// but with all dynamically-allocated buffers duplicated in new buffers.
14310 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14312 /// The contents of CResult_ErrorMessageDecodeErrorZ
14313 pub union CResult_ErrorMessageDecodeErrorZPtr {
14314 /// A pointer to the contents in the success state.
14315 /// Reading from this pointer when `result_ok` is not set is undefined.
14316 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14317 /// A pointer to the contents in the error state.
14318 /// Reading from this pointer when `result_ok` is set is undefined.
14319 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14322 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14323 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14324 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14325 pub struct CResult_ErrorMessageDecodeErrorZ {
14326 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14327 /// `err` or `result` depending on the state of `result_ok`.
14328 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14329 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14330 pub result_ok: bool,
14333 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14334 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14335 CResult_ErrorMessageDecodeErrorZ {
14336 contents: CResult_ErrorMessageDecodeErrorZPtr {
14337 result: Box::into_raw(Box::new(o)),
14343 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14344 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14345 CResult_ErrorMessageDecodeErrorZ {
14346 contents: CResult_ErrorMessageDecodeErrorZPtr {
14347 err: Box::into_raw(Box::new(e)),
14352 /// Checks if the given object is currently in the success state
14354 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14358 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14359 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14360 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14361 fn drop(&mut self) {
14362 if self.result_ok {
14363 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14364 let _ = unsafe { Box::from_raw(self.contents.result) };
14367 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14368 let _ = unsafe { Box::from_raw(self.contents.err) };
14373 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14374 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14375 let contents = if o.result_ok {
14376 let result = unsafe { o.contents.result };
14377 unsafe { o.contents.result = core::ptr::null_mut() };
14378 CResult_ErrorMessageDecodeErrorZPtr { result }
14380 let err = unsafe { o.contents.err };
14381 unsafe { o.contents.err = core::ptr::null_mut(); }
14382 CResult_ErrorMessageDecodeErrorZPtr { err }
14386 result_ok: o.result_ok,
14390 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14391 fn clone(&self) -> Self {
14392 if self.result_ok {
14393 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14394 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14397 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14398 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14404 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14405 /// but with all dynamically-allocated buffers duplicated in new buffers.
14406 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14408 /// The contents of CResult_WarningMessageDecodeErrorZ
14409 pub union CResult_WarningMessageDecodeErrorZPtr {
14410 /// A pointer to the contents in the success state.
14411 /// Reading from this pointer when `result_ok` is not set is undefined.
14412 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14413 /// A pointer to the contents in the error state.
14414 /// Reading from this pointer when `result_ok` is set is undefined.
14415 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14418 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14419 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14420 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14421 pub struct CResult_WarningMessageDecodeErrorZ {
14422 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14423 /// `err` or `result` depending on the state of `result_ok`.
14424 pub contents: CResult_WarningMessageDecodeErrorZPtr,
14425 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14426 pub result_ok: bool,
14429 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14430 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14431 CResult_WarningMessageDecodeErrorZ {
14432 contents: CResult_WarningMessageDecodeErrorZPtr {
14433 result: Box::into_raw(Box::new(o)),
14439 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14440 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14441 CResult_WarningMessageDecodeErrorZ {
14442 contents: CResult_WarningMessageDecodeErrorZPtr {
14443 err: Box::into_raw(Box::new(e)),
14448 /// Checks if the given object is currently in the success state
14450 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14454 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14455 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14456 impl Drop for CResult_WarningMessageDecodeErrorZ {
14457 fn drop(&mut self) {
14458 if self.result_ok {
14459 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14460 let _ = unsafe { Box::from_raw(self.contents.result) };
14463 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14464 let _ = unsafe { Box::from_raw(self.contents.err) };
14469 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14470 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14471 let contents = if o.result_ok {
14472 let result = unsafe { o.contents.result };
14473 unsafe { o.contents.result = core::ptr::null_mut() };
14474 CResult_WarningMessageDecodeErrorZPtr { result }
14476 let err = unsafe { o.contents.err };
14477 unsafe { o.contents.err = core::ptr::null_mut(); }
14478 CResult_WarningMessageDecodeErrorZPtr { err }
14482 result_ok: o.result_ok,
14486 impl Clone for CResult_WarningMessageDecodeErrorZ {
14487 fn clone(&self) -> Self {
14488 if self.result_ok {
14489 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14490 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14493 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14494 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14500 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14501 /// but with all dynamically-allocated buffers duplicated in new buffers.
14502 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14504 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14505 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14506 /// A pointer to the contents in the success state.
14507 /// Reading from this pointer when `result_ok` is not set is undefined.
14508 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14509 /// A pointer to the contents in the error state.
14510 /// Reading from this pointer when `result_ok` is set is undefined.
14511 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14514 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14515 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14516 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14517 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14518 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14519 /// `err` or `result` depending on the state of `result_ok`.
14520 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14521 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14522 pub result_ok: bool,
14525 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14526 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14527 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14528 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14529 result: Box::into_raw(Box::new(o)),
14535 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14536 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14537 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14538 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14539 err: Box::into_raw(Box::new(e)),
14544 /// Checks if the given object is currently in the success state
14546 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14550 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14551 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14552 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14553 fn drop(&mut self) {
14554 if self.result_ok {
14555 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14556 let _ = unsafe { Box::from_raw(self.contents.result) };
14559 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14560 let _ = unsafe { Box::from_raw(self.contents.err) };
14565 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14566 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14567 let contents = if o.result_ok {
14568 let result = unsafe { o.contents.result };
14569 unsafe { o.contents.result = core::ptr::null_mut() };
14570 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14572 let err = unsafe { o.contents.err };
14573 unsafe { o.contents.err = core::ptr::null_mut(); }
14574 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14578 result_ok: o.result_ok,
14582 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14583 fn clone(&self) -> Self {
14584 if self.result_ok {
14585 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14586 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14589 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14590 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14596 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14597 /// but with all dynamically-allocated buffers duplicated in new buffers.
14598 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14600 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14601 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14602 /// A pointer to the contents in the success state.
14603 /// Reading from this pointer when `result_ok` is not set is undefined.
14604 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14605 /// A pointer to the contents in the error state.
14606 /// Reading from this pointer when `result_ok` is set is undefined.
14607 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14610 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14611 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14613 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14614 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14615 /// `err` or `result` depending on the state of `result_ok`.
14616 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14617 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14618 pub result_ok: bool,
14621 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14622 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14623 CResult_NodeAnnouncementDecodeErrorZ {
14624 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14625 result: Box::into_raw(Box::new(o)),
14631 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14632 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14633 CResult_NodeAnnouncementDecodeErrorZ {
14634 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14635 err: Box::into_raw(Box::new(e)),
14640 /// Checks if the given object is currently in the success state
14642 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14646 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14647 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14648 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14649 fn drop(&mut self) {
14650 if self.result_ok {
14651 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14652 let _ = unsafe { Box::from_raw(self.contents.result) };
14655 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14656 let _ = unsafe { Box::from_raw(self.contents.err) };
14661 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14662 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14663 let contents = if o.result_ok {
14664 let result = unsafe { o.contents.result };
14665 unsafe { o.contents.result = core::ptr::null_mut() };
14666 CResult_NodeAnnouncementDecodeErrorZPtr { result }
14668 let err = unsafe { o.contents.err };
14669 unsafe { o.contents.err = core::ptr::null_mut(); }
14670 CResult_NodeAnnouncementDecodeErrorZPtr { err }
14674 result_ok: o.result_ok,
14678 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14679 fn clone(&self) -> Self {
14680 if self.result_ok {
14681 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14682 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14685 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14686 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14692 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14693 /// but with all dynamically-allocated buffers duplicated in new buffers.
14694 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14696 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14697 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14698 /// A pointer to the contents in the success state.
14699 /// Reading from this pointer when `result_ok` is not set is undefined.
14700 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14701 /// A pointer to the contents in the error state.
14702 /// Reading from this pointer when `result_ok` is set is undefined.
14703 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14706 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14707 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14709 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14710 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14711 /// `err` or `result` depending on the state of `result_ok`.
14712 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14713 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14714 pub result_ok: bool,
14717 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14718 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14719 CResult_QueryShortChannelIdsDecodeErrorZ {
14720 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14721 result: Box::into_raw(Box::new(o)),
14727 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14728 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14729 CResult_QueryShortChannelIdsDecodeErrorZ {
14730 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14731 err: Box::into_raw(Box::new(e)),
14736 /// Checks if the given object is currently in the success state
14738 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14742 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14743 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14744 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14745 fn drop(&mut self) {
14746 if self.result_ok {
14747 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14748 let _ = unsafe { Box::from_raw(self.contents.result) };
14751 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14752 let _ = unsafe { Box::from_raw(self.contents.err) };
14757 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14758 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14759 let contents = if o.result_ok {
14760 let result = unsafe { o.contents.result };
14761 unsafe { o.contents.result = core::ptr::null_mut() };
14762 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14764 let err = unsafe { o.contents.err };
14765 unsafe { o.contents.err = core::ptr::null_mut(); }
14766 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14770 result_ok: o.result_ok,
14774 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14775 fn clone(&self) -> Self {
14776 if self.result_ok {
14777 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14778 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14781 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14782 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14788 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14789 /// but with all dynamically-allocated buffers duplicated in new buffers.
14790 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14792 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14793 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14794 /// A pointer to the contents in the success state.
14795 /// Reading from this pointer when `result_ok` is not set is undefined.
14796 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14797 /// A pointer to the contents in the error state.
14798 /// Reading from this pointer when `result_ok` is set is undefined.
14799 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14802 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14803 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14804 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14805 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14806 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14807 /// `err` or `result` depending on the state of `result_ok`.
14808 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14809 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14810 pub result_ok: bool,
14813 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14814 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14815 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14816 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14817 result: Box::into_raw(Box::new(o)),
14823 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14824 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14825 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14826 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14827 err: Box::into_raw(Box::new(e)),
14832 /// Checks if the given object is currently in the success state
14834 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14838 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14839 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14840 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14841 fn drop(&mut self) {
14842 if self.result_ok {
14843 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14844 let _ = unsafe { Box::from_raw(self.contents.result) };
14847 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14848 let _ = unsafe { Box::from_raw(self.contents.err) };
14853 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14854 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14855 let contents = if o.result_ok {
14856 let result = unsafe { o.contents.result };
14857 unsafe { o.contents.result = core::ptr::null_mut() };
14858 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14860 let err = unsafe { o.contents.err };
14861 unsafe { o.contents.err = core::ptr::null_mut(); }
14862 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14866 result_ok: o.result_ok,
14870 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14871 fn clone(&self) -> Self {
14872 if self.result_ok {
14873 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14874 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14877 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14878 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14884 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14885 /// but with all dynamically-allocated buffers duplicated in new buffers.
14886 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14888 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14889 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14890 /// A pointer to the contents in the success state.
14891 /// Reading from this pointer when `result_ok` is not set is undefined.
14892 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14893 /// A pointer to the contents in the error state.
14894 /// Reading from this pointer when `result_ok` is set is undefined.
14895 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14898 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14899 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14900 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14901 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14902 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14903 /// `err` or `result` depending on the state of `result_ok`.
14904 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14905 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14906 pub result_ok: bool,
14909 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14910 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14911 CResult_QueryChannelRangeDecodeErrorZ {
14912 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14913 result: Box::into_raw(Box::new(o)),
14919 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14920 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14921 CResult_QueryChannelRangeDecodeErrorZ {
14922 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14923 err: Box::into_raw(Box::new(e)),
14928 /// Checks if the given object is currently in the success state
14930 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14934 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14935 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14936 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14937 fn drop(&mut self) {
14938 if self.result_ok {
14939 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14940 let _ = unsafe { Box::from_raw(self.contents.result) };
14943 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14944 let _ = unsafe { Box::from_raw(self.contents.err) };
14949 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14950 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14951 let contents = if o.result_ok {
14952 let result = unsafe { o.contents.result };
14953 unsafe { o.contents.result = core::ptr::null_mut() };
14954 CResult_QueryChannelRangeDecodeErrorZPtr { result }
14956 let err = unsafe { o.contents.err };
14957 unsafe { o.contents.err = core::ptr::null_mut(); }
14958 CResult_QueryChannelRangeDecodeErrorZPtr { err }
14962 result_ok: o.result_ok,
14966 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14967 fn clone(&self) -> Self {
14968 if self.result_ok {
14969 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14970 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14973 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14974 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14980 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14981 /// but with all dynamically-allocated buffers duplicated in new buffers.
14982 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14984 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14985 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14986 /// A pointer to the contents in the success state.
14987 /// Reading from this pointer when `result_ok` is not set is undefined.
14988 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
14989 /// A pointer to the contents in the error state.
14990 /// Reading from this pointer when `result_ok` is set is undefined.
14991 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14994 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
14995 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14996 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14997 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
14998 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
14999 /// `err` or `result` depending on the state of `result_ok`.
15000 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15001 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15002 pub result_ok: bool,
15005 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15006 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15007 CResult_ReplyChannelRangeDecodeErrorZ {
15008 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15009 result: Box::into_raw(Box::new(o)),
15015 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15016 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15017 CResult_ReplyChannelRangeDecodeErrorZ {
15018 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15019 err: Box::into_raw(Box::new(e)),
15024 /// Checks if the given object is currently in the success state
15026 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15030 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15031 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15032 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15033 fn drop(&mut self) {
15034 if self.result_ok {
15035 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15036 let _ = unsafe { Box::from_raw(self.contents.result) };
15039 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15040 let _ = unsafe { Box::from_raw(self.contents.err) };
15045 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15046 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15047 let contents = if o.result_ok {
15048 let result = unsafe { o.contents.result };
15049 unsafe { o.contents.result = core::ptr::null_mut() };
15050 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15052 let err = unsafe { o.contents.err };
15053 unsafe { o.contents.err = core::ptr::null_mut(); }
15054 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15058 result_ok: o.result_ok,
15062 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15063 fn clone(&self) -> Self {
15064 if self.result_ok {
15065 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15066 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15069 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15070 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15076 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15077 /// but with all dynamically-allocated buffers duplicated in new buffers.
15078 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15080 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15081 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15082 /// A pointer to the contents in the success state.
15083 /// Reading from this pointer when `result_ok` is not set is undefined.
15084 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15085 /// A pointer to the contents in the error state.
15086 /// Reading from this pointer when `result_ok` is set is undefined.
15087 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15090 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15091 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15092 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15093 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15094 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15095 /// `err` or `result` depending on the state of `result_ok`.
15096 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15097 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15098 pub result_ok: bool,
15101 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15102 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15103 CResult_GossipTimestampFilterDecodeErrorZ {
15104 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15105 result: Box::into_raw(Box::new(o)),
15111 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15112 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15113 CResult_GossipTimestampFilterDecodeErrorZ {
15114 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15115 err: Box::into_raw(Box::new(e)),
15120 /// Checks if the given object is currently in the success state
15122 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15126 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15127 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15128 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15129 fn drop(&mut self) {
15130 if self.result_ok {
15131 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15132 let _ = unsafe { Box::from_raw(self.contents.result) };
15135 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15136 let _ = unsafe { Box::from_raw(self.contents.err) };
15141 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15142 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15143 let contents = if o.result_ok {
15144 let result = unsafe { o.contents.result };
15145 unsafe { o.contents.result = core::ptr::null_mut() };
15146 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15148 let err = unsafe { o.contents.err };
15149 unsafe { o.contents.err = core::ptr::null_mut(); }
15150 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15154 result_ok: o.result_ok,
15158 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15159 fn clone(&self) -> Self {
15160 if self.result_ok {
15161 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15162 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15165 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15166 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15172 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15173 /// but with all dynamically-allocated buffers duplicated in new buffers.
15174 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15176 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15177 /// This corresponds to std::vector in C++
15178 pub struct CVec_PhantomRouteHintsZ {
15179 /// The elements in the array.
15180 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15181 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15182 /// The number of elements pointed to by `data`.
15185 impl CVec_PhantomRouteHintsZ {
15186 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15187 if self.datalen == 0 { return Vec::new(); }
15188 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15189 self.data = core::ptr::null_mut();
15193 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15194 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15197 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15198 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15199 let datalen = v.len();
15200 let data = Box::into_raw(v.into_boxed_slice());
15201 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15205 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15206 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15207 impl Drop for CVec_PhantomRouteHintsZ {
15208 fn drop(&mut self) {
15209 if self.datalen == 0 { return; }
15210 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15214 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15215 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15216 /// A pointer to the contents in the success state.
15217 /// Reading from this pointer when `result_ok` is not set is undefined.
15218 pub result: *mut crate::lightning_invoice::Invoice,
15219 /// A pointer to the contents in the error state.
15220 /// Reading from this pointer when `result_ok` is set is undefined.
15221 pub err: *mut crate::lightning_invoice::SignOrCreationError,
15224 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15225 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15227 pub struct CResult_InvoiceSignOrCreationErrorZ {
15228 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15229 /// `err` or `result` depending on the state of `result_ok`.
15230 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15231 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15232 pub result_ok: bool,
15235 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15236 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15237 CResult_InvoiceSignOrCreationErrorZ {
15238 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15239 result: Box::into_raw(Box::new(o)),
15245 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15246 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15247 CResult_InvoiceSignOrCreationErrorZ {
15248 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15249 err: Box::into_raw(Box::new(e)),
15254 /// Checks if the given object is currently in the success state
15256 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15260 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15261 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15262 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15263 fn drop(&mut self) {
15264 if self.result_ok {
15265 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15266 let _ = unsafe { Box::from_raw(self.contents.result) };
15269 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15270 let _ = unsafe { Box::from_raw(self.contents.err) };
15275 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15276 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15277 let contents = if o.result_ok {
15278 let result = unsafe { o.contents.result };
15279 unsafe { o.contents.result = core::ptr::null_mut() };
15280 CResult_InvoiceSignOrCreationErrorZPtr { result }
15282 let err = unsafe { o.contents.err };
15283 unsafe { o.contents.err = core::ptr::null_mut(); }
15284 CResult_InvoiceSignOrCreationErrorZPtr { err }
15288 result_ok: o.result_ok,
15292 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15293 fn clone(&self) -> Self {
15294 if self.result_ok {
15295 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15296 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15299 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15300 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15306 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15307 /// but with all dynamically-allocated buffers duplicated in new buffers.
15308 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15310 /// An enum which can either contain a crate::lightning::chain::Filter or not
15311 pub enum COption_FilterZ {
15312 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15313 Some(crate::lightning::chain::Filter),
15314 /// When we're in this state, this COption_FilterZ contains nothing
15317 impl COption_FilterZ {
15318 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15319 if let Self::None = self { false } else { true }
15321 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15324 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15325 if let Self::Some(v) = self { v } else { unreachable!() }
15329 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15330 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15331 COption_FilterZ::Some(o)
15334 /// Constructs a new COption_FilterZ containing nothing
15335 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15336 COption_FilterZ::None
15339 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15340 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15342 /// The contents of CResult_LockedChannelMonitorNoneZ
15343 pub union CResult_LockedChannelMonitorNoneZPtr {
15344 /// A pointer to the contents in the success state.
15345 /// Reading from this pointer when `result_ok` is not set is undefined.
15346 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15347 /// Note that this value is always NULL, as there are no contents in the Err variant
15348 pub err: *mut core::ffi::c_void,
15351 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15352 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15353 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15354 pub struct CResult_LockedChannelMonitorNoneZ {
15355 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15356 /// `err` or `result` depending on the state of `result_ok`.
15357 pub contents: CResult_LockedChannelMonitorNoneZPtr,
15358 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15359 pub result_ok: bool,
15362 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15363 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15364 CResult_LockedChannelMonitorNoneZ {
15365 contents: CResult_LockedChannelMonitorNoneZPtr {
15366 result: Box::into_raw(Box::new(o)),
15372 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15373 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15374 CResult_LockedChannelMonitorNoneZ {
15375 contents: CResult_LockedChannelMonitorNoneZPtr {
15376 err: core::ptr::null_mut(),
15381 /// Checks if the given object is currently in the success state
15383 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15387 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15388 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15389 impl Drop for CResult_LockedChannelMonitorNoneZ {
15390 fn drop(&mut self) {
15391 if self.result_ok {
15392 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15393 let _ = unsafe { Box::from_raw(self.contents.result) };
15399 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15400 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15401 let contents = if o.result_ok {
15402 let result = unsafe { o.contents.result };
15403 unsafe { o.contents.result = core::ptr::null_mut() };
15404 CResult_LockedChannelMonitorNoneZPtr { result }
15406 let _ = unsafe { Box::from_raw(o.contents.err) };
15407 o.contents.err = core::ptr::null_mut();
15408 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15412 result_ok: o.result_ok,
15417 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15418 /// This corresponds to std::vector in C++
15419 pub struct CVec_OutPointZ {
15420 /// The elements in the array.
15421 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15422 pub data: *mut crate::lightning::chain::transaction::OutPoint,
15423 /// The number of elements pointed to by `data`.
15426 impl CVec_OutPointZ {
15427 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15428 if self.datalen == 0 { return Vec::new(); }
15429 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15430 self.data = core::ptr::null_mut();
15434 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15435 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15438 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15439 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15440 let datalen = v.len();
15441 let data = Box::into_raw(v.into_boxed_slice());
15442 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15446 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15447 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15448 impl Drop for CVec_OutPointZ {
15449 fn drop(&mut self) {
15450 if self.datalen == 0 { return; }
15451 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15454 impl Clone for CVec_OutPointZ {
15455 fn clone(&self) -> Self {
15456 let mut res = Vec::new();
15457 if self.datalen == 0 { return Self::from(res); }
15458 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });