2 use alloc::str::FromStr;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
11 /// The contents of CResult_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13 /// Note that this value is always NULL, as there are no contents in the OK variant
14 pub result: *mut core::ffi::c_void,
15 /// Note that this value is always NULL, as there are no contents in the Err variant
16 pub err: *mut core::ffi::c_void,
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23 /// The contents of this CResult_NoneNoneZ, accessible via either
24 /// `err` or `result` depending on the state of `result_ok`.
25 pub contents: CResult_NoneNoneZPtr,
26 /// Whether this CResult_NoneNoneZ represents a success state.
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
33 contents: CResult_NoneNoneZPtr {
34 result: core::ptr::null_mut(),
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
43 contents: CResult_NoneNoneZPtr {
44 err: core::ptr::null_mut(),
49 /// Checks if the given object is currently in the success state
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66 let contents = if o.result_ok {
67 let _ = unsafe { Box::from_raw(o.contents.result) };
68 o.contents.result = core::ptr::null_mut();
69 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
71 let _ = unsafe { Box::from_raw(o.contents.err) };
72 o.contents.err = core::ptr::null_mut();
73 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
77 result_ok: o.result_ok,
81 impl Clone for CResult_NoneNoneZ {
82 fn clone(&self) -> Self {
84 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85 result: core::ptr::null_mut()
88 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89 err: core::ptr::null_mut()
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101 /// A pointer to the contents in the success state.
102 /// Reading from this pointer when `result_ok` is not set is undefined.
103 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104 /// A pointer to the contents in the error state.
105 /// Reading from this pointer when `result_ok` is set is undefined.
106 pub err: *mut crate::lightning::ln::msgs::DecodeError,
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114 /// `err` or `result` depending on the state of `result_ok`.
115 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124 result: Box::into_raw(Box::new(o)),
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134 err: Box::into_raw(Box::new(e)),
139 /// Checks if the given object is currently in the success state
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
150 if unsafe { !(self.contents.result as *mut ()).is_null() } {
151 let _ = unsafe { Box::from_raw(self.contents.result) };
154 if unsafe { !(self.contents.err as *mut ()).is_null() } {
155 let _ = unsafe { Box::from_raw(self.contents.err) };
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162 let contents = if o.result_ok {
163 let result = unsafe { o.contents.result };
164 unsafe { o.contents.result = core::ptr::null_mut() };
165 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
167 let err = unsafe { o.contents.err };
168 unsafe { o.contents.err = core::ptr::null_mut(); }
169 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
173 result_ok: o.result_ok,
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178 fn clone(&self) -> Self {
180 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
184 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197 /// A pointer to the contents in the success state.
198 /// Reading from this pointer when `result_ok` is not set is undefined.
199 pub result: *mut crate::c_types::SecretKey,
200 /// A pointer to the contents in the error state.
201 /// Reading from this pointer when `result_ok` is set is undefined.
202 pub err: *mut crate::c_types::Secp256k1Error,
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210 /// `err` or `result` depending on the state of `result_ok`.
211 pub contents: CResult_SecretKeyErrorZPtr,
212 /// Whether this CResult_SecretKeyErrorZ represents a success state.
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218 CResult_SecretKeyErrorZ {
219 contents: CResult_SecretKeyErrorZPtr {
220 result: Box::into_raw(Box::new(o)),
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228 CResult_SecretKeyErrorZ {
229 contents: CResult_SecretKeyErrorZPtr {
230 err: Box::into_raw(Box::new(e)),
235 /// Checks if the given object is currently in the success state
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
247 let _ = unsafe { Box::from_raw(self.contents.result) };
250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
251 let _ = unsafe { Box::from_raw(self.contents.err) };
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258 let contents = if o.result_ok {
259 let result = unsafe { o.contents.result };
260 unsafe { o.contents.result = core::ptr::null_mut() };
261 CResult_SecretKeyErrorZPtr { result }
263 let err = unsafe { o.contents.err };
264 unsafe { o.contents.err = core::ptr::null_mut(); }
265 CResult_SecretKeyErrorZPtr { err }
269 result_ok: o.result_ok,
273 impl Clone for CResult_SecretKeyErrorZ {
274 fn clone(&self) -> Self {
276 Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
280 Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293 /// A pointer to the contents in the success state.
294 /// Reading from this pointer when `result_ok` is not set is undefined.
295 pub result: *mut crate::c_types::PublicKey,
296 /// A pointer to the contents in the error state.
297 /// Reading from this pointer when `result_ok` is set is undefined.
298 pub err: *mut crate::c_types::Secp256k1Error,
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306 /// `err` or `result` depending on the state of `result_ok`.
307 pub contents: CResult_PublicKeyErrorZPtr,
308 /// Whether this CResult_PublicKeyErrorZ represents a success state.
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314 CResult_PublicKeyErrorZ {
315 contents: CResult_PublicKeyErrorZPtr {
316 result: Box::into_raw(Box::new(o)),
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324 CResult_PublicKeyErrorZ {
325 contents: CResult_PublicKeyErrorZPtr {
326 err: Box::into_raw(Box::new(e)),
331 /// Checks if the given object is currently in the success state
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
343 let _ = unsafe { Box::from_raw(self.contents.result) };
346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
347 let _ = unsafe { Box::from_raw(self.contents.err) };
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354 let contents = if o.result_ok {
355 let result = unsafe { o.contents.result };
356 unsafe { o.contents.result = core::ptr::null_mut() };
357 CResult_PublicKeyErrorZPtr { result }
359 let err = unsafe { o.contents.err };
360 unsafe { o.contents.err = core::ptr::null_mut(); }
361 CResult_PublicKeyErrorZPtr { err }
365 result_ok: o.result_ok,
369 impl Clone for CResult_PublicKeyErrorZ {
370 fn clone(&self) -> Self {
372 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
376 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389 /// A pointer to the contents in the success state.
390 /// Reading from this pointer when `result_ok` is not set is undefined.
391 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392 /// A pointer to the contents in the error state.
393 /// Reading from this pointer when `result_ok` is set is undefined.
394 pub err: *mut crate::lightning::ln::msgs::DecodeError,
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402 /// `err` or `result` depending on the state of `result_ok`.
403 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410 CResult_TxCreationKeysDecodeErrorZ {
411 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412 result: Box::into_raw(Box::new(o)),
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420 CResult_TxCreationKeysDecodeErrorZ {
421 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422 err: Box::into_raw(Box::new(e)),
427 /// Checks if the given object is currently in the success state
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
438 if unsafe { !(self.contents.result as *mut ()).is_null() } {
439 let _ = unsafe { Box::from_raw(self.contents.result) };
442 if unsafe { !(self.contents.err as *mut ()).is_null() } {
443 let _ = unsafe { Box::from_raw(self.contents.err) };
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450 let contents = if o.result_ok {
451 let result = unsafe { o.contents.result };
452 unsafe { o.contents.result = core::ptr::null_mut() };
453 CResult_TxCreationKeysDecodeErrorZPtr { result }
455 let err = unsafe { o.contents.err };
456 unsafe { o.contents.err = core::ptr::null_mut(); }
457 CResult_TxCreationKeysDecodeErrorZPtr { err }
461 result_ok: o.result_ok,
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466 fn clone(&self) -> Self {
468 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
472 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485 /// A pointer to the contents in the success state.
486 /// Reading from this pointer when `result_ok` is not set is undefined.
487 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488 /// A pointer to the contents in the error state.
489 /// Reading from this pointer when `result_ok` is set is undefined.
490 pub err: *mut crate::lightning::ln::msgs::DecodeError,
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498 /// `err` or `result` depending on the state of `result_ok`.
499 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506 CResult_ChannelPublicKeysDecodeErrorZ {
507 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508 result: Box::into_raw(Box::new(o)),
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516 CResult_ChannelPublicKeysDecodeErrorZ {
517 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518 err: Box::into_raw(Box::new(e)),
523 /// Checks if the given object is currently in the success state
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
534 if unsafe { !(self.contents.result as *mut ()).is_null() } {
535 let _ = unsafe { Box::from_raw(self.contents.result) };
538 if unsafe { !(self.contents.err as *mut ()).is_null() } {
539 let _ = unsafe { Box::from_raw(self.contents.err) };
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546 let contents = if o.result_ok {
547 let result = unsafe { o.contents.result };
548 unsafe { o.contents.result = core::ptr::null_mut() };
549 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
551 let err = unsafe { o.contents.err };
552 unsafe { o.contents.err = core::ptr::null_mut(); }
553 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
557 result_ok: o.result_ok,
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562 fn clone(&self) -> Self {
564 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
568 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581 /// A pointer to the contents in the success state.
582 /// Reading from this pointer when `result_ok` is not set is undefined.
583 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584 /// A pointer to the contents in the error state.
585 /// Reading from this pointer when `result_ok` is set is undefined.
586 pub err: *mut crate::c_types::Secp256k1Error,
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594 /// `err` or `result` depending on the state of `result_ok`.
595 pub contents: CResult_TxCreationKeysErrorZPtr,
596 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602 CResult_TxCreationKeysErrorZ {
603 contents: CResult_TxCreationKeysErrorZPtr {
604 result: Box::into_raw(Box::new(o)),
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612 CResult_TxCreationKeysErrorZ {
613 contents: CResult_TxCreationKeysErrorZPtr {
614 err: Box::into_raw(Box::new(e)),
619 /// Checks if the given object is currently in the success state
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
630 if unsafe { !(self.contents.result as *mut ()).is_null() } {
631 let _ = unsafe { Box::from_raw(self.contents.result) };
634 if unsafe { !(self.contents.err as *mut ()).is_null() } {
635 let _ = unsafe { Box::from_raw(self.contents.err) };
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642 let contents = if o.result_ok {
643 let result = unsafe { o.contents.result };
644 unsafe { o.contents.result = core::ptr::null_mut() };
645 CResult_TxCreationKeysErrorZPtr { result }
647 let err = unsafe { o.contents.err };
648 unsafe { o.contents.err = core::ptr::null_mut(); }
649 CResult_TxCreationKeysErrorZPtr { err }
653 result_ok: o.result_ok,
657 impl Clone for CResult_TxCreationKeysErrorZ {
658 fn clone(&self) -> Self {
660 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
664 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678 /// When we're in this state, this COption_u32Z contains a u32
680 /// When we're in this state, this COption_u32Z contains nothing
684 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685 if let Self::None = self { false } else { true }
687 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
690 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691 if let Self::Some(v) = self { v } else { unreachable!() }
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697 COption_u32Z::Some(o)
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714 /// A pointer to the contents in the success state.
715 /// Reading from this pointer when `result_ok` is not set is undefined.
716 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717 /// A pointer to the contents in the error state.
718 /// Reading from this pointer when `result_ok` is set is undefined.
719 pub err: *mut crate::lightning::ln::msgs::DecodeError,
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727 /// `err` or `result` depending on the state of `result_ok`.
728 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735 CResult_HTLCOutputInCommitmentDecodeErrorZ {
736 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737 result: Box::into_raw(Box::new(o)),
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745 CResult_HTLCOutputInCommitmentDecodeErrorZ {
746 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747 err: Box::into_raw(Box::new(e)),
752 /// Checks if the given object is currently in the success state
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
763 if unsafe { !(self.contents.result as *mut ()).is_null() } {
764 let _ = unsafe { Box::from_raw(self.contents.result) };
767 if unsafe { !(self.contents.err as *mut ()).is_null() } {
768 let _ = unsafe { Box::from_raw(self.contents.err) };
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775 let contents = if o.result_ok {
776 let result = unsafe { o.contents.result };
777 unsafe { o.contents.result = core::ptr::null_mut() };
778 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
780 let err = unsafe { o.contents.err };
781 unsafe { o.contents.err = core::ptr::null_mut(); }
782 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
786 result_ok: o.result_ok,
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791 fn clone(&self) -> Self {
793 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
797 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
808 /// An enum which can either contain a or not
809 pub enum COption_NoneZ {
810 /// When we're in this state, this COption_NoneZ contains a
812 /// When we're in this state, this COption_NoneZ contains nothing
816 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817 if let Self::None = self { false } else { true }
819 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
824 /// Constructs a new COption_NoneZ containing a
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839 /// A pointer to the contents in the success state.
840 /// Reading from this pointer when `result_ok` is not set is undefined.
841 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842 /// A pointer to the contents in the error state.
843 /// Reading from this pointer when `result_ok` is set is undefined.
844 pub err: *mut crate::lightning::ln::msgs::DecodeError,
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852 /// `err` or `result` depending on the state of `result_ok`.
853 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862 result: Box::into_raw(Box::new(o)),
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872 err: Box::into_raw(Box::new(e)),
877 /// Checks if the given object is currently in the success state
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
888 if unsafe { !(self.contents.result as *mut ()).is_null() } {
889 let _ = unsafe { Box::from_raw(self.contents.result) };
892 if unsafe { !(self.contents.err as *mut ()).is_null() } {
893 let _ = unsafe { Box::from_raw(self.contents.err) };
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900 let contents = if o.result_ok {
901 let result = unsafe { o.contents.result };
902 unsafe { o.contents.result = core::ptr::null_mut() };
903 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
905 let err = unsafe { o.contents.err };
906 unsafe { o.contents.err = core::ptr::null_mut(); }
907 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
911 result_ok: o.result_ok,
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916 fn clone(&self) -> Self {
918 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
922 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935 /// A pointer to the contents in the success state.
936 /// Reading from this pointer when `result_ok` is not set is undefined.
937 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938 /// A pointer to the contents in the error state.
939 /// Reading from this pointer when `result_ok` is set is undefined.
940 pub err: *mut crate::lightning::ln::msgs::DecodeError,
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948 /// `err` or `result` depending on the state of `result_ok`.
949 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956 CResult_ChannelTransactionParametersDecodeErrorZ {
957 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958 result: Box::into_raw(Box::new(o)),
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966 CResult_ChannelTransactionParametersDecodeErrorZ {
967 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968 err: Box::into_raw(Box::new(e)),
973 /// Checks if the given object is currently in the success state
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
984 if unsafe { !(self.contents.result as *mut ()).is_null() } {
985 let _ = unsafe { Box::from_raw(self.contents.result) };
988 if unsafe { !(self.contents.err as *mut ()).is_null() } {
989 let _ = unsafe { Box::from_raw(self.contents.err) };
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996 let contents = if o.result_ok {
997 let result = unsafe { o.contents.result };
998 unsafe { o.contents.result = core::ptr::null_mut() };
999 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1001 let err = unsafe { o.contents.err };
1002 unsafe { o.contents.err = core::ptr::null_mut(); }
1003 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1007 result_ok: o.result_ok,
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012 fn clone(&self) -> Self {
1014 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1018 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032 /// The elements in the array.
1033 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034 pub data: *mut crate::c_types::Signature,
1035 /// The number of elements pointed to by `data`.
1038 impl CVec_SignatureZ {
1039 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040 if self.datalen == 0 { return Vec::new(); }
1041 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042 self.data = core::ptr::null_mut();
1046 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051 fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052 let datalen = v.len();
1053 let data = Box::into_raw(v.into_boxed_slice());
1054 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061 fn drop(&mut self) {
1062 if self.datalen == 0 { return; }
1063 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1066 impl Clone for CVec_SignatureZ {
1067 fn clone(&self) -> Self {
1068 let mut res = Vec::new();
1069 if self.datalen == 0 { return Self::from(res); }
1070 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077 /// A pointer to the contents in the success state.
1078 /// Reading from this pointer when `result_ok` is not set is undefined.
1079 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080 /// A pointer to the contents in the error state.
1081 /// Reading from this pointer when `result_ok` is set is undefined.
1082 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090 /// `err` or `result` depending on the state of `result_ok`.
1091 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093 pub result_ok: bool,
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098 CResult_HolderCommitmentTransactionDecodeErrorZ {
1099 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100 result: Box::into_raw(Box::new(o)),
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108 CResult_HolderCommitmentTransactionDecodeErrorZ {
1109 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110 err: Box::into_raw(Box::new(e)),
1115 /// Checks if the given object is currently in the success state
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124 fn drop(&mut self) {
1126 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127 let _ = unsafe { Box::from_raw(self.contents.result) };
1130 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131 let _ = unsafe { Box::from_raw(self.contents.err) };
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138 let contents = if o.result_ok {
1139 let result = unsafe { o.contents.result };
1140 unsafe { o.contents.result = core::ptr::null_mut() };
1141 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1143 let err = unsafe { o.contents.err };
1144 unsafe { o.contents.err = core::ptr::null_mut(); }
1145 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1149 result_ok: o.result_ok,
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154 fn clone(&self) -> Self {
1156 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1160 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173 /// A pointer to the contents in the success state.
1174 /// Reading from this pointer when `result_ok` is not set is undefined.
1175 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176 /// A pointer to the contents in the error state.
1177 /// Reading from this pointer when `result_ok` is set is undefined.
1178 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186 /// `err` or `result` depending on the state of `result_ok`.
1187 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189 pub result_ok: bool,
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196 result: Box::into_raw(Box::new(o)),
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206 err: Box::into_raw(Box::new(e)),
1211 /// Checks if the given object is currently in the success state
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220 fn drop(&mut self) {
1222 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223 let _ = unsafe { Box::from_raw(self.contents.result) };
1226 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227 let _ = unsafe { Box::from_raw(self.contents.err) };
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234 let contents = if o.result_ok {
1235 let result = unsafe { o.contents.result };
1236 unsafe { o.contents.result = core::ptr::null_mut() };
1237 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1239 let err = unsafe { o.contents.err };
1240 unsafe { o.contents.err = core::ptr::null_mut(); }
1241 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1245 result_ok: o.result_ok,
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250 fn clone(&self) -> Self {
1252 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1256 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269 /// A pointer to the contents in the success state.
1270 /// Reading from this pointer when `result_ok` is not set is undefined.
1271 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272 /// Note that this value is always NULL, as there are no contents in the Err variant
1273 pub err: *mut core::ffi::c_void,
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281 /// `err` or `result` depending on the state of `result_ok`.
1282 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284 pub result_ok: bool,
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289 CResult_TrustedClosingTransactionNoneZ {
1290 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291 result: Box::into_raw(Box::new(o)),
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299 CResult_TrustedClosingTransactionNoneZ {
1300 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301 err: core::ptr::null_mut(),
1306 /// Checks if the given object is currently in the success state
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315 fn drop(&mut self) {
1317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318 let _ = unsafe { Box::from_raw(self.contents.result) };
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326 let contents = if o.result_ok {
1327 let result = unsafe { o.contents.result };
1328 unsafe { o.contents.result = core::ptr::null_mut() };
1329 CResult_TrustedClosingTransactionNoneZPtr { result }
1331 let _ = unsafe { Box::from_raw(o.contents.err) };
1332 o.contents.err = core::ptr::null_mut();
1333 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1337 result_ok: o.result_ok,
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344 /// A pointer to the contents in the success state.
1345 /// Reading from this pointer when `result_ok` is not set is undefined.
1346 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347 /// A pointer to the contents in the error state.
1348 /// Reading from this pointer when `result_ok` is set is undefined.
1349 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357 /// `err` or `result` depending on the state of `result_ok`.
1358 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360 pub result_ok: bool,
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365 CResult_CommitmentTransactionDecodeErrorZ {
1366 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367 result: Box::into_raw(Box::new(o)),
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375 CResult_CommitmentTransactionDecodeErrorZ {
1376 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377 err: Box::into_raw(Box::new(e)),
1382 /// Checks if the given object is currently in the success state
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391 fn drop(&mut self) {
1393 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394 let _ = unsafe { Box::from_raw(self.contents.result) };
1397 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398 let _ = unsafe { Box::from_raw(self.contents.err) };
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405 let contents = if o.result_ok {
1406 let result = unsafe { o.contents.result };
1407 unsafe { o.contents.result = core::ptr::null_mut() };
1408 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1410 let err = unsafe { o.contents.err };
1411 unsafe { o.contents.err = core::ptr::null_mut(); }
1412 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1416 result_ok: o.result_ok,
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421 fn clone(&self) -> Self {
1423 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1427 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440 /// A pointer to the contents in the success state.
1441 /// Reading from this pointer when `result_ok` is not set is undefined.
1442 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443 /// Note that this value is always NULL, as there are no contents in the Err variant
1444 pub err: *mut core::ffi::c_void,
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452 /// `err` or `result` depending on the state of `result_ok`.
1453 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455 pub result_ok: bool,
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460 CResult_TrustedCommitmentTransactionNoneZ {
1461 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462 result: Box::into_raw(Box::new(o)),
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470 CResult_TrustedCommitmentTransactionNoneZ {
1471 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472 err: core::ptr::null_mut(),
1477 /// Checks if the given object is currently in the success state
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486 fn drop(&mut self) {
1488 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489 let _ = unsafe { Box::from_raw(self.contents.result) };
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497 let contents = if o.result_ok {
1498 let result = unsafe { o.contents.result };
1499 unsafe { o.contents.result = core::ptr::null_mut() };
1500 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1502 let _ = unsafe { Box::from_raw(o.contents.err) };
1503 o.contents.err = core::ptr::null_mut();
1504 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1508 result_ok: o.result_ok,
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515 /// A pointer to the contents in the success state.
1516 /// Reading from this pointer when `result_ok` is not set is undefined.
1517 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518 /// Note that this value is always NULL, as there are no contents in the Err variant
1519 pub err: *mut core::ffi::c_void,
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527 /// `err` or `result` depending on the state of `result_ok`.
1528 pub contents: CResult_CVec_SignatureZNoneZPtr,
1529 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530 pub result_ok: bool,
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535 CResult_CVec_SignatureZNoneZ {
1536 contents: CResult_CVec_SignatureZNoneZPtr {
1537 result: Box::into_raw(Box::new(o)),
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545 CResult_CVec_SignatureZNoneZ {
1546 contents: CResult_CVec_SignatureZNoneZPtr {
1547 err: core::ptr::null_mut(),
1552 /// Checks if the given object is currently in the success state
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561 fn drop(&mut self) {
1563 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564 let _ = unsafe { Box::from_raw(self.contents.result) };
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572 let contents = if o.result_ok {
1573 let result = unsafe { o.contents.result };
1574 unsafe { o.contents.result = core::ptr::null_mut() };
1575 CResult_CVec_SignatureZNoneZPtr { result }
1577 let _ = unsafe { Box::from_raw(o.contents.err) };
1578 o.contents.err = core::ptr::null_mut();
1579 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1583 result_ok: o.result_ok,
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588 fn clone(&self) -> Self {
1590 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1594 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595 err: core::ptr::null_mut()
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607 /// A pointer to the contents in the success state.
1608 /// Reading from this pointer when `result_ok` is not set is undefined.
1609 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610 /// A pointer to the contents in the error state.
1611 /// Reading from this pointer when `result_ok` is set is undefined.
1612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620 /// `err` or `result` depending on the state of `result_ok`.
1621 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623 pub result_ok: bool,
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628 CResult_ShutdownScriptDecodeErrorZ {
1629 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630 result: Box::into_raw(Box::new(o)),
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638 CResult_ShutdownScriptDecodeErrorZ {
1639 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640 err: Box::into_raw(Box::new(e)),
1645 /// Checks if the given object is currently in the success state
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654 fn drop(&mut self) {
1656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657 let _ = unsafe { Box::from_raw(self.contents.result) };
1660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661 let _ = unsafe { Box::from_raw(self.contents.err) };
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668 let contents = if o.result_ok {
1669 let result = unsafe { o.contents.result };
1670 unsafe { o.contents.result = core::ptr::null_mut() };
1671 CResult_ShutdownScriptDecodeErrorZPtr { result }
1673 let err = unsafe { o.contents.err };
1674 unsafe { o.contents.err = core::ptr::null_mut(); }
1675 CResult_ShutdownScriptDecodeErrorZPtr { err }
1679 result_ok: o.result_ok,
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684 fn clone(&self) -> Self {
1686 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1690 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703 /// A pointer to the contents in the success state.
1704 /// Reading from this pointer when `result_ok` is not set is undefined.
1705 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706 /// A pointer to the contents in the error state.
1707 /// Reading from this pointer when `result_ok` is set is undefined.
1708 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716 /// `err` or `result` depending on the state of `result_ok`.
1717 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719 pub result_ok: bool,
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724 CResult_ShutdownScriptInvalidShutdownScriptZ {
1725 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726 result: Box::into_raw(Box::new(o)),
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734 CResult_ShutdownScriptInvalidShutdownScriptZ {
1735 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736 err: Box::into_raw(Box::new(e)),
1741 /// Checks if the given object is currently in the success state
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750 fn drop(&mut self) {
1752 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753 let _ = unsafe { Box::from_raw(self.contents.result) };
1756 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757 let _ = unsafe { Box::from_raw(self.contents.err) };
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764 let contents = if o.result_ok {
1765 let result = unsafe { o.contents.result };
1766 unsafe { o.contents.result = core::ptr::null_mut() };
1767 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1769 let err = unsafe { o.contents.err };
1770 unsafe { o.contents.err = core::ptr::null_mut(); }
1771 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1775 result_ok: o.result_ok,
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780 fn clone(&self) -> Self {
1782 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1786 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799 /// Note that this value is always NULL, as there are no contents in the OK variant
1800 pub result: *mut core::ffi::c_void,
1801 /// A pointer to the contents in the error state.
1802 /// Reading from this pointer when `result_ok` is set is undefined.
1803 pub err: *mut crate::c_types::IOError,
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810 /// The contents of this CResult_NoneErrorZ, accessible via either
1811 /// `err` or `result` depending on the state of `result_ok`.
1812 pub contents: CResult_NoneErrorZPtr,
1813 /// Whether this CResult_NoneErrorZ represents a success state.
1814 pub result_ok: bool,
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819 CResult_NoneErrorZ {
1820 contents: CResult_NoneErrorZPtr {
1821 result: core::ptr::null_mut(),
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829 CResult_NoneErrorZ {
1830 contents: CResult_NoneErrorZPtr {
1831 err: Box::into_raw(Box::new(e)),
1836 /// Checks if the given object is currently in the success state
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845 fn drop(&mut self) {
1848 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849 let _ = unsafe { Box::from_raw(self.contents.err) };
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856 let contents = if o.result_ok {
1857 let _ = unsafe { Box::from_raw(o.contents.result) };
1858 o.contents.result = core::ptr::null_mut();
1859 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1861 let err = unsafe { o.contents.err };
1862 unsafe { o.contents.err = core::ptr::null_mut(); }
1863 CResult_NoneErrorZPtr { err }
1867 result_ok: o.result_ok,
1871 impl Clone for CResult_NoneErrorZ {
1872 fn clone(&self) -> Self {
1874 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875 result: core::ptr::null_mut()
1878 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891 /// A pointer to the contents in the success state.
1892 /// Reading from this pointer when `result_ok` is not set is undefined.
1893 pub result: *mut crate::lightning::routing::router::RouteHop,
1894 /// A pointer to the contents in the error state.
1895 /// Reading from this pointer when `result_ok` is set is undefined.
1896 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904 /// `err` or `result` depending on the state of `result_ok`.
1905 pub contents: CResult_RouteHopDecodeErrorZPtr,
1906 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907 pub result_ok: bool,
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912 CResult_RouteHopDecodeErrorZ {
1913 contents: CResult_RouteHopDecodeErrorZPtr {
1914 result: Box::into_raw(Box::new(o)),
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922 CResult_RouteHopDecodeErrorZ {
1923 contents: CResult_RouteHopDecodeErrorZPtr {
1924 err: Box::into_raw(Box::new(e)),
1929 /// Checks if the given object is currently in the success state
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938 fn drop(&mut self) {
1940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941 let _ = unsafe { Box::from_raw(self.contents.result) };
1944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945 let _ = unsafe { Box::from_raw(self.contents.err) };
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952 let contents = if o.result_ok {
1953 let result = unsafe { o.contents.result };
1954 unsafe { o.contents.result = core::ptr::null_mut() };
1955 CResult_RouteHopDecodeErrorZPtr { result }
1957 let err = unsafe { o.contents.err };
1958 unsafe { o.contents.err = core::ptr::null_mut(); }
1959 CResult_RouteHopDecodeErrorZPtr { err }
1963 result_ok: o.result_ok,
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968 fn clone(&self) -> Self {
1970 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1974 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988 /// The elements in the array.
1989 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990 pub data: *mut crate::lightning::routing::router::RouteHop,
1991 /// The number of elements pointed to by `data`.
1994 impl CVec_RouteHopZ {
1995 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996 if self.datalen == 0 { return Vec::new(); }
1997 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998 self.data = core::ptr::null_mut();
2002 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008 let datalen = v.len();
2009 let data = Box::into_raw(v.into_boxed_slice());
2010 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017 fn drop(&mut self) {
2018 if self.datalen == 0 { return; }
2019 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2022 impl Clone for CVec_RouteHopZ {
2023 fn clone(&self) -> Self {
2024 let mut res = Vec::new();
2025 if self.datalen == 0 { return Self::from(res); }
2026 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034 /// The elements in the array.
2035 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037 /// The number of elements pointed to by `data`.
2040 impl CVec_CVec_RouteHopZZ {
2041 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042 if self.datalen == 0 { return Vec::new(); }
2043 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044 self.data = core::ptr::null_mut();
2048 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054 let datalen = v.len();
2055 let data = Box::into_raw(v.into_boxed_slice());
2056 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063 fn drop(&mut self) {
2064 if self.datalen == 0 { return; }
2065 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069 fn clone(&self) -> Self {
2070 let mut res = Vec::new();
2071 if self.datalen == 0 { return Self::from(res); }
2072 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079 /// A pointer to the contents in the success state.
2080 /// Reading from this pointer when `result_ok` is not set is undefined.
2081 pub result: *mut crate::lightning::routing::router::Route,
2082 /// A pointer to the contents in the error state.
2083 /// Reading from this pointer when `result_ok` is set is undefined.
2084 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092 /// `err` or `result` depending on the state of `result_ok`.
2093 pub contents: CResult_RouteDecodeErrorZPtr,
2094 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095 pub result_ok: bool,
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100 CResult_RouteDecodeErrorZ {
2101 contents: CResult_RouteDecodeErrorZPtr {
2102 result: Box::into_raw(Box::new(o)),
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110 CResult_RouteDecodeErrorZ {
2111 contents: CResult_RouteDecodeErrorZPtr {
2112 err: Box::into_raw(Box::new(e)),
2117 /// Checks if the given object is currently in the success state
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126 fn drop(&mut self) {
2128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129 let _ = unsafe { Box::from_raw(self.contents.result) };
2132 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133 let _ = unsafe { Box::from_raw(self.contents.err) };
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140 let contents = if o.result_ok {
2141 let result = unsafe { o.contents.result };
2142 unsafe { o.contents.result = core::ptr::null_mut() };
2143 CResult_RouteDecodeErrorZPtr { result }
2145 let err = unsafe { o.contents.err };
2146 unsafe { o.contents.err = core::ptr::null_mut(); }
2147 CResult_RouteDecodeErrorZPtr { err }
2151 result_ok: o.result_ok,
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156 fn clone(&self) -> Self {
2158 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2162 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175 /// A pointer to the contents in the success state.
2176 /// Reading from this pointer when `result_ok` is not set is undefined.
2177 pub result: *mut crate::lightning::routing::router::RouteParameters,
2178 /// A pointer to the contents in the error state.
2179 /// Reading from this pointer when `result_ok` is set is undefined.
2180 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188 /// `err` or `result` depending on the state of `result_ok`.
2189 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191 pub result_ok: bool,
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196 CResult_RouteParametersDecodeErrorZ {
2197 contents: CResult_RouteParametersDecodeErrorZPtr {
2198 result: Box::into_raw(Box::new(o)),
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206 CResult_RouteParametersDecodeErrorZ {
2207 contents: CResult_RouteParametersDecodeErrorZPtr {
2208 err: Box::into_raw(Box::new(e)),
2213 /// Checks if the given object is currently in the success state
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222 fn drop(&mut self) {
2224 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225 let _ = unsafe { Box::from_raw(self.contents.result) };
2228 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229 let _ = unsafe { Box::from_raw(self.contents.err) };
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236 let contents = if o.result_ok {
2237 let result = unsafe { o.contents.result };
2238 unsafe { o.contents.result = core::ptr::null_mut() };
2239 CResult_RouteParametersDecodeErrorZPtr { result }
2241 let err = unsafe { o.contents.err };
2242 unsafe { o.contents.err = core::ptr::null_mut(); }
2243 CResult_RouteParametersDecodeErrorZPtr { err }
2247 result_ok: o.result_ok,
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252 fn clone(&self) -> Self {
2254 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2258 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272 /// The elements in the array.
2273 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274 pub data: *mut crate::lightning::routing::router::RouteHint,
2275 /// The number of elements pointed to by `data`.
2278 impl CVec_RouteHintZ {
2279 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280 if self.datalen == 0 { return Vec::new(); }
2281 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282 self.data = core::ptr::null_mut();
2286 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292 let datalen = v.len();
2293 let data = Box::into_raw(v.into_boxed_slice());
2294 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301 fn drop(&mut self) {
2302 if self.datalen == 0 { return; }
2303 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2306 impl Clone for CVec_RouteHintZ {
2307 fn clone(&self) -> Self {
2308 let mut res = Vec::new();
2309 if self.datalen == 0 { return Self::from(res); }
2310 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318 /// When we're in this state, this COption_u64Z contains a u64
2320 /// When we're in this state, this COption_u64Z contains nothing
2324 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325 if let Self::None = self { false } else { true }
2327 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2330 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331 if let Self::Some(v) = self { v } else { unreachable!() }
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337 COption_u64Z::Some(o)
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354 /// A pointer to the contents in the success state.
2355 /// Reading from this pointer when `result_ok` is not set is undefined.
2356 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357 /// A pointer to the contents in the error state.
2358 /// Reading from this pointer when `result_ok` is set is undefined.
2359 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367 /// `err` or `result` depending on the state of `result_ok`.
2368 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370 pub result_ok: bool,
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375 CResult_PaymentParametersDecodeErrorZ {
2376 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377 result: Box::into_raw(Box::new(o)),
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385 CResult_PaymentParametersDecodeErrorZ {
2386 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387 err: Box::into_raw(Box::new(e)),
2392 /// Checks if the given object is currently in the success state
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401 fn drop(&mut self) {
2403 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404 let _ = unsafe { Box::from_raw(self.contents.result) };
2407 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408 let _ = unsafe { Box::from_raw(self.contents.err) };
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415 let contents = if o.result_ok {
2416 let result = unsafe { o.contents.result };
2417 unsafe { o.contents.result = core::ptr::null_mut() };
2418 CResult_PaymentParametersDecodeErrorZPtr { result }
2420 let err = unsafe { o.contents.err };
2421 unsafe { o.contents.err = core::ptr::null_mut(); }
2422 CResult_PaymentParametersDecodeErrorZPtr { err }
2426 result_ok: o.result_ok,
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431 fn clone(&self) -> Self {
2433 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2437 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451 /// The elements in the array.
2452 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454 /// The number of elements pointed to by `data`.
2457 impl CVec_RouteHintHopZ {
2458 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459 if self.datalen == 0 { return Vec::new(); }
2460 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461 self.data = core::ptr::null_mut();
2465 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471 let datalen = v.len();
2472 let data = Box::into_raw(v.into_boxed_slice());
2473 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480 fn drop(&mut self) {
2481 if self.datalen == 0 { return; }
2482 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2485 impl Clone for CVec_RouteHintHopZ {
2486 fn clone(&self) -> Self {
2487 let mut res = Vec::new();
2488 if self.datalen == 0 { return Self::from(res); }
2489 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496 /// A pointer to the contents in the success state.
2497 /// Reading from this pointer when `result_ok` is not set is undefined.
2498 pub result: *mut crate::lightning::routing::router::RouteHint,
2499 /// A pointer to the contents in the error state.
2500 /// Reading from this pointer when `result_ok` is set is undefined.
2501 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509 /// `err` or `result` depending on the state of `result_ok`.
2510 pub contents: CResult_RouteHintDecodeErrorZPtr,
2511 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512 pub result_ok: bool,
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517 CResult_RouteHintDecodeErrorZ {
2518 contents: CResult_RouteHintDecodeErrorZPtr {
2519 result: Box::into_raw(Box::new(o)),
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527 CResult_RouteHintDecodeErrorZ {
2528 contents: CResult_RouteHintDecodeErrorZPtr {
2529 err: Box::into_raw(Box::new(e)),
2534 /// Checks if the given object is currently in the success state
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543 fn drop(&mut self) {
2545 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546 let _ = unsafe { Box::from_raw(self.contents.result) };
2549 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550 let _ = unsafe { Box::from_raw(self.contents.err) };
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557 let contents = if o.result_ok {
2558 let result = unsafe { o.contents.result };
2559 unsafe { o.contents.result = core::ptr::null_mut() };
2560 CResult_RouteHintDecodeErrorZPtr { result }
2562 let err = unsafe { o.contents.err };
2563 unsafe { o.contents.err = core::ptr::null_mut(); }
2564 CResult_RouteHintDecodeErrorZPtr { err }
2568 result_ok: o.result_ok,
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573 fn clone(&self) -> Self {
2575 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2579 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592 /// A pointer to the contents in the success state.
2593 /// Reading from this pointer when `result_ok` is not set is undefined.
2594 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595 /// A pointer to the contents in the error state.
2596 /// Reading from this pointer when `result_ok` is set is undefined.
2597 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605 /// `err` or `result` depending on the state of `result_ok`.
2606 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608 pub result_ok: bool,
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613 CResult_RouteHintHopDecodeErrorZ {
2614 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615 result: Box::into_raw(Box::new(o)),
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623 CResult_RouteHintHopDecodeErrorZ {
2624 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625 err: Box::into_raw(Box::new(e)),
2630 /// Checks if the given object is currently in the success state
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639 fn drop(&mut self) {
2641 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642 let _ = unsafe { Box::from_raw(self.contents.result) };
2645 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646 let _ = unsafe { Box::from_raw(self.contents.err) };
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653 let contents = if o.result_ok {
2654 let result = unsafe { o.contents.result };
2655 unsafe { o.contents.result = core::ptr::null_mut() };
2656 CResult_RouteHintHopDecodeErrorZPtr { result }
2658 let err = unsafe { o.contents.err };
2659 unsafe { o.contents.err = core::ptr::null_mut(); }
2660 CResult_RouteHintHopDecodeErrorZPtr { err }
2664 result_ok: o.result_ok,
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669 fn clone(&self) -> Self {
2671 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2675 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689 /// The elements in the array.
2690 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692 /// The number of elements pointed to by `data`.
2695 impl CVec_ChannelDetailsZ {
2696 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697 if self.datalen == 0 { return Vec::new(); }
2698 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699 self.data = core::ptr::null_mut();
2703 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709 let datalen = v.len();
2710 let data = Box::into_raw(v.into_boxed_slice());
2711 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718 fn drop(&mut self) {
2719 if self.datalen == 0 { return; }
2720 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2723 impl Clone for CVec_ChannelDetailsZ {
2724 fn clone(&self) -> Self {
2725 let mut res = Vec::new();
2726 if self.datalen == 0 { return Self::from(res); }
2727 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734 /// A pointer to the contents in the success state.
2735 /// Reading from this pointer when `result_ok` is not set is undefined.
2736 pub result: *mut crate::lightning::routing::router::Route,
2737 /// A pointer to the contents in the error state.
2738 /// Reading from this pointer when `result_ok` is set is undefined.
2739 pub err: *mut crate::lightning::ln::msgs::LightningError,
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747 /// `err` or `result` depending on the state of `result_ok`.
2748 pub contents: CResult_RouteLightningErrorZPtr,
2749 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750 pub result_ok: bool,
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755 CResult_RouteLightningErrorZ {
2756 contents: CResult_RouteLightningErrorZPtr {
2757 result: Box::into_raw(Box::new(o)),
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765 CResult_RouteLightningErrorZ {
2766 contents: CResult_RouteLightningErrorZPtr {
2767 err: Box::into_raw(Box::new(e)),
2772 /// Checks if the given object is currently in the success state
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781 fn drop(&mut self) {
2783 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784 let _ = unsafe { Box::from_raw(self.contents.result) };
2787 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788 let _ = unsafe { Box::from_raw(self.contents.err) };
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795 let contents = if o.result_ok {
2796 let result = unsafe { o.contents.result };
2797 unsafe { o.contents.result = core::ptr::null_mut() };
2798 CResult_RouteLightningErrorZPtr { result }
2800 let err = unsafe { o.contents.err };
2801 unsafe { o.contents.err = core::ptr::null_mut(); }
2802 CResult_RouteLightningErrorZPtr { err }
2806 result_ok: o.result_ok,
2810 impl Clone for CResult_RouteLightningErrorZ {
2811 fn clone(&self) -> Self {
2813 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2817 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2828 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2829 /// This corresponds to std::vector in C++
2830 pub struct CVec_PublicKeyZ {
2831 /// The elements in the array.
2832 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2833 pub data: *mut crate::c_types::PublicKey,
2834 /// The number of elements pointed to by `data`.
2837 impl CVec_PublicKeyZ {
2838 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
2839 if self.datalen == 0 { return Vec::new(); }
2840 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2841 self.data = core::ptr::null_mut();
2845 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
2846 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2849 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
2850 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
2851 let datalen = v.len();
2852 let data = Box::into_raw(v.into_boxed_slice());
2853 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2857 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2858 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
2859 impl Drop for CVec_PublicKeyZ {
2860 fn drop(&mut self) {
2861 if self.datalen == 0 { return; }
2862 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2865 impl Clone for CVec_PublicKeyZ {
2866 fn clone(&self) -> Self {
2867 let mut res = Vec::new();
2868 if self.datalen == 0 { return Self::from(res); }
2869 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2874 /// The contents of CResult_PaymentPurposeDecodeErrorZ
2875 pub union CResult_PaymentPurposeDecodeErrorZPtr {
2876 /// A pointer to the contents in the success state.
2877 /// Reading from this pointer when `result_ok` is not set is undefined.
2878 pub result: *mut crate::lightning::util::events::PaymentPurpose,
2879 /// A pointer to the contents in the error state.
2880 /// Reading from this pointer when `result_ok` is set is undefined.
2881 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2884 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2885 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2887 pub struct CResult_PaymentPurposeDecodeErrorZ {
2888 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2889 /// `err` or `result` depending on the state of `result_ok`.
2890 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
2891 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2892 pub result_ok: bool,
2895 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
2896 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
2897 CResult_PaymentPurposeDecodeErrorZ {
2898 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2899 result: Box::into_raw(Box::new(o)),
2905 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
2906 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
2907 CResult_PaymentPurposeDecodeErrorZ {
2908 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2909 err: Box::into_raw(Box::new(e)),
2914 /// Checks if the given object is currently in the success state
2916 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
2920 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
2921 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
2922 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
2923 fn drop(&mut self) {
2925 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2926 let _ = unsafe { Box::from_raw(self.contents.result) };
2929 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2930 let _ = unsafe { Box::from_raw(self.contents.err) };
2935 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
2936 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
2937 let contents = if o.result_ok {
2938 let result = unsafe { o.contents.result };
2939 unsafe { o.contents.result = core::ptr::null_mut() };
2940 CResult_PaymentPurposeDecodeErrorZPtr { result }
2942 let err = unsafe { o.contents.err };
2943 unsafe { o.contents.err = core::ptr::null_mut(); }
2944 CResult_PaymentPurposeDecodeErrorZPtr { err }
2948 result_ok: o.result_ok,
2952 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
2953 fn clone(&self) -> Self {
2955 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2956 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
2959 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2960 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2966 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
2967 /// but with all dynamically-allocated buffers duplicated in new buffers.
2968 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
2971 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2972 pub enum COption_ClosureReasonZ {
2973 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2974 Some(crate::lightning::util::events::ClosureReason),
2975 /// When we're in this state, this COption_ClosureReasonZ contains nothing
2978 impl COption_ClosureReasonZ {
2979 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2980 if let Self::None = self { false } else { true }
2982 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2985 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
2986 if let Self::Some(v) = self { v } else { unreachable!() }
2990 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
2991 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
2992 COption_ClosureReasonZ::Some(o)
2995 /// Constructs a new COption_ClosureReasonZ containing nothing
2996 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
2997 COption_ClosureReasonZ::None
3000 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3001 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3003 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3004 /// but with all dynamically-allocated buffers duplicated in new buffers.
3005 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3007 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3008 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3009 /// A pointer to the contents in the success state.
3010 /// Reading from this pointer when `result_ok` is not set is undefined.
3011 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3012 /// A pointer to the contents in the error state.
3013 /// Reading from this pointer when `result_ok` is set is undefined.
3014 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3017 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3018 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3019 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3020 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3021 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3022 /// `err` or `result` depending on the state of `result_ok`.
3023 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3024 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3025 pub result_ok: bool,
3028 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3029 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3030 CResult_COption_ClosureReasonZDecodeErrorZ {
3031 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3032 result: Box::into_raw(Box::new(o)),
3038 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3039 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3040 CResult_COption_ClosureReasonZDecodeErrorZ {
3041 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3042 err: Box::into_raw(Box::new(e)),
3047 /// Checks if the given object is currently in the success state
3049 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3053 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3054 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3055 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3056 fn drop(&mut self) {
3058 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3059 let _ = unsafe { Box::from_raw(self.contents.result) };
3062 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3063 let _ = unsafe { Box::from_raw(self.contents.err) };
3068 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3069 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3070 let contents = if o.result_ok {
3071 let result = unsafe { o.contents.result };
3072 unsafe { o.contents.result = core::ptr::null_mut() };
3073 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3075 let err = unsafe { o.contents.err };
3076 unsafe { o.contents.err = core::ptr::null_mut(); }
3077 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3081 result_ok: o.result_ok,
3085 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3086 fn clone(&self) -> Self {
3088 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3089 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3092 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3093 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3099 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3100 /// but with all dynamically-allocated buffers duplicated in new buffers.
3101 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3104 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3105 pub enum COption_NetworkUpdateZ {
3106 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3107 Some(crate::lightning::routing::gossip::NetworkUpdate),
3108 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3111 impl COption_NetworkUpdateZ {
3112 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3113 if let Self::None = self { false } else { true }
3115 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3118 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3119 if let Self::Some(v) = self { v } else { unreachable!() }
3123 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3124 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3125 COption_NetworkUpdateZ::Some(o)
3128 /// Constructs a new COption_NetworkUpdateZ containing nothing
3129 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3130 COption_NetworkUpdateZ::None
3133 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3134 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3136 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3137 /// but with all dynamically-allocated buffers duplicated in new buffers.
3138 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3140 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3141 /// This corresponds to std::vector in C++
3142 pub struct CVec_SpendableOutputDescriptorZ {
3143 /// The elements in the array.
3144 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3145 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3146 /// The number of elements pointed to by `data`.
3149 impl CVec_SpendableOutputDescriptorZ {
3150 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3151 if self.datalen == 0 { return Vec::new(); }
3152 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3153 self.data = core::ptr::null_mut();
3157 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3158 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3161 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3162 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3163 let datalen = v.len();
3164 let data = Box::into_raw(v.into_boxed_slice());
3165 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3169 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3170 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3171 impl Drop for CVec_SpendableOutputDescriptorZ {
3172 fn drop(&mut self) {
3173 if self.datalen == 0 { return; }
3174 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3177 impl Clone for CVec_SpendableOutputDescriptorZ {
3178 fn clone(&self) -> Self {
3179 let mut res = Vec::new();
3180 if self.datalen == 0 { return Self::from(res); }
3181 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3187 /// An enum which can either contain a crate::lightning::util::events::Event or not
3188 pub enum COption_EventZ {
3189 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3190 Some(crate::lightning::util::events::Event),
3191 /// When we're in this state, this COption_EventZ contains nothing
3194 impl COption_EventZ {
3195 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3196 if let Self::None = self { false } else { true }
3198 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3201 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3202 if let Self::Some(v) = self { v } else { unreachable!() }
3206 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3207 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3208 COption_EventZ::Some(o)
3211 /// Constructs a new COption_EventZ containing nothing
3212 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3213 COption_EventZ::None
3216 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3217 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3219 /// Creates a new COption_EventZ which has the same data as `orig`
3220 /// but with all dynamically-allocated buffers duplicated in new buffers.
3221 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3223 /// The contents of CResult_COption_EventZDecodeErrorZ
3224 pub union CResult_COption_EventZDecodeErrorZPtr {
3225 /// A pointer to the contents in the success state.
3226 /// Reading from this pointer when `result_ok` is not set is undefined.
3227 pub result: *mut crate::c_types::derived::COption_EventZ,
3228 /// A pointer to the contents in the error state.
3229 /// Reading from this pointer when `result_ok` is set is undefined.
3230 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3233 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3234 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3236 pub struct CResult_COption_EventZDecodeErrorZ {
3237 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3238 /// `err` or `result` depending on the state of `result_ok`.
3239 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3240 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3241 pub result_ok: bool,
3244 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3245 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3246 CResult_COption_EventZDecodeErrorZ {
3247 contents: CResult_COption_EventZDecodeErrorZPtr {
3248 result: Box::into_raw(Box::new(o)),
3254 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3255 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3256 CResult_COption_EventZDecodeErrorZ {
3257 contents: CResult_COption_EventZDecodeErrorZPtr {
3258 err: Box::into_raw(Box::new(e)),
3263 /// Checks if the given object is currently in the success state
3265 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3269 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3270 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3271 impl Drop for CResult_COption_EventZDecodeErrorZ {
3272 fn drop(&mut self) {
3274 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3275 let _ = unsafe { Box::from_raw(self.contents.result) };
3278 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3279 let _ = unsafe { Box::from_raw(self.contents.err) };
3284 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3285 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3286 let contents = if o.result_ok {
3287 let result = unsafe { o.contents.result };
3288 unsafe { o.contents.result = core::ptr::null_mut() };
3289 CResult_COption_EventZDecodeErrorZPtr { result }
3291 let err = unsafe { o.contents.err };
3292 unsafe { o.contents.err = core::ptr::null_mut(); }
3293 CResult_COption_EventZDecodeErrorZPtr { err }
3297 result_ok: o.result_ok,
3301 impl Clone for CResult_COption_EventZDecodeErrorZ {
3302 fn clone(&self) -> Self {
3304 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3305 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3308 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3309 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3315 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3316 /// but with all dynamically-allocated buffers duplicated in new buffers.
3317 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3319 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3320 /// This corresponds to std::vector in C++
3321 pub struct CVec_MessageSendEventZ {
3322 /// The elements in the array.
3323 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3324 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3325 /// The number of elements pointed to by `data`.
3328 impl CVec_MessageSendEventZ {
3329 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3330 if self.datalen == 0 { return Vec::new(); }
3331 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3332 self.data = core::ptr::null_mut();
3336 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3337 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3340 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3341 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3342 let datalen = v.len();
3343 let data = Box::into_raw(v.into_boxed_slice());
3344 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3348 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3349 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3350 impl Drop for CVec_MessageSendEventZ {
3351 fn drop(&mut self) {
3352 if self.datalen == 0 { return; }
3353 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3356 impl Clone for CVec_MessageSendEventZ {
3357 fn clone(&self) -> Self {
3358 let mut res = Vec::new();
3359 if self.datalen == 0 { return Self::from(res); }
3360 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3365 /// The contents of CResult_TxOutAccessErrorZ
3366 pub union CResult_TxOutAccessErrorZPtr {
3367 /// A pointer to the contents in the success state.
3368 /// Reading from this pointer when `result_ok` is not set is undefined.
3369 pub result: *mut crate::c_types::TxOut,
3370 /// A pointer to the contents in the error state.
3371 /// Reading from this pointer when `result_ok` is set is undefined.
3372 pub err: *mut crate::lightning::chain::AccessError,
3375 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3376 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3378 pub struct CResult_TxOutAccessErrorZ {
3379 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3380 /// `err` or `result` depending on the state of `result_ok`.
3381 pub contents: CResult_TxOutAccessErrorZPtr,
3382 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3383 pub result_ok: bool,
3386 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3387 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3388 CResult_TxOutAccessErrorZ {
3389 contents: CResult_TxOutAccessErrorZPtr {
3390 result: Box::into_raw(Box::new(o)),
3396 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3397 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3398 CResult_TxOutAccessErrorZ {
3399 contents: CResult_TxOutAccessErrorZPtr {
3400 err: Box::into_raw(Box::new(e)),
3405 /// Checks if the given object is currently in the success state
3407 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3411 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3412 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3413 impl Drop for CResult_TxOutAccessErrorZ {
3414 fn drop(&mut self) {
3416 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3417 let _ = unsafe { Box::from_raw(self.contents.result) };
3420 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3421 let _ = unsafe { Box::from_raw(self.contents.err) };
3426 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3427 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3428 let contents = if o.result_ok {
3429 let result = unsafe { o.contents.result };
3430 unsafe { o.contents.result = core::ptr::null_mut() };
3431 CResult_TxOutAccessErrorZPtr { result }
3433 let err = unsafe { o.contents.err };
3434 unsafe { o.contents.err = core::ptr::null_mut(); }
3435 CResult_TxOutAccessErrorZPtr { err }
3439 result_ok: o.result_ok,
3443 impl Clone for CResult_TxOutAccessErrorZ {
3444 fn clone(&self) -> Self {
3446 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3447 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3450 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3451 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3457 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3458 /// but with all dynamically-allocated buffers duplicated in new buffers.
3459 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3461 /// A tuple of 2 elements. See the individual fields for the types contained.
3462 pub struct C2Tuple_usizeTransactionZ {
3463 /// The element at position 0
3465 /// The element at position 1
3466 pub b: crate::c_types::Transaction,
3468 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3469 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3476 impl C2Tuple_usizeTransactionZ {
3477 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3481 impl Clone for C2Tuple_usizeTransactionZ {
3482 fn clone(&self) -> Self {
3484 a: Clone::clone(&self.a),
3485 b: Clone::clone(&self.b),
3490 /// Creates a new tuple which has the same data as `orig`
3491 /// but with all dynamically-allocated buffers duplicated in new buffers.
3492 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3493 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3495 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3496 C2Tuple_usizeTransactionZ { a, b, }
3500 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3501 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3503 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3504 /// This corresponds to std::vector in C++
3505 pub struct CVec_C2Tuple_usizeTransactionZZ {
3506 /// The elements in the array.
3507 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3508 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3509 /// The number of elements pointed to by `data`.
3512 impl CVec_C2Tuple_usizeTransactionZZ {
3513 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3514 if self.datalen == 0 { return Vec::new(); }
3515 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3516 self.data = core::ptr::null_mut();
3520 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3521 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3524 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3525 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3526 let datalen = v.len();
3527 let data = Box::into_raw(v.into_boxed_slice());
3528 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3532 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3533 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3534 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3535 fn drop(&mut self) {
3536 if self.datalen == 0 { return; }
3537 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3540 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3541 fn clone(&self) -> Self {
3542 let mut res = Vec::new();
3543 if self.datalen == 0 { return Self::from(res); }
3544 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3549 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3550 /// This corresponds to std::vector in C++
3551 pub struct CVec_TxidZ {
3552 /// The elements in the array.
3553 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3554 pub data: *mut crate::c_types::ThirtyTwoBytes,
3555 /// The number of elements pointed to by `data`.
3559 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3560 if self.datalen == 0 { return Vec::new(); }
3561 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3562 self.data = core::ptr::null_mut();
3566 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3567 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3570 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3571 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3572 let datalen = v.len();
3573 let data = Box::into_raw(v.into_boxed_slice());
3574 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3578 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3579 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3580 impl Drop for CVec_TxidZ {
3581 fn drop(&mut self) {
3582 if self.datalen == 0 { return; }
3583 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3586 impl Clone for CVec_TxidZ {
3587 fn clone(&self) -> Self {
3588 let mut res = Vec::new();
3589 if self.datalen == 0 { return Self::from(res); }
3590 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3595 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3596 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3597 /// Note that this value is always NULL, as there are no contents in the OK variant
3598 pub result: *mut core::ffi::c_void,
3599 /// A pointer to the contents in the error state.
3600 /// Reading from this pointer when `result_ok` is set is undefined.
3601 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3604 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3605 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3607 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3608 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3609 /// `err` or `result` depending on the state of `result_ok`.
3610 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3611 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3612 pub result_ok: bool,
3615 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3616 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3617 CResult_NoneChannelMonitorUpdateErrZ {
3618 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3619 result: core::ptr::null_mut(),
3625 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3626 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3627 CResult_NoneChannelMonitorUpdateErrZ {
3628 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3629 err: Box::into_raw(Box::new(e)),
3634 /// Checks if the given object is currently in the success state
3636 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3640 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3641 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3642 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3643 fn drop(&mut self) {
3646 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3647 let _ = unsafe { Box::from_raw(self.contents.err) };
3652 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3653 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3654 let contents = if o.result_ok {
3655 let _ = unsafe { Box::from_raw(o.contents.result) };
3656 o.contents.result = core::ptr::null_mut();
3657 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3659 let err = unsafe { o.contents.err };
3660 unsafe { o.contents.err = core::ptr::null_mut(); }
3661 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3665 result_ok: o.result_ok,
3669 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3670 fn clone(&self) -> Self {
3672 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3673 result: core::ptr::null_mut()
3676 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3677 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3683 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3684 /// but with all dynamically-allocated buffers duplicated in new buffers.
3685 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3687 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3688 /// This corresponds to std::vector in C++
3689 pub struct CVec_MonitorEventZ {
3690 /// The elements in the array.
3691 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3692 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3693 /// The number of elements pointed to by `data`.
3696 impl CVec_MonitorEventZ {
3697 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3698 if self.datalen == 0 { return Vec::new(); }
3699 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3700 self.data = core::ptr::null_mut();
3704 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3705 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3708 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3709 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3710 let datalen = v.len();
3711 let data = Box::into_raw(v.into_boxed_slice());
3712 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3716 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3717 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3718 impl Drop for CVec_MonitorEventZ {
3719 fn drop(&mut self) {
3720 if self.datalen == 0 { return; }
3721 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3724 impl Clone for CVec_MonitorEventZ {
3725 fn clone(&self) -> Self {
3726 let mut res = Vec::new();
3727 if self.datalen == 0 { return Self::from(res); }
3728 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3733 /// A tuple of 2 elements. See the individual fields for the types contained.
3734 pub struct C2Tuple_OutPointCVec_MonitorEventZZ {
3735 /// The element at position 0
3736 pub a: crate::lightning::chain::transaction::OutPoint,
3737 /// The element at position 1
3738 pub b: crate::c_types::derived::CVec_MonitorEventZ,
3740 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)> for C2Tuple_OutPointCVec_MonitorEventZZ {
3741 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)) -> Self {
3748 impl C2Tuple_OutPointCVec_MonitorEventZZ {
3749 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ) {
3753 impl Clone for C2Tuple_OutPointCVec_MonitorEventZZ {
3754 fn clone(&self) -> Self {
3756 a: Clone::clone(&self.a),
3757 b: Clone::clone(&self.b),
3762 /// Creates a new tuple which has the same data as `orig`
3763 /// but with all dynamically-allocated buffers duplicated in new buffers.
3764 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorEventZZ) -> C2Tuple_OutPointCVec_MonitorEventZZ { Clone::clone(&orig) }
3765 /// Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
3767 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ) -> C2Tuple_OutPointCVec_MonitorEventZZ {
3768 C2Tuple_OutPointCVec_MonitorEventZZ { a, b, }
3772 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
3773 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_free(_res: C2Tuple_OutPointCVec_MonitorEventZZ) { }
3775 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
3776 /// This corresponds to std::vector in C++
3777 pub struct CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3778 /// The elements in the array.
3779 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3780 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ,
3781 /// The number of elements pointed to by `data`.
3784 impl CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3785 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ> {
3786 if self.datalen == 0 { return Vec::new(); }
3787 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3788 self.data = core::ptr::null_mut();
3792 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ] {
3793 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3796 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>> for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3797 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>) -> Self {
3798 let datalen = v.len();
3799 let data = Box::into_raw(v.into_boxed_slice());
3800 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3804 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3805 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorEventZZZ) { }
3806 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3807 fn drop(&mut self) {
3808 if self.datalen == 0 { return; }
3809 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3812 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3813 fn clone(&self) -> Self {
3814 let mut res = Vec::new();
3815 if self.datalen == 0 { return Self::from(res); }
3816 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3822 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3823 pub enum COption_C2Tuple_usizeTransactionZZ {
3824 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3825 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3826 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3829 impl COption_C2Tuple_usizeTransactionZZ {
3830 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3831 if let Self::None = self { false } else { true }
3833 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3836 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3837 if let Self::Some(v) = self { v } else { unreachable!() }
3841 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3842 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3843 COption_C2Tuple_usizeTransactionZZ::Some(o)
3846 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3847 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3848 COption_C2Tuple_usizeTransactionZZ::None
3851 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3852 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3854 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3855 /// but with all dynamically-allocated buffers duplicated in new buffers.
3856 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3858 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3859 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3860 /// A pointer to the contents in the success state.
3861 /// Reading from this pointer when `result_ok` is not set is undefined.
3862 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3863 /// A pointer to the contents in the error state.
3864 /// Reading from this pointer when `result_ok` is set is undefined.
3865 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3868 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3869 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3871 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3872 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3873 /// `err` or `result` depending on the state of `result_ok`.
3874 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3875 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3876 pub result_ok: bool,
3879 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3880 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3881 CResult_FixedPenaltyScorerDecodeErrorZ {
3882 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3883 result: Box::into_raw(Box::new(o)),
3889 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3890 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3891 CResult_FixedPenaltyScorerDecodeErrorZ {
3892 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3893 err: Box::into_raw(Box::new(e)),
3898 /// Checks if the given object is currently in the success state
3900 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3904 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3905 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3906 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3907 fn drop(&mut self) {
3909 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3910 let _ = unsafe { Box::from_raw(self.contents.result) };
3913 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3914 let _ = unsafe { Box::from_raw(self.contents.err) };
3919 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3920 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3921 let contents = if o.result_ok {
3922 let result = unsafe { o.contents.result };
3923 unsafe { o.contents.result = core::ptr::null_mut() };
3924 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3926 let err = unsafe { o.contents.err };
3927 unsafe { o.contents.err = core::ptr::null_mut(); }
3928 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3932 result_ok: o.result_ok,
3936 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3937 fn clone(&self) -> Self {
3939 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3940 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3943 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3944 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3950 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3951 /// but with all dynamically-allocated buffers duplicated in new buffers.
3952 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3954 /// A tuple of 2 elements. See the individual fields for the types contained.
3955 pub struct C2Tuple_u64u64Z {
3956 /// The element at position 0
3958 /// The element at position 1
3961 impl From<(u64, u64)> for C2Tuple_u64u64Z {
3962 fn from (tup: (u64, u64)) -> Self {
3969 impl C2Tuple_u64u64Z {
3970 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
3974 impl Clone for C2Tuple_u64u64Z {
3975 fn clone(&self) -> Self {
3977 a: Clone::clone(&self.a),
3978 b: Clone::clone(&self.b),
3983 /// Creates a new tuple which has the same data as `orig`
3984 /// but with all dynamically-allocated buffers duplicated in new buffers.
3985 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
3986 /// Creates a new C2Tuple_u64u64Z from the contained elements.
3988 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
3989 C2Tuple_u64u64Z { a, b, }
3993 /// Frees any resources used by the C2Tuple_u64u64Z.
3994 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
3997 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
3998 pub enum COption_C2Tuple_u64u64ZZ {
3999 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4000 Some(crate::c_types::derived::C2Tuple_u64u64Z),
4001 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4004 impl COption_C2Tuple_u64u64ZZ {
4005 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4006 if let Self::None = self { false } else { true }
4008 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4011 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4012 if let Self::Some(v) = self { v } else { unreachable!() }
4016 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4017 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4018 COption_C2Tuple_u64u64ZZ::Some(o)
4021 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4022 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4023 COption_C2Tuple_u64u64ZZ::None
4026 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4027 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4029 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4030 /// but with all dynamically-allocated buffers duplicated in new buffers.
4031 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4033 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4034 /// This corresponds to std::vector in C++
4035 pub struct CVec_NodeIdZ {
4036 /// The elements in the array.
4037 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4038 pub data: *mut crate::lightning::routing::gossip::NodeId,
4039 /// The number of elements pointed to by `data`.
4043 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4044 if self.datalen == 0 { return Vec::new(); }
4045 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4046 self.data = core::ptr::null_mut();
4050 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4051 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4054 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4055 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4056 let datalen = v.len();
4057 let data = Box::into_raw(v.into_boxed_slice());
4058 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4062 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4063 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4064 impl Drop for CVec_NodeIdZ {
4065 fn drop(&mut self) {
4066 if self.datalen == 0 { return; }
4067 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4070 impl Clone for CVec_NodeIdZ {
4071 fn clone(&self) -> Self {
4072 let mut res = Vec::new();
4073 if self.datalen == 0 { return Self::from(res); }
4074 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4079 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4080 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4081 /// A pointer to the contents in the success state.
4082 /// Reading from this pointer when `result_ok` is not set is undefined.
4083 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4084 /// A pointer to the contents in the error state.
4085 /// Reading from this pointer when `result_ok` is set is undefined.
4086 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4089 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4090 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4091 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4092 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4093 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4094 /// `err` or `result` depending on the state of `result_ok`.
4095 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4096 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4097 pub result_ok: bool,
4100 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4101 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4102 CResult_ProbabilisticScorerDecodeErrorZ {
4103 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4104 result: Box::into_raw(Box::new(o)),
4110 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4111 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4112 CResult_ProbabilisticScorerDecodeErrorZ {
4113 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4114 err: Box::into_raw(Box::new(e)),
4119 /// Checks if the given object is currently in the success state
4121 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4125 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4126 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4127 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4128 fn drop(&mut self) {
4130 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4131 let _ = unsafe { Box::from_raw(self.contents.result) };
4134 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4135 let _ = unsafe { Box::from_raw(self.contents.err) };
4140 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4141 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4142 let contents = if o.result_ok {
4143 let result = unsafe { o.contents.result };
4144 unsafe { o.contents.result = core::ptr::null_mut() };
4145 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4147 let err = unsafe { o.contents.err };
4148 unsafe { o.contents.err = core::ptr::null_mut(); }
4149 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4153 result_ok: o.result_ok,
4158 /// The contents of CResult_InitFeaturesDecodeErrorZ
4159 pub union CResult_InitFeaturesDecodeErrorZPtr {
4160 /// A pointer to the contents in the success state.
4161 /// Reading from this pointer when `result_ok` is not set is undefined.
4162 pub result: *mut crate::lightning::ln::features::InitFeatures,
4163 /// A pointer to the contents in the error state.
4164 /// Reading from this pointer when `result_ok` is set is undefined.
4165 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4168 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4169 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4170 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4171 pub struct CResult_InitFeaturesDecodeErrorZ {
4172 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4173 /// `err` or `result` depending on the state of `result_ok`.
4174 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4175 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4176 pub result_ok: bool,
4179 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4180 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4181 CResult_InitFeaturesDecodeErrorZ {
4182 contents: CResult_InitFeaturesDecodeErrorZPtr {
4183 result: Box::into_raw(Box::new(o)),
4189 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4190 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4191 CResult_InitFeaturesDecodeErrorZ {
4192 contents: CResult_InitFeaturesDecodeErrorZPtr {
4193 err: Box::into_raw(Box::new(e)),
4198 /// Checks if the given object is currently in the success state
4200 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4204 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4205 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4206 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4207 fn drop(&mut self) {
4209 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4210 let _ = unsafe { Box::from_raw(self.contents.result) };
4213 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4214 let _ = unsafe { Box::from_raw(self.contents.err) };
4219 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4220 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4221 let contents = if o.result_ok {
4222 let result = unsafe { o.contents.result };
4223 unsafe { o.contents.result = core::ptr::null_mut() };
4224 CResult_InitFeaturesDecodeErrorZPtr { result }
4226 let err = unsafe { o.contents.err };
4227 unsafe { o.contents.err = core::ptr::null_mut(); }
4228 CResult_InitFeaturesDecodeErrorZPtr { err }
4232 result_ok: o.result_ok,
4236 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4237 fn clone(&self) -> Self {
4239 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4240 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4243 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4244 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4250 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4251 /// but with all dynamically-allocated buffers duplicated in new buffers.
4252 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4254 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4255 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4256 /// A pointer to the contents in the success state.
4257 /// Reading from this pointer when `result_ok` is not set is undefined.
4258 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4259 /// A pointer to the contents in the error state.
4260 /// Reading from this pointer when `result_ok` is set is undefined.
4261 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4264 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4265 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4266 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4267 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4268 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4269 /// `err` or `result` depending on the state of `result_ok`.
4270 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4271 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4272 pub result_ok: bool,
4275 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4276 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4277 CResult_ChannelFeaturesDecodeErrorZ {
4278 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4279 result: Box::into_raw(Box::new(o)),
4285 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4286 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4287 CResult_ChannelFeaturesDecodeErrorZ {
4288 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4289 err: Box::into_raw(Box::new(e)),
4294 /// Checks if the given object is currently in the success state
4296 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4300 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4301 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4302 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4303 fn drop(&mut self) {
4305 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4306 let _ = unsafe { Box::from_raw(self.contents.result) };
4309 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4310 let _ = unsafe { Box::from_raw(self.contents.err) };
4315 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4316 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4317 let contents = if o.result_ok {
4318 let result = unsafe { o.contents.result };
4319 unsafe { o.contents.result = core::ptr::null_mut() };
4320 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4322 let err = unsafe { o.contents.err };
4323 unsafe { o.contents.err = core::ptr::null_mut(); }
4324 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4328 result_ok: o.result_ok,
4332 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4333 fn clone(&self) -> Self {
4335 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4336 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4339 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4340 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4346 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4347 /// but with all dynamically-allocated buffers duplicated in new buffers.
4348 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4350 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4351 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4352 /// A pointer to the contents in the success state.
4353 /// Reading from this pointer when `result_ok` is not set is undefined.
4354 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4355 /// A pointer to the contents in the error state.
4356 /// Reading from this pointer when `result_ok` is set is undefined.
4357 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4360 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4361 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4362 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4363 pub struct CResult_NodeFeaturesDecodeErrorZ {
4364 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4365 /// `err` or `result` depending on the state of `result_ok`.
4366 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4367 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4368 pub result_ok: bool,
4371 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4372 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4373 CResult_NodeFeaturesDecodeErrorZ {
4374 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4375 result: Box::into_raw(Box::new(o)),
4381 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4382 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4383 CResult_NodeFeaturesDecodeErrorZ {
4384 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4385 err: Box::into_raw(Box::new(e)),
4390 /// Checks if the given object is currently in the success state
4392 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4396 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4397 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4398 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4399 fn drop(&mut self) {
4401 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4402 let _ = unsafe { Box::from_raw(self.contents.result) };
4405 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4406 let _ = unsafe { Box::from_raw(self.contents.err) };
4411 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4412 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4413 let contents = if o.result_ok {
4414 let result = unsafe { o.contents.result };
4415 unsafe { o.contents.result = core::ptr::null_mut() };
4416 CResult_NodeFeaturesDecodeErrorZPtr { result }
4418 let err = unsafe { o.contents.err };
4419 unsafe { o.contents.err = core::ptr::null_mut(); }
4420 CResult_NodeFeaturesDecodeErrorZPtr { err }
4424 result_ok: o.result_ok,
4428 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4429 fn clone(&self) -> Self {
4431 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4432 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4435 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4436 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4442 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4443 /// but with all dynamically-allocated buffers duplicated in new buffers.
4444 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4446 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4447 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4448 /// A pointer to the contents in the success state.
4449 /// Reading from this pointer when `result_ok` is not set is undefined.
4450 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4451 /// A pointer to the contents in the error state.
4452 /// Reading from this pointer when `result_ok` is set is undefined.
4453 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4456 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4457 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4458 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4459 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4460 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4461 /// `err` or `result` depending on the state of `result_ok`.
4462 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4463 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4464 pub result_ok: bool,
4467 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4468 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4469 CResult_InvoiceFeaturesDecodeErrorZ {
4470 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4471 result: Box::into_raw(Box::new(o)),
4477 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4478 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4479 CResult_InvoiceFeaturesDecodeErrorZ {
4480 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4481 err: Box::into_raw(Box::new(e)),
4486 /// Checks if the given object is currently in the success state
4488 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4492 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4493 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4494 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4495 fn drop(&mut self) {
4497 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4498 let _ = unsafe { Box::from_raw(self.contents.result) };
4501 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4502 let _ = unsafe { Box::from_raw(self.contents.err) };
4507 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4508 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4509 let contents = if o.result_ok {
4510 let result = unsafe { o.contents.result };
4511 unsafe { o.contents.result = core::ptr::null_mut() };
4512 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4514 let err = unsafe { o.contents.err };
4515 unsafe { o.contents.err = core::ptr::null_mut(); }
4516 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4520 result_ok: o.result_ok,
4524 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4525 fn clone(&self) -> Self {
4527 Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4528 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4531 Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4532 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4538 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4539 /// but with all dynamically-allocated buffers duplicated in new buffers.
4540 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4542 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4543 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4544 /// A pointer to the contents in the success state.
4545 /// Reading from this pointer when `result_ok` is not set is undefined.
4546 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4547 /// A pointer to the contents in the error state.
4548 /// Reading from this pointer when `result_ok` is set is undefined.
4549 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4552 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4553 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4554 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4555 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4556 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4557 /// `err` or `result` depending on the state of `result_ok`.
4558 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4559 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4560 pub result_ok: bool,
4563 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4564 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4565 CResult_ChannelTypeFeaturesDecodeErrorZ {
4566 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4567 result: Box::into_raw(Box::new(o)),
4573 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4574 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4575 CResult_ChannelTypeFeaturesDecodeErrorZ {
4576 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4577 err: Box::into_raw(Box::new(e)),
4582 /// Checks if the given object is currently in the success state
4584 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4588 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4589 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4590 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4591 fn drop(&mut self) {
4593 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4594 let _ = unsafe { Box::from_raw(self.contents.result) };
4597 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4598 let _ = unsafe { Box::from_raw(self.contents.err) };
4603 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4604 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4605 let contents = if o.result_ok {
4606 let result = unsafe { o.contents.result };
4607 unsafe { o.contents.result = core::ptr::null_mut() };
4608 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4610 let err = unsafe { o.contents.err };
4611 unsafe { o.contents.err = core::ptr::null_mut(); }
4612 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4616 result_ok: o.result_ok,
4620 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4621 fn clone(&self) -> Self {
4623 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4624 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4627 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4628 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4634 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4635 /// but with all dynamically-allocated buffers duplicated in new buffers.
4636 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4638 /// The contents of CResult_NodeIdDecodeErrorZ
4639 pub union CResult_NodeIdDecodeErrorZPtr {
4640 /// A pointer to the contents in the success state.
4641 /// Reading from this pointer when `result_ok` is not set is undefined.
4642 pub result: *mut crate::lightning::routing::gossip::NodeId,
4643 /// A pointer to the contents in the error state.
4644 /// Reading from this pointer when `result_ok` is set is undefined.
4645 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4648 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4649 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4650 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4651 pub struct CResult_NodeIdDecodeErrorZ {
4652 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4653 /// `err` or `result` depending on the state of `result_ok`.
4654 pub contents: CResult_NodeIdDecodeErrorZPtr,
4655 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4656 pub result_ok: bool,
4659 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
4660 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
4661 CResult_NodeIdDecodeErrorZ {
4662 contents: CResult_NodeIdDecodeErrorZPtr {
4663 result: Box::into_raw(Box::new(o)),
4669 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
4670 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
4671 CResult_NodeIdDecodeErrorZ {
4672 contents: CResult_NodeIdDecodeErrorZPtr {
4673 err: Box::into_raw(Box::new(e)),
4678 /// Checks if the given object is currently in the success state
4680 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
4684 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
4685 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
4686 impl Drop for CResult_NodeIdDecodeErrorZ {
4687 fn drop(&mut self) {
4689 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4690 let _ = unsafe { Box::from_raw(self.contents.result) };
4693 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4694 let _ = unsafe { Box::from_raw(self.contents.err) };
4699 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
4700 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
4701 let contents = if o.result_ok {
4702 let result = unsafe { o.contents.result };
4703 unsafe { o.contents.result = core::ptr::null_mut() };
4704 CResult_NodeIdDecodeErrorZPtr { result }
4706 let err = unsafe { o.contents.err };
4707 unsafe { o.contents.err = core::ptr::null_mut(); }
4708 CResult_NodeIdDecodeErrorZPtr { err }
4712 result_ok: o.result_ok,
4716 impl Clone for CResult_NodeIdDecodeErrorZ {
4717 fn clone(&self) -> Self {
4719 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
4720 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
4723 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
4724 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4730 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
4731 /// but with all dynamically-allocated buffers duplicated in new buffers.
4732 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
4734 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4735 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4736 /// A pointer to the contents in the success state.
4737 /// Reading from this pointer when `result_ok` is not set is undefined.
4738 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
4739 /// A pointer to the contents in the error state.
4740 /// Reading from this pointer when `result_ok` is set is undefined.
4741 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4744 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
4745 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4746 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4747 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
4748 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
4749 /// `err` or `result` depending on the state of `result_ok`.
4750 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
4751 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
4752 pub result_ok: bool,
4755 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
4756 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4757 CResult_COption_NetworkUpdateZDecodeErrorZ {
4758 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4759 result: Box::into_raw(Box::new(o)),
4765 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
4766 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4767 CResult_COption_NetworkUpdateZDecodeErrorZ {
4768 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4769 err: Box::into_raw(Box::new(e)),
4774 /// Checks if the given object is currently in the success state
4776 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
4780 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
4781 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
4782 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
4783 fn drop(&mut self) {
4785 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4786 let _ = unsafe { Box::from_raw(self.contents.result) };
4789 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4790 let _ = unsafe { Box::from_raw(self.contents.err) };
4795 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
4796 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4797 let contents = if o.result_ok {
4798 let result = unsafe { o.contents.result };
4799 unsafe { o.contents.result = core::ptr::null_mut() };
4800 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
4802 let err = unsafe { o.contents.err };
4803 unsafe { o.contents.err = core::ptr::null_mut(); }
4804 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
4808 result_ok: o.result_ok,
4812 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
4813 fn clone(&self) -> Self {
4815 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4816 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
4819 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4820 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4826 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
4827 /// but with all dynamically-allocated buffers duplicated in new buffers.
4828 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
4830 /// An enum which can either contain a crate::lightning::chain::Access or not
4831 pub enum COption_AccessZ {
4832 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
4833 Some(crate::lightning::chain::Access),
4834 /// When we're in this state, this COption_AccessZ contains nothing
4837 impl COption_AccessZ {
4838 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4839 if let Self::None = self { false } else { true }
4841 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4844 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
4845 if let Self::Some(v) = self { v } else { unreachable!() }
4849 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
4850 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
4851 COption_AccessZ::Some(o)
4854 /// Constructs a new COption_AccessZ containing nothing
4855 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
4856 COption_AccessZ::None
4859 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
4860 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
4862 /// The contents of CResult_boolLightningErrorZ
4863 pub union CResult_boolLightningErrorZPtr {
4864 /// A pointer to the contents in the success state.
4865 /// Reading from this pointer when `result_ok` is not set is undefined.
4866 pub result: *mut bool,
4867 /// A pointer to the contents in the error state.
4868 /// Reading from this pointer when `result_ok` is set is undefined.
4869 pub err: *mut crate::lightning::ln::msgs::LightningError,
4872 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
4873 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4875 pub struct CResult_boolLightningErrorZ {
4876 /// The contents of this CResult_boolLightningErrorZ, accessible via either
4877 /// `err` or `result` depending on the state of `result_ok`.
4878 pub contents: CResult_boolLightningErrorZPtr,
4879 /// Whether this CResult_boolLightningErrorZ represents a success state.
4880 pub result_ok: bool,
4883 /// Creates a new CResult_boolLightningErrorZ in the success state.
4884 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
4885 CResult_boolLightningErrorZ {
4886 contents: CResult_boolLightningErrorZPtr {
4887 result: Box::into_raw(Box::new(o)),
4893 /// Creates a new CResult_boolLightningErrorZ in the error state.
4894 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
4895 CResult_boolLightningErrorZ {
4896 contents: CResult_boolLightningErrorZPtr {
4897 err: Box::into_raw(Box::new(e)),
4902 /// Checks if the given object is currently in the success state
4904 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
4908 /// Frees any resources used by the CResult_boolLightningErrorZ.
4909 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
4910 impl Drop for CResult_boolLightningErrorZ {
4911 fn drop(&mut self) {
4913 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4914 let _ = unsafe { Box::from_raw(self.contents.result) };
4917 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4918 let _ = unsafe { Box::from_raw(self.contents.err) };
4923 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
4924 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
4925 let contents = if o.result_ok {
4926 let result = unsafe { o.contents.result };
4927 unsafe { o.contents.result = core::ptr::null_mut() };
4928 CResult_boolLightningErrorZPtr { result }
4930 let err = unsafe { o.contents.err };
4931 unsafe { o.contents.err = core::ptr::null_mut(); }
4932 CResult_boolLightningErrorZPtr { err }
4936 result_ok: o.result_ok,
4940 impl Clone for CResult_boolLightningErrorZ {
4941 fn clone(&self) -> Self {
4943 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
4944 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4947 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
4948 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4954 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
4955 /// but with all dynamically-allocated buffers duplicated in new buffers.
4956 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
4958 /// A tuple of 3 elements. See the individual fields for the types contained.
4959 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4960 /// The element at position 0
4961 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
4962 /// The element at position 1
4963 pub b: crate::lightning::ln::msgs::ChannelUpdate,
4964 /// The element at position 2
4965 pub c: crate::lightning::ln::msgs::ChannelUpdate,
4967 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4968 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
4976 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4977 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
4978 (self.a, self.b, self.c)
4981 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4982 fn clone(&self) -> Self {
4984 a: Clone::clone(&self.a),
4985 b: Clone::clone(&self.b),
4986 c: Clone::clone(&self.c),
4991 /// Creates a new tuple which has the same data as `orig`
4992 /// but with all dynamically-allocated buffers duplicated in new buffers.
4993 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
4994 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
4996 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 {
4997 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5001 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5002 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5004 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5005 /// This corresponds to std::vector in C++
5006 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5007 /// The elements in the array.
5008 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5009 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
5010 /// The number of elements pointed to by `data`.
5013 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5014 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
5015 if self.datalen == 0 { return Vec::new(); }
5016 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5017 self.data = core::ptr::null_mut();
5021 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
5022 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5025 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5026 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
5027 let datalen = v.len();
5028 let data = Box::into_raw(v.into_boxed_slice());
5029 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5033 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5034 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5035 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5036 fn drop(&mut self) {
5037 if self.datalen == 0 { return; }
5038 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5041 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5042 fn clone(&self) -> Self {
5043 let mut res = Vec::new();
5044 if self.datalen == 0 { return Self::from(res); }
5045 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5050 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5051 /// This corresponds to std::vector in C++
5052 pub struct CVec_NodeAnnouncementZ {
5053 /// The elements in the array.
5054 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5055 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
5056 /// The number of elements pointed to by `data`.
5059 impl CVec_NodeAnnouncementZ {
5060 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
5061 if self.datalen == 0 { return Vec::new(); }
5062 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5063 self.data = core::ptr::null_mut();
5067 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
5068 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5071 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
5072 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
5073 let datalen = v.len();
5074 let data = Box::into_raw(v.into_boxed_slice());
5075 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5079 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5080 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
5081 impl Drop for CVec_NodeAnnouncementZ {
5082 fn drop(&mut self) {
5083 if self.datalen == 0 { return; }
5084 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5087 impl Clone for CVec_NodeAnnouncementZ {
5088 fn clone(&self) -> Self {
5089 let mut res = Vec::new();
5090 if self.datalen == 0 { return Self::from(res); }
5091 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5096 /// The contents of CResult_NoneLightningErrorZ
5097 pub union CResult_NoneLightningErrorZPtr {
5098 /// Note that this value is always NULL, as there are no contents in the OK variant
5099 pub result: *mut core::ffi::c_void,
5100 /// A pointer to the contents in the error state.
5101 /// Reading from this pointer when `result_ok` is set is undefined.
5102 pub err: *mut crate::lightning::ln::msgs::LightningError,
5105 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5106 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5108 pub struct CResult_NoneLightningErrorZ {
5109 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5110 /// `err` or `result` depending on the state of `result_ok`.
5111 pub contents: CResult_NoneLightningErrorZPtr,
5112 /// Whether this CResult_NoneLightningErrorZ represents a success state.
5113 pub result_ok: bool,
5116 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5117 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5118 CResult_NoneLightningErrorZ {
5119 contents: CResult_NoneLightningErrorZPtr {
5120 result: core::ptr::null_mut(),
5126 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5127 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5128 CResult_NoneLightningErrorZ {
5129 contents: CResult_NoneLightningErrorZPtr {
5130 err: Box::into_raw(Box::new(e)),
5135 /// Checks if the given object is currently in the success state
5137 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5141 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5142 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5143 impl Drop for CResult_NoneLightningErrorZ {
5144 fn drop(&mut self) {
5147 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5148 let _ = unsafe { Box::from_raw(self.contents.err) };
5153 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5154 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5155 let contents = if o.result_ok {
5156 let _ = unsafe { Box::from_raw(o.contents.result) };
5157 o.contents.result = core::ptr::null_mut();
5158 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5160 let err = unsafe { o.contents.err };
5161 unsafe { o.contents.err = core::ptr::null_mut(); }
5162 CResult_NoneLightningErrorZPtr { err }
5166 result_ok: o.result_ok,
5170 impl Clone for CResult_NoneLightningErrorZ {
5171 fn clone(&self) -> Self {
5173 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5174 result: core::ptr::null_mut()
5177 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5178 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5184 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5185 /// but with all dynamically-allocated buffers duplicated in new buffers.
5186 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5188 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5189 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5190 /// A pointer to the contents in the success state.
5191 /// Reading from this pointer when `result_ok` is not set is undefined.
5192 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5193 /// A pointer to the contents in the error state.
5194 /// Reading from this pointer when `result_ok` is set is undefined.
5195 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5198 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5199 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5200 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5201 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5202 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5203 /// `err` or `result` depending on the state of `result_ok`.
5204 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5205 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5206 pub result_ok: bool,
5209 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5210 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5211 CResult_ChannelUpdateInfoDecodeErrorZ {
5212 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5213 result: Box::into_raw(Box::new(o)),
5219 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5220 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5221 CResult_ChannelUpdateInfoDecodeErrorZ {
5222 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5223 err: Box::into_raw(Box::new(e)),
5228 /// Checks if the given object is currently in the success state
5230 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5234 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5235 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5236 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5237 fn drop(&mut self) {
5239 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5240 let _ = unsafe { Box::from_raw(self.contents.result) };
5243 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5244 let _ = unsafe { Box::from_raw(self.contents.err) };
5249 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5250 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5251 let contents = if o.result_ok {
5252 let result = unsafe { o.contents.result };
5253 unsafe { o.contents.result = core::ptr::null_mut() };
5254 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5256 let err = unsafe { o.contents.err };
5257 unsafe { o.contents.err = core::ptr::null_mut(); }
5258 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5262 result_ok: o.result_ok,
5266 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5267 fn clone(&self) -> Self {
5269 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5270 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5273 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5274 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5280 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5281 /// but with all dynamically-allocated buffers duplicated in new buffers.
5282 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5284 /// The contents of CResult_ChannelInfoDecodeErrorZ
5285 pub union CResult_ChannelInfoDecodeErrorZPtr {
5286 /// A pointer to the contents in the success state.
5287 /// Reading from this pointer when `result_ok` is not set is undefined.
5288 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5289 /// A pointer to the contents in the error state.
5290 /// Reading from this pointer when `result_ok` is set is undefined.
5291 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5294 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5295 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5296 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5297 pub struct CResult_ChannelInfoDecodeErrorZ {
5298 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5299 /// `err` or `result` depending on the state of `result_ok`.
5300 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5301 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5302 pub result_ok: bool,
5305 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5306 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5307 CResult_ChannelInfoDecodeErrorZ {
5308 contents: CResult_ChannelInfoDecodeErrorZPtr {
5309 result: Box::into_raw(Box::new(o)),
5315 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5316 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5317 CResult_ChannelInfoDecodeErrorZ {
5318 contents: CResult_ChannelInfoDecodeErrorZPtr {
5319 err: Box::into_raw(Box::new(e)),
5324 /// Checks if the given object is currently in the success state
5326 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5330 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5331 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5332 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5333 fn drop(&mut self) {
5335 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5336 let _ = unsafe { Box::from_raw(self.contents.result) };
5339 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5340 let _ = unsafe { Box::from_raw(self.contents.err) };
5345 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5346 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5347 let contents = if o.result_ok {
5348 let result = unsafe { o.contents.result };
5349 unsafe { o.contents.result = core::ptr::null_mut() };
5350 CResult_ChannelInfoDecodeErrorZPtr { result }
5352 let err = unsafe { o.contents.err };
5353 unsafe { o.contents.err = core::ptr::null_mut(); }
5354 CResult_ChannelInfoDecodeErrorZPtr { err }
5358 result_ok: o.result_ok,
5362 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5363 fn clone(&self) -> Self {
5365 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5366 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5369 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5370 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5376 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5377 /// but with all dynamically-allocated buffers duplicated in new buffers.
5378 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5380 /// The contents of CResult_RoutingFeesDecodeErrorZ
5381 pub union CResult_RoutingFeesDecodeErrorZPtr {
5382 /// A pointer to the contents in the success state.
5383 /// Reading from this pointer when `result_ok` is not set is undefined.
5384 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5385 /// A pointer to the contents in the error state.
5386 /// Reading from this pointer when `result_ok` is set is undefined.
5387 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5390 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5391 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5393 pub struct CResult_RoutingFeesDecodeErrorZ {
5394 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5395 /// `err` or `result` depending on the state of `result_ok`.
5396 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5397 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5398 pub result_ok: bool,
5401 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5402 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5403 CResult_RoutingFeesDecodeErrorZ {
5404 contents: CResult_RoutingFeesDecodeErrorZPtr {
5405 result: Box::into_raw(Box::new(o)),
5411 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5412 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5413 CResult_RoutingFeesDecodeErrorZ {
5414 contents: CResult_RoutingFeesDecodeErrorZPtr {
5415 err: Box::into_raw(Box::new(e)),
5420 /// Checks if the given object is currently in the success state
5422 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5426 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5427 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5428 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5429 fn drop(&mut self) {
5431 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5432 let _ = unsafe { Box::from_raw(self.contents.result) };
5435 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5436 let _ = unsafe { Box::from_raw(self.contents.err) };
5441 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5442 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5443 let contents = if o.result_ok {
5444 let result = unsafe { o.contents.result };
5445 unsafe { o.contents.result = core::ptr::null_mut() };
5446 CResult_RoutingFeesDecodeErrorZPtr { result }
5448 let err = unsafe { o.contents.err };
5449 unsafe { o.contents.err = core::ptr::null_mut(); }
5450 CResult_RoutingFeesDecodeErrorZPtr { err }
5454 result_ok: o.result_ok,
5458 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5459 fn clone(&self) -> Self {
5461 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5462 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5465 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5466 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5472 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5473 /// but with all dynamically-allocated buffers duplicated in new buffers.
5474 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5476 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5477 /// This corresponds to std::vector in C++
5478 pub struct CVec_NetAddressZ {
5479 /// The elements in the array.
5480 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5481 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5482 /// The number of elements pointed to by `data`.
5485 impl CVec_NetAddressZ {
5486 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5487 if self.datalen == 0 { return Vec::new(); }
5488 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5489 self.data = core::ptr::null_mut();
5493 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5494 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5497 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5498 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5499 let datalen = v.len();
5500 let data = Box::into_raw(v.into_boxed_slice());
5501 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5505 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5506 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5507 impl Drop for CVec_NetAddressZ {
5508 fn drop(&mut self) {
5509 if self.datalen == 0 { return; }
5510 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5513 impl Clone for CVec_NetAddressZ {
5514 fn clone(&self) -> Self {
5515 let mut res = Vec::new();
5516 if self.datalen == 0 { return Self::from(res); }
5517 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5522 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5523 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5524 /// A pointer to the contents in the success state.
5525 /// Reading from this pointer when `result_ok` is not set is undefined.
5526 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5527 /// A pointer to the contents in the error state.
5528 /// Reading from this pointer when `result_ok` is set is undefined.
5529 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5532 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5533 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5534 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5535 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5536 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5537 /// `err` or `result` depending on the state of `result_ok`.
5538 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5539 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5540 pub result_ok: bool,
5543 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5544 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5545 CResult_NodeAnnouncementInfoDecodeErrorZ {
5546 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5547 result: Box::into_raw(Box::new(o)),
5553 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5554 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5555 CResult_NodeAnnouncementInfoDecodeErrorZ {
5556 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5557 err: Box::into_raw(Box::new(e)),
5562 /// Checks if the given object is currently in the success state
5564 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5568 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5569 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5570 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5571 fn drop(&mut self) {
5573 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5574 let _ = unsafe { Box::from_raw(self.contents.result) };
5577 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5578 let _ = unsafe { Box::from_raw(self.contents.err) };
5583 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5584 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5585 let contents = if o.result_ok {
5586 let result = unsafe { o.contents.result };
5587 unsafe { o.contents.result = core::ptr::null_mut() };
5588 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5590 let err = unsafe { o.contents.err };
5591 unsafe { o.contents.err = core::ptr::null_mut(); }
5592 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5596 result_ok: o.result_ok,
5600 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5601 fn clone(&self) -> Self {
5603 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5604 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5607 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5608 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5614 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5615 /// but with all dynamically-allocated buffers duplicated in new buffers.
5616 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5618 /// The contents of CResult_NodeAliasDecodeErrorZ
5619 pub union CResult_NodeAliasDecodeErrorZPtr {
5620 /// A pointer to the contents in the success state.
5621 /// Reading from this pointer when `result_ok` is not set is undefined.
5622 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
5623 /// A pointer to the contents in the error state.
5624 /// Reading from this pointer when `result_ok` is set is undefined.
5625 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5628 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
5629 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
5630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5631 pub struct CResult_NodeAliasDecodeErrorZ {
5632 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
5633 /// `err` or `result` depending on the state of `result_ok`.
5634 pub contents: CResult_NodeAliasDecodeErrorZPtr,
5635 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
5636 pub result_ok: bool,
5639 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
5640 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
5641 CResult_NodeAliasDecodeErrorZ {
5642 contents: CResult_NodeAliasDecodeErrorZPtr {
5643 result: Box::into_raw(Box::new(o)),
5649 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
5650 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
5651 CResult_NodeAliasDecodeErrorZ {
5652 contents: CResult_NodeAliasDecodeErrorZPtr {
5653 err: Box::into_raw(Box::new(e)),
5658 /// Checks if the given object is currently in the success state
5660 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
5664 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
5665 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
5666 impl Drop for CResult_NodeAliasDecodeErrorZ {
5667 fn drop(&mut self) {
5669 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5670 let _ = unsafe { Box::from_raw(self.contents.result) };
5673 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5674 let _ = unsafe { Box::from_raw(self.contents.err) };
5679 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
5680 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
5681 let contents = if o.result_ok {
5682 let result = unsafe { o.contents.result };
5683 unsafe { o.contents.result = core::ptr::null_mut() };
5684 CResult_NodeAliasDecodeErrorZPtr { result }
5686 let err = unsafe { o.contents.err };
5687 unsafe { o.contents.err = core::ptr::null_mut(); }
5688 CResult_NodeAliasDecodeErrorZPtr { err }
5692 result_ok: o.result_ok,
5696 impl Clone for CResult_NodeAliasDecodeErrorZ {
5697 fn clone(&self) -> Self {
5699 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
5700 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
5703 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
5704 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5710 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
5711 /// but with all dynamically-allocated buffers duplicated in new buffers.
5712 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
5714 /// A dynamically-allocated array of u64s of arbitrary size.
5715 /// This corresponds to std::vector in C++
5716 pub struct CVec_u64Z {
5717 /// The elements in the array.
5718 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5720 /// The number of elements pointed to by `data`.
5724 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
5725 if self.datalen == 0 { return Vec::new(); }
5726 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5727 self.data = core::ptr::null_mut();
5731 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5732 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5735 impl From<Vec<u64>> for CVec_u64Z {
5736 fn from(v: Vec<u64>) -> Self {
5737 let datalen = v.len();
5738 let data = Box::into_raw(v.into_boxed_slice());
5739 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5743 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5744 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5745 impl Drop for CVec_u64Z {
5746 fn drop(&mut self) {
5747 if self.datalen == 0 { return; }
5748 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5751 impl Clone for CVec_u64Z {
5752 fn clone(&self) -> Self {
5753 let mut res = Vec::new();
5754 if self.datalen == 0 { return Self::from(res); }
5755 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5760 /// The contents of CResult_NodeInfoDecodeErrorZ
5761 pub union CResult_NodeInfoDecodeErrorZPtr {
5762 /// A pointer to the contents in the success state.
5763 /// Reading from this pointer when `result_ok` is not set is undefined.
5764 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
5765 /// A pointer to the contents in the error state.
5766 /// Reading from this pointer when `result_ok` is set is undefined.
5767 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5770 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5771 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5773 pub struct CResult_NodeInfoDecodeErrorZ {
5774 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5775 /// `err` or `result` depending on the state of `result_ok`.
5776 pub contents: CResult_NodeInfoDecodeErrorZPtr,
5777 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5778 pub result_ok: bool,
5781 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5782 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5783 CResult_NodeInfoDecodeErrorZ {
5784 contents: CResult_NodeInfoDecodeErrorZPtr {
5785 result: Box::into_raw(Box::new(o)),
5791 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5792 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5793 CResult_NodeInfoDecodeErrorZ {
5794 contents: CResult_NodeInfoDecodeErrorZPtr {
5795 err: Box::into_raw(Box::new(e)),
5800 /// Checks if the given object is currently in the success state
5802 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
5806 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5807 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5808 impl Drop for CResult_NodeInfoDecodeErrorZ {
5809 fn drop(&mut self) {
5811 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5812 let _ = unsafe { Box::from_raw(self.contents.result) };
5815 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5816 let _ = unsafe { Box::from_raw(self.contents.err) };
5821 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5822 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5823 let contents = if o.result_ok {
5824 let result = unsafe { o.contents.result };
5825 unsafe { o.contents.result = core::ptr::null_mut() };
5826 CResult_NodeInfoDecodeErrorZPtr { result }
5828 let err = unsafe { o.contents.err };
5829 unsafe { o.contents.err = core::ptr::null_mut(); }
5830 CResult_NodeInfoDecodeErrorZPtr { err }
5834 result_ok: o.result_ok,
5838 impl Clone for CResult_NodeInfoDecodeErrorZ {
5839 fn clone(&self) -> Self {
5841 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5842 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
5845 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5846 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5852 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5853 /// but with all dynamically-allocated buffers duplicated in new buffers.
5854 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
5856 /// The contents of CResult_NetworkGraphDecodeErrorZ
5857 pub union CResult_NetworkGraphDecodeErrorZPtr {
5858 /// A pointer to the contents in the success state.
5859 /// Reading from this pointer when `result_ok` is not set is undefined.
5860 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
5861 /// A pointer to the contents in the error state.
5862 /// Reading from this pointer when `result_ok` is set is undefined.
5863 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5866 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5867 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5869 pub struct CResult_NetworkGraphDecodeErrorZ {
5870 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5871 /// `err` or `result` depending on the state of `result_ok`.
5872 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5873 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5874 pub result_ok: bool,
5877 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5878 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5879 CResult_NetworkGraphDecodeErrorZ {
5880 contents: CResult_NetworkGraphDecodeErrorZPtr {
5881 result: Box::into_raw(Box::new(o)),
5887 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5888 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5889 CResult_NetworkGraphDecodeErrorZ {
5890 contents: CResult_NetworkGraphDecodeErrorZPtr {
5891 err: Box::into_raw(Box::new(e)),
5896 /// Checks if the given object is currently in the success state
5898 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
5902 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
5903 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5904 impl Drop for CResult_NetworkGraphDecodeErrorZ {
5905 fn drop(&mut self) {
5907 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5908 let _ = unsafe { Box::from_raw(self.contents.result) };
5911 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5912 let _ = unsafe { Box::from_raw(self.contents.err) };
5917 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5918 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
5919 let contents = if o.result_ok {
5920 let result = unsafe { o.contents.result };
5921 unsafe { o.contents.result = core::ptr::null_mut() };
5922 CResult_NetworkGraphDecodeErrorZPtr { result }
5924 let err = unsafe { o.contents.err };
5925 unsafe { o.contents.err = core::ptr::null_mut(); }
5926 CResult_NetworkGraphDecodeErrorZPtr { err }
5930 result_ok: o.result_ok,
5936 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
5937 pub enum COption_CVec_NetAddressZZ {
5938 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
5939 Some(crate::c_types::derived::CVec_NetAddressZ),
5940 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
5943 impl COption_CVec_NetAddressZZ {
5944 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5945 if let Self::None = self { false } else { true }
5947 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5950 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
5951 if let Self::Some(v) = self { v } else { unreachable!() }
5955 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
5956 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
5957 COption_CVec_NetAddressZZ::Some(o)
5960 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
5961 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
5962 COption_CVec_NetAddressZZ::None
5965 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
5966 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
5968 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
5969 /// but with all dynamically-allocated buffers duplicated in new buffers.
5970 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
5972 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
5973 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5974 /// A pointer to the contents in the success state.
5975 /// Reading from this pointer when `result_ok` is not set is undefined.
5976 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
5977 /// A pointer to the contents in the error state.
5978 /// Reading from this pointer when `result_ok` is set is undefined.
5979 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5982 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5983 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5984 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5985 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5986 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
5987 /// `err` or `result` depending on the state of `result_ok`.
5988 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
5989 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
5990 pub result_ok: bool,
5993 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
5994 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5995 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5996 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5997 result: Box::into_raw(Box::new(o)),
6003 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6004 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6005 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6006 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6007 err: Box::into_raw(Box::new(e)),
6012 /// Checks if the given object is currently in the success state
6014 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6018 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6019 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6020 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6021 fn drop(&mut self) {
6023 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6024 let _ = unsafe { Box::from_raw(self.contents.result) };
6027 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6028 let _ = unsafe { Box::from_raw(self.contents.err) };
6033 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6034 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6035 let contents = if o.result_ok {
6036 let result = unsafe { o.contents.result };
6037 unsafe { o.contents.result = core::ptr::null_mut() };
6038 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6040 let err = unsafe { o.contents.err };
6041 unsafe { o.contents.err = core::ptr::null_mut(); }
6042 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6046 result_ok: o.result_ok,
6050 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6051 fn clone(&self) -> Self {
6053 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6054 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6057 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6058 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6064 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6065 /// but with all dynamically-allocated buffers duplicated in new buffers.
6066 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6068 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6069 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6070 /// A pointer to the contents in the success state.
6071 /// Reading from this pointer when `result_ok` is not set is undefined.
6072 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6073 /// A pointer to the contents in the error state.
6074 /// Reading from this pointer when `result_ok` is set is undefined.
6075 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6078 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6079 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6081 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6082 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6083 /// `err` or `result` depending on the state of `result_ok`.
6084 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6085 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6086 pub result_ok: bool,
6089 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6090 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6091 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6092 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6093 result: Box::into_raw(Box::new(o)),
6099 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6100 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6101 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6102 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6103 err: Box::into_raw(Box::new(e)),
6108 /// Checks if the given object is currently in the success state
6110 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6114 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6115 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6116 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6117 fn drop(&mut self) {
6119 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6120 let _ = unsafe { Box::from_raw(self.contents.result) };
6123 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6124 let _ = unsafe { Box::from_raw(self.contents.err) };
6129 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6130 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6131 let contents = if o.result_ok {
6132 let result = unsafe { o.contents.result };
6133 unsafe { o.contents.result = core::ptr::null_mut() };
6134 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6136 let err = unsafe { o.contents.err };
6137 unsafe { o.contents.err = core::ptr::null_mut(); }
6138 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6142 result_ok: o.result_ok,
6146 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6147 fn clone(&self) -> Self {
6149 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6150 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6153 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6154 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6160 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6161 /// but with all dynamically-allocated buffers duplicated in new buffers.
6162 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6164 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6165 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6166 /// A pointer to the contents in the success state.
6167 /// Reading from this pointer when `result_ok` is not set is undefined.
6168 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6169 /// A pointer to the contents in the error state.
6170 /// Reading from this pointer when `result_ok` is set is undefined.
6171 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6174 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6175 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6176 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6177 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6178 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6179 /// `err` or `result` depending on the state of `result_ok`.
6180 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6181 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6182 pub result_ok: bool,
6185 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6186 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6187 CResult_SpendableOutputDescriptorDecodeErrorZ {
6188 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6189 result: Box::into_raw(Box::new(o)),
6195 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6196 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6197 CResult_SpendableOutputDescriptorDecodeErrorZ {
6198 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6199 err: Box::into_raw(Box::new(e)),
6204 /// Checks if the given object is currently in the success state
6206 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6210 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6211 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6212 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6213 fn drop(&mut self) {
6215 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6216 let _ = unsafe { Box::from_raw(self.contents.result) };
6219 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6220 let _ = unsafe { Box::from_raw(self.contents.err) };
6225 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6226 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6227 let contents = if o.result_ok {
6228 let result = unsafe { o.contents.result };
6229 unsafe { o.contents.result = core::ptr::null_mut() };
6230 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6232 let err = unsafe { o.contents.err };
6233 unsafe { o.contents.err = core::ptr::null_mut(); }
6234 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6238 result_ok: o.result_ok,
6242 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6243 fn clone(&self) -> Self {
6245 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6246 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6249 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6250 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6256 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6257 /// but with all dynamically-allocated buffers duplicated in new buffers.
6258 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6260 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6261 /// This corresponds to std::vector in C++
6262 pub struct CVec_PaymentPreimageZ {
6263 /// The elements in the array.
6264 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6265 pub data: *mut crate::c_types::ThirtyTwoBytes,
6266 /// The number of elements pointed to by `data`.
6269 impl CVec_PaymentPreimageZ {
6270 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6271 if self.datalen == 0 { return Vec::new(); }
6272 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6273 self.data = core::ptr::null_mut();
6277 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6278 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6281 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6282 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6283 let datalen = v.len();
6284 let data = Box::into_raw(v.into_boxed_slice());
6285 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6289 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6290 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6291 impl Drop for CVec_PaymentPreimageZ {
6292 fn drop(&mut self) {
6293 if self.datalen == 0 { return; }
6294 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6297 impl Clone for CVec_PaymentPreimageZ {
6298 fn clone(&self) -> Self {
6299 let mut res = Vec::new();
6300 if self.datalen == 0 { return Self::from(res); }
6301 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6306 /// A tuple of 2 elements. See the individual fields for the types contained.
6307 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6308 /// The element at position 0
6309 pub a: crate::c_types::Signature,
6310 /// The element at position 1
6311 pub b: crate::c_types::derived::CVec_SignatureZ,
6313 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6314 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6321 impl C2Tuple_SignatureCVec_SignatureZZ {
6322 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6326 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6327 fn clone(&self) -> Self {
6329 a: Clone::clone(&self.a),
6330 b: Clone::clone(&self.b),
6335 /// Creates a new tuple which has the same data as `orig`
6336 /// but with all dynamically-allocated buffers duplicated in new buffers.
6337 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6338 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6340 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6341 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6345 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6346 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6348 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6349 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6350 /// A pointer to the contents in the success state.
6351 /// Reading from this pointer when `result_ok` is not set is undefined.
6352 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6353 /// Note that this value is always NULL, as there are no contents in the Err variant
6354 pub err: *mut core::ffi::c_void,
6357 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6358 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6360 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6361 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6362 /// `err` or `result` depending on the state of `result_ok`.
6363 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6364 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6365 pub result_ok: bool,
6368 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6369 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6370 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6371 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6372 result: Box::into_raw(Box::new(o)),
6378 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6379 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6380 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6381 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6382 err: core::ptr::null_mut(),
6387 /// Checks if the given object is currently in the success state
6389 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6393 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6394 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6395 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6396 fn drop(&mut self) {
6398 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6399 let _ = unsafe { Box::from_raw(self.contents.result) };
6405 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6406 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6407 let contents = if o.result_ok {
6408 let result = unsafe { o.contents.result };
6409 unsafe { o.contents.result = core::ptr::null_mut() };
6410 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6412 let _ = unsafe { Box::from_raw(o.contents.err) };
6413 o.contents.err = core::ptr::null_mut();
6414 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6418 result_ok: o.result_ok,
6422 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6423 fn clone(&self) -> Self {
6425 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6426 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6429 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6430 err: core::ptr::null_mut()
6436 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6437 /// but with all dynamically-allocated buffers duplicated in new buffers.
6438 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6440 /// The contents of CResult_SignatureNoneZ
6441 pub union CResult_SignatureNoneZPtr {
6442 /// A pointer to the contents in the success state.
6443 /// Reading from this pointer when `result_ok` is not set is undefined.
6444 pub result: *mut crate::c_types::Signature,
6445 /// Note that this value is always NULL, as there are no contents in the Err variant
6446 pub err: *mut core::ffi::c_void,
6449 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6450 /// containing a crate::c_types::Signature on success and a () on failure.
6451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6452 pub struct CResult_SignatureNoneZ {
6453 /// The contents of this CResult_SignatureNoneZ, accessible via either
6454 /// `err` or `result` depending on the state of `result_ok`.
6455 pub contents: CResult_SignatureNoneZPtr,
6456 /// Whether this CResult_SignatureNoneZ represents a success state.
6457 pub result_ok: bool,
6460 /// Creates a new CResult_SignatureNoneZ in the success state.
6461 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6462 CResult_SignatureNoneZ {
6463 contents: CResult_SignatureNoneZPtr {
6464 result: Box::into_raw(Box::new(o)),
6470 /// Creates a new CResult_SignatureNoneZ in the error state.
6471 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6472 CResult_SignatureNoneZ {
6473 contents: CResult_SignatureNoneZPtr {
6474 err: core::ptr::null_mut(),
6479 /// Checks if the given object is currently in the success state
6481 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6485 /// Frees any resources used by the CResult_SignatureNoneZ.
6486 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6487 impl Drop for CResult_SignatureNoneZ {
6488 fn drop(&mut self) {
6490 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6491 let _ = unsafe { Box::from_raw(self.contents.result) };
6497 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6498 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6499 let contents = if o.result_ok {
6500 let result = unsafe { o.contents.result };
6501 unsafe { o.contents.result = core::ptr::null_mut() };
6502 CResult_SignatureNoneZPtr { result }
6504 let _ = unsafe { Box::from_raw(o.contents.err) };
6505 o.contents.err = core::ptr::null_mut();
6506 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6510 result_ok: o.result_ok,
6514 impl Clone for CResult_SignatureNoneZ {
6515 fn clone(&self) -> Self {
6517 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6518 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6521 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6522 err: core::ptr::null_mut()
6528 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6529 /// but with all dynamically-allocated buffers duplicated in new buffers.
6530 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6532 /// A tuple of 2 elements. See the individual fields for the types contained.
6533 pub struct C2Tuple_SignatureSignatureZ {
6534 /// The element at position 0
6535 pub a: crate::c_types::Signature,
6536 /// The element at position 1
6537 pub b: crate::c_types::Signature,
6539 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6540 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6547 impl C2Tuple_SignatureSignatureZ {
6548 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6552 impl Clone for C2Tuple_SignatureSignatureZ {
6553 fn clone(&self) -> Self {
6555 a: Clone::clone(&self.a),
6556 b: Clone::clone(&self.b),
6561 /// Creates a new tuple which has the same data as `orig`
6562 /// but with all dynamically-allocated buffers duplicated in new buffers.
6563 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6564 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6566 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6567 C2Tuple_SignatureSignatureZ { a, b, }
6571 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6572 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6574 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6575 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6576 /// A pointer to the contents in the success state.
6577 /// Reading from this pointer when `result_ok` is not set is undefined.
6578 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6579 /// Note that this value is always NULL, as there are no contents in the Err variant
6580 pub err: *mut core::ffi::c_void,
6583 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6584 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6586 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6587 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6588 /// `err` or `result` depending on the state of `result_ok`.
6589 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6590 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6591 pub result_ok: bool,
6594 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6595 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6596 CResult_C2Tuple_SignatureSignatureZNoneZ {
6597 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6598 result: Box::into_raw(Box::new(o)),
6604 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6605 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6606 CResult_C2Tuple_SignatureSignatureZNoneZ {
6607 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6608 err: core::ptr::null_mut(),
6613 /// Checks if the given object is currently in the success state
6615 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6619 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6620 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6621 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
6622 fn drop(&mut self) {
6624 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6625 let _ = unsafe { Box::from_raw(self.contents.result) };
6631 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6632 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
6633 let contents = if o.result_ok {
6634 let result = unsafe { o.contents.result };
6635 unsafe { o.contents.result = core::ptr::null_mut() };
6636 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
6638 let _ = unsafe { Box::from_raw(o.contents.err) };
6639 o.contents.err = core::ptr::null_mut();
6640 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6644 result_ok: o.result_ok,
6648 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6649 fn clone(&self) -> Self {
6651 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6652 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6655 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6656 err: core::ptr::null_mut()
6662 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6663 /// but with all dynamically-allocated buffers duplicated in new buffers.
6664 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6666 /// The contents of CResult_SecretKeyNoneZ
6667 pub union CResult_SecretKeyNoneZPtr {
6668 /// A pointer to the contents in the success state.
6669 /// Reading from this pointer when `result_ok` is not set is undefined.
6670 pub result: *mut crate::c_types::SecretKey,
6671 /// Note that this value is always NULL, as there are no contents in the Err variant
6672 pub err: *mut core::ffi::c_void,
6675 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6676 /// containing a crate::c_types::SecretKey on success and a () on failure.
6677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6678 pub struct CResult_SecretKeyNoneZ {
6679 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6680 /// `err` or `result` depending on the state of `result_ok`.
6681 pub contents: CResult_SecretKeyNoneZPtr,
6682 /// Whether this CResult_SecretKeyNoneZ represents a success state.
6683 pub result_ok: bool,
6686 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6687 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6688 CResult_SecretKeyNoneZ {
6689 contents: CResult_SecretKeyNoneZPtr {
6690 result: Box::into_raw(Box::new(o)),
6696 /// Creates a new CResult_SecretKeyNoneZ in the error state.
6697 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
6698 CResult_SecretKeyNoneZ {
6699 contents: CResult_SecretKeyNoneZPtr {
6700 err: core::ptr::null_mut(),
6705 /// Checks if the given object is currently in the success state
6707 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
6711 /// Frees any resources used by the CResult_SecretKeyNoneZ.
6712 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
6713 impl Drop for CResult_SecretKeyNoneZ {
6714 fn drop(&mut self) {
6716 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6717 let _ = unsafe { Box::from_raw(self.contents.result) };
6723 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
6724 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
6725 let contents = if o.result_ok {
6726 let result = unsafe { o.contents.result };
6727 unsafe { o.contents.result = core::ptr::null_mut() };
6728 CResult_SecretKeyNoneZPtr { result }
6730 let _ = unsafe { Box::from_raw(o.contents.err) };
6731 o.contents.err = core::ptr::null_mut();
6732 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
6736 result_ok: o.result_ok,
6740 impl Clone for CResult_SecretKeyNoneZ {
6741 fn clone(&self) -> Self {
6743 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
6744 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
6747 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
6748 err: core::ptr::null_mut()
6754 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
6755 /// but with all dynamically-allocated buffers duplicated in new buffers.
6756 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
6758 /// The contents of CResult_SignDecodeErrorZ
6759 pub union CResult_SignDecodeErrorZPtr {
6760 /// A pointer to the contents in the success state.
6761 /// Reading from this pointer when `result_ok` is not set is undefined.
6762 pub result: *mut crate::lightning::chain::keysinterface::Sign,
6763 /// A pointer to the contents in the error state.
6764 /// Reading from this pointer when `result_ok` is set is undefined.
6765 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6768 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6769 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6770 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6771 pub struct CResult_SignDecodeErrorZ {
6772 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
6773 /// `err` or `result` depending on the state of `result_ok`.
6774 pub contents: CResult_SignDecodeErrorZPtr,
6775 /// Whether this CResult_SignDecodeErrorZ represents a success state.
6776 pub result_ok: bool,
6779 /// Creates a new CResult_SignDecodeErrorZ in the success state.
6780 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
6781 CResult_SignDecodeErrorZ {
6782 contents: CResult_SignDecodeErrorZPtr {
6783 result: Box::into_raw(Box::new(o)),
6789 /// Creates a new CResult_SignDecodeErrorZ in the error state.
6790 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
6791 CResult_SignDecodeErrorZ {
6792 contents: CResult_SignDecodeErrorZPtr {
6793 err: Box::into_raw(Box::new(e)),
6798 /// Checks if the given object is currently in the success state
6800 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
6804 /// Frees any resources used by the CResult_SignDecodeErrorZ.
6805 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
6806 impl Drop for CResult_SignDecodeErrorZ {
6807 fn drop(&mut self) {
6809 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6810 let _ = unsafe { Box::from_raw(self.contents.result) };
6813 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6814 let _ = unsafe { Box::from_raw(self.contents.err) };
6819 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
6820 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
6821 let contents = if o.result_ok {
6822 let result = unsafe { o.contents.result };
6823 unsafe { o.contents.result = core::ptr::null_mut() };
6824 CResult_SignDecodeErrorZPtr { result }
6826 let err = unsafe { o.contents.err };
6827 unsafe { o.contents.err = core::ptr::null_mut(); }
6828 CResult_SignDecodeErrorZPtr { err }
6832 result_ok: o.result_ok,
6836 impl Clone for CResult_SignDecodeErrorZ {
6837 fn clone(&self) -> Self {
6839 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
6840 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
6843 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
6844 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6850 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
6851 /// but with all dynamically-allocated buffers duplicated in new buffers.
6852 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
6854 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6855 /// This corresponds to std::vector in C++
6856 pub struct CVec_u5Z {
6857 /// The elements in the array.
6858 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6859 pub data: *mut crate::c_types::u5,
6860 /// The number of elements pointed to by `data`.
6864 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
6865 if self.datalen == 0 { return Vec::new(); }
6866 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6867 self.data = core::ptr::null_mut();
6871 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
6872 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6875 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
6876 fn from(v: Vec<crate::c_types::u5>) -> Self {
6877 let datalen = v.len();
6878 let data = Box::into_raw(v.into_boxed_slice());
6879 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6883 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6884 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
6885 impl Drop for CVec_u5Z {
6886 fn drop(&mut self) {
6887 if self.datalen == 0 { return; }
6888 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6891 impl Clone for CVec_u5Z {
6892 fn clone(&self) -> Self {
6893 let mut res = Vec::new();
6894 if self.datalen == 0 { return Self::from(res); }
6895 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6900 /// The contents of CResult_RecoverableSignatureNoneZ
6901 pub union CResult_RecoverableSignatureNoneZPtr {
6902 /// A pointer to the contents in the success state.
6903 /// Reading from this pointer when `result_ok` is not set is undefined.
6904 pub result: *mut crate::c_types::RecoverableSignature,
6905 /// Note that this value is always NULL, as there are no contents in the Err variant
6906 pub err: *mut core::ffi::c_void,
6909 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6910 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
6911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6912 pub struct CResult_RecoverableSignatureNoneZ {
6913 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6914 /// `err` or `result` depending on the state of `result_ok`.
6915 pub contents: CResult_RecoverableSignatureNoneZPtr,
6916 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6917 pub result_ok: bool,
6920 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
6921 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
6922 CResult_RecoverableSignatureNoneZ {
6923 contents: CResult_RecoverableSignatureNoneZPtr {
6924 result: Box::into_raw(Box::new(o)),
6930 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
6931 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
6932 CResult_RecoverableSignatureNoneZ {
6933 contents: CResult_RecoverableSignatureNoneZPtr {
6934 err: core::ptr::null_mut(),
6939 /// Checks if the given object is currently in the success state
6941 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
6945 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
6946 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
6947 impl Drop for CResult_RecoverableSignatureNoneZ {
6948 fn drop(&mut self) {
6950 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6951 let _ = unsafe { Box::from_raw(self.contents.result) };
6957 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
6958 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
6959 let contents = if o.result_ok {
6960 let result = unsafe { o.contents.result };
6961 unsafe { o.contents.result = core::ptr::null_mut() };
6962 CResult_RecoverableSignatureNoneZPtr { result }
6964 let _ = unsafe { Box::from_raw(o.contents.err) };
6965 o.contents.err = core::ptr::null_mut();
6966 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
6970 result_ok: o.result_ok,
6974 impl Clone for CResult_RecoverableSignatureNoneZ {
6975 fn clone(&self) -> Self {
6977 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
6978 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
6981 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
6982 err: core::ptr::null_mut()
6988 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
6989 /// but with all dynamically-allocated buffers duplicated in new buffers.
6990 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
6992 /// A dynamically-allocated array of u8s of arbitrary size.
6993 /// This corresponds to std::vector in C++
6994 pub struct CVec_u8Z {
6995 /// The elements in the array.
6996 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6998 /// The number of elements pointed to by `data`.
7002 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
7003 if self.datalen == 0 { return Vec::new(); }
7004 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7005 self.data = core::ptr::null_mut();
7009 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
7010 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7013 impl From<Vec<u8>> for CVec_u8Z {
7014 fn from(v: Vec<u8>) -> Self {
7015 let datalen = v.len();
7016 let data = Box::into_raw(v.into_boxed_slice());
7017 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7021 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7022 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
7023 impl Drop for CVec_u8Z {
7024 fn drop(&mut self) {
7025 if self.datalen == 0 { return; }
7026 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7029 impl Clone for CVec_u8Z {
7030 fn clone(&self) -> Self {
7031 let mut res = Vec::new();
7032 if self.datalen == 0 { return Self::from(res); }
7033 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7038 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7039 /// This corresponds to std::vector in C++
7040 pub struct CVec_CVec_u8ZZ {
7041 /// The elements in the array.
7042 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7043 pub data: *mut crate::c_types::derived::CVec_u8Z,
7044 /// The number of elements pointed to by `data`.
7047 impl CVec_CVec_u8ZZ {
7048 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
7049 if self.datalen == 0 { return Vec::new(); }
7050 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7051 self.data = core::ptr::null_mut();
7055 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
7056 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7059 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
7060 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
7061 let datalen = v.len();
7062 let data = Box::into_raw(v.into_boxed_slice());
7063 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7067 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7068 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
7069 impl Drop for CVec_CVec_u8ZZ {
7070 fn drop(&mut self) {
7071 if self.datalen == 0 { return; }
7072 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7075 impl Clone for CVec_CVec_u8ZZ {
7076 fn clone(&self) -> Self {
7077 let mut res = Vec::new();
7078 if self.datalen == 0 { return Self::from(res); }
7079 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7084 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
7085 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
7086 /// A pointer to the contents in the success state.
7087 /// Reading from this pointer when `result_ok` is not set is undefined.
7088 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
7089 /// Note that this value is always NULL, as there are no contents in the Err variant
7090 pub err: *mut core::ffi::c_void,
7093 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7094 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7096 pub struct CResult_CVec_CVec_u8ZZNoneZ {
7097 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7098 /// `err` or `result` depending on the state of `result_ok`.
7099 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
7100 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7101 pub result_ok: bool,
7104 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
7105 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
7106 CResult_CVec_CVec_u8ZZNoneZ {
7107 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7108 result: Box::into_raw(Box::new(o)),
7114 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
7115 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
7116 CResult_CVec_CVec_u8ZZNoneZ {
7117 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7118 err: core::ptr::null_mut(),
7123 /// Checks if the given object is currently in the success state
7125 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
7129 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
7130 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
7131 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
7132 fn drop(&mut self) {
7134 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7135 let _ = unsafe { Box::from_raw(self.contents.result) };
7141 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
7142 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
7143 let contents = if o.result_ok {
7144 let result = unsafe { o.contents.result };
7145 unsafe { o.contents.result = core::ptr::null_mut() };
7146 CResult_CVec_CVec_u8ZZNoneZPtr { result }
7148 let _ = unsafe { Box::from_raw(o.contents.err) };
7149 o.contents.err = core::ptr::null_mut();
7150 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
7154 result_ok: o.result_ok,
7158 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
7159 fn clone(&self) -> Self {
7161 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7162 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
7165 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7166 err: core::ptr::null_mut()
7172 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
7173 /// but with all dynamically-allocated buffers duplicated in new buffers.
7174 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
7176 /// The contents of CResult_InMemorySignerDecodeErrorZ
7177 pub union CResult_InMemorySignerDecodeErrorZPtr {
7178 /// A pointer to the contents in the success state.
7179 /// Reading from this pointer when `result_ok` is not set is undefined.
7180 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
7181 /// A pointer to the contents in the error state.
7182 /// Reading from this pointer when `result_ok` is set is undefined.
7183 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7186 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7187 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7189 pub struct CResult_InMemorySignerDecodeErrorZ {
7190 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7191 /// `err` or `result` depending on the state of `result_ok`.
7192 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7193 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7194 pub result_ok: bool,
7197 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7198 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7199 CResult_InMemorySignerDecodeErrorZ {
7200 contents: CResult_InMemorySignerDecodeErrorZPtr {
7201 result: Box::into_raw(Box::new(o)),
7207 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7208 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7209 CResult_InMemorySignerDecodeErrorZ {
7210 contents: CResult_InMemorySignerDecodeErrorZPtr {
7211 err: Box::into_raw(Box::new(e)),
7216 /// Checks if the given object is currently in the success state
7218 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7222 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7223 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7224 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7225 fn drop(&mut self) {
7227 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7228 let _ = unsafe { Box::from_raw(self.contents.result) };
7231 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7232 let _ = unsafe { Box::from_raw(self.contents.err) };
7237 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7238 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7239 let contents = if o.result_ok {
7240 let result = unsafe { o.contents.result };
7241 unsafe { o.contents.result = core::ptr::null_mut() };
7242 CResult_InMemorySignerDecodeErrorZPtr { result }
7244 let err = unsafe { o.contents.err };
7245 unsafe { o.contents.err = core::ptr::null_mut(); }
7246 CResult_InMemorySignerDecodeErrorZPtr { err }
7250 result_ok: o.result_ok,
7254 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7255 fn clone(&self) -> Self {
7257 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7258 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7261 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7262 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7268 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7269 /// but with all dynamically-allocated buffers duplicated in new buffers.
7270 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7272 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7273 /// This corresponds to std::vector in C++
7274 pub struct CVec_TxOutZ {
7275 /// The elements in the array.
7276 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7277 pub data: *mut crate::c_types::TxOut,
7278 /// The number of elements pointed to by `data`.
7282 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7283 if self.datalen == 0 { return Vec::new(); }
7284 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7285 self.data = core::ptr::null_mut();
7289 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7290 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7293 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7294 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7295 let datalen = v.len();
7296 let data = Box::into_raw(v.into_boxed_slice());
7297 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7301 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7302 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7303 impl Drop for CVec_TxOutZ {
7304 fn drop(&mut self) {
7305 if self.datalen == 0 { return; }
7306 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7309 impl Clone for CVec_TxOutZ {
7310 fn clone(&self) -> Self {
7311 let mut res = Vec::new();
7312 if self.datalen == 0 { return Self::from(res); }
7313 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7318 /// The contents of CResult_TransactionNoneZ
7319 pub union CResult_TransactionNoneZPtr {
7320 /// A pointer to the contents in the success state.
7321 /// Reading from this pointer when `result_ok` is not set is undefined.
7322 pub result: *mut crate::c_types::Transaction,
7323 /// Note that this value is always NULL, as there are no contents in the Err variant
7324 pub err: *mut core::ffi::c_void,
7327 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7328 /// containing a crate::c_types::Transaction on success and a () on failure.
7329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7330 pub struct CResult_TransactionNoneZ {
7331 /// The contents of this CResult_TransactionNoneZ, accessible via either
7332 /// `err` or `result` depending on the state of `result_ok`.
7333 pub contents: CResult_TransactionNoneZPtr,
7334 /// Whether this CResult_TransactionNoneZ represents a success state.
7335 pub result_ok: bool,
7338 /// Creates a new CResult_TransactionNoneZ in the success state.
7339 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7340 CResult_TransactionNoneZ {
7341 contents: CResult_TransactionNoneZPtr {
7342 result: Box::into_raw(Box::new(o)),
7348 /// Creates a new CResult_TransactionNoneZ in the error state.
7349 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7350 CResult_TransactionNoneZ {
7351 contents: CResult_TransactionNoneZPtr {
7352 err: core::ptr::null_mut(),
7357 /// Checks if the given object is currently in the success state
7359 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7363 /// Frees any resources used by the CResult_TransactionNoneZ.
7364 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7365 impl Drop for CResult_TransactionNoneZ {
7366 fn drop(&mut self) {
7368 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7369 let _ = unsafe { Box::from_raw(self.contents.result) };
7375 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7376 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7377 let contents = if o.result_ok {
7378 let result = unsafe { o.contents.result };
7379 unsafe { o.contents.result = core::ptr::null_mut() };
7380 CResult_TransactionNoneZPtr { result }
7382 let _ = unsafe { Box::from_raw(o.contents.err) };
7383 o.contents.err = core::ptr::null_mut();
7384 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7388 result_ok: o.result_ok,
7392 impl Clone for CResult_TransactionNoneZ {
7393 fn clone(&self) -> Self {
7395 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7396 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7399 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7400 err: core::ptr::null_mut()
7406 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7407 /// but with all dynamically-allocated buffers duplicated in new buffers.
7408 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7410 /// A tuple of 2 elements. See the individual fields for the types contained.
7411 pub struct C2Tuple_BlockHashChannelMonitorZ {
7412 /// The element at position 0
7413 pub a: crate::c_types::ThirtyTwoBytes,
7414 /// The element at position 1
7415 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7417 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7418 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7425 impl C2Tuple_BlockHashChannelMonitorZ {
7426 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
7430 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
7432 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
7433 C2Tuple_BlockHashChannelMonitorZ { a, b, }
7437 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
7438 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
7440 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7441 /// This corresponds to std::vector in C++
7442 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
7443 /// The elements in the array.
7444 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7445 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7446 /// The number of elements pointed to by `data`.
7449 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
7450 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
7451 if self.datalen == 0 { return Vec::new(); }
7452 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7453 self.data = core::ptr::null_mut();
7457 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
7458 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7461 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7462 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
7463 let datalen = v.len();
7464 let data = Box::into_raw(v.into_boxed_slice());
7465 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7469 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7470 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
7471 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7472 fn drop(&mut self) {
7473 if self.datalen == 0 { return; }
7474 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7478 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7479 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7480 /// A pointer to the contents in the success state.
7481 /// Reading from this pointer when `result_ok` is not set is undefined.
7482 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
7483 /// A pointer to the contents in the error state.
7484 /// Reading from this pointer when `result_ok` is set is undefined.
7485 pub err: *mut crate::c_types::IOError,
7488 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7489 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7491 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7492 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7493 /// `err` or `result` depending on the state of `result_ok`.
7494 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
7495 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7496 pub result_ok: bool,
7499 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
7500 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7501 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7502 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7503 result: Box::into_raw(Box::new(o)),
7509 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
7510 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7511 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7512 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7513 err: Box::into_raw(Box::new(e)),
7518 /// Checks if the given object is currently in the success state
7520 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
7524 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
7525 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
7526 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7527 fn drop(&mut self) {
7529 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7530 let _ = unsafe { Box::from_raw(self.contents.result) };
7533 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7534 let _ = unsafe { Box::from_raw(self.contents.err) };
7539 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7540 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
7541 let contents = if o.result_ok {
7542 let result = unsafe { o.contents.result };
7543 unsafe { o.contents.result = core::ptr::null_mut() };
7544 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
7546 let err = unsafe { o.contents.err };
7547 unsafe { o.contents.err = core::ptr::null_mut(); }
7548 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
7552 result_ok: o.result_ok,
7558 /// An enum which can either contain a u16 or not
7559 pub enum COption_u16Z {
7560 /// When we're in this state, this COption_u16Z contains a u16
7562 /// When we're in this state, this COption_u16Z contains nothing
7566 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7567 if let Self::None = self { false } else { true }
7569 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7572 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
7573 if let Self::Some(v) = self { v } else { unreachable!() }
7577 /// Constructs a new COption_u16Z containing a u16
7578 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
7579 COption_u16Z::Some(o)
7582 /// Constructs a new COption_u16Z containing nothing
7583 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
7587 /// Frees any resources associated with the u16, if we are in the Some state
7588 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
7590 /// Creates a new COption_u16Z which has the same data as `orig`
7591 /// but with all dynamically-allocated buffers duplicated in new buffers.
7592 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
7594 /// The contents of CResult_NoneAPIErrorZ
7595 pub union CResult_NoneAPIErrorZPtr {
7596 /// Note that this value is always NULL, as there are no contents in the OK variant
7597 pub result: *mut core::ffi::c_void,
7598 /// A pointer to the contents in the error state.
7599 /// Reading from this pointer when `result_ok` is set is undefined.
7600 pub err: *mut crate::lightning::util::errors::APIError,
7603 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7604 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
7605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7606 pub struct CResult_NoneAPIErrorZ {
7607 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
7608 /// `err` or `result` depending on the state of `result_ok`.
7609 pub contents: CResult_NoneAPIErrorZPtr,
7610 /// Whether this CResult_NoneAPIErrorZ represents a success state.
7611 pub result_ok: bool,
7614 /// Creates a new CResult_NoneAPIErrorZ in the success state.
7615 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
7616 CResult_NoneAPIErrorZ {
7617 contents: CResult_NoneAPIErrorZPtr {
7618 result: core::ptr::null_mut(),
7624 /// Creates a new CResult_NoneAPIErrorZ in the error state.
7625 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
7626 CResult_NoneAPIErrorZ {
7627 contents: CResult_NoneAPIErrorZPtr {
7628 err: Box::into_raw(Box::new(e)),
7633 /// Checks if the given object is currently in the success state
7635 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
7639 /// Frees any resources used by the CResult_NoneAPIErrorZ.
7640 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
7641 impl Drop for CResult_NoneAPIErrorZ {
7642 fn drop(&mut self) {
7645 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7646 let _ = unsafe { Box::from_raw(self.contents.err) };
7651 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
7652 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
7653 let contents = if o.result_ok {
7654 let _ = unsafe { Box::from_raw(o.contents.result) };
7655 o.contents.result = core::ptr::null_mut();
7656 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
7658 let err = unsafe { o.contents.err };
7659 unsafe { o.contents.err = core::ptr::null_mut(); }
7660 CResult_NoneAPIErrorZPtr { err }
7664 result_ok: o.result_ok,
7668 impl Clone for CResult_NoneAPIErrorZ {
7669 fn clone(&self) -> Self {
7671 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
7672 result: core::ptr::null_mut()
7675 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
7676 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7682 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
7683 /// but with all dynamically-allocated buffers duplicated in new buffers.
7684 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
7686 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7687 /// This corresponds to std::vector in C++
7688 pub struct CVec_CResult_NoneAPIErrorZZ {
7689 /// The elements in the array.
7690 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7691 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
7692 /// The number of elements pointed to by `data`.
7695 impl CVec_CResult_NoneAPIErrorZZ {
7696 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
7697 if self.datalen == 0 { return Vec::new(); }
7698 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7699 self.data = core::ptr::null_mut();
7703 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
7704 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7707 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
7708 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
7709 let datalen = v.len();
7710 let data = Box::into_raw(v.into_boxed_slice());
7711 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7716 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
7717 impl Drop for CVec_CResult_NoneAPIErrorZZ {
7718 fn drop(&mut self) {
7719 if self.datalen == 0 { return; }
7720 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7723 impl Clone for CVec_CResult_NoneAPIErrorZZ {
7724 fn clone(&self) -> Self {
7725 let mut res = Vec::new();
7726 if self.datalen == 0 { return Self::from(res); }
7727 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7732 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7733 /// This corresponds to std::vector in C++
7734 pub struct CVec_APIErrorZ {
7735 /// The elements in the array.
7736 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7737 pub data: *mut crate::lightning::util::errors::APIError,
7738 /// The number of elements pointed to by `data`.
7741 impl CVec_APIErrorZ {
7742 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
7743 if self.datalen == 0 { return Vec::new(); }
7744 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7745 self.data = core::ptr::null_mut();
7749 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
7750 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7753 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
7754 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
7755 let datalen = v.len();
7756 let data = Box::into_raw(v.into_boxed_slice());
7757 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7761 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7762 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
7763 impl Drop for CVec_APIErrorZ {
7764 fn drop(&mut self) {
7765 if self.datalen == 0 { return; }
7766 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7769 impl Clone for CVec_APIErrorZ {
7770 fn clone(&self) -> Self {
7771 let mut res = Vec::new();
7772 if self.datalen == 0 { return Self::from(res); }
7773 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7778 /// The contents of CResult__u832APIErrorZ
7779 pub union CResult__u832APIErrorZPtr {
7780 /// A pointer to the contents in the success state.
7781 /// Reading from this pointer when `result_ok` is not set is undefined.
7782 pub result: *mut crate::c_types::ThirtyTwoBytes,
7783 /// A pointer to the contents in the error state.
7784 /// Reading from this pointer when `result_ok` is set is undefined.
7785 pub err: *mut crate::lightning::util::errors::APIError,
7788 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
7789 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7790 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7791 pub struct CResult__u832APIErrorZ {
7792 /// The contents of this CResult__u832APIErrorZ, accessible via either
7793 /// `err` or `result` depending on the state of `result_ok`.
7794 pub contents: CResult__u832APIErrorZPtr,
7795 /// Whether this CResult__u832APIErrorZ represents a success state.
7796 pub result_ok: bool,
7799 /// Creates a new CResult__u832APIErrorZ in the success state.
7800 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
7801 CResult__u832APIErrorZ {
7802 contents: CResult__u832APIErrorZPtr {
7803 result: Box::into_raw(Box::new(o)),
7809 /// Creates a new CResult__u832APIErrorZ in the error state.
7810 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
7811 CResult__u832APIErrorZ {
7812 contents: CResult__u832APIErrorZPtr {
7813 err: Box::into_raw(Box::new(e)),
7818 /// Checks if the given object is currently in the success state
7820 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
7824 /// Frees any resources used by the CResult__u832APIErrorZ.
7825 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
7826 impl Drop for CResult__u832APIErrorZ {
7827 fn drop(&mut self) {
7829 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7830 let _ = unsafe { Box::from_raw(self.contents.result) };
7833 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7834 let _ = unsafe { Box::from_raw(self.contents.err) };
7839 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
7840 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7841 let contents = if o.result_ok {
7842 let result = unsafe { o.contents.result };
7843 unsafe { o.contents.result = core::ptr::null_mut() };
7844 CResult__u832APIErrorZPtr { result }
7846 let err = unsafe { o.contents.err };
7847 unsafe { o.contents.err = core::ptr::null_mut(); }
7848 CResult__u832APIErrorZPtr { err }
7852 result_ok: o.result_ok,
7856 impl Clone for CResult__u832APIErrorZ {
7857 fn clone(&self) -> Self {
7859 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
7860 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7863 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
7864 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7870 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
7871 /// but with all dynamically-allocated buffers duplicated in new buffers.
7872 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
7874 /// The contents of CResult_PaymentIdPaymentSendFailureZ
7875 pub union CResult_PaymentIdPaymentSendFailureZPtr {
7876 /// A pointer to the contents in the success state.
7877 /// Reading from this pointer when `result_ok` is not set is undefined.
7878 pub result: *mut crate::c_types::ThirtyTwoBytes,
7879 /// A pointer to the contents in the error state.
7880 /// Reading from this pointer when `result_ok` is set is undefined.
7881 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7884 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
7885 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7887 pub struct CResult_PaymentIdPaymentSendFailureZ {
7888 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
7889 /// `err` or `result` depending on the state of `result_ok`.
7890 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
7891 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
7892 pub result_ok: bool,
7895 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
7896 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
7897 CResult_PaymentIdPaymentSendFailureZ {
7898 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7899 result: Box::into_raw(Box::new(o)),
7905 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
7906 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
7907 CResult_PaymentIdPaymentSendFailureZ {
7908 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7909 err: Box::into_raw(Box::new(e)),
7914 /// Checks if the given object is currently in the success state
7916 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
7920 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
7921 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
7922 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
7923 fn drop(&mut self) {
7925 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7926 let _ = unsafe { Box::from_raw(self.contents.result) };
7929 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7930 let _ = unsafe { Box::from_raw(self.contents.err) };
7935 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
7936 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7937 let contents = if o.result_ok {
7938 let result = unsafe { o.contents.result };
7939 unsafe { o.contents.result = core::ptr::null_mut() };
7940 CResult_PaymentIdPaymentSendFailureZPtr { result }
7942 let err = unsafe { o.contents.err };
7943 unsafe { o.contents.err = core::ptr::null_mut(); }
7944 CResult_PaymentIdPaymentSendFailureZPtr { err }
7948 result_ok: o.result_ok,
7952 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
7953 fn clone(&self) -> Self {
7955 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7956 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7959 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7960 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7966 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
7967 /// but with all dynamically-allocated buffers duplicated in new buffers.
7968 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
7970 /// The contents of CResult_NonePaymentSendFailureZ
7971 pub union CResult_NonePaymentSendFailureZPtr {
7972 /// Note that this value is always NULL, as there are no contents in the OK variant
7973 pub result: *mut core::ffi::c_void,
7974 /// A pointer to the contents in the error state.
7975 /// Reading from this pointer when `result_ok` is set is undefined.
7976 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7979 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7980 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7982 pub struct CResult_NonePaymentSendFailureZ {
7983 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7984 /// `err` or `result` depending on the state of `result_ok`.
7985 pub contents: CResult_NonePaymentSendFailureZPtr,
7986 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
7987 pub result_ok: bool,
7990 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
7991 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
7992 CResult_NonePaymentSendFailureZ {
7993 contents: CResult_NonePaymentSendFailureZPtr {
7994 result: core::ptr::null_mut(),
8000 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8001 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8002 CResult_NonePaymentSendFailureZ {
8003 contents: CResult_NonePaymentSendFailureZPtr {
8004 err: Box::into_raw(Box::new(e)),
8009 /// Checks if the given object is currently in the success state
8011 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8015 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8016 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8017 impl Drop for CResult_NonePaymentSendFailureZ {
8018 fn drop(&mut self) {
8021 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8022 let _ = unsafe { Box::from_raw(self.contents.err) };
8027 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8028 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8029 let contents = if o.result_ok {
8030 let _ = unsafe { Box::from_raw(o.contents.result) };
8031 o.contents.result = core::ptr::null_mut();
8032 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8034 let err = unsafe { o.contents.err };
8035 unsafe { o.contents.err = core::ptr::null_mut(); }
8036 CResult_NonePaymentSendFailureZPtr { err }
8040 result_ok: o.result_ok,
8044 impl Clone for CResult_NonePaymentSendFailureZ {
8045 fn clone(&self) -> Self {
8047 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8048 result: core::ptr::null_mut()
8051 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8052 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8058 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8059 /// but with all dynamically-allocated buffers duplicated in new buffers.
8060 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8062 /// A tuple of 2 elements. See the individual fields for the types contained.
8063 pub struct C2Tuple_PaymentHashPaymentIdZ {
8064 /// The element at position 0
8065 pub a: crate::c_types::ThirtyTwoBytes,
8066 /// The element at position 1
8067 pub b: crate::c_types::ThirtyTwoBytes,
8069 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8070 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8077 impl C2Tuple_PaymentHashPaymentIdZ {
8078 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8082 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8083 fn clone(&self) -> Self {
8085 a: Clone::clone(&self.a),
8086 b: Clone::clone(&self.b),
8091 /// Creates a new tuple which has the same data as `orig`
8092 /// but with all dynamically-allocated buffers duplicated in new buffers.
8093 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8094 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8096 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8097 C2Tuple_PaymentHashPaymentIdZ { a, b, }
8101 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8102 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8104 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8105 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8106 /// A pointer to the contents in the success state.
8107 /// Reading from this pointer when `result_ok` is not set is undefined.
8108 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8109 /// A pointer to the contents in the error state.
8110 /// Reading from this pointer when `result_ok` is set is undefined.
8111 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8114 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8115 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8116 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8117 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8118 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8119 /// `err` or `result` depending on the state of `result_ok`.
8120 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8121 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8122 pub result_ok: bool,
8125 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8126 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8127 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8128 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8129 result: Box::into_raw(Box::new(o)),
8135 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8136 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8137 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8138 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8139 err: Box::into_raw(Box::new(e)),
8144 /// Checks if the given object is currently in the success state
8146 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8150 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8151 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8152 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8153 fn drop(&mut self) {
8155 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8156 let _ = unsafe { Box::from_raw(self.contents.result) };
8159 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8160 let _ = unsafe { Box::from_raw(self.contents.err) };
8165 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8166 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8167 let contents = if o.result_ok {
8168 let result = unsafe { o.contents.result };
8169 unsafe { o.contents.result = core::ptr::null_mut() };
8170 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8172 let err = unsafe { o.contents.err };
8173 unsafe { o.contents.err = core::ptr::null_mut(); }
8174 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8178 result_ok: o.result_ok,
8182 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8183 fn clone(&self) -> Self {
8185 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8186 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8189 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8190 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8196 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8197 /// but with all dynamically-allocated buffers duplicated in new buffers.
8198 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8200 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8201 /// This corresponds to std::vector in C++
8202 pub struct CVec_ThirtyTwoBytesZ {
8203 /// The elements in the array.
8204 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8205 pub data: *mut crate::c_types::ThirtyTwoBytes,
8206 /// The number of elements pointed to by `data`.
8209 impl CVec_ThirtyTwoBytesZ {
8210 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8211 if self.datalen == 0 { return Vec::new(); }
8212 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8213 self.data = core::ptr::null_mut();
8217 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8218 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8221 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8222 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8223 let datalen = v.len();
8224 let data = Box::into_raw(v.into_boxed_slice());
8225 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8229 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8230 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8231 impl Drop for CVec_ThirtyTwoBytesZ {
8232 fn drop(&mut self) {
8233 if self.datalen == 0 { return; }
8234 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8237 impl Clone for CVec_ThirtyTwoBytesZ {
8238 fn clone(&self) -> Self {
8239 let mut res = Vec::new();
8240 if self.datalen == 0 { return Self::from(res); }
8241 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8246 /// A tuple of 2 elements. See the individual fields for the types contained.
8247 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8248 /// The element at position 0
8249 pub a: crate::c_types::ThirtyTwoBytes,
8250 /// The element at position 1
8251 pub b: crate::c_types::ThirtyTwoBytes,
8253 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8254 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8261 impl C2Tuple_PaymentHashPaymentSecretZ {
8262 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8266 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8267 fn clone(&self) -> Self {
8269 a: Clone::clone(&self.a),
8270 b: Clone::clone(&self.b),
8275 /// Creates a new tuple which has the same data as `orig`
8276 /// but with all dynamically-allocated buffers duplicated in new buffers.
8277 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8278 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8280 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8281 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8285 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8286 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8288 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8289 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8290 /// A pointer to the contents in the success state.
8291 /// Reading from this pointer when `result_ok` is not set is undefined.
8292 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8293 /// Note that this value is always NULL, as there are no contents in the Err variant
8294 pub err: *mut core::ffi::c_void,
8297 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8298 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8299 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8300 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8301 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8302 /// `err` or `result` depending on the state of `result_ok`.
8303 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8304 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8305 pub result_ok: bool,
8308 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8309 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8310 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8311 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8312 result: Box::into_raw(Box::new(o)),
8318 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8319 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8320 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8321 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8322 err: core::ptr::null_mut(),
8327 /// Checks if the given object is currently in the success state
8329 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8333 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8334 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8335 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8336 fn drop(&mut self) {
8338 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8339 let _ = unsafe { Box::from_raw(self.contents.result) };
8345 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8346 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8347 let contents = if o.result_ok {
8348 let result = unsafe { o.contents.result };
8349 unsafe { o.contents.result = core::ptr::null_mut() };
8350 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8352 let _ = unsafe { Box::from_raw(o.contents.err) };
8353 o.contents.err = core::ptr::null_mut();
8354 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8358 result_ok: o.result_ok,
8362 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8363 fn clone(&self) -> Self {
8365 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8366 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8369 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8370 err: core::ptr::null_mut()
8376 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8377 /// but with all dynamically-allocated buffers duplicated in new buffers.
8378 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8380 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8381 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8382 /// A pointer to the contents in the success state.
8383 /// Reading from this pointer when `result_ok` is not set is undefined.
8384 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8385 /// A pointer to the contents in the error state.
8386 /// Reading from this pointer when `result_ok` is set is undefined.
8387 pub err: *mut crate::lightning::util::errors::APIError,
8390 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8391 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8393 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8394 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8395 /// `err` or `result` depending on the state of `result_ok`.
8396 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8397 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8398 pub result_ok: bool,
8401 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8402 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8403 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8404 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8405 result: Box::into_raw(Box::new(o)),
8411 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8412 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8413 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8414 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8415 err: Box::into_raw(Box::new(e)),
8420 /// Checks if the given object is currently in the success state
8422 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
8426 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
8427 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
8428 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8429 fn drop(&mut self) {
8431 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8432 let _ = unsafe { Box::from_raw(self.contents.result) };
8435 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8436 let _ = unsafe { Box::from_raw(self.contents.err) };
8441 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8442 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
8443 let contents = if o.result_ok {
8444 let result = unsafe { o.contents.result };
8445 unsafe { o.contents.result = core::ptr::null_mut() };
8446 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
8448 let err = unsafe { o.contents.err };
8449 unsafe { o.contents.err = core::ptr::null_mut(); }
8450 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
8454 result_ok: o.result_ok,
8458 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8459 fn clone(&self) -> Self {
8461 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8462 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8465 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8466 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8472 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
8473 /// but with all dynamically-allocated buffers duplicated in new buffers.
8474 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
8476 /// The contents of CResult_PaymentSecretNoneZ
8477 pub union CResult_PaymentSecretNoneZPtr {
8478 /// A pointer to the contents in the success state.
8479 /// Reading from this pointer when `result_ok` is not set is undefined.
8480 pub result: *mut crate::c_types::ThirtyTwoBytes,
8481 /// Note that this value is always NULL, as there are no contents in the Err variant
8482 pub err: *mut core::ffi::c_void,
8485 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8486 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8487 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8488 pub struct CResult_PaymentSecretNoneZ {
8489 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8490 /// `err` or `result` depending on the state of `result_ok`.
8491 pub contents: CResult_PaymentSecretNoneZPtr,
8492 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8493 pub result_ok: bool,
8496 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8497 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8498 CResult_PaymentSecretNoneZ {
8499 contents: CResult_PaymentSecretNoneZPtr {
8500 result: Box::into_raw(Box::new(o)),
8506 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8507 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8508 CResult_PaymentSecretNoneZ {
8509 contents: CResult_PaymentSecretNoneZPtr {
8510 err: core::ptr::null_mut(),
8515 /// Checks if the given object is currently in the success state
8517 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8521 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8522 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8523 impl Drop for CResult_PaymentSecretNoneZ {
8524 fn drop(&mut self) {
8526 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8527 let _ = unsafe { Box::from_raw(self.contents.result) };
8533 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8534 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8535 let contents = if o.result_ok {
8536 let result = unsafe { o.contents.result };
8537 unsafe { o.contents.result = core::ptr::null_mut() };
8538 CResult_PaymentSecretNoneZPtr { result }
8540 let _ = unsafe { Box::from_raw(o.contents.err) };
8541 o.contents.err = core::ptr::null_mut();
8542 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8546 result_ok: o.result_ok,
8550 impl Clone for CResult_PaymentSecretNoneZ {
8551 fn clone(&self) -> Self {
8553 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8554 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8557 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8558 err: core::ptr::null_mut()
8564 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8565 /// but with all dynamically-allocated buffers duplicated in new buffers.
8566 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
8568 /// The contents of CResult_PaymentSecretAPIErrorZ
8569 pub union CResult_PaymentSecretAPIErrorZPtr {
8570 /// A pointer to the contents in the success state.
8571 /// Reading from this pointer when `result_ok` is not set is undefined.
8572 pub result: *mut crate::c_types::ThirtyTwoBytes,
8573 /// A pointer to the contents in the error state.
8574 /// Reading from this pointer when `result_ok` is set is undefined.
8575 pub err: *mut crate::lightning::util::errors::APIError,
8578 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8579 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8581 pub struct CResult_PaymentSecretAPIErrorZ {
8582 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8583 /// `err` or `result` depending on the state of `result_ok`.
8584 pub contents: CResult_PaymentSecretAPIErrorZPtr,
8585 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8586 pub result_ok: bool,
8589 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
8590 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
8591 CResult_PaymentSecretAPIErrorZ {
8592 contents: CResult_PaymentSecretAPIErrorZPtr {
8593 result: Box::into_raw(Box::new(o)),
8599 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
8600 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
8601 CResult_PaymentSecretAPIErrorZ {
8602 contents: CResult_PaymentSecretAPIErrorZPtr {
8603 err: Box::into_raw(Box::new(e)),
8608 /// Checks if the given object is currently in the success state
8610 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
8614 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
8615 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
8616 impl Drop for CResult_PaymentSecretAPIErrorZ {
8617 fn drop(&mut self) {
8619 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8620 let _ = unsafe { Box::from_raw(self.contents.result) };
8623 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8624 let _ = unsafe { Box::from_raw(self.contents.err) };
8629 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
8630 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8631 let contents = if o.result_ok {
8632 let result = unsafe { o.contents.result };
8633 unsafe { o.contents.result = core::ptr::null_mut() };
8634 CResult_PaymentSecretAPIErrorZPtr { result }
8636 let err = unsafe { o.contents.err };
8637 unsafe { o.contents.err = core::ptr::null_mut(); }
8638 CResult_PaymentSecretAPIErrorZPtr { err }
8642 result_ok: o.result_ok,
8646 impl Clone for CResult_PaymentSecretAPIErrorZ {
8647 fn clone(&self) -> Self {
8649 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
8650 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8653 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
8654 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8660 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
8661 /// but with all dynamically-allocated buffers duplicated in new buffers.
8662 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
8664 /// The contents of CResult_PaymentPreimageAPIErrorZ
8665 pub union CResult_PaymentPreimageAPIErrorZPtr {
8666 /// A pointer to the contents in the success state.
8667 /// Reading from this pointer when `result_ok` is not set is undefined.
8668 pub result: *mut crate::c_types::ThirtyTwoBytes,
8669 /// A pointer to the contents in the error state.
8670 /// Reading from this pointer when `result_ok` is set is undefined.
8671 pub err: *mut crate::lightning::util::errors::APIError,
8674 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8675 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8676 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8677 pub struct CResult_PaymentPreimageAPIErrorZ {
8678 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8679 /// `err` or `result` depending on the state of `result_ok`.
8680 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
8681 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8682 pub result_ok: bool,
8685 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
8686 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
8687 CResult_PaymentPreimageAPIErrorZ {
8688 contents: CResult_PaymentPreimageAPIErrorZPtr {
8689 result: Box::into_raw(Box::new(o)),
8695 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
8696 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
8697 CResult_PaymentPreimageAPIErrorZ {
8698 contents: CResult_PaymentPreimageAPIErrorZPtr {
8699 err: Box::into_raw(Box::new(e)),
8704 /// Checks if the given object is currently in the success state
8706 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
8710 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
8711 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
8712 impl Drop for CResult_PaymentPreimageAPIErrorZ {
8713 fn drop(&mut self) {
8715 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8716 let _ = unsafe { Box::from_raw(self.contents.result) };
8719 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8720 let _ = unsafe { Box::from_raw(self.contents.err) };
8725 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
8726 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8727 let contents = if o.result_ok {
8728 let result = unsafe { o.contents.result };
8729 unsafe { o.contents.result = core::ptr::null_mut() };
8730 CResult_PaymentPreimageAPIErrorZPtr { result }
8732 let err = unsafe { o.contents.err };
8733 unsafe { o.contents.err = core::ptr::null_mut(); }
8734 CResult_PaymentPreimageAPIErrorZPtr { err }
8738 result_ok: o.result_ok,
8742 impl Clone for CResult_PaymentPreimageAPIErrorZ {
8743 fn clone(&self) -> Self {
8745 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
8746 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8749 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
8750 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8756 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
8757 /// but with all dynamically-allocated buffers duplicated in new buffers.
8758 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
8760 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8761 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8762 /// A pointer to the contents in the success state.
8763 /// Reading from this pointer when `result_ok` is not set is undefined.
8764 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
8765 /// A pointer to the contents in the error state.
8766 /// Reading from this pointer when `result_ok` is set is undefined.
8767 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8770 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8771 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8773 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
8774 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8775 /// `err` or `result` depending on the state of `result_ok`.
8776 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
8777 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8778 pub result_ok: bool,
8781 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
8782 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8783 CResult_CounterpartyForwardingInfoDecodeErrorZ {
8784 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8785 result: Box::into_raw(Box::new(o)),
8791 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
8792 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8793 CResult_CounterpartyForwardingInfoDecodeErrorZ {
8794 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8795 err: Box::into_raw(Box::new(e)),
8800 /// Checks if the given object is currently in the success state
8802 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
8806 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
8807 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
8808 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8809 fn drop(&mut self) {
8811 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8812 let _ = unsafe { Box::from_raw(self.contents.result) };
8815 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8816 let _ = unsafe { Box::from_raw(self.contents.err) };
8821 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8822 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8823 let contents = if o.result_ok {
8824 let result = unsafe { o.contents.result };
8825 unsafe { o.contents.result = core::ptr::null_mut() };
8826 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
8828 let err = unsafe { o.contents.err };
8829 unsafe { o.contents.err = core::ptr::null_mut(); }
8830 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
8834 result_ok: o.result_ok,
8838 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8839 fn clone(&self) -> Self {
8841 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8842 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
8845 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8846 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8852 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
8853 /// but with all dynamically-allocated buffers duplicated in new buffers.
8854 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
8856 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
8857 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
8858 /// A pointer to the contents in the success state.
8859 /// Reading from this pointer when `result_ok` is not set is undefined.
8860 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
8861 /// A pointer to the contents in the error state.
8862 /// Reading from this pointer when `result_ok` is set is undefined.
8863 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8866 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8867 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8869 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
8870 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8871 /// `err` or `result` depending on the state of `result_ok`.
8872 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
8873 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8874 pub result_ok: bool,
8877 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
8878 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
8879 CResult_ChannelCounterpartyDecodeErrorZ {
8880 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8881 result: Box::into_raw(Box::new(o)),
8887 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
8888 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
8889 CResult_ChannelCounterpartyDecodeErrorZ {
8890 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8891 err: Box::into_raw(Box::new(e)),
8896 /// Checks if the given object is currently in the success state
8898 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
8902 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
8903 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
8904 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
8905 fn drop(&mut self) {
8907 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8908 let _ = unsafe { Box::from_raw(self.contents.result) };
8911 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8912 let _ = unsafe { Box::from_raw(self.contents.err) };
8917 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
8918 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
8919 let contents = if o.result_ok {
8920 let result = unsafe { o.contents.result };
8921 unsafe { o.contents.result = core::ptr::null_mut() };
8922 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
8924 let err = unsafe { o.contents.err };
8925 unsafe { o.contents.err = core::ptr::null_mut(); }
8926 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
8930 result_ok: o.result_ok,
8934 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
8935 fn clone(&self) -> Self {
8937 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8938 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
8941 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8942 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8948 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
8949 /// but with all dynamically-allocated buffers duplicated in new buffers.
8950 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
8952 /// The contents of CResult_ChannelDetailsDecodeErrorZ
8953 pub union CResult_ChannelDetailsDecodeErrorZPtr {
8954 /// A pointer to the contents in the success state.
8955 /// Reading from this pointer when `result_ok` is not set is undefined.
8956 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
8957 /// A pointer to the contents in the error state.
8958 /// Reading from this pointer when `result_ok` is set is undefined.
8959 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8962 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
8963 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
8964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8965 pub struct CResult_ChannelDetailsDecodeErrorZ {
8966 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
8967 /// `err` or `result` depending on the state of `result_ok`.
8968 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
8969 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
8970 pub result_ok: bool,
8973 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
8974 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
8975 CResult_ChannelDetailsDecodeErrorZ {
8976 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8977 result: Box::into_raw(Box::new(o)),
8983 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
8984 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
8985 CResult_ChannelDetailsDecodeErrorZ {
8986 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8987 err: Box::into_raw(Box::new(e)),
8992 /// Checks if the given object is currently in the success state
8994 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
8998 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
8999 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9000 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9001 fn drop(&mut self) {
9003 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9004 let _ = unsafe { Box::from_raw(self.contents.result) };
9007 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9008 let _ = unsafe { Box::from_raw(self.contents.err) };
9013 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9014 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9015 let contents = if o.result_ok {
9016 let result = unsafe { o.contents.result };
9017 unsafe { o.contents.result = core::ptr::null_mut() };
9018 CResult_ChannelDetailsDecodeErrorZPtr { result }
9020 let err = unsafe { o.contents.err };
9021 unsafe { o.contents.err = core::ptr::null_mut(); }
9022 CResult_ChannelDetailsDecodeErrorZPtr { err }
9026 result_ok: o.result_ok,
9030 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9031 fn clone(&self) -> Self {
9033 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9034 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9037 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9038 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9044 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9045 /// but with all dynamically-allocated buffers duplicated in new buffers.
9046 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9048 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9049 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9050 /// A pointer to the contents in the success state.
9051 /// Reading from this pointer when `result_ok` is not set is undefined.
9052 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9053 /// A pointer to the contents in the error state.
9054 /// Reading from this pointer when `result_ok` is set is undefined.
9055 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9058 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9059 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9061 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9062 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9063 /// `err` or `result` depending on the state of `result_ok`.
9064 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9065 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9066 pub result_ok: bool,
9069 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9070 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9071 CResult_PhantomRouteHintsDecodeErrorZ {
9072 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9073 result: Box::into_raw(Box::new(o)),
9079 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9080 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9081 CResult_PhantomRouteHintsDecodeErrorZ {
9082 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9083 err: Box::into_raw(Box::new(e)),
9088 /// Checks if the given object is currently in the success state
9090 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9094 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9095 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9096 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9097 fn drop(&mut self) {
9099 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9100 let _ = unsafe { Box::from_raw(self.contents.result) };
9103 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9104 let _ = unsafe { Box::from_raw(self.contents.err) };
9109 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9110 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9111 let contents = if o.result_ok {
9112 let result = unsafe { o.contents.result };
9113 unsafe { o.contents.result = core::ptr::null_mut() };
9114 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9116 let err = unsafe { o.contents.err };
9117 unsafe { o.contents.err = core::ptr::null_mut(); }
9118 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9122 result_ok: o.result_ok,
9126 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9127 fn clone(&self) -> Self {
9129 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9130 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9133 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9134 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9140 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9141 /// but with all dynamically-allocated buffers duplicated in new buffers.
9142 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9144 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9145 /// This corresponds to std::vector in C++
9146 pub struct CVec_ChannelMonitorZ {
9147 /// The elements in the array.
9148 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9149 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9150 /// The number of elements pointed to by `data`.
9153 impl CVec_ChannelMonitorZ {
9154 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9155 if self.datalen == 0 { return Vec::new(); }
9156 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9157 self.data = core::ptr::null_mut();
9161 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9162 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9165 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9166 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9167 let datalen = v.len();
9168 let data = Box::into_raw(v.into_boxed_slice());
9169 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9173 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9174 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9175 impl Drop for CVec_ChannelMonitorZ {
9176 fn drop(&mut self) {
9177 if self.datalen == 0 { return; }
9178 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9182 /// A tuple of 2 elements. See the individual fields for the types contained.
9183 pub struct C2Tuple_BlockHashChannelManagerZ {
9184 /// The element at position 0
9185 pub a: crate::c_types::ThirtyTwoBytes,
9186 /// The element at position 1
9187 pub b: crate::lightning::ln::channelmanager::ChannelManager,
9189 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9190 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9197 impl C2Tuple_BlockHashChannelManagerZ {
9198 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9202 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9204 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9205 C2Tuple_BlockHashChannelManagerZ { a, b, }
9209 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9210 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9212 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9213 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9214 /// A pointer to the contents in the success state.
9215 /// Reading from this pointer when `result_ok` is not set is undefined.
9216 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9217 /// A pointer to the contents in the error state.
9218 /// Reading from this pointer when `result_ok` is set is undefined.
9219 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9222 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9223 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9225 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9226 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9227 /// `err` or `result` depending on the state of `result_ok`.
9228 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9229 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9230 pub result_ok: bool,
9233 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9234 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9235 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9236 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9237 result: Box::into_raw(Box::new(o)),
9243 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9244 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9245 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9246 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9247 err: Box::into_raw(Box::new(e)),
9252 /// Checks if the given object is currently in the success state
9254 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9258 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9259 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9260 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9261 fn drop(&mut self) {
9263 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9264 let _ = unsafe { Box::from_raw(self.contents.result) };
9267 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9268 let _ = unsafe { Box::from_raw(self.contents.err) };
9273 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9274 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9275 let contents = if o.result_ok {
9276 let result = unsafe { o.contents.result };
9277 unsafe { o.contents.result = core::ptr::null_mut() };
9278 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9280 let err = unsafe { o.contents.err };
9281 unsafe { o.contents.err = core::ptr::null_mut(); }
9282 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9286 result_ok: o.result_ok,
9291 /// The contents of CResult_ChannelConfigDecodeErrorZ
9292 pub union CResult_ChannelConfigDecodeErrorZPtr {
9293 /// A pointer to the contents in the success state.
9294 /// Reading from this pointer when `result_ok` is not set is undefined.
9295 pub result: *mut crate::lightning::util::config::ChannelConfig,
9296 /// A pointer to the contents in the error state.
9297 /// Reading from this pointer when `result_ok` is set is undefined.
9298 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9301 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9302 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9304 pub struct CResult_ChannelConfigDecodeErrorZ {
9305 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9306 /// `err` or `result` depending on the state of `result_ok`.
9307 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9308 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9309 pub result_ok: bool,
9312 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9313 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9314 CResult_ChannelConfigDecodeErrorZ {
9315 contents: CResult_ChannelConfigDecodeErrorZPtr {
9316 result: Box::into_raw(Box::new(o)),
9322 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9323 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9324 CResult_ChannelConfigDecodeErrorZ {
9325 contents: CResult_ChannelConfigDecodeErrorZPtr {
9326 err: Box::into_raw(Box::new(e)),
9331 /// Checks if the given object is currently in the success state
9333 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9337 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9338 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9339 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9340 fn drop(&mut self) {
9342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9343 let _ = unsafe { Box::from_raw(self.contents.result) };
9346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9347 let _ = unsafe { Box::from_raw(self.contents.err) };
9352 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9353 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9354 let contents = if o.result_ok {
9355 let result = unsafe { o.contents.result };
9356 unsafe { o.contents.result = core::ptr::null_mut() };
9357 CResult_ChannelConfigDecodeErrorZPtr { result }
9359 let err = unsafe { o.contents.err };
9360 unsafe { o.contents.err = core::ptr::null_mut(); }
9361 CResult_ChannelConfigDecodeErrorZPtr { err }
9365 result_ok: o.result_ok,
9369 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9370 fn clone(&self) -> Self {
9372 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9373 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9376 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9377 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9383 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9384 /// but with all dynamically-allocated buffers duplicated in new buffers.
9385 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9387 /// The contents of CResult_OutPointDecodeErrorZ
9388 pub union CResult_OutPointDecodeErrorZPtr {
9389 /// A pointer to the contents in the success state.
9390 /// Reading from this pointer when `result_ok` is not set is undefined.
9391 pub result: *mut crate::lightning::chain::transaction::OutPoint,
9392 /// A pointer to the contents in the error state.
9393 /// Reading from this pointer when `result_ok` is set is undefined.
9394 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9397 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9398 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9400 pub struct CResult_OutPointDecodeErrorZ {
9401 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9402 /// `err` or `result` depending on the state of `result_ok`.
9403 pub contents: CResult_OutPointDecodeErrorZPtr,
9404 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9405 pub result_ok: bool,
9408 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9409 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9410 CResult_OutPointDecodeErrorZ {
9411 contents: CResult_OutPointDecodeErrorZPtr {
9412 result: Box::into_raw(Box::new(o)),
9418 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9419 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9420 CResult_OutPointDecodeErrorZ {
9421 contents: CResult_OutPointDecodeErrorZPtr {
9422 err: Box::into_raw(Box::new(e)),
9427 /// Checks if the given object is currently in the success state
9429 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
9433 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
9434 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
9435 impl Drop for CResult_OutPointDecodeErrorZ {
9436 fn drop(&mut self) {
9438 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9439 let _ = unsafe { Box::from_raw(self.contents.result) };
9442 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9443 let _ = unsafe { Box::from_raw(self.contents.err) };
9448 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
9449 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
9450 let contents = if o.result_ok {
9451 let result = unsafe { o.contents.result };
9452 unsafe { o.contents.result = core::ptr::null_mut() };
9453 CResult_OutPointDecodeErrorZPtr { result }
9455 let err = unsafe { o.contents.err };
9456 unsafe { o.contents.err = core::ptr::null_mut(); }
9457 CResult_OutPointDecodeErrorZPtr { err }
9461 result_ok: o.result_ok,
9465 impl Clone for CResult_OutPointDecodeErrorZ {
9466 fn clone(&self) -> Self {
9468 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
9469 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
9472 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
9473 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9479 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9480 /// but with all dynamically-allocated buffers duplicated in new buffers.
9481 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
9483 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
9484 pub enum COption_TypeZ {
9485 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9486 Some(crate::lightning::ln::wire::Type),
9487 /// When we're in this state, this COption_TypeZ contains nothing
9490 impl COption_TypeZ {
9491 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9492 if let Self::None = self { false } else { true }
9494 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9497 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
9498 if let Self::Some(v) = self { v } else { unreachable!() }
9502 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
9503 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
9504 COption_TypeZ::Some(o)
9507 /// Constructs a new COption_TypeZ containing nothing
9508 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
9512 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
9513 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
9515 /// The contents of CResult_COption_TypeZDecodeErrorZ
9516 pub union CResult_COption_TypeZDecodeErrorZPtr {
9517 /// A pointer to the contents in the success state.
9518 /// Reading from this pointer when `result_ok` is not set is undefined.
9519 pub result: *mut crate::c_types::derived::COption_TypeZ,
9520 /// A pointer to the contents in the error state.
9521 /// Reading from this pointer when `result_ok` is set is undefined.
9522 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9525 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9526 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9527 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9528 pub struct CResult_COption_TypeZDecodeErrorZ {
9529 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9530 /// `err` or `result` depending on the state of `result_ok`.
9531 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
9532 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9533 pub result_ok: bool,
9536 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
9537 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
9538 CResult_COption_TypeZDecodeErrorZ {
9539 contents: CResult_COption_TypeZDecodeErrorZPtr {
9540 result: Box::into_raw(Box::new(o)),
9546 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
9547 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
9548 CResult_COption_TypeZDecodeErrorZ {
9549 contents: CResult_COption_TypeZDecodeErrorZPtr {
9550 err: Box::into_raw(Box::new(e)),
9555 /// Checks if the given object is currently in the success state
9557 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
9561 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
9562 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
9563 impl Drop for CResult_COption_TypeZDecodeErrorZ {
9564 fn drop(&mut self) {
9566 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9567 let _ = unsafe { Box::from_raw(self.contents.result) };
9570 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9571 let _ = unsafe { Box::from_raw(self.contents.err) };
9576 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
9577 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9578 let contents = if o.result_ok {
9579 let result = unsafe { o.contents.result };
9580 unsafe { o.contents.result = core::ptr::null_mut() };
9581 CResult_COption_TypeZDecodeErrorZPtr { result }
9583 let err = unsafe { o.contents.err };
9584 unsafe { o.contents.err = core::ptr::null_mut(); }
9585 CResult_COption_TypeZDecodeErrorZPtr { err }
9589 result_ok: o.result_ok,
9594 /// The contents of CResult_PaymentIdPaymentErrorZ
9595 pub union CResult_PaymentIdPaymentErrorZPtr {
9596 /// A pointer to the contents in the success state.
9597 /// Reading from this pointer when `result_ok` is not set is undefined.
9598 pub result: *mut crate::c_types::ThirtyTwoBytes,
9599 /// A pointer to the contents in the error state.
9600 /// Reading from this pointer when `result_ok` is set is undefined.
9601 pub err: *mut crate::lightning_invoice::payment::PaymentError,
9604 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
9605 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
9606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9607 pub struct CResult_PaymentIdPaymentErrorZ {
9608 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
9609 /// `err` or `result` depending on the state of `result_ok`.
9610 pub contents: CResult_PaymentIdPaymentErrorZPtr,
9611 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
9612 pub result_ok: bool,
9615 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
9616 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
9617 CResult_PaymentIdPaymentErrorZ {
9618 contents: CResult_PaymentIdPaymentErrorZPtr {
9619 result: Box::into_raw(Box::new(o)),
9625 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
9626 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
9627 CResult_PaymentIdPaymentErrorZ {
9628 contents: CResult_PaymentIdPaymentErrorZPtr {
9629 err: Box::into_raw(Box::new(e)),
9634 /// Checks if the given object is currently in the success state
9636 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
9640 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
9641 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
9642 impl Drop for CResult_PaymentIdPaymentErrorZ {
9643 fn drop(&mut self) {
9645 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9646 let _ = unsafe { Box::from_raw(self.contents.result) };
9649 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9650 let _ = unsafe { Box::from_raw(self.contents.err) };
9655 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
9656 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
9657 let contents = if o.result_ok {
9658 let result = unsafe { o.contents.result };
9659 unsafe { o.contents.result = core::ptr::null_mut() };
9660 CResult_PaymentIdPaymentErrorZPtr { result }
9662 let err = unsafe { o.contents.err };
9663 unsafe { o.contents.err = core::ptr::null_mut(); }
9664 CResult_PaymentIdPaymentErrorZPtr { err }
9668 result_ok: o.result_ok,
9672 impl Clone for CResult_PaymentIdPaymentErrorZ {
9673 fn clone(&self) -> Self {
9675 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
9676 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9679 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
9680 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
9686 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
9687 /// but with all dynamically-allocated buffers duplicated in new buffers.
9688 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
9690 /// The contents of CResult_SiPrefixParseErrorZ
9691 pub union CResult_SiPrefixParseErrorZPtr {
9692 /// A pointer to the contents in the success state.
9693 /// Reading from this pointer when `result_ok` is not set is undefined.
9694 pub result: *mut crate::lightning_invoice::SiPrefix,
9695 /// A pointer to the contents in the error state.
9696 /// Reading from this pointer when `result_ok` is set is undefined.
9697 pub err: *mut crate::lightning_invoice::ParseError,
9700 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
9701 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
9702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9703 pub struct CResult_SiPrefixParseErrorZ {
9704 /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
9705 /// `err` or `result` depending on the state of `result_ok`.
9706 pub contents: CResult_SiPrefixParseErrorZPtr,
9707 /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
9708 pub result_ok: bool,
9711 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
9712 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
9713 CResult_SiPrefixParseErrorZ {
9714 contents: CResult_SiPrefixParseErrorZPtr {
9715 result: Box::into_raw(Box::new(o)),
9721 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
9722 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
9723 CResult_SiPrefixParseErrorZ {
9724 contents: CResult_SiPrefixParseErrorZPtr {
9725 err: Box::into_raw(Box::new(e)),
9730 /// Checks if the given object is currently in the success state
9732 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
9736 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
9737 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
9738 impl Drop for CResult_SiPrefixParseErrorZ {
9739 fn drop(&mut self) {
9741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9742 let _ = unsafe { Box::from_raw(self.contents.result) };
9745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9746 let _ = unsafe { Box::from_raw(self.contents.err) };
9751 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
9752 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
9753 let contents = if o.result_ok {
9754 let result = unsafe { o.contents.result };
9755 unsafe { o.contents.result = core::ptr::null_mut() };
9756 CResult_SiPrefixParseErrorZPtr { result }
9758 let err = unsafe { o.contents.err };
9759 unsafe { o.contents.err = core::ptr::null_mut(); }
9760 CResult_SiPrefixParseErrorZPtr { err }
9764 result_ok: o.result_ok,
9768 impl Clone for CResult_SiPrefixParseErrorZ {
9769 fn clone(&self) -> Self {
9771 Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
9772 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
9775 Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
9776 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9782 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
9783 /// but with all dynamically-allocated buffers duplicated in new buffers.
9784 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
9786 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
9787 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
9788 /// A pointer to the contents in the success state.
9789 /// Reading from this pointer when `result_ok` is not set is undefined.
9790 pub result: *mut crate::lightning_invoice::Invoice,
9791 /// A pointer to the contents in the error state.
9792 /// Reading from this pointer when `result_ok` is set is undefined.
9793 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
9796 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
9797 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
9798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9799 pub struct CResult_InvoiceParseOrSemanticErrorZ {
9800 /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
9801 /// `err` or `result` depending on the state of `result_ok`.
9802 pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
9803 /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
9804 pub result_ok: bool,
9807 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
9808 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
9809 CResult_InvoiceParseOrSemanticErrorZ {
9810 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9811 result: Box::into_raw(Box::new(o)),
9817 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
9818 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
9819 CResult_InvoiceParseOrSemanticErrorZ {
9820 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9821 err: Box::into_raw(Box::new(e)),
9826 /// Checks if the given object is currently in the success state
9828 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
9832 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
9833 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
9834 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
9835 fn drop(&mut self) {
9837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9838 let _ = unsafe { Box::from_raw(self.contents.result) };
9841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9842 let _ = unsafe { Box::from_raw(self.contents.err) };
9847 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
9848 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
9849 let contents = if o.result_ok {
9850 let result = unsafe { o.contents.result };
9851 unsafe { o.contents.result = core::ptr::null_mut() };
9852 CResult_InvoiceParseOrSemanticErrorZPtr { result }
9854 let err = unsafe { o.contents.err };
9855 unsafe { o.contents.err = core::ptr::null_mut(); }
9856 CResult_InvoiceParseOrSemanticErrorZPtr { err }
9860 result_ok: o.result_ok,
9864 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
9865 fn clone(&self) -> Self {
9867 Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9868 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
9871 Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9872 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
9878 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
9879 /// but with all dynamically-allocated buffers duplicated in new buffers.
9880 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
9882 /// The contents of CResult_SignedRawInvoiceParseErrorZ
9883 pub union CResult_SignedRawInvoiceParseErrorZPtr {
9884 /// A pointer to the contents in the success state.
9885 /// Reading from this pointer when `result_ok` is not set is undefined.
9886 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
9887 /// A pointer to the contents in the error state.
9888 /// Reading from this pointer when `result_ok` is set is undefined.
9889 pub err: *mut crate::lightning_invoice::ParseError,
9892 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
9893 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
9894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9895 pub struct CResult_SignedRawInvoiceParseErrorZ {
9896 /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
9897 /// `err` or `result` depending on the state of `result_ok`.
9898 pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
9899 /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
9900 pub result_ok: bool,
9903 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
9904 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
9905 CResult_SignedRawInvoiceParseErrorZ {
9906 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9907 result: Box::into_raw(Box::new(o)),
9913 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
9914 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
9915 CResult_SignedRawInvoiceParseErrorZ {
9916 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9917 err: Box::into_raw(Box::new(e)),
9922 /// Checks if the given object is currently in the success state
9924 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
9928 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
9929 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
9930 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
9931 fn drop(&mut self) {
9933 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9934 let _ = unsafe { Box::from_raw(self.contents.result) };
9937 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9938 let _ = unsafe { Box::from_raw(self.contents.err) };
9943 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
9944 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
9945 let contents = if o.result_ok {
9946 let result = unsafe { o.contents.result };
9947 unsafe { o.contents.result = core::ptr::null_mut() };
9948 CResult_SignedRawInvoiceParseErrorZPtr { result }
9950 let err = unsafe { o.contents.err };
9951 unsafe { o.contents.err = core::ptr::null_mut(); }
9952 CResult_SignedRawInvoiceParseErrorZPtr { err }
9956 result_ok: o.result_ok,
9960 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
9961 fn clone(&self) -> Self {
9963 Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9964 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
9967 Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9968 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9974 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
9975 /// but with all dynamically-allocated buffers duplicated in new buffers.
9976 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
9978 /// A tuple of 3 elements. See the individual fields for the types contained.
9979 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9980 /// The element at position 0
9981 pub a: crate::lightning_invoice::RawInvoice,
9982 /// The element at position 1
9983 pub b: crate::c_types::ThirtyTwoBytes,
9984 /// The element at position 2
9985 pub c: crate::lightning_invoice::InvoiceSignature,
9987 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9988 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
9996 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9997 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
9998 (self.a, self.b, self.c)
10001 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10002 fn clone(&self) -> Self {
10004 a: Clone::clone(&self.a),
10005 b: Clone::clone(&self.b),
10006 c: Clone::clone(&self.c),
10011 /// Creates a new tuple which has the same data as `orig`
10012 /// but with all dynamically-allocated buffers duplicated in new buffers.
10013 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
10014 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10016 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 {
10017 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
10021 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10022 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
10024 /// The contents of CResult_PayeePubKeyErrorZ
10025 pub union CResult_PayeePubKeyErrorZPtr {
10026 /// A pointer to the contents in the success state.
10027 /// Reading from this pointer when `result_ok` is not set is undefined.
10028 pub result: *mut crate::lightning_invoice::PayeePubKey,
10029 /// A pointer to the contents in the error state.
10030 /// Reading from this pointer when `result_ok` is set is undefined.
10031 pub err: *mut crate::c_types::Secp256k1Error,
10034 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
10035 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
10036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10037 pub struct CResult_PayeePubKeyErrorZ {
10038 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
10039 /// `err` or `result` depending on the state of `result_ok`.
10040 pub contents: CResult_PayeePubKeyErrorZPtr,
10041 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
10042 pub result_ok: bool,
10045 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
10046 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
10047 CResult_PayeePubKeyErrorZ {
10048 contents: CResult_PayeePubKeyErrorZPtr {
10049 result: Box::into_raw(Box::new(o)),
10055 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
10056 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
10057 CResult_PayeePubKeyErrorZ {
10058 contents: CResult_PayeePubKeyErrorZPtr {
10059 err: Box::into_raw(Box::new(e)),
10064 /// Checks if the given object is currently in the success state
10066 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
10070 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
10071 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
10072 impl Drop for CResult_PayeePubKeyErrorZ {
10073 fn drop(&mut self) {
10074 if self.result_ok {
10075 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10076 let _ = unsafe { Box::from_raw(self.contents.result) };
10079 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10080 let _ = unsafe { Box::from_raw(self.contents.err) };
10085 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
10086 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
10087 let contents = if o.result_ok {
10088 let result = unsafe { o.contents.result };
10089 unsafe { o.contents.result = core::ptr::null_mut() };
10090 CResult_PayeePubKeyErrorZPtr { result }
10092 let err = unsafe { o.contents.err };
10093 unsafe { o.contents.err = core::ptr::null_mut(); }
10094 CResult_PayeePubKeyErrorZPtr { err }
10098 result_ok: o.result_ok,
10102 impl Clone for CResult_PayeePubKeyErrorZ {
10103 fn clone(&self) -> Self {
10104 if self.result_ok {
10105 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
10106 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
10109 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
10110 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10116 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10117 /// but with all dynamically-allocated buffers duplicated in new buffers.
10118 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
10120 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
10121 /// This corresponds to std::vector in C++
10122 pub struct CVec_PrivateRouteZ {
10123 /// The elements in the array.
10124 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10125 pub data: *mut crate::lightning_invoice::PrivateRoute,
10126 /// The number of elements pointed to by `data`.
10129 impl CVec_PrivateRouteZ {
10130 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
10131 if self.datalen == 0 { return Vec::new(); }
10132 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10133 self.data = core::ptr::null_mut();
10137 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
10138 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10141 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
10142 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
10143 let datalen = v.len();
10144 let data = Box::into_raw(v.into_boxed_slice());
10145 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10149 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10150 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
10151 impl Drop for CVec_PrivateRouteZ {
10152 fn drop(&mut self) {
10153 if self.datalen == 0 { return; }
10154 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10157 impl Clone for CVec_PrivateRouteZ {
10158 fn clone(&self) -> Self {
10159 let mut res = Vec::new();
10160 if self.datalen == 0 { return Self::from(res); }
10161 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10166 /// The contents of CResult_PositiveTimestampCreationErrorZ
10167 pub union CResult_PositiveTimestampCreationErrorZPtr {
10168 /// A pointer to the contents in the success state.
10169 /// Reading from this pointer when `result_ok` is not set is undefined.
10170 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
10171 /// A pointer to the contents in the error state.
10172 /// Reading from this pointer when `result_ok` is set is undefined.
10173 pub err: *mut crate::lightning_invoice::CreationError,
10176 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
10177 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
10178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10179 pub struct CResult_PositiveTimestampCreationErrorZ {
10180 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
10181 /// `err` or `result` depending on the state of `result_ok`.
10182 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
10183 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
10184 pub result_ok: bool,
10187 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10188 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
10189 CResult_PositiveTimestampCreationErrorZ {
10190 contents: CResult_PositiveTimestampCreationErrorZPtr {
10191 result: Box::into_raw(Box::new(o)),
10197 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10198 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
10199 CResult_PositiveTimestampCreationErrorZ {
10200 contents: CResult_PositiveTimestampCreationErrorZPtr {
10201 err: Box::into_raw(Box::new(e)),
10206 /// Checks if the given object is currently in the success state
10208 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
10212 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10213 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
10214 impl Drop for CResult_PositiveTimestampCreationErrorZ {
10215 fn drop(&mut self) {
10216 if self.result_ok {
10217 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10218 let _ = unsafe { Box::from_raw(self.contents.result) };
10221 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10222 let _ = unsafe { Box::from_raw(self.contents.err) };
10227 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
10228 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
10229 let contents = if o.result_ok {
10230 let result = unsafe { o.contents.result };
10231 unsafe { o.contents.result = core::ptr::null_mut() };
10232 CResult_PositiveTimestampCreationErrorZPtr { result }
10234 let err = unsafe { o.contents.err };
10235 unsafe { o.contents.err = core::ptr::null_mut(); }
10236 CResult_PositiveTimestampCreationErrorZPtr { err }
10240 result_ok: o.result_ok,
10244 impl Clone for CResult_PositiveTimestampCreationErrorZ {
10245 fn clone(&self) -> Self {
10246 if self.result_ok {
10247 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
10248 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
10251 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
10252 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10258 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10259 /// but with all dynamically-allocated buffers duplicated in new buffers.
10260 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
10262 /// The contents of CResult_NoneSemanticErrorZ
10263 pub union CResult_NoneSemanticErrorZPtr {
10264 /// Note that this value is always NULL, as there are no contents in the OK variant
10265 pub result: *mut core::ffi::c_void,
10266 /// A pointer to the contents in the error state.
10267 /// Reading from this pointer when `result_ok` is set is undefined.
10268 pub err: *mut crate::lightning_invoice::SemanticError,
10271 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10272 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10274 pub struct CResult_NoneSemanticErrorZ {
10275 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
10276 /// `err` or `result` depending on the state of `result_ok`.
10277 pub contents: CResult_NoneSemanticErrorZPtr,
10278 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
10279 pub result_ok: bool,
10282 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
10283 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
10284 CResult_NoneSemanticErrorZ {
10285 contents: CResult_NoneSemanticErrorZPtr {
10286 result: core::ptr::null_mut(),
10292 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
10293 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
10294 CResult_NoneSemanticErrorZ {
10295 contents: CResult_NoneSemanticErrorZPtr {
10296 err: Box::into_raw(Box::new(e)),
10301 /// Checks if the given object is currently in the success state
10303 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
10307 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
10308 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
10309 impl Drop for CResult_NoneSemanticErrorZ {
10310 fn drop(&mut self) {
10311 if self.result_ok {
10313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10314 let _ = unsafe { Box::from_raw(self.contents.err) };
10319 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
10320 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
10321 let contents = if o.result_ok {
10322 let _ = unsafe { Box::from_raw(o.contents.result) };
10323 o.contents.result = core::ptr::null_mut();
10324 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
10326 let err = unsafe { o.contents.err };
10327 unsafe { o.contents.err = core::ptr::null_mut(); }
10328 CResult_NoneSemanticErrorZPtr { err }
10332 result_ok: o.result_ok,
10336 impl Clone for CResult_NoneSemanticErrorZ {
10337 fn clone(&self) -> Self {
10338 if self.result_ok {
10339 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
10340 result: core::ptr::null_mut()
10343 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
10344 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10350 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10351 /// but with all dynamically-allocated buffers duplicated in new buffers.
10352 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
10354 /// The contents of CResult_InvoiceSemanticErrorZ
10355 pub union CResult_InvoiceSemanticErrorZPtr {
10356 /// A pointer to the contents in the success state.
10357 /// Reading from this pointer when `result_ok` is not set is undefined.
10358 pub result: *mut crate::lightning_invoice::Invoice,
10359 /// A pointer to the contents in the error state.
10360 /// Reading from this pointer when `result_ok` is set is undefined.
10361 pub err: *mut crate::lightning_invoice::SemanticError,
10364 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10365 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10367 pub struct CResult_InvoiceSemanticErrorZ {
10368 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10369 /// `err` or `result` depending on the state of `result_ok`.
10370 pub contents: CResult_InvoiceSemanticErrorZPtr,
10371 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10372 pub result_ok: bool,
10375 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10376 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
10377 CResult_InvoiceSemanticErrorZ {
10378 contents: CResult_InvoiceSemanticErrorZPtr {
10379 result: Box::into_raw(Box::new(o)),
10385 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10386 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
10387 CResult_InvoiceSemanticErrorZ {
10388 contents: CResult_InvoiceSemanticErrorZPtr {
10389 err: Box::into_raw(Box::new(e)),
10394 /// Checks if the given object is currently in the success state
10396 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
10400 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10401 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
10402 impl Drop for CResult_InvoiceSemanticErrorZ {
10403 fn drop(&mut self) {
10404 if self.result_ok {
10405 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10406 let _ = unsafe { Box::from_raw(self.contents.result) };
10409 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10410 let _ = unsafe { Box::from_raw(self.contents.err) };
10415 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
10416 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
10417 let contents = if o.result_ok {
10418 let result = unsafe { o.contents.result };
10419 unsafe { o.contents.result = core::ptr::null_mut() };
10420 CResult_InvoiceSemanticErrorZPtr { result }
10422 let err = unsafe { o.contents.err };
10423 unsafe { o.contents.err = core::ptr::null_mut(); }
10424 CResult_InvoiceSemanticErrorZPtr { err }
10428 result_ok: o.result_ok,
10432 impl Clone for CResult_InvoiceSemanticErrorZ {
10433 fn clone(&self) -> Self {
10434 if self.result_ok {
10435 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
10436 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10439 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
10440 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10446 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10447 /// but with all dynamically-allocated buffers duplicated in new buffers.
10448 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
10450 /// The contents of CResult_DescriptionCreationErrorZ
10451 pub union CResult_DescriptionCreationErrorZPtr {
10452 /// A pointer to the contents in the success state.
10453 /// Reading from this pointer when `result_ok` is not set is undefined.
10454 pub result: *mut crate::lightning_invoice::Description,
10455 /// A pointer to the contents in the error state.
10456 /// Reading from this pointer when `result_ok` is set is undefined.
10457 pub err: *mut crate::lightning_invoice::CreationError,
10460 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10461 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10463 pub struct CResult_DescriptionCreationErrorZ {
10464 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10465 /// `err` or `result` depending on the state of `result_ok`.
10466 pub contents: CResult_DescriptionCreationErrorZPtr,
10467 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
10468 pub result_ok: bool,
10471 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
10472 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
10473 CResult_DescriptionCreationErrorZ {
10474 contents: CResult_DescriptionCreationErrorZPtr {
10475 result: Box::into_raw(Box::new(o)),
10481 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
10482 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
10483 CResult_DescriptionCreationErrorZ {
10484 contents: CResult_DescriptionCreationErrorZPtr {
10485 err: Box::into_raw(Box::new(e)),
10490 /// Checks if the given object is currently in the success state
10492 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
10496 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
10497 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
10498 impl Drop for CResult_DescriptionCreationErrorZ {
10499 fn drop(&mut self) {
10500 if self.result_ok {
10501 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10502 let _ = unsafe { Box::from_raw(self.contents.result) };
10505 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10506 let _ = unsafe { Box::from_raw(self.contents.err) };
10511 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
10512 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
10513 let contents = if o.result_ok {
10514 let result = unsafe { o.contents.result };
10515 unsafe { o.contents.result = core::ptr::null_mut() };
10516 CResult_DescriptionCreationErrorZPtr { result }
10518 let err = unsafe { o.contents.err };
10519 unsafe { o.contents.err = core::ptr::null_mut(); }
10520 CResult_DescriptionCreationErrorZPtr { err }
10524 result_ok: o.result_ok,
10528 impl Clone for CResult_DescriptionCreationErrorZ {
10529 fn clone(&self) -> Self {
10530 if self.result_ok {
10531 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
10532 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
10535 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
10536 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10542 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10543 /// but with all dynamically-allocated buffers duplicated in new buffers.
10544 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
10546 /// The contents of CResult_PrivateRouteCreationErrorZ
10547 pub union CResult_PrivateRouteCreationErrorZPtr {
10548 /// A pointer to the contents in the success state.
10549 /// Reading from this pointer when `result_ok` is not set is undefined.
10550 pub result: *mut crate::lightning_invoice::PrivateRoute,
10551 /// A pointer to the contents in the error state.
10552 /// Reading from this pointer when `result_ok` is set is undefined.
10553 pub err: *mut crate::lightning_invoice::CreationError,
10556 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
10557 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
10558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10559 pub struct CResult_PrivateRouteCreationErrorZ {
10560 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
10561 /// `err` or `result` depending on the state of `result_ok`.
10562 pub contents: CResult_PrivateRouteCreationErrorZPtr,
10563 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
10564 pub result_ok: bool,
10567 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10568 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
10569 CResult_PrivateRouteCreationErrorZ {
10570 contents: CResult_PrivateRouteCreationErrorZPtr {
10571 result: Box::into_raw(Box::new(o)),
10577 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10578 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
10579 CResult_PrivateRouteCreationErrorZ {
10580 contents: CResult_PrivateRouteCreationErrorZPtr {
10581 err: Box::into_raw(Box::new(e)),
10586 /// Checks if the given object is currently in the success state
10588 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
10592 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10593 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
10594 impl Drop for CResult_PrivateRouteCreationErrorZ {
10595 fn drop(&mut self) {
10596 if self.result_ok {
10597 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10598 let _ = unsafe { Box::from_raw(self.contents.result) };
10601 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10602 let _ = unsafe { Box::from_raw(self.contents.err) };
10607 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
10608 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
10609 let contents = if o.result_ok {
10610 let result = unsafe { o.contents.result };
10611 unsafe { o.contents.result = core::ptr::null_mut() };
10612 CResult_PrivateRouteCreationErrorZPtr { result }
10614 let err = unsafe { o.contents.err };
10615 unsafe { o.contents.err = core::ptr::null_mut(); }
10616 CResult_PrivateRouteCreationErrorZPtr { err }
10620 result_ok: o.result_ok,
10624 impl Clone for CResult_PrivateRouteCreationErrorZ {
10625 fn clone(&self) -> Self {
10626 if self.result_ok {
10627 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
10628 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
10631 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
10632 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10638 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10639 /// but with all dynamically-allocated buffers duplicated in new buffers.
10640 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
10642 /// The contents of CResult_StringErrorZ
10643 pub union CResult_StringErrorZPtr {
10644 /// A pointer to the contents in the success state.
10645 /// Reading from this pointer when `result_ok` is not set is undefined.
10646 pub result: *mut crate::c_types::Str,
10647 /// A pointer to the contents in the error state.
10648 /// Reading from this pointer when `result_ok` is set is undefined.
10649 pub err: *mut crate::c_types::Secp256k1Error,
10652 /// A CResult_StringErrorZ represents the result of a fallible operation,
10653 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10655 pub struct CResult_StringErrorZ {
10656 /// The contents of this CResult_StringErrorZ, accessible via either
10657 /// `err` or `result` depending on the state of `result_ok`.
10658 pub contents: CResult_StringErrorZPtr,
10659 /// Whether this CResult_StringErrorZ represents a success state.
10660 pub result_ok: bool,
10663 /// Creates a new CResult_StringErrorZ in the success state.
10664 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10665 CResult_StringErrorZ {
10666 contents: CResult_StringErrorZPtr {
10667 result: Box::into_raw(Box::new(o)),
10673 /// Creates a new CResult_StringErrorZ in the error state.
10674 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10675 CResult_StringErrorZ {
10676 contents: CResult_StringErrorZPtr {
10677 err: Box::into_raw(Box::new(e)),
10682 /// Checks if the given object is currently in the success state
10684 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10688 /// Frees any resources used by the CResult_StringErrorZ.
10689 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10690 impl Drop for CResult_StringErrorZ {
10691 fn drop(&mut self) {
10692 if self.result_ok {
10693 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10694 let _ = unsafe { Box::from_raw(self.contents.result) };
10697 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10698 let _ = unsafe { Box::from_raw(self.contents.err) };
10703 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10704 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10705 let contents = if o.result_ok {
10706 let result = unsafe { o.contents.result };
10707 unsafe { o.contents.result = core::ptr::null_mut() };
10708 CResult_StringErrorZPtr { result }
10710 let err = unsafe { o.contents.err };
10711 unsafe { o.contents.err = core::ptr::null_mut(); }
10712 CResult_StringErrorZPtr { err }
10716 result_ok: o.result_ok,
10720 impl Clone for CResult_StringErrorZ {
10721 fn clone(&self) -> Self {
10722 if self.result_ok {
10723 Self { result_ok: true, contents: CResult_StringErrorZPtr {
10724 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10727 Self { result_ok: false, contents: CResult_StringErrorZPtr {
10728 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10734 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10735 /// but with all dynamically-allocated buffers duplicated in new buffers.
10736 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10738 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10739 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10740 /// A pointer to the contents in the success state.
10741 /// Reading from this pointer when `result_ok` is not set is undefined.
10742 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10743 /// A pointer to the contents in the error state.
10744 /// Reading from this pointer when `result_ok` is set is undefined.
10745 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10748 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10749 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10751 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10752 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10753 /// `err` or `result` depending on the state of `result_ok`.
10754 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10755 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10756 pub result_ok: bool,
10759 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10760 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10761 CResult_ChannelMonitorUpdateDecodeErrorZ {
10762 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10763 result: Box::into_raw(Box::new(o)),
10769 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10770 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10771 CResult_ChannelMonitorUpdateDecodeErrorZ {
10772 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10773 err: Box::into_raw(Box::new(e)),
10778 /// Checks if the given object is currently in the success state
10780 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10784 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10785 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10786 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10787 fn drop(&mut self) {
10788 if self.result_ok {
10789 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10790 let _ = unsafe { Box::from_raw(self.contents.result) };
10793 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10794 let _ = unsafe { Box::from_raw(self.contents.err) };
10799 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10800 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10801 let contents = if o.result_ok {
10802 let result = unsafe { o.contents.result };
10803 unsafe { o.contents.result = core::ptr::null_mut() };
10804 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10806 let err = unsafe { o.contents.err };
10807 unsafe { o.contents.err = core::ptr::null_mut(); }
10808 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10812 result_ok: o.result_ok,
10816 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10817 fn clone(&self) -> Self {
10818 if self.result_ok {
10819 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10820 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10823 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10824 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10830 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10831 /// but with all dynamically-allocated buffers duplicated in new buffers.
10832 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10835 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10836 pub enum COption_MonitorEventZ {
10837 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10838 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10839 /// When we're in this state, this COption_MonitorEventZ contains nothing
10842 impl COption_MonitorEventZ {
10843 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10844 if let Self::None = self { false } else { true }
10846 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10849 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10850 if let Self::Some(v) = self { v } else { unreachable!() }
10854 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10855 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10856 COption_MonitorEventZ::Some(o)
10859 /// Constructs a new COption_MonitorEventZ containing nothing
10860 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10861 COption_MonitorEventZ::None
10864 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10865 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10867 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10868 /// but with all dynamically-allocated buffers duplicated in new buffers.
10869 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10871 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10872 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10873 /// A pointer to the contents in the success state.
10874 /// Reading from this pointer when `result_ok` is not set is undefined.
10875 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10876 /// A pointer to the contents in the error state.
10877 /// Reading from this pointer when `result_ok` is set is undefined.
10878 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10881 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10882 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10883 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10884 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10885 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10886 /// `err` or `result` depending on the state of `result_ok`.
10887 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10888 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10889 pub result_ok: bool,
10892 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10893 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10894 CResult_COption_MonitorEventZDecodeErrorZ {
10895 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10896 result: Box::into_raw(Box::new(o)),
10902 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10903 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10904 CResult_COption_MonitorEventZDecodeErrorZ {
10905 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10906 err: Box::into_raw(Box::new(e)),
10911 /// Checks if the given object is currently in the success state
10913 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10917 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10918 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10919 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10920 fn drop(&mut self) {
10921 if self.result_ok {
10922 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10923 let _ = unsafe { Box::from_raw(self.contents.result) };
10926 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10927 let _ = unsafe { Box::from_raw(self.contents.err) };
10932 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10933 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10934 let contents = if o.result_ok {
10935 let result = unsafe { o.contents.result };
10936 unsafe { o.contents.result = core::ptr::null_mut() };
10937 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10939 let err = unsafe { o.contents.err };
10940 unsafe { o.contents.err = core::ptr::null_mut(); }
10941 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10945 result_ok: o.result_ok,
10949 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10950 fn clone(&self) -> Self {
10951 if self.result_ok {
10952 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10953 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10956 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10957 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10963 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10964 /// but with all dynamically-allocated buffers duplicated in new buffers.
10965 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10967 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10968 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10969 /// A pointer to the contents in the success state.
10970 /// Reading from this pointer when `result_ok` is not set is undefined.
10971 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10972 /// A pointer to the contents in the error state.
10973 /// Reading from this pointer when `result_ok` is set is undefined.
10974 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10977 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10978 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10980 pub struct CResult_HTLCUpdateDecodeErrorZ {
10981 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10982 /// `err` or `result` depending on the state of `result_ok`.
10983 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10984 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10985 pub result_ok: bool,
10988 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10989 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10990 CResult_HTLCUpdateDecodeErrorZ {
10991 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10992 result: Box::into_raw(Box::new(o)),
10998 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10999 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11000 CResult_HTLCUpdateDecodeErrorZ {
11001 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11002 err: Box::into_raw(Box::new(e)),
11007 /// Checks if the given object is currently in the success state
11009 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11013 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11014 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11015 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11016 fn drop(&mut self) {
11017 if self.result_ok {
11018 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11019 let _ = unsafe { Box::from_raw(self.contents.result) };
11022 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11023 let _ = unsafe { Box::from_raw(self.contents.err) };
11028 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11029 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11030 let contents = if o.result_ok {
11031 let result = unsafe { o.contents.result };
11032 unsafe { o.contents.result = core::ptr::null_mut() };
11033 CResult_HTLCUpdateDecodeErrorZPtr { result }
11035 let err = unsafe { o.contents.err };
11036 unsafe { o.contents.err = core::ptr::null_mut(); }
11037 CResult_HTLCUpdateDecodeErrorZPtr { err }
11041 result_ok: o.result_ok,
11045 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11046 fn clone(&self) -> Self {
11047 if self.result_ok {
11048 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11049 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11052 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11053 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11059 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11060 /// but with all dynamically-allocated buffers duplicated in new buffers.
11061 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11063 /// A tuple of 2 elements. See the individual fields for the types contained.
11064 pub struct C2Tuple_OutPointScriptZ {
11065 /// The element at position 0
11066 pub a: crate::lightning::chain::transaction::OutPoint,
11067 /// The element at position 1
11068 pub b: crate::c_types::derived::CVec_u8Z,
11070 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11071 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11078 impl C2Tuple_OutPointScriptZ {
11079 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11083 impl Clone for C2Tuple_OutPointScriptZ {
11084 fn clone(&self) -> Self {
11086 a: Clone::clone(&self.a),
11087 b: Clone::clone(&self.b),
11092 /// Creates a new tuple which has the same data as `orig`
11093 /// but with all dynamically-allocated buffers duplicated in new buffers.
11094 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11095 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11097 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11098 C2Tuple_OutPointScriptZ { a, b, }
11102 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11103 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11105 /// A tuple of 2 elements. See the individual fields for the types contained.
11106 pub struct C2Tuple_u32ScriptZ {
11107 /// The element at position 0
11109 /// The element at position 1
11110 pub b: crate::c_types::derived::CVec_u8Z,
11112 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11113 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11120 impl C2Tuple_u32ScriptZ {
11121 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11125 impl Clone for C2Tuple_u32ScriptZ {
11126 fn clone(&self) -> Self {
11128 a: Clone::clone(&self.a),
11129 b: Clone::clone(&self.b),
11134 /// Creates a new tuple which has the same data as `orig`
11135 /// but with all dynamically-allocated buffers duplicated in new buffers.
11136 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11137 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11139 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11140 C2Tuple_u32ScriptZ { a, b, }
11144 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11145 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11147 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11148 /// This corresponds to std::vector in C++
11149 pub struct CVec_C2Tuple_u32ScriptZZ {
11150 /// The elements in the array.
11151 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11152 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11153 /// The number of elements pointed to by `data`.
11156 impl CVec_C2Tuple_u32ScriptZZ {
11157 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11158 if self.datalen == 0 { return Vec::new(); }
11159 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11160 self.data = core::ptr::null_mut();
11164 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11165 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11168 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11169 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11170 let datalen = v.len();
11171 let data = Box::into_raw(v.into_boxed_slice());
11172 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11176 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11177 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11178 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11179 fn drop(&mut self) {
11180 if self.datalen == 0 { return; }
11181 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11184 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11185 fn clone(&self) -> Self {
11186 let mut res = Vec::new();
11187 if self.datalen == 0 { return Self::from(res); }
11188 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11193 /// A tuple of 2 elements. See the individual fields for the types contained.
11194 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11195 /// The element at position 0
11196 pub a: crate::c_types::ThirtyTwoBytes,
11197 /// The element at position 1
11198 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11200 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11201 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11208 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11209 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11213 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11214 fn clone(&self) -> Self {
11216 a: Clone::clone(&self.a),
11217 b: Clone::clone(&self.b),
11222 /// Creates a new tuple which has the same data as `orig`
11223 /// but with all dynamically-allocated buffers duplicated in new buffers.
11224 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11225 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11227 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 {
11228 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11232 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11233 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11235 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11236 /// This corresponds to std::vector in C++
11237 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11238 /// The elements in the array.
11239 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11240 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11241 /// The number of elements pointed to by `data`.
11244 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11245 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11246 if self.datalen == 0 { return Vec::new(); }
11247 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11248 self.data = core::ptr::null_mut();
11252 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11253 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11256 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11257 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11258 let datalen = v.len();
11259 let data = Box::into_raw(v.into_boxed_slice());
11260 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11264 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11265 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11266 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11267 fn drop(&mut self) {
11268 if self.datalen == 0 { return; }
11269 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11272 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11273 fn clone(&self) -> Self {
11274 let mut res = Vec::new();
11275 if self.datalen == 0 { return Self::from(res); }
11276 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11281 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11282 /// This corresponds to std::vector in C++
11283 pub struct CVec_EventZ {
11284 /// The elements in the array.
11285 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11286 pub data: *mut crate::lightning::util::events::Event,
11287 /// The number of elements pointed to by `data`.
11291 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11292 if self.datalen == 0 { return Vec::new(); }
11293 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11294 self.data = core::ptr::null_mut();
11298 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11299 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11302 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11303 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11304 let datalen = v.len();
11305 let data = Box::into_raw(v.into_boxed_slice());
11306 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11310 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11311 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11312 impl Drop for CVec_EventZ {
11313 fn drop(&mut self) {
11314 if self.datalen == 0 { return; }
11315 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11318 impl Clone for CVec_EventZ {
11319 fn clone(&self) -> Self {
11320 let mut res = Vec::new();
11321 if self.datalen == 0 { return Self::from(res); }
11322 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11327 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11328 /// This corresponds to std::vector in C++
11329 pub struct CVec_TransactionZ {
11330 /// The elements in the array.
11331 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11332 pub data: *mut crate::c_types::Transaction,
11333 /// The number of elements pointed to by `data`.
11336 impl CVec_TransactionZ {
11337 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11338 if self.datalen == 0 { return Vec::new(); }
11339 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11340 self.data = core::ptr::null_mut();
11344 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11345 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11348 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11349 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11350 let datalen = v.len();
11351 let data = Box::into_raw(v.into_boxed_slice());
11352 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11356 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11357 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11358 impl Drop for CVec_TransactionZ {
11359 fn drop(&mut self) {
11360 if self.datalen == 0 { return; }
11361 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11364 impl Clone for CVec_TransactionZ {
11365 fn clone(&self) -> Self {
11366 let mut res = Vec::new();
11367 if self.datalen == 0 { return Self::from(res); }
11368 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11373 /// A tuple of 2 elements. See the individual fields for the types contained.
11374 pub struct C2Tuple_u32TxOutZ {
11375 /// The element at position 0
11377 /// The element at position 1
11378 pub b: crate::c_types::TxOut,
11380 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11381 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11388 impl C2Tuple_u32TxOutZ {
11389 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11393 impl Clone for C2Tuple_u32TxOutZ {
11394 fn clone(&self) -> Self {
11396 a: Clone::clone(&self.a),
11397 b: Clone::clone(&self.b),
11402 /// Creates a new tuple which has the same data as `orig`
11403 /// but with all dynamically-allocated buffers duplicated in new buffers.
11404 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11405 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11407 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11408 C2Tuple_u32TxOutZ { a, b, }
11412 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11413 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11415 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11416 /// This corresponds to std::vector in C++
11417 pub struct CVec_C2Tuple_u32TxOutZZ {
11418 /// The elements in the array.
11419 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11420 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11421 /// The number of elements pointed to by `data`.
11424 impl CVec_C2Tuple_u32TxOutZZ {
11425 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11426 if self.datalen == 0 { return Vec::new(); }
11427 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11428 self.data = core::ptr::null_mut();
11432 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11433 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11436 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11437 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11438 let datalen = v.len();
11439 let data = Box::into_raw(v.into_boxed_slice());
11440 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11444 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11445 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11446 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11447 fn drop(&mut self) {
11448 if self.datalen == 0 { return; }
11449 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11452 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11453 fn clone(&self) -> Self {
11454 let mut res = Vec::new();
11455 if self.datalen == 0 { return Self::from(res); }
11456 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11461 /// A tuple of 2 elements. See the individual fields for the types contained.
11462 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11463 /// The element at position 0
11464 pub a: crate::c_types::ThirtyTwoBytes,
11465 /// The element at position 1
11466 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11468 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11469 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11476 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11477 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11481 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11482 fn clone(&self) -> Self {
11484 a: Clone::clone(&self.a),
11485 b: Clone::clone(&self.b),
11490 /// Creates a new tuple which has the same data as `orig`
11491 /// but with all dynamically-allocated buffers duplicated in new buffers.
11492 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11493 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11495 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 {
11496 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11500 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11501 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11503 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11504 /// This corresponds to std::vector in C++
11505 pub struct CVec_TransactionOutputsZ {
11506 /// The elements in the array.
11507 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11508 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11509 /// The number of elements pointed to by `data`.
11512 impl CVec_TransactionOutputsZ {
11513 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11514 if self.datalen == 0 { return Vec::new(); }
11515 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11516 self.data = core::ptr::null_mut();
11520 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11521 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11524 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11525 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11526 let datalen = v.len();
11527 let data = Box::into_raw(v.into_boxed_slice());
11528 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11532 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11533 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11534 impl Drop for CVec_TransactionOutputsZ {
11535 fn drop(&mut self) {
11536 if self.datalen == 0 { return; }
11537 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11540 impl Clone for CVec_TransactionOutputsZ {
11541 fn clone(&self) -> Self {
11542 let mut res = Vec::new();
11543 if self.datalen == 0 { return Self::from(res); }
11544 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11549 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11550 /// This corresponds to std::vector in C++
11551 pub struct CVec_BalanceZ {
11552 /// The elements in the array.
11553 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11554 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11555 /// The number of elements pointed to by `data`.
11558 impl CVec_BalanceZ {
11559 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11560 if self.datalen == 0 { return Vec::new(); }
11561 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11562 self.data = core::ptr::null_mut();
11566 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11567 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11570 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11571 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11572 let datalen = v.len();
11573 let data = Box::into_raw(v.into_boxed_slice());
11574 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11578 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11579 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11580 impl Drop for CVec_BalanceZ {
11581 fn drop(&mut self) {
11582 if self.datalen == 0 { return; }
11583 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11586 impl Clone for CVec_BalanceZ {
11587 fn clone(&self) -> Self {
11588 let mut res = Vec::new();
11589 if self.datalen == 0 { return Self::from(res); }
11590 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11595 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11596 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
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::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11606 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ 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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11609 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11610 /// `err` or `result` depending on the state of `result_ok`.
11611 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11612 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11613 pub result_ok: bool,
11616 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11617 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11618 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11619 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11620 result: Box::into_raw(Box::new(o)),
11626 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11627 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11628 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11629 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11641 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11642 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11643 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
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::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11657 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, 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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11663 let err = unsafe { o.contents.err };
11664 unsafe { o.contents.err = core::ptr::null_mut(); }
11665 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11669 result_ok: o.result_ok,
11674 /// A tuple of 2 elements. See the individual fields for the types contained.
11675 pub struct C2Tuple_PublicKeyTypeZ {
11676 /// The element at position 0
11677 pub a: crate::c_types::PublicKey,
11678 /// The element at position 1
11679 pub b: crate::lightning::ln::wire::Type,
11681 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11682 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11689 impl C2Tuple_PublicKeyTypeZ {
11690 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11694 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11696 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11697 C2Tuple_PublicKeyTypeZ { a, b, }
11701 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11702 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11704 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11705 /// This corresponds to std::vector in C++
11706 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11707 /// The elements in the array.
11708 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11709 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11710 /// The number of elements pointed to by `data`.
11713 impl CVec_C2Tuple_PublicKeyTypeZZ {
11714 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11715 if self.datalen == 0 { return Vec::new(); }
11716 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11717 self.data = core::ptr::null_mut();
11721 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11722 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11725 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11726 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11727 let datalen = v.len();
11728 let data = Box::into_raw(v.into_boxed_slice());
11729 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11733 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11734 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11735 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11736 fn drop(&mut self) {
11737 if self.datalen == 0 { return; }
11738 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11743 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11744 pub enum COption_NetAddressZ {
11745 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11746 Some(crate::lightning::ln::msgs::NetAddress),
11747 /// When we're in this state, this COption_NetAddressZ contains nothing
11750 impl COption_NetAddressZ {
11751 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11752 if let Self::None = self { false } else { true }
11754 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11757 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11758 if let Self::Some(v) = self { v } else { unreachable!() }
11762 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11763 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11764 COption_NetAddressZ::Some(o)
11767 /// Constructs a new COption_NetAddressZ containing nothing
11768 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11769 COption_NetAddressZ::None
11772 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11773 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11775 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11776 /// but with all dynamically-allocated buffers duplicated in new buffers.
11777 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11779 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11780 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11781 /// A pointer to the contents in the success state.
11782 /// Reading from this pointer when `result_ok` is not set is undefined.
11783 pub result: *mut crate::c_types::derived::CVec_u8Z,
11784 /// A pointer to the contents in the error state.
11785 /// Reading from this pointer when `result_ok` is set is undefined.
11786 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11789 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11790 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11792 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11793 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11794 /// `err` or `result` depending on the state of `result_ok`.
11795 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11796 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11797 pub result_ok: bool,
11800 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11801 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11802 CResult_CVec_u8ZPeerHandleErrorZ {
11803 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11804 result: Box::into_raw(Box::new(o)),
11810 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11811 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11812 CResult_CVec_u8ZPeerHandleErrorZ {
11813 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11814 err: Box::into_raw(Box::new(e)),
11819 /// Checks if the given object is currently in the success state
11821 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11825 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11826 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11827 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11828 fn drop(&mut self) {
11829 if self.result_ok {
11830 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11831 let _ = unsafe { Box::from_raw(self.contents.result) };
11834 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11835 let _ = unsafe { Box::from_raw(self.contents.err) };
11840 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11841 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11842 let contents = if o.result_ok {
11843 let result = unsafe { o.contents.result };
11844 unsafe { o.contents.result = core::ptr::null_mut() };
11845 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11847 let err = unsafe { o.contents.err };
11848 unsafe { o.contents.err = core::ptr::null_mut(); }
11849 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11853 result_ok: o.result_ok,
11857 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11858 fn clone(&self) -> Self {
11859 if self.result_ok {
11860 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11861 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11864 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11865 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11871 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11872 /// but with all dynamically-allocated buffers duplicated in new buffers.
11873 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11875 /// The contents of CResult_NonePeerHandleErrorZ
11876 pub union CResult_NonePeerHandleErrorZPtr {
11877 /// Note that this value is always NULL, as there are no contents in the OK variant
11878 pub result: *mut core::ffi::c_void,
11879 /// A pointer to the contents in the error state.
11880 /// Reading from this pointer when `result_ok` is set is undefined.
11881 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11884 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11885 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11887 pub struct CResult_NonePeerHandleErrorZ {
11888 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11889 /// `err` or `result` depending on the state of `result_ok`.
11890 pub contents: CResult_NonePeerHandleErrorZPtr,
11891 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11892 pub result_ok: bool,
11895 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11896 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11897 CResult_NonePeerHandleErrorZ {
11898 contents: CResult_NonePeerHandleErrorZPtr {
11899 result: core::ptr::null_mut(),
11905 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11906 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11907 CResult_NonePeerHandleErrorZ {
11908 contents: CResult_NonePeerHandleErrorZPtr {
11909 err: Box::into_raw(Box::new(e)),
11914 /// Checks if the given object is currently in the success state
11916 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11920 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11921 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11922 impl Drop for CResult_NonePeerHandleErrorZ {
11923 fn drop(&mut self) {
11924 if self.result_ok {
11926 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11927 let _ = unsafe { Box::from_raw(self.contents.err) };
11932 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11933 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11934 let contents = if o.result_ok {
11935 let _ = unsafe { Box::from_raw(o.contents.result) };
11936 o.contents.result = core::ptr::null_mut();
11937 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11939 let err = unsafe { o.contents.err };
11940 unsafe { o.contents.err = core::ptr::null_mut(); }
11941 CResult_NonePeerHandleErrorZPtr { err }
11945 result_ok: o.result_ok,
11949 impl Clone for CResult_NonePeerHandleErrorZ {
11950 fn clone(&self) -> Self {
11951 if self.result_ok {
11952 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11953 result: core::ptr::null_mut()
11956 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11957 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11963 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11964 /// but with all dynamically-allocated buffers duplicated in new buffers.
11965 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11967 /// The contents of CResult_boolPeerHandleErrorZ
11968 pub union CResult_boolPeerHandleErrorZPtr {
11969 /// A pointer to the contents in the success state.
11970 /// Reading from this pointer when `result_ok` is not set is undefined.
11971 pub result: *mut bool,
11972 /// A pointer to the contents in the error state.
11973 /// Reading from this pointer when `result_ok` is set is undefined.
11974 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11977 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11978 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11980 pub struct CResult_boolPeerHandleErrorZ {
11981 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11982 /// `err` or `result` depending on the state of `result_ok`.
11983 pub contents: CResult_boolPeerHandleErrorZPtr,
11984 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11985 pub result_ok: bool,
11988 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11989 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11990 CResult_boolPeerHandleErrorZ {
11991 contents: CResult_boolPeerHandleErrorZPtr {
11992 result: Box::into_raw(Box::new(o)),
11998 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11999 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12000 CResult_boolPeerHandleErrorZ {
12001 contents: CResult_boolPeerHandleErrorZPtr {
12002 err: Box::into_raw(Box::new(e)),
12007 /// Checks if the given object is currently in the success state
12009 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12013 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12014 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12015 impl Drop for CResult_boolPeerHandleErrorZ {
12016 fn drop(&mut self) {
12017 if self.result_ok {
12018 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12019 let _ = unsafe { Box::from_raw(self.contents.result) };
12022 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12023 let _ = unsafe { Box::from_raw(self.contents.err) };
12028 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12029 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12030 let contents = if o.result_ok {
12031 let result = unsafe { o.contents.result };
12032 unsafe { o.contents.result = core::ptr::null_mut() };
12033 CResult_boolPeerHandleErrorZPtr { result }
12035 let err = unsafe { o.contents.err };
12036 unsafe { o.contents.err = core::ptr::null_mut(); }
12037 CResult_boolPeerHandleErrorZPtr { err }
12041 result_ok: o.result_ok,
12045 impl Clone for CResult_boolPeerHandleErrorZ {
12046 fn clone(&self) -> Self {
12047 if self.result_ok {
12048 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12049 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12052 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12053 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12059 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12060 /// but with all dynamically-allocated buffers duplicated in new buffers.
12061 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12063 /// The contents of CResult_u32GraphSyncErrorZ
12064 pub union CResult_u32GraphSyncErrorZPtr {
12065 /// A pointer to the contents in the success state.
12066 /// Reading from this pointer when `result_ok` is not set is undefined.
12067 pub result: *mut u32,
12068 /// A pointer to the contents in the error state.
12069 /// Reading from this pointer when `result_ok` is set is undefined.
12070 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12073 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12074 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12076 pub struct CResult_u32GraphSyncErrorZ {
12077 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12078 /// `err` or `result` depending on the state of `result_ok`.
12079 pub contents: CResult_u32GraphSyncErrorZPtr,
12080 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12081 pub result_ok: bool,
12084 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12085 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12086 CResult_u32GraphSyncErrorZ {
12087 contents: CResult_u32GraphSyncErrorZPtr {
12088 result: Box::into_raw(Box::new(o)),
12094 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12095 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12096 CResult_u32GraphSyncErrorZ {
12097 contents: CResult_u32GraphSyncErrorZPtr {
12098 err: Box::into_raw(Box::new(e)),
12103 /// Checks if the given object is currently in the success state
12105 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12109 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12110 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12111 impl Drop for CResult_u32GraphSyncErrorZ {
12112 fn drop(&mut self) {
12113 if self.result_ok {
12114 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12115 let _ = unsafe { Box::from_raw(self.contents.result) };
12118 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12119 let _ = unsafe { Box::from_raw(self.contents.err) };
12124 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12125 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12126 let contents = if o.result_ok {
12127 let result = unsafe { o.contents.result };
12128 unsafe { o.contents.result = core::ptr::null_mut() };
12129 CResult_u32GraphSyncErrorZPtr { result }
12131 let err = unsafe { o.contents.err };
12132 unsafe { o.contents.err = core::ptr::null_mut(); }
12133 CResult_u32GraphSyncErrorZPtr { err }
12137 result_ok: o.result_ok,
12142 /// The contents of CResult_NetAddressDecodeErrorZ
12143 pub union CResult_NetAddressDecodeErrorZPtr {
12144 /// A pointer to the contents in the success state.
12145 /// Reading from this pointer when `result_ok` is not set is undefined.
12146 pub result: *mut crate::lightning::ln::msgs::NetAddress,
12147 /// A pointer to the contents in the error state.
12148 /// Reading from this pointer when `result_ok` is set is undefined.
12149 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12152 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
12153 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
12154 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12155 pub struct CResult_NetAddressDecodeErrorZ {
12156 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
12157 /// `err` or `result` depending on the state of `result_ok`.
12158 pub contents: CResult_NetAddressDecodeErrorZPtr,
12159 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
12160 pub result_ok: bool,
12163 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
12164 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
12165 CResult_NetAddressDecodeErrorZ {
12166 contents: CResult_NetAddressDecodeErrorZPtr {
12167 result: Box::into_raw(Box::new(o)),
12173 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
12174 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
12175 CResult_NetAddressDecodeErrorZ {
12176 contents: CResult_NetAddressDecodeErrorZPtr {
12177 err: Box::into_raw(Box::new(e)),
12182 /// Checks if the given object is currently in the success state
12184 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
12188 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
12189 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
12190 impl Drop for CResult_NetAddressDecodeErrorZ {
12191 fn drop(&mut self) {
12192 if self.result_ok {
12193 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12194 let _ = unsafe { Box::from_raw(self.contents.result) };
12197 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12198 let _ = unsafe { Box::from_raw(self.contents.err) };
12203 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
12204 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
12205 let contents = if o.result_ok {
12206 let result = unsafe { o.contents.result };
12207 unsafe { o.contents.result = core::ptr::null_mut() };
12208 CResult_NetAddressDecodeErrorZPtr { result }
12210 let err = unsafe { o.contents.err };
12211 unsafe { o.contents.err = core::ptr::null_mut(); }
12212 CResult_NetAddressDecodeErrorZPtr { err }
12216 result_ok: o.result_ok,
12220 impl Clone for CResult_NetAddressDecodeErrorZ {
12221 fn clone(&self) -> Self {
12222 if self.result_ok {
12223 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
12224 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
12227 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
12228 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12234 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12235 /// but with all dynamically-allocated buffers duplicated in new buffers.
12236 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
12238 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
12239 /// This corresponds to std::vector in C++
12240 pub struct CVec_UpdateAddHTLCZ {
12241 /// The elements in the array.
12242 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12243 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12244 /// The number of elements pointed to by `data`.
12247 impl CVec_UpdateAddHTLCZ {
12248 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
12249 if self.datalen == 0 { return Vec::new(); }
12250 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12251 self.data = core::ptr::null_mut();
12255 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
12256 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12259 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
12260 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
12261 let datalen = v.len();
12262 let data = Box::into_raw(v.into_boxed_slice());
12263 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12267 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12268 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12269 impl Drop for CVec_UpdateAddHTLCZ {
12270 fn drop(&mut self) {
12271 if self.datalen == 0 { return; }
12272 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12275 impl Clone for CVec_UpdateAddHTLCZ {
12276 fn clone(&self) -> Self {
12277 let mut res = Vec::new();
12278 if self.datalen == 0 { return Self::from(res); }
12279 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12284 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12285 /// This corresponds to std::vector in C++
12286 pub struct CVec_UpdateFulfillHTLCZ {
12287 /// The elements in the array.
12288 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12289 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12290 /// The number of elements pointed to by `data`.
12293 impl CVec_UpdateFulfillHTLCZ {
12294 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12295 if self.datalen == 0 { return Vec::new(); }
12296 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12297 self.data = core::ptr::null_mut();
12301 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12302 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12305 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12306 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12307 let datalen = v.len();
12308 let data = Box::into_raw(v.into_boxed_slice());
12309 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12313 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12314 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12315 impl Drop for CVec_UpdateFulfillHTLCZ {
12316 fn drop(&mut self) {
12317 if self.datalen == 0 { return; }
12318 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12321 impl Clone for CVec_UpdateFulfillHTLCZ {
12322 fn clone(&self) -> Self {
12323 let mut res = Vec::new();
12324 if self.datalen == 0 { return Self::from(res); }
12325 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12330 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12331 /// This corresponds to std::vector in C++
12332 pub struct CVec_UpdateFailHTLCZ {
12333 /// The elements in the array.
12334 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12335 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12336 /// The number of elements pointed to by `data`.
12339 impl CVec_UpdateFailHTLCZ {
12340 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12341 if self.datalen == 0 { return Vec::new(); }
12342 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12343 self.data = core::ptr::null_mut();
12347 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12348 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12351 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12352 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12353 let datalen = v.len();
12354 let data = Box::into_raw(v.into_boxed_slice());
12355 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12359 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12360 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12361 impl Drop for CVec_UpdateFailHTLCZ {
12362 fn drop(&mut self) {
12363 if self.datalen == 0 { return; }
12364 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12367 impl Clone for CVec_UpdateFailHTLCZ {
12368 fn clone(&self) -> Self {
12369 let mut res = Vec::new();
12370 if self.datalen == 0 { return Self::from(res); }
12371 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12376 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12377 /// This corresponds to std::vector in C++
12378 pub struct CVec_UpdateFailMalformedHTLCZ {
12379 /// The elements in the array.
12380 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12381 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12382 /// The number of elements pointed to by `data`.
12385 impl CVec_UpdateFailMalformedHTLCZ {
12386 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12387 if self.datalen == 0 { return Vec::new(); }
12388 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12389 self.data = core::ptr::null_mut();
12393 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12394 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12397 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12398 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12399 let datalen = v.len();
12400 let data = Box::into_raw(v.into_boxed_slice());
12401 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12405 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12406 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12407 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12408 fn drop(&mut self) {
12409 if self.datalen == 0 { return; }
12410 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12413 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12414 fn clone(&self) -> Self {
12415 let mut res = Vec::new();
12416 if self.datalen == 0 { return Self::from(res); }
12417 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12422 /// The contents of CResult_AcceptChannelDecodeErrorZ
12423 pub union CResult_AcceptChannelDecodeErrorZPtr {
12424 /// A pointer to the contents in the success state.
12425 /// Reading from this pointer when `result_ok` is not set is undefined.
12426 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12427 /// A pointer to the contents in the error state.
12428 /// Reading from this pointer when `result_ok` is set is undefined.
12429 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12432 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12433 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12435 pub struct CResult_AcceptChannelDecodeErrorZ {
12436 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12437 /// `err` or `result` depending on the state of `result_ok`.
12438 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12439 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12440 pub result_ok: bool,
12443 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12444 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12445 CResult_AcceptChannelDecodeErrorZ {
12446 contents: CResult_AcceptChannelDecodeErrorZPtr {
12447 result: Box::into_raw(Box::new(o)),
12453 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12454 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12455 CResult_AcceptChannelDecodeErrorZ {
12456 contents: CResult_AcceptChannelDecodeErrorZPtr {
12457 err: Box::into_raw(Box::new(e)),
12462 /// Checks if the given object is currently in the success state
12464 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12468 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12469 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12470 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12471 fn drop(&mut self) {
12472 if self.result_ok {
12473 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12474 let _ = unsafe { Box::from_raw(self.contents.result) };
12477 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12478 let _ = unsafe { Box::from_raw(self.contents.err) };
12483 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12484 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12485 let contents = if o.result_ok {
12486 let result = unsafe { o.contents.result };
12487 unsafe { o.contents.result = core::ptr::null_mut() };
12488 CResult_AcceptChannelDecodeErrorZPtr { result }
12490 let err = unsafe { o.contents.err };
12491 unsafe { o.contents.err = core::ptr::null_mut(); }
12492 CResult_AcceptChannelDecodeErrorZPtr { err }
12496 result_ok: o.result_ok,
12500 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12501 fn clone(&self) -> Self {
12502 if self.result_ok {
12503 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12504 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12507 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12508 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12514 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12515 /// but with all dynamically-allocated buffers duplicated in new buffers.
12516 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12518 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12519 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12520 /// A pointer to the contents in the success state.
12521 /// Reading from this pointer when `result_ok` is not set is undefined.
12522 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12523 /// A pointer to the contents in the error state.
12524 /// Reading from this pointer when `result_ok` is set is undefined.
12525 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12528 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12529 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12531 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12532 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12533 /// `err` or `result` depending on the state of `result_ok`.
12534 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12535 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12536 pub result_ok: bool,
12539 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12540 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12541 CResult_AnnouncementSignaturesDecodeErrorZ {
12542 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12543 result: Box::into_raw(Box::new(o)),
12549 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12550 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12551 CResult_AnnouncementSignaturesDecodeErrorZ {
12552 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12553 err: Box::into_raw(Box::new(e)),
12558 /// Checks if the given object is currently in the success state
12560 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12564 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12565 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12566 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12567 fn drop(&mut self) {
12568 if self.result_ok {
12569 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12570 let _ = unsafe { Box::from_raw(self.contents.result) };
12573 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12574 let _ = unsafe { Box::from_raw(self.contents.err) };
12579 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12580 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12581 let contents = if o.result_ok {
12582 let result = unsafe { o.contents.result };
12583 unsafe { o.contents.result = core::ptr::null_mut() };
12584 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12586 let err = unsafe { o.contents.err };
12587 unsafe { o.contents.err = core::ptr::null_mut(); }
12588 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12592 result_ok: o.result_ok,
12596 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12597 fn clone(&self) -> Self {
12598 if self.result_ok {
12599 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12600 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12603 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12604 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12610 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12611 /// but with all dynamically-allocated buffers duplicated in new buffers.
12612 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12614 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12615 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12616 /// A pointer to the contents in the success state.
12617 /// Reading from this pointer when `result_ok` is not set is undefined.
12618 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12619 /// A pointer to the contents in the error state.
12620 /// Reading from this pointer when `result_ok` is set is undefined.
12621 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12624 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12625 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12627 pub struct CResult_ChannelReestablishDecodeErrorZ {
12628 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12629 /// `err` or `result` depending on the state of `result_ok`.
12630 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12631 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12632 pub result_ok: bool,
12635 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12636 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12637 CResult_ChannelReestablishDecodeErrorZ {
12638 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12639 result: Box::into_raw(Box::new(o)),
12645 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12646 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12647 CResult_ChannelReestablishDecodeErrorZ {
12648 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12649 err: Box::into_raw(Box::new(e)),
12654 /// Checks if the given object is currently in the success state
12656 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12660 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12661 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12662 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12663 fn drop(&mut self) {
12664 if self.result_ok {
12665 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12666 let _ = unsafe { Box::from_raw(self.contents.result) };
12669 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12670 let _ = unsafe { Box::from_raw(self.contents.err) };
12675 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12676 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12677 let contents = if o.result_ok {
12678 let result = unsafe { o.contents.result };
12679 unsafe { o.contents.result = core::ptr::null_mut() };
12680 CResult_ChannelReestablishDecodeErrorZPtr { result }
12682 let err = unsafe { o.contents.err };
12683 unsafe { o.contents.err = core::ptr::null_mut(); }
12684 CResult_ChannelReestablishDecodeErrorZPtr { err }
12688 result_ok: o.result_ok,
12692 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12693 fn clone(&self) -> Self {
12694 if self.result_ok {
12695 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12696 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12699 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12700 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12706 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12707 /// but with all dynamically-allocated buffers duplicated in new buffers.
12708 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12710 /// The contents of CResult_ClosingSignedDecodeErrorZ
12711 pub union CResult_ClosingSignedDecodeErrorZPtr {
12712 /// A pointer to the contents in the success state.
12713 /// Reading from this pointer when `result_ok` is not set is undefined.
12714 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12715 /// A pointer to the contents in the error state.
12716 /// Reading from this pointer when `result_ok` is set is undefined.
12717 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12720 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12721 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12723 pub struct CResult_ClosingSignedDecodeErrorZ {
12724 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12725 /// `err` or `result` depending on the state of `result_ok`.
12726 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12727 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12728 pub result_ok: bool,
12731 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12732 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12733 CResult_ClosingSignedDecodeErrorZ {
12734 contents: CResult_ClosingSignedDecodeErrorZPtr {
12735 result: Box::into_raw(Box::new(o)),
12741 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12742 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12743 CResult_ClosingSignedDecodeErrorZ {
12744 contents: CResult_ClosingSignedDecodeErrorZPtr {
12745 err: Box::into_raw(Box::new(e)),
12750 /// Checks if the given object is currently in the success state
12752 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12756 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12757 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12758 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12759 fn drop(&mut self) {
12760 if self.result_ok {
12761 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12762 let _ = unsafe { Box::from_raw(self.contents.result) };
12765 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12766 let _ = unsafe { Box::from_raw(self.contents.err) };
12771 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12772 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12773 let contents = if o.result_ok {
12774 let result = unsafe { o.contents.result };
12775 unsafe { o.contents.result = core::ptr::null_mut() };
12776 CResult_ClosingSignedDecodeErrorZPtr { result }
12778 let err = unsafe { o.contents.err };
12779 unsafe { o.contents.err = core::ptr::null_mut(); }
12780 CResult_ClosingSignedDecodeErrorZPtr { err }
12784 result_ok: o.result_ok,
12788 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12789 fn clone(&self) -> Self {
12790 if self.result_ok {
12791 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12792 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12795 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12796 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12802 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12803 /// but with all dynamically-allocated buffers duplicated in new buffers.
12804 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12806 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12807 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12808 /// A pointer to the contents in the success state.
12809 /// Reading from this pointer when `result_ok` is not set is undefined.
12810 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12811 /// A pointer to the contents in the error state.
12812 /// Reading from this pointer when `result_ok` is set is undefined.
12813 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12816 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12817 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12819 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12820 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12821 /// `err` or `result` depending on the state of `result_ok`.
12822 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12823 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12824 pub result_ok: bool,
12827 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12828 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12829 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12830 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12831 result: Box::into_raw(Box::new(o)),
12837 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12838 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12839 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12840 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12841 err: Box::into_raw(Box::new(e)),
12846 /// Checks if the given object is currently in the success state
12848 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12852 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12853 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12854 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12855 fn drop(&mut self) {
12856 if self.result_ok {
12857 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12858 let _ = unsafe { Box::from_raw(self.contents.result) };
12861 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12862 let _ = unsafe { Box::from_raw(self.contents.err) };
12867 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12868 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12869 let contents = if o.result_ok {
12870 let result = unsafe { o.contents.result };
12871 unsafe { o.contents.result = core::ptr::null_mut() };
12872 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12874 let err = unsafe { o.contents.err };
12875 unsafe { o.contents.err = core::ptr::null_mut(); }
12876 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12880 result_ok: o.result_ok,
12884 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12885 fn clone(&self) -> Self {
12886 if self.result_ok {
12887 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12888 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12891 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12892 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12898 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12899 /// but with all dynamically-allocated buffers duplicated in new buffers.
12900 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12902 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12903 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12904 /// A pointer to the contents in the success state.
12905 /// Reading from this pointer when `result_ok` is not set is undefined.
12906 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12907 /// A pointer to the contents in the error state.
12908 /// Reading from this pointer when `result_ok` is set is undefined.
12909 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12912 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12913 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12915 pub struct CResult_CommitmentSignedDecodeErrorZ {
12916 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12917 /// `err` or `result` depending on the state of `result_ok`.
12918 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12919 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12920 pub result_ok: bool,
12923 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12924 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12925 CResult_CommitmentSignedDecodeErrorZ {
12926 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12927 result: Box::into_raw(Box::new(o)),
12933 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12934 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12935 CResult_CommitmentSignedDecodeErrorZ {
12936 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12937 err: Box::into_raw(Box::new(e)),
12942 /// Checks if the given object is currently in the success state
12944 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12948 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12949 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12950 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12951 fn drop(&mut self) {
12952 if self.result_ok {
12953 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12954 let _ = unsafe { Box::from_raw(self.contents.result) };
12957 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12958 let _ = unsafe { Box::from_raw(self.contents.err) };
12963 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12964 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12965 let contents = if o.result_ok {
12966 let result = unsafe { o.contents.result };
12967 unsafe { o.contents.result = core::ptr::null_mut() };
12968 CResult_CommitmentSignedDecodeErrorZPtr { result }
12970 let err = unsafe { o.contents.err };
12971 unsafe { o.contents.err = core::ptr::null_mut(); }
12972 CResult_CommitmentSignedDecodeErrorZPtr { err }
12976 result_ok: o.result_ok,
12980 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12981 fn clone(&self) -> Self {
12982 if self.result_ok {
12983 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12984 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12987 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12988 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12994 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12995 /// but with all dynamically-allocated buffers duplicated in new buffers.
12996 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12998 /// The contents of CResult_FundingCreatedDecodeErrorZ
12999 pub union CResult_FundingCreatedDecodeErrorZPtr {
13000 /// A pointer to the contents in the success state.
13001 /// Reading from this pointer when `result_ok` is not set is undefined.
13002 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13003 /// A pointer to the contents in the error state.
13004 /// Reading from this pointer when `result_ok` is set is undefined.
13005 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13008 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13009 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13011 pub struct CResult_FundingCreatedDecodeErrorZ {
13012 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13013 /// `err` or `result` depending on the state of `result_ok`.
13014 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13015 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13016 pub result_ok: bool,
13019 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13020 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13021 CResult_FundingCreatedDecodeErrorZ {
13022 contents: CResult_FundingCreatedDecodeErrorZPtr {
13023 result: Box::into_raw(Box::new(o)),
13029 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13030 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13031 CResult_FundingCreatedDecodeErrorZ {
13032 contents: CResult_FundingCreatedDecodeErrorZPtr {
13033 err: Box::into_raw(Box::new(e)),
13038 /// Checks if the given object is currently in the success state
13040 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13044 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13045 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13046 impl Drop for CResult_FundingCreatedDecodeErrorZ {
13047 fn drop(&mut self) {
13048 if self.result_ok {
13049 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13050 let _ = unsafe { Box::from_raw(self.contents.result) };
13053 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13054 let _ = unsafe { Box::from_raw(self.contents.err) };
13059 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
13060 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
13061 let contents = if o.result_ok {
13062 let result = unsafe { o.contents.result };
13063 unsafe { o.contents.result = core::ptr::null_mut() };
13064 CResult_FundingCreatedDecodeErrorZPtr { result }
13066 let err = unsafe { o.contents.err };
13067 unsafe { o.contents.err = core::ptr::null_mut(); }
13068 CResult_FundingCreatedDecodeErrorZPtr { err }
13072 result_ok: o.result_ok,
13076 impl Clone for CResult_FundingCreatedDecodeErrorZ {
13077 fn clone(&self) -> Self {
13078 if self.result_ok {
13079 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
13080 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
13083 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
13084 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13090 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13091 /// but with all dynamically-allocated buffers duplicated in new buffers.
13092 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
13094 /// The contents of CResult_FundingSignedDecodeErrorZ
13095 pub union CResult_FundingSignedDecodeErrorZPtr {
13096 /// A pointer to the contents in the success state.
13097 /// Reading from this pointer when `result_ok` is not set is undefined.
13098 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
13099 /// A pointer to the contents in the error state.
13100 /// Reading from this pointer when `result_ok` is set is undefined.
13101 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13104 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
13105 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13107 pub struct CResult_FundingSignedDecodeErrorZ {
13108 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
13109 /// `err` or `result` depending on the state of `result_ok`.
13110 pub contents: CResult_FundingSignedDecodeErrorZPtr,
13111 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
13112 pub result_ok: bool,
13115 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13116 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
13117 CResult_FundingSignedDecodeErrorZ {
13118 contents: CResult_FundingSignedDecodeErrorZPtr {
13119 result: Box::into_raw(Box::new(o)),
13125 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13126 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
13127 CResult_FundingSignedDecodeErrorZ {
13128 contents: CResult_FundingSignedDecodeErrorZPtr {
13129 err: Box::into_raw(Box::new(e)),
13134 /// Checks if the given object is currently in the success state
13136 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
13140 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13141 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
13142 impl Drop for CResult_FundingSignedDecodeErrorZ {
13143 fn drop(&mut self) {
13144 if self.result_ok {
13145 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13146 let _ = unsafe { Box::from_raw(self.contents.result) };
13149 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13150 let _ = unsafe { Box::from_raw(self.contents.err) };
13155 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
13156 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13157 let contents = if o.result_ok {
13158 let result = unsafe { o.contents.result };
13159 unsafe { o.contents.result = core::ptr::null_mut() };
13160 CResult_FundingSignedDecodeErrorZPtr { result }
13162 let err = unsafe { o.contents.err };
13163 unsafe { o.contents.err = core::ptr::null_mut(); }
13164 CResult_FundingSignedDecodeErrorZPtr { err }
13168 result_ok: o.result_ok,
13172 impl Clone for CResult_FundingSignedDecodeErrorZ {
13173 fn clone(&self) -> Self {
13174 if self.result_ok {
13175 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
13176 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
13179 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
13180 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13186 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13187 /// but with all dynamically-allocated buffers duplicated in new buffers.
13188 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
13190 /// The contents of CResult_ChannelReadyDecodeErrorZ
13191 pub union CResult_ChannelReadyDecodeErrorZPtr {
13192 /// A pointer to the contents in the success state.
13193 /// Reading from this pointer when `result_ok` is not set is undefined.
13194 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
13195 /// A pointer to the contents in the error state.
13196 /// Reading from this pointer when `result_ok` is set is undefined.
13197 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13200 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
13201 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
13202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13203 pub struct CResult_ChannelReadyDecodeErrorZ {
13204 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
13205 /// `err` or `result` depending on the state of `result_ok`.
13206 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
13207 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
13208 pub result_ok: bool,
13211 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
13212 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
13213 CResult_ChannelReadyDecodeErrorZ {
13214 contents: CResult_ChannelReadyDecodeErrorZPtr {
13215 result: Box::into_raw(Box::new(o)),
13221 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
13222 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
13223 CResult_ChannelReadyDecodeErrorZ {
13224 contents: CResult_ChannelReadyDecodeErrorZPtr {
13225 err: Box::into_raw(Box::new(e)),
13230 /// Checks if the given object is currently in the success state
13232 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13236 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13237 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13238 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13239 fn drop(&mut self) {
13240 if self.result_ok {
13241 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13242 let _ = unsafe { Box::from_raw(self.contents.result) };
13245 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13246 let _ = unsafe { Box::from_raw(self.contents.err) };
13251 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13252 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13253 let contents = if o.result_ok {
13254 let result = unsafe { o.contents.result };
13255 unsafe { o.contents.result = core::ptr::null_mut() };
13256 CResult_ChannelReadyDecodeErrorZPtr { result }
13258 let err = unsafe { o.contents.err };
13259 unsafe { o.contents.err = core::ptr::null_mut(); }
13260 CResult_ChannelReadyDecodeErrorZPtr { err }
13264 result_ok: o.result_ok,
13268 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13269 fn clone(&self) -> Self {
13270 if self.result_ok {
13271 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13272 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13275 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13276 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13282 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13283 /// but with all dynamically-allocated buffers duplicated in new buffers.
13284 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13286 /// The contents of CResult_InitDecodeErrorZ
13287 pub union CResult_InitDecodeErrorZPtr {
13288 /// A pointer to the contents in the success state.
13289 /// Reading from this pointer when `result_ok` is not set is undefined.
13290 pub result: *mut crate::lightning::ln::msgs::Init,
13291 /// A pointer to the contents in the error state.
13292 /// Reading from this pointer when `result_ok` is set is undefined.
13293 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13296 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13297 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13299 pub struct CResult_InitDecodeErrorZ {
13300 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13301 /// `err` or `result` depending on the state of `result_ok`.
13302 pub contents: CResult_InitDecodeErrorZPtr,
13303 /// Whether this CResult_InitDecodeErrorZ represents a success state.
13304 pub result_ok: bool,
13307 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13308 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13309 CResult_InitDecodeErrorZ {
13310 contents: CResult_InitDecodeErrorZPtr {
13311 result: Box::into_raw(Box::new(o)),
13317 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13318 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13319 CResult_InitDecodeErrorZ {
13320 contents: CResult_InitDecodeErrorZPtr {
13321 err: Box::into_raw(Box::new(e)),
13326 /// Checks if the given object is currently in the success state
13328 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13332 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13333 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13334 impl Drop for CResult_InitDecodeErrorZ {
13335 fn drop(&mut self) {
13336 if self.result_ok {
13337 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13338 let _ = unsafe { Box::from_raw(self.contents.result) };
13341 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13342 let _ = unsafe { Box::from_raw(self.contents.err) };
13347 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
13348 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
13349 let contents = if o.result_ok {
13350 let result = unsafe { o.contents.result };
13351 unsafe { o.contents.result = core::ptr::null_mut() };
13352 CResult_InitDecodeErrorZPtr { result }
13354 let err = unsafe { o.contents.err };
13355 unsafe { o.contents.err = core::ptr::null_mut(); }
13356 CResult_InitDecodeErrorZPtr { err }
13360 result_ok: o.result_ok,
13364 impl Clone for CResult_InitDecodeErrorZ {
13365 fn clone(&self) -> Self {
13366 if self.result_ok {
13367 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
13368 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
13371 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
13372 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13378 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13379 /// but with all dynamically-allocated buffers duplicated in new buffers.
13380 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
13382 /// The contents of CResult_OpenChannelDecodeErrorZ
13383 pub union CResult_OpenChannelDecodeErrorZPtr {
13384 /// A pointer to the contents in the success state.
13385 /// Reading from this pointer when `result_ok` is not set is undefined.
13386 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
13387 /// A pointer to the contents in the error state.
13388 /// Reading from this pointer when `result_ok` is set is undefined.
13389 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13392 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
13393 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13395 pub struct CResult_OpenChannelDecodeErrorZ {
13396 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
13397 /// `err` or `result` depending on the state of `result_ok`.
13398 pub contents: CResult_OpenChannelDecodeErrorZPtr,
13399 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
13400 pub result_ok: bool,
13403 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13404 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13405 CResult_OpenChannelDecodeErrorZ {
13406 contents: CResult_OpenChannelDecodeErrorZPtr {
13407 result: Box::into_raw(Box::new(o)),
13413 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13414 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13415 CResult_OpenChannelDecodeErrorZ {
13416 contents: CResult_OpenChannelDecodeErrorZPtr {
13417 err: Box::into_raw(Box::new(e)),
13422 /// Checks if the given object is currently in the success state
13424 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13428 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13429 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13430 impl Drop for CResult_OpenChannelDecodeErrorZ {
13431 fn drop(&mut self) {
13432 if self.result_ok {
13433 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13434 let _ = unsafe { Box::from_raw(self.contents.result) };
13437 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13438 let _ = unsafe { Box::from_raw(self.contents.err) };
13443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13444 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13445 let contents = if o.result_ok {
13446 let result = unsafe { o.contents.result };
13447 unsafe { o.contents.result = core::ptr::null_mut() };
13448 CResult_OpenChannelDecodeErrorZPtr { result }
13450 let err = unsafe { o.contents.err };
13451 unsafe { o.contents.err = core::ptr::null_mut(); }
13452 CResult_OpenChannelDecodeErrorZPtr { err }
13456 result_ok: o.result_ok,
13460 impl Clone for CResult_OpenChannelDecodeErrorZ {
13461 fn clone(&self) -> Self {
13462 if self.result_ok {
13463 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13464 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13467 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13468 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13474 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13475 /// but with all dynamically-allocated buffers duplicated in new buffers.
13476 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13478 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13479 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13480 /// A pointer to the contents in the success state.
13481 /// Reading from this pointer when `result_ok` is not set is undefined.
13482 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13483 /// A pointer to the contents in the error state.
13484 /// Reading from this pointer when `result_ok` is set is undefined.
13485 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13488 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13489 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13491 pub struct CResult_RevokeAndACKDecodeErrorZ {
13492 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13493 /// `err` or `result` depending on the state of `result_ok`.
13494 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13495 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13496 pub result_ok: bool,
13499 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13500 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13501 CResult_RevokeAndACKDecodeErrorZ {
13502 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13503 result: Box::into_raw(Box::new(o)),
13509 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13510 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13511 CResult_RevokeAndACKDecodeErrorZ {
13512 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13513 err: Box::into_raw(Box::new(e)),
13518 /// Checks if the given object is currently in the success state
13520 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13524 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13525 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13526 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13527 fn drop(&mut self) {
13528 if self.result_ok {
13529 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13530 let _ = unsafe { Box::from_raw(self.contents.result) };
13533 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13534 let _ = unsafe { Box::from_raw(self.contents.err) };
13539 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13540 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13541 let contents = if o.result_ok {
13542 let result = unsafe { o.contents.result };
13543 unsafe { o.contents.result = core::ptr::null_mut() };
13544 CResult_RevokeAndACKDecodeErrorZPtr { result }
13546 let err = unsafe { o.contents.err };
13547 unsafe { o.contents.err = core::ptr::null_mut(); }
13548 CResult_RevokeAndACKDecodeErrorZPtr { err }
13552 result_ok: o.result_ok,
13556 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13557 fn clone(&self) -> Self {
13558 if self.result_ok {
13559 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13560 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13563 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13564 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13570 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13571 /// but with all dynamically-allocated buffers duplicated in new buffers.
13572 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13574 /// The contents of CResult_ShutdownDecodeErrorZ
13575 pub union CResult_ShutdownDecodeErrorZPtr {
13576 /// A pointer to the contents in the success state.
13577 /// Reading from this pointer when `result_ok` is not set is undefined.
13578 pub result: *mut crate::lightning::ln::msgs::Shutdown,
13579 /// A pointer to the contents in the error state.
13580 /// Reading from this pointer when `result_ok` is set is undefined.
13581 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13584 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13585 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13586 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13587 pub struct CResult_ShutdownDecodeErrorZ {
13588 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13589 /// `err` or `result` depending on the state of `result_ok`.
13590 pub contents: CResult_ShutdownDecodeErrorZPtr,
13591 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13592 pub result_ok: bool,
13595 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13596 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13597 CResult_ShutdownDecodeErrorZ {
13598 contents: CResult_ShutdownDecodeErrorZPtr {
13599 result: Box::into_raw(Box::new(o)),
13605 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13606 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13607 CResult_ShutdownDecodeErrorZ {
13608 contents: CResult_ShutdownDecodeErrorZPtr {
13609 err: Box::into_raw(Box::new(e)),
13614 /// Checks if the given object is currently in the success state
13616 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13620 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13621 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13622 impl Drop for CResult_ShutdownDecodeErrorZ {
13623 fn drop(&mut self) {
13624 if self.result_ok {
13625 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13626 let _ = unsafe { Box::from_raw(self.contents.result) };
13629 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13630 let _ = unsafe { Box::from_raw(self.contents.err) };
13635 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13636 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13637 let contents = if o.result_ok {
13638 let result = unsafe { o.contents.result };
13639 unsafe { o.contents.result = core::ptr::null_mut() };
13640 CResult_ShutdownDecodeErrorZPtr { result }
13642 let err = unsafe { o.contents.err };
13643 unsafe { o.contents.err = core::ptr::null_mut(); }
13644 CResult_ShutdownDecodeErrorZPtr { err }
13648 result_ok: o.result_ok,
13652 impl Clone for CResult_ShutdownDecodeErrorZ {
13653 fn clone(&self) -> Self {
13654 if self.result_ok {
13655 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13656 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13659 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13660 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13666 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13667 /// but with all dynamically-allocated buffers duplicated in new buffers.
13668 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13670 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13671 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13672 /// A pointer to the contents in the success state.
13673 /// Reading from this pointer when `result_ok` is not set is undefined.
13674 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13675 /// A pointer to the contents in the error state.
13676 /// Reading from this pointer when `result_ok` is set is undefined.
13677 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13680 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13681 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13683 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13684 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13685 /// `err` or `result` depending on the state of `result_ok`.
13686 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13687 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13688 pub result_ok: bool,
13691 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13692 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13693 CResult_UpdateFailHTLCDecodeErrorZ {
13694 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13695 result: Box::into_raw(Box::new(o)),
13701 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13702 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13703 CResult_UpdateFailHTLCDecodeErrorZ {
13704 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13705 err: Box::into_raw(Box::new(e)),
13710 /// Checks if the given object is currently in the success state
13712 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13716 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13717 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13718 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13719 fn drop(&mut self) {
13720 if self.result_ok {
13721 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13722 let _ = unsafe { Box::from_raw(self.contents.result) };
13725 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13726 let _ = unsafe { Box::from_raw(self.contents.err) };
13731 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13732 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13733 let contents = if o.result_ok {
13734 let result = unsafe { o.contents.result };
13735 unsafe { o.contents.result = core::ptr::null_mut() };
13736 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13738 let err = unsafe { o.contents.err };
13739 unsafe { o.contents.err = core::ptr::null_mut(); }
13740 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13744 result_ok: o.result_ok,
13748 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13749 fn clone(&self) -> Self {
13750 if self.result_ok {
13751 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13752 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13755 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13756 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13762 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13763 /// but with all dynamically-allocated buffers duplicated in new buffers.
13764 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13766 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13767 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13768 /// A pointer to the contents in the success state.
13769 /// Reading from this pointer when `result_ok` is not set is undefined.
13770 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13771 /// A pointer to the contents in the error state.
13772 /// Reading from this pointer when `result_ok` is set is undefined.
13773 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13776 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13777 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13778 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13779 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13780 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13781 /// `err` or `result` depending on the state of `result_ok`.
13782 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13783 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13784 pub result_ok: bool,
13787 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13788 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13789 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13790 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13791 result: Box::into_raw(Box::new(o)),
13797 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13798 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13799 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13800 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13801 err: Box::into_raw(Box::new(e)),
13806 /// Checks if the given object is currently in the success state
13808 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13812 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13813 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13814 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13815 fn drop(&mut self) {
13816 if self.result_ok {
13817 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13818 let _ = unsafe { Box::from_raw(self.contents.result) };
13821 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13822 let _ = unsafe { Box::from_raw(self.contents.err) };
13827 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13828 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13829 let contents = if o.result_ok {
13830 let result = unsafe { o.contents.result };
13831 unsafe { o.contents.result = core::ptr::null_mut() };
13832 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13834 let err = unsafe { o.contents.err };
13835 unsafe { o.contents.err = core::ptr::null_mut(); }
13836 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13840 result_ok: o.result_ok,
13844 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13845 fn clone(&self) -> Self {
13846 if self.result_ok {
13847 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13848 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13851 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13852 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13858 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13859 /// but with all dynamically-allocated buffers duplicated in new buffers.
13860 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13862 /// The contents of CResult_UpdateFeeDecodeErrorZ
13863 pub union CResult_UpdateFeeDecodeErrorZPtr {
13864 /// A pointer to the contents in the success state.
13865 /// Reading from this pointer when `result_ok` is not set is undefined.
13866 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13867 /// A pointer to the contents in the error state.
13868 /// Reading from this pointer when `result_ok` is set is undefined.
13869 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13872 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13873 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13875 pub struct CResult_UpdateFeeDecodeErrorZ {
13876 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13877 /// `err` or `result` depending on the state of `result_ok`.
13878 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13879 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13880 pub result_ok: bool,
13883 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13884 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13885 CResult_UpdateFeeDecodeErrorZ {
13886 contents: CResult_UpdateFeeDecodeErrorZPtr {
13887 result: Box::into_raw(Box::new(o)),
13893 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13894 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13895 CResult_UpdateFeeDecodeErrorZ {
13896 contents: CResult_UpdateFeeDecodeErrorZPtr {
13897 err: Box::into_raw(Box::new(e)),
13902 /// Checks if the given object is currently in the success state
13904 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13908 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13909 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13910 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13911 fn drop(&mut self) {
13912 if self.result_ok {
13913 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13914 let _ = unsafe { Box::from_raw(self.contents.result) };
13917 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13918 let _ = unsafe { Box::from_raw(self.contents.err) };
13923 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13924 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13925 let contents = if o.result_ok {
13926 let result = unsafe { o.contents.result };
13927 unsafe { o.contents.result = core::ptr::null_mut() };
13928 CResult_UpdateFeeDecodeErrorZPtr { result }
13930 let err = unsafe { o.contents.err };
13931 unsafe { o.contents.err = core::ptr::null_mut(); }
13932 CResult_UpdateFeeDecodeErrorZPtr { err }
13936 result_ok: o.result_ok,
13940 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13941 fn clone(&self) -> Self {
13942 if self.result_ok {
13943 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13944 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13947 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13948 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13954 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13955 /// but with all dynamically-allocated buffers duplicated in new buffers.
13956 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13958 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13959 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13960 /// A pointer to the contents in the success state.
13961 /// Reading from this pointer when `result_ok` is not set is undefined.
13962 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13963 /// A pointer to the contents in the error state.
13964 /// Reading from this pointer when `result_ok` is set is undefined.
13965 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13968 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13969 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13970 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13971 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13972 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13973 /// `err` or `result` depending on the state of `result_ok`.
13974 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13975 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13976 pub result_ok: bool,
13979 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13980 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13981 CResult_UpdateFulfillHTLCDecodeErrorZ {
13982 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13983 result: Box::into_raw(Box::new(o)),
13989 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13990 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13991 CResult_UpdateFulfillHTLCDecodeErrorZ {
13992 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13993 err: Box::into_raw(Box::new(e)),
13998 /// Checks if the given object is currently in the success state
14000 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14004 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14005 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14006 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14007 fn drop(&mut self) {
14008 if self.result_ok {
14009 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14010 let _ = unsafe { Box::from_raw(self.contents.result) };
14013 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14014 let _ = unsafe { Box::from_raw(self.contents.err) };
14019 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14020 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14021 let contents = if o.result_ok {
14022 let result = unsafe { o.contents.result };
14023 unsafe { o.contents.result = core::ptr::null_mut() };
14024 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14026 let err = unsafe { o.contents.err };
14027 unsafe { o.contents.err = core::ptr::null_mut(); }
14028 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14032 result_ok: o.result_ok,
14036 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14037 fn clone(&self) -> Self {
14038 if self.result_ok {
14039 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14040 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14043 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14044 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14050 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14051 /// but with all dynamically-allocated buffers duplicated in new buffers.
14052 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
14054 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
14055 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
14056 /// A pointer to the contents in the success state.
14057 /// Reading from this pointer when `result_ok` is not set is undefined.
14058 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14059 /// A pointer to the contents in the error state.
14060 /// Reading from this pointer when `result_ok` is set is undefined.
14061 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14064 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
14065 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14066 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14067 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
14068 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
14069 /// `err` or `result` depending on the state of `result_ok`.
14070 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
14071 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
14072 pub result_ok: bool,
14075 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14076 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
14077 CResult_UpdateAddHTLCDecodeErrorZ {
14078 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14079 result: Box::into_raw(Box::new(o)),
14085 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14086 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
14087 CResult_UpdateAddHTLCDecodeErrorZ {
14088 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14089 err: Box::into_raw(Box::new(e)),
14094 /// Checks if the given object is currently in the success state
14096 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
14100 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14101 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
14102 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
14103 fn drop(&mut self) {
14104 if self.result_ok {
14105 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14106 let _ = unsafe { Box::from_raw(self.contents.result) };
14109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14110 let _ = unsafe { Box::from_raw(self.contents.err) };
14115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
14116 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14117 let contents = if o.result_ok {
14118 let result = unsafe { o.contents.result };
14119 unsafe { o.contents.result = core::ptr::null_mut() };
14120 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
14122 let err = unsafe { o.contents.err };
14123 unsafe { o.contents.err = core::ptr::null_mut(); }
14124 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
14128 result_ok: o.result_ok,
14132 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
14133 fn clone(&self) -> Self {
14134 if self.result_ok {
14135 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14136 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
14139 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14140 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14146 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14147 /// but with all dynamically-allocated buffers duplicated in new buffers.
14148 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
14150 /// The contents of CResult_PingDecodeErrorZ
14151 pub union CResult_PingDecodeErrorZPtr {
14152 /// A pointer to the contents in the success state.
14153 /// Reading from this pointer when `result_ok` is not set is undefined.
14154 pub result: *mut crate::lightning::ln::msgs::Ping,
14155 /// A pointer to the contents in the error state.
14156 /// Reading from this pointer when `result_ok` is set is undefined.
14157 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14160 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
14161 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
14162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14163 pub struct CResult_PingDecodeErrorZ {
14164 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
14165 /// `err` or `result` depending on the state of `result_ok`.
14166 pub contents: CResult_PingDecodeErrorZPtr,
14167 /// Whether this CResult_PingDecodeErrorZ represents a success state.
14168 pub result_ok: bool,
14171 /// Creates a new CResult_PingDecodeErrorZ in the success state.
14172 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
14173 CResult_PingDecodeErrorZ {
14174 contents: CResult_PingDecodeErrorZPtr {
14175 result: Box::into_raw(Box::new(o)),
14181 /// Creates a new CResult_PingDecodeErrorZ in the error state.
14182 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
14183 CResult_PingDecodeErrorZ {
14184 contents: CResult_PingDecodeErrorZPtr {
14185 err: Box::into_raw(Box::new(e)),
14190 /// Checks if the given object is currently in the success state
14192 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
14196 /// Frees any resources used by the CResult_PingDecodeErrorZ.
14197 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
14198 impl Drop for CResult_PingDecodeErrorZ {
14199 fn drop(&mut self) {
14200 if self.result_ok {
14201 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14202 let _ = unsafe { Box::from_raw(self.contents.result) };
14205 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14206 let _ = unsafe { Box::from_raw(self.contents.err) };
14211 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
14212 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
14213 let contents = if o.result_ok {
14214 let result = unsafe { o.contents.result };
14215 unsafe { o.contents.result = core::ptr::null_mut() };
14216 CResult_PingDecodeErrorZPtr { result }
14218 let err = unsafe { o.contents.err };
14219 unsafe { o.contents.err = core::ptr::null_mut(); }
14220 CResult_PingDecodeErrorZPtr { err }
14224 result_ok: o.result_ok,
14228 impl Clone for CResult_PingDecodeErrorZ {
14229 fn clone(&self) -> Self {
14230 if self.result_ok {
14231 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
14232 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
14235 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
14236 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14242 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
14243 /// but with all dynamically-allocated buffers duplicated in new buffers.
14244 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
14246 /// The contents of CResult_PongDecodeErrorZ
14247 pub union CResult_PongDecodeErrorZPtr {
14248 /// A pointer to the contents in the success state.
14249 /// Reading from this pointer when `result_ok` is not set is undefined.
14250 pub result: *mut crate::lightning::ln::msgs::Pong,
14251 /// A pointer to the contents in the error state.
14252 /// Reading from this pointer when `result_ok` is set is undefined.
14253 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14256 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
14257 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
14258 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14259 pub struct CResult_PongDecodeErrorZ {
14260 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
14261 /// `err` or `result` depending on the state of `result_ok`.
14262 pub contents: CResult_PongDecodeErrorZPtr,
14263 /// Whether this CResult_PongDecodeErrorZ represents a success state.
14264 pub result_ok: bool,
14267 /// Creates a new CResult_PongDecodeErrorZ in the success state.
14268 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
14269 CResult_PongDecodeErrorZ {
14270 contents: CResult_PongDecodeErrorZPtr {
14271 result: Box::into_raw(Box::new(o)),
14277 /// Creates a new CResult_PongDecodeErrorZ in the error state.
14278 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
14279 CResult_PongDecodeErrorZ {
14280 contents: CResult_PongDecodeErrorZPtr {
14281 err: Box::into_raw(Box::new(e)),
14286 /// Checks if the given object is currently in the success state
14288 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
14292 /// Frees any resources used by the CResult_PongDecodeErrorZ.
14293 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
14294 impl Drop for CResult_PongDecodeErrorZ {
14295 fn drop(&mut self) {
14296 if self.result_ok {
14297 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14298 let _ = unsafe { Box::from_raw(self.contents.result) };
14301 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14302 let _ = unsafe { Box::from_raw(self.contents.err) };
14307 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
14308 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
14309 let contents = if o.result_ok {
14310 let result = unsafe { o.contents.result };
14311 unsafe { o.contents.result = core::ptr::null_mut() };
14312 CResult_PongDecodeErrorZPtr { result }
14314 let err = unsafe { o.contents.err };
14315 unsafe { o.contents.err = core::ptr::null_mut(); }
14316 CResult_PongDecodeErrorZPtr { err }
14320 result_ok: o.result_ok,
14324 impl Clone for CResult_PongDecodeErrorZ {
14325 fn clone(&self) -> Self {
14326 if self.result_ok {
14327 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
14328 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
14331 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
14332 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14338 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
14339 /// but with all dynamically-allocated buffers duplicated in new buffers.
14340 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
14342 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
14343 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14344 /// A pointer to the contents in the success state.
14345 /// Reading from this pointer when `result_ok` is not set is undefined.
14346 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
14347 /// A pointer to the contents in the error state.
14348 /// Reading from this pointer when `result_ok` is set is undefined.
14349 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14352 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14353 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14355 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14356 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
14357 /// `err` or `result` depending on the state of `result_ok`.
14358 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
14359 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
14360 pub result_ok: bool,
14363 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
14364 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14365 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14366 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14367 result: Box::into_raw(Box::new(o)),
14373 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
14374 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14375 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14376 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14377 err: Box::into_raw(Box::new(e)),
14382 /// Checks if the given object is currently in the success state
14384 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
14388 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
14389 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
14390 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14391 fn drop(&mut self) {
14392 if self.result_ok {
14393 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14394 let _ = unsafe { Box::from_raw(self.contents.result) };
14397 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14398 let _ = unsafe { Box::from_raw(self.contents.err) };
14403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14404 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14405 let contents = if o.result_ok {
14406 let result = unsafe { o.contents.result };
14407 unsafe { o.contents.result = core::ptr::null_mut() };
14408 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
14410 let err = unsafe { o.contents.err };
14411 unsafe { o.contents.err = core::ptr::null_mut(); }
14412 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14416 result_ok: o.result_ok,
14420 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14421 fn clone(&self) -> Self {
14422 if self.result_ok {
14423 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14424 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14427 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14428 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14434 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14435 /// but with all dynamically-allocated buffers duplicated in new buffers.
14436 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14438 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14439 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14440 /// A pointer to the contents in the success state.
14441 /// Reading from this pointer when `result_ok` is not set is undefined.
14442 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14443 /// A pointer to the contents in the error state.
14444 /// Reading from this pointer when `result_ok` is set is undefined.
14445 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14448 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14449 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14450 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14451 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14452 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14453 /// `err` or `result` depending on the state of `result_ok`.
14454 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14455 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14456 pub result_ok: bool,
14459 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14460 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14461 CResult_ChannelAnnouncementDecodeErrorZ {
14462 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14463 result: Box::into_raw(Box::new(o)),
14469 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14470 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14471 CResult_ChannelAnnouncementDecodeErrorZ {
14472 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14473 err: Box::into_raw(Box::new(e)),
14478 /// Checks if the given object is currently in the success state
14480 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14484 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14485 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14486 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14487 fn drop(&mut self) {
14488 if self.result_ok {
14489 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14490 let _ = unsafe { Box::from_raw(self.contents.result) };
14493 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14494 let _ = unsafe { Box::from_raw(self.contents.err) };
14499 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14500 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14501 let contents = if o.result_ok {
14502 let result = unsafe { o.contents.result };
14503 unsafe { o.contents.result = core::ptr::null_mut() };
14504 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14506 let err = unsafe { o.contents.err };
14507 unsafe { o.contents.err = core::ptr::null_mut(); }
14508 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14512 result_ok: o.result_ok,
14516 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14517 fn clone(&self) -> Self {
14518 if self.result_ok {
14519 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14520 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14523 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14524 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14530 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14531 /// but with all dynamically-allocated buffers duplicated in new buffers.
14532 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14534 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14535 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14536 /// A pointer to the contents in the success state.
14537 /// Reading from this pointer when `result_ok` is not set is undefined.
14538 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14539 /// A pointer to the contents in the error state.
14540 /// Reading from this pointer when `result_ok` is set is undefined.
14541 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14544 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14545 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14546 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14547 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14548 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14549 /// `err` or `result` depending on the state of `result_ok`.
14550 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14551 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14552 pub result_ok: bool,
14555 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14556 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14557 CResult_UnsignedChannelUpdateDecodeErrorZ {
14558 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14559 result: Box::into_raw(Box::new(o)),
14565 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14566 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14567 CResult_UnsignedChannelUpdateDecodeErrorZ {
14568 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14569 err: Box::into_raw(Box::new(e)),
14574 /// Checks if the given object is currently in the success state
14576 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14580 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14581 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14582 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14583 fn drop(&mut self) {
14584 if self.result_ok {
14585 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14586 let _ = unsafe { Box::from_raw(self.contents.result) };
14589 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14590 let _ = unsafe { Box::from_raw(self.contents.err) };
14595 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14596 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14597 let contents = if o.result_ok {
14598 let result = unsafe { o.contents.result };
14599 unsafe { o.contents.result = core::ptr::null_mut() };
14600 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14602 let err = unsafe { o.contents.err };
14603 unsafe { o.contents.err = core::ptr::null_mut(); }
14604 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14608 result_ok: o.result_ok,
14612 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14613 fn clone(&self) -> Self {
14614 if self.result_ok {
14615 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14616 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14619 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14620 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14626 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14627 /// but with all dynamically-allocated buffers duplicated in new buffers.
14628 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14630 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14631 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14632 /// A pointer to the contents in the success state.
14633 /// Reading from this pointer when `result_ok` is not set is undefined.
14634 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14635 /// A pointer to the contents in the error state.
14636 /// Reading from this pointer when `result_ok` is set is undefined.
14637 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14640 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14641 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14642 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14643 pub struct CResult_ChannelUpdateDecodeErrorZ {
14644 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14645 /// `err` or `result` depending on the state of `result_ok`.
14646 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14647 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14648 pub result_ok: bool,
14651 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14652 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14653 CResult_ChannelUpdateDecodeErrorZ {
14654 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14655 result: Box::into_raw(Box::new(o)),
14661 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14662 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14663 CResult_ChannelUpdateDecodeErrorZ {
14664 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14665 err: Box::into_raw(Box::new(e)),
14670 /// Checks if the given object is currently in the success state
14672 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14676 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14677 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14678 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14679 fn drop(&mut self) {
14680 if self.result_ok {
14681 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14682 let _ = unsafe { Box::from_raw(self.contents.result) };
14685 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14686 let _ = unsafe { Box::from_raw(self.contents.err) };
14691 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14692 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14693 let contents = if o.result_ok {
14694 let result = unsafe { o.contents.result };
14695 unsafe { o.contents.result = core::ptr::null_mut() };
14696 CResult_ChannelUpdateDecodeErrorZPtr { result }
14698 let err = unsafe { o.contents.err };
14699 unsafe { o.contents.err = core::ptr::null_mut(); }
14700 CResult_ChannelUpdateDecodeErrorZPtr { err }
14704 result_ok: o.result_ok,
14708 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14709 fn clone(&self) -> Self {
14710 if self.result_ok {
14711 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14712 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14715 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14716 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14722 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14723 /// but with all dynamically-allocated buffers duplicated in new buffers.
14724 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14726 /// The contents of CResult_ErrorMessageDecodeErrorZ
14727 pub union CResult_ErrorMessageDecodeErrorZPtr {
14728 /// A pointer to the contents in the success state.
14729 /// Reading from this pointer when `result_ok` is not set is undefined.
14730 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14731 /// A pointer to the contents in the error state.
14732 /// Reading from this pointer when `result_ok` is set is undefined.
14733 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14736 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14737 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14738 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14739 pub struct CResult_ErrorMessageDecodeErrorZ {
14740 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14741 /// `err` or `result` depending on the state of `result_ok`.
14742 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14743 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14744 pub result_ok: bool,
14747 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14748 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14749 CResult_ErrorMessageDecodeErrorZ {
14750 contents: CResult_ErrorMessageDecodeErrorZPtr {
14751 result: Box::into_raw(Box::new(o)),
14757 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14758 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14759 CResult_ErrorMessageDecodeErrorZ {
14760 contents: CResult_ErrorMessageDecodeErrorZPtr {
14761 err: Box::into_raw(Box::new(e)),
14766 /// Checks if the given object is currently in the success state
14768 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14772 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14773 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14774 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14775 fn drop(&mut self) {
14776 if self.result_ok {
14777 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14778 let _ = unsafe { Box::from_raw(self.contents.result) };
14781 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14782 let _ = unsafe { Box::from_raw(self.contents.err) };
14787 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14788 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14789 let contents = if o.result_ok {
14790 let result = unsafe { o.contents.result };
14791 unsafe { o.contents.result = core::ptr::null_mut() };
14792 CResult_ErrorMessageDecodeErrorZPtr { result }
14794 let err = unsafe { o.contents.err };
14795 unsafe { o.contents.err = core::ptr::null_mut(); }
14796 CResult_ErrorMessageDecodeErrorZPtr { err }
14800 result_ok: o.result_ok,
14804 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14805 fn clone(&self) -> Self {
14806 if self.result_ok {
14807 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14808 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14811 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14812 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14818 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14819 /// but with all dynamically-allocated buffers duplicated in new buffers.
14820 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14822 /// The contents of CResult_WarningMessageDecodeErrorZ
14823 pub union CResult_WarningMessageDecodeErrorZPtr {
14824 /// A pointer to the contents in the success state.
14825 /// Reading from this pointer when `result_ok` is not set is undefined.
14826 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14827 /// A pointer to the contents in the error state.
14828 /// Reading from this pointer when `result_ok` is set is undefined.
14829 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14832 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14833 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14835 pub struct CResult_WarningMessageDecodeErrorZ {
14836 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14837 /// `err` or `result` depending on the state of `result_ok`.
14838 pub contents: CResult_WarningMessageDecodeErrorZPtr,
14839 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14840 pub result_ok: bool,
14843 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14844 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14845 CResult_WarningMessageDecodeErrorZ {
14846 contents: CResult_WarningMessageDecodeErrorZPtr {
14847 result: Box::into_raw(Box::new(o)),
14853 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14854 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14855 CResult_WarningMessageDecodeErrorZ {
14856 contents: CResult_WarningMessageDecodeErrorZPtr {
14857 err: Box::into_raw(Box::new(e)),
14862 /// Checks if the given object is currently in the success state
14864 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14868 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14869 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14870 impl Drop for CResult_WarningMessageDecodeErrorZ {
14871 fn drop(&mut self) {
14872 if self.result_ok {
14873 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14874 let _ = unsafe { Box::from_raw(self.contents.result) };
14877 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14878 let _ = unsafe { Box::from_raw(self.contents.err) };
14883 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14884 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14885 let contents = if o.result_ok {
14886 let result = unsafe { o.contents.result };
14887 unsafe { o.contents.result = core::ptr::null_mut() };
14888 CResult_WarningMessageDecodeErrorZPtr { result }
14890 let err = unsafe { o.contents.err };
14891 unsafe { o.contents.err = core::ptr::null_mut(); }
14892 CResult_WarningMessageDecodeErrorZPtr { err }
14896 result_ok: o.result_ok,
14900 impl Clone for CResult_WarningMessageDecodeErrorZ {
14901 fn clone(&self) -> Self {
14902 if self.result_ok {
14903 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14904 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14907 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14908 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14914 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14915 /// but with all dynamically-allocated buffers duplicated in new buffers.
14916 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14918 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14919 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14920 /// A pointer to the contents in the success state.
14921 /// Reading from this pointer when `result_ok` is not set is undefined.
14922 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14923 /// A pointer to the contents in the error state.
14924 /// Reading from this pointer when `result_ok` is set is undefined.
14925 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14928 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14929 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14931 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14932 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14933 /// `err` or `result` depending on the state of `result_ok`.
14934 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14935 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14936 pub result_ok: bool,
14939 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14940 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14941 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14942 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14943 result: Box::into_raw(Box::new(o)),
14949 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14950 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14951 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14952 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14953 err: Box::into_raw(Box::new(e)),
14958 /// Checks if the given object is currently in the success state
14960 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14964 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14965 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14966 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14967 fn drop(&mut self) {
14968 if self.result_ok {
14969 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14970 let _ = unsafe { Box::from_raw(self.contents.result) };
14973 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14974 let _ = unsafe { Box::from_raw(self.contents.err) };
14979 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14980 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14981 let contents = if o.result_ok {
14982 let result = unsafe { o.contents.result };
14983 unsafe { o.contents.result = core::ptr::null_mut() };
14984 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14986 let err = unsafe { o.contents.err };
14987 unsafe { o.contents.err = core::ptr::null_mut(); }
14988 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14992 result_ok: o.result_ok,
14996 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14997 fn clone(&self) -> Self {
14998 if self.result_ok {
14999 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15000 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15003 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15004 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15010 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15011 /// but with all dynamically-allocated buffers duplicated in new buffers.
15012 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15014 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
15015 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
15016 /// A pointer to the contents in the success state.
15017 /// Reading from this pointer when `result_ok` is not set is undefined.
15018 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
15019 /// A pointer to the contents in the error state.
15020 /// Reading from this pointer when `result_ok` is set is undefined.
15021 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15024 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15025 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15026 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15027 pub struct CResult_NodeAnnouncementDecodeErrorZ {
15028 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
15029 /// `err` or `result` depending on the state of `result_ok`.
15030 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
15031 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
15032 pub result_ok: bool,
15035 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15036 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
15037 CResult_NodeAnnouncementDecodeErrorZ {
15038 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15039 result: Box::into_raw(Box::new(o)),
15045 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15046 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
15047 CResult_NodeAnnouncementDecodeErrorZ {
15048 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15049 err: Box::into_raw(Box::new(e)),
15054 /// Checks if the given object is currently in the success state
15056 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
15060 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15061 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
15062 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
15063 fn drop(&mut self) {
15064 if self.result_ok {
15065 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15066 let _ = unsafe { Box::from_raw(self.contents.result) };
15069 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15070 let _ = unsafe { Box::from_raw(self.contents.err) };
15075 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
15076 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15077 let contents = if o.result_ok {
15078 let result = unsafe { o.contents.result };
15079 unsafe { o.contents.result = core::ptr::null_mut() };
15080 CResult_NodeAnnouncementDecodeErrorZPtr { result }
15082 let err = unsafe { o.contents.err };
15083 unsafe { o.contents.err = core::ptr::null_mut(); }
15084 CResult_NodeAnnouncementDecodeErrorZPtr { err }
15088 result_ok: o.result_ok,
15092 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
15093 fn clone(&self) -> Self {
15094 if self.result_ok {
15095 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15096 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15099 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15100 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15106 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15107 /// but with all dynamically-allocated buffers duplicated in new buffers.
15108 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15110 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
15111 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
15112 /// A pointer to the contents in the success state.
15113 /// Reading from this pointer when `result_ok` is not set is undefined.
15114 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
15115 /// A pointer to the contents in the error state.
15116 /// Reading from this pointer when `result_ok` is set is undefined.
15117 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15120 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
15121 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
15122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15123 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
15124 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
15125 /// `err` or `result` depending on the state of `result_ok`.
15126 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
15127 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
15128 pub result_ok: bool,
15131 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15132 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15133 CResult_QueryShortChannelIdsDecodeErrorZ {
15134 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15135 result: Box::into_raw(Box::new(o)),
15141 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15142 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15143 CResult_QueryShortChannelIdsDecodeErrorZ {
15144 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15145 err: Box::into_raw(Box::new(e)),
15150 /// Checks if the given object is currently in the success state
15152 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
15156 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
15157 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
15158 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
15159 fn drop(&mut self) {
15160 if self.result_ok {
15161 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15162 let _ = unsafe { Box::from_raw(self.contents.result) };
15165 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15166 let _ = unsafe { Box::from_raw(self.contents.err) };
15171 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
15172 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
15173 let contents = if o.result_ok {
15174 let result = unsafe { o.contents.result };
15175 unsafe { o.contents.result = core::ptr::null_mut() };
15176 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
15178 let err = unsafe { o.contents.err };
15179 unsafe { o.contents.err = core::ptr::null_mut(); }
15180 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
15184 result_ok: o.result_ok,
15188 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
15189 fn clone(&self) -> Self {
15190 if self.result_ok {
15191 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15192 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
15195 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15196 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15202 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
15203 /// but with all dynamically-allocated buffers duplicated in new buffers.
15204 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
15206 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
15207 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15208 /// A pointer to the contents in the success state.
15209 /// Reading from this pointer when `result_ok` is not set is undefined.
15210 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
15211 /// A pointer to the contents in the error state.
15212 /// Reading from this pointer when `result_ok` is set is undefined.
15213 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15216 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
15217 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
15218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15219 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15220 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
15221 /// `err` or `result` depending on the state of `result_ok`.
15222 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
15223 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
15224 pub result_ok: bool,
15227 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
15228 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15229 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15230 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15231 result: Box::into_raw(Box::new(o)),
15237 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
15238 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15239 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15240 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15241 err: Box::into_raw(Box::new(e)),
15246 /// Checks if the given object is currently in the success state
15248 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
15252 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
15253 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
15254 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15255 fn drop(&mut self) {
15256 if self.result_ok {
15257 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15258 let _ = unsafe { Box::from_raw(self.contents.result) };
15261 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15262 let _ = unsafe { Box::from_raw(self.contents.err) };
15267 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15268 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
15269 let contents = if o.result_ok {
15270 let result = unsafe { o.contents.result };
15271 unsafe { o.contents.result = core::ptr::null_mut() };
15272 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
15274 let err = unsafe { o.contents.err };
15275 unsafe { o.contents.err = core::ptr::null_mut(); }
15276 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
15280 result_ok: o.result_ok,
15284 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15285 fn clone(&self) -> Self {
15286 if self.result_ok {
15287 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15288 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
15291 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15292 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15298 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15299 /// but with all dynamically-allocated buffers duplicated in new buffers.
15300 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
15302 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
15303 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
15304 /// A pointer to the contents in the success state.
15305 /// Reading from this pointer when `result_ok` is not set is undefined.
15306 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
15307 /// A pointer to the contents in the error state.
15308 /// Reading from this pointer when `result_ok` is set is undefined.
15309 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15312 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
15313 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15315 pub struct CResult_QueryChannelRangeDecodeErrorZ {
15316 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
15317 /// `err` or `result` depending on the state of `result_ok`.
15318 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
15319 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
15320 pub result_ok: bool,
15323 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
15324 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
15325 CResult_QueryChannelRangeDecodeErrorZ {
15326 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15327 result: Box::into_raw(Box::new(o)),
15333 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
15334 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
15335 CResult_QueryChannelRangeDecodeErrorZ {
15336 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15337 err: Box::into_raw(Box::new(e)),
15342 /// Checks if the given object is currently in the success state
15344 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
15348 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
15349 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
15350 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
15351 fn drop(&mut self) {
15352 if self.result_ok {
15353 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15354 let _ = unsafe { Box::from_raw(self.contents.result) };
15357 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15358 let _ = unsafe { Box::from_raw(self.contents.err) };
15363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
15364 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15365 let contents = if o.result_ok {
15366 let result = unsafe { o.contents.result };
15367 unsafe { o.contents.result = core::ptr::null_mut() };
15368 CResult_QueryChannelRangeDecodeErrorZPtr { result }
15370 let err = unsafe { o.contents.err };
15371 unsafe { o.contents.err = core::ptr::null_mut(); }
15372 CResult_QueryChannelRangeDecodeErrorZPtr { err }
15376 result_ok: o.result_ok,
15380 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
15381 fn clone(&self) -> Self {
15382 if self.result_ok {
15383 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15384 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
15387 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15388 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15394 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
15395 /// but with all dynamically-allocated buffers duplicated in new buffers.
15396 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15398 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
15399 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
15400 /// A pointer to the contents in the success state.
15401 /// Reading from this pointer when `result_ok` is not set is undefined.
15402 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
15403 /// A pointer to the contents in the error state.
15404 /// Reading from this pointer when `result_ok` is set is undefined.
15405 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15408 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
15409 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15411 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
15412 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
15413 /// `err` or `result` depending on the state of `result_ok`.
15414 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15415 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15416 pub result_ok: bool,
15419 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15420 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15421 CResult_ReplyChannelRangeDecodeErrorZ {
15422 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15423 result: Box::into_raw(Box::new(o)),
15429 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15430 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15431 CResult_ReplyChannelRangeDecodeErrorZ {
15432 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15433 err: Box::into_raw(Box::new(e)),
15438 /// Checks if the given object is currently in the success state
15440 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15444 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15445 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15446 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15447 fn drop(&mut self) {
15448 if self.result_ok {
15449 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15450 let _ = unsafe { Box::from_raw(self.contents.result) };
15453 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15454 let _ = unsafe { Box::from_raw(self.contents.err) };
15459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15460 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15461 let contents = if o.result_ok {
15462 let result = unsafe { o.contents.result };
15463 unsafe { o.contents.result = core::ptr::null_mut() };
15464 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15466 let err = unsafe { o.contents.err };
15467 unsafe { o.contents.err = core::ptr::null_mut(); }
15468 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15472 result_ok: o.result_ok,
15476 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15477 fn clone(&self) -> Self {
15478 if self.result_ok {
15479 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15480 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15483 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15484 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15490 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15491 /// but with all dynamically-allocated buffers duplicated in new buffers.
15492 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15494 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15495 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15496 /// A pointer to the contents in the success state.
15497 /// Reading from this pointer when `result_ok` is not set is undefined.
15498 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15499 /// A pointer to the contents in the error state.
15500 /// Reading from this pointer when `result_ok` is set is undefined.
15501 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15504 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15505 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15507 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15508 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15509 /// `err` or `result` depending on the state of `result_ok`.
15510 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15511 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15512 pub result_ok: bool,
15515 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15516 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15517 CResult_GossipTimestampFilterDecodeErrorZ {
15518 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15519 result: Box::into_raw(Box::new(o)),
15525 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15526 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15527 CResult_GossipTimestampFilterDecodeErrorZ {
15528 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15529 err: Box::into_raw(Box::new(e)),
15534 /// Checks if the given object is currently in the success state
15536 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15540 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15541 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15542 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15543 fn drop(&mut self) {
15544 if self.result_ok {
15545 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15546 let _ = unsafe { Box::from_raw(self.contents.result) };
15549 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15550 let _ = unsafe { Box::from_raw(self.contents.err) };
15555 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15556 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15557 let contents = if o.result_ok {
15558 let result = unsafe { o.contents.result };
15559 unsafe { o.contents.result = core::ptr::null_mut() };
15560 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15562 let err = unsafe { o.contents.err };
15563 unsafe { o.contents.err = core::ptr::null_mut(); }
15564 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15568 result_ok: o.result_ok,
15572 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15573 fn clone(&self) -> Self {
15574 if self.result_ok {
15575 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15576 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15579 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15580 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15586 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15587 /// but with all dynamically-allocated buffers duplicated in new buffers.
15588 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15590 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15591 /// This corresponds to std::vector in C++
15592 pub struct CVec_PhantomRouteHintsZ {
15593 /// The elements in the array.
15594 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15595 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15596 /// The number of elements pointed to by `data`.
15599 impl CVec_PhantomRouteHintsZ {
15600 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15601 if self.datalen == 0 { return Vec::new(); }
15602 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15603 self.data = core::ptr::null_mut();
15607 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15608 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15611 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15612 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15613 let datalen = v.len();
15614 let data = Box::into_raw(v.into_boxed_slice());
15615 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15619 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15620 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15621 impl Drop for CVec_PhantomRouteHintsZ {
15622 fn drop(&mut self) {
15623 if self.datalen == 0 { return; }
15624 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15627 impl Clone for CVec_PhantomRouteHintsZ {
15628 fn clone(&self) -> Self {
15629 let mut res = Vec::new();
15630 if self.datalen == 0 { return Self::from(res); }
15631 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15636 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15637 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15638 /// A pointer to the contents in the success state.
15639 /// Reading from this pointer when `result_ok` is not set is undefined.
15640 pub result: *mut crate::lightning_invoice::Invoice,
15641 /// A pointer to the contents in the error state.
15642 /// Reading from this pointer when `result_ok` is set is undefined.
15643 pub err: *mut crate::lightning_invoice::SignOrCreationError,
15646 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15647 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15648 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15649 pub struct CResult_InvoiceSignOrCreationErrorZ {
15650 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15651 /// `err` or `result` depending on the state of `result_ok`.
15652 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15653 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15654 pub result_ok: bool,
15657 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15658 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15659 CResult_InvoiceSignOrCreationErrorZ {
15660 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15661 result: Box::into_raw(Box::new(o)),
15667 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15668 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15669 CResult_InvoiceSignOrCreationErrorZ {
15670 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15671 err: Box::into_raw(Box::new(e)),
15676 /// Checks if the given object is currently in the success state
15678 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15682 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15683 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15684 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15685 fn drop(&mut self) {
15686 if self.result_ok {
15687 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15688 let _ = unsafe { Box::from_raw(self.contents.result) };
15691 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15692 let _ = unsafe { Box::from_raw(self.contents.err) };
15697 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15698 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15699 let contents = if o.result_ok {
15700 let result = unsafe { o.contents.result };
15701 unsafe { o.contents.result = core::ptr::null_mut() };
15702 CResult_InvoiceSignOrCreationErrorZPtr { result }
15704 let err = unsafe { o.contents.err };
15705 unsafe { o.contents.err = core::ptr::null_mut(); }
15706 CResult_InvoiceSignOrCreationErrorZPtr { err }
15710 result_ok: o.result_ok,
15714 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15715 fn clone(&self) -> Self {
15716 if self.result_ok {
15717 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15718 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15721 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15722 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15728 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15729 /// but with all dynamically-allocated buffers duplicated in new buffers.
15730 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15732 /// An enum which can either contain a crate::lightning::chain::Filter or not
15733 pub enum COption_FilterZ {
15734 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15735 Some(crate::lightning::chain::Filter),
15736 /// When we're in this state, this COption_FilterZ contains nothing
15739 impl COption_FilterZ {
15740 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15741 if let Self::None = self { false } else { true }
15743 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15746 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15747 if let Self::Some(v) = self { v } else { unreachable!() }
15751 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15752 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15753 COption_FilterZ::Some(o)
15756 /// Constructs a new COption_FilterZ containing nothing
15757 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15758 COption_FilterZ::None
15761 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15762 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15764 /// The contents of CResult_LockedChannelMonitorNoneZ
15765 pub union CResult_LockedChannelMonitorNoneZPtr {
15766 /// A pointer to the contents in the success state.
15767 /// Reading from this pointer when `result_ok` is not set is undefined.
15768 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15769 /// Note that this value is always NULL, as there are no contents in the Err variant
15770 pub err: *mut core::ffi::c_void,
15773 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15774 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15775 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15776 pub struct CResult_LockedChannelMonitorNoneZ {
15777 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15778 /// `err` or `result` depending on the state of `result_ok`.
15779 pub contents: CResult_LockedChannelMonitorNoneZPtr,
15780 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15781 pub result_ok: bool,
15784 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15785 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15786 CResult_LockedChannelMonitorNoneZ {
15787 contents: CResult_LockedChannelMonitorNoneZPtr {
15788 result: Box::into_raw(Box::new(o)),
15794 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15795 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15796 CResult_LockedChannelMonitorNoneZ {
15797 contents: CResult_LockedChannelMonitorNoneZPtr {
15798 err: core::ptr::null_mut(),
15803 /// Checks if the given object is currently in the success state
15805 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15809 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15810 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15811 impl Drop for CResult_LockedChannelMonitorNoneZ {
15812 fn drop(&mut self) {
15813 if self.result_ok {
15814 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15815 let _ = unsafe { Box::from_raw(self.contents.result) };
15821 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15822 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15823 let contents = if o.result_ok {
15824 let result = unsafe { o.contents.result };
15825 unsafe { o.contents.result = core::ptr::null_mut() };
15826 CResult_LockedChannelMonitorNoneZPtr { result }
15828 let _ = unsafe { Box::from_raw(o.contents.err) };
15829 o.contents.err = core::ptr::null_mut();
15830 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15834 result_ok: o.result_ok,
15839 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15840 /// This corresponds to std::vector in C++
15841 pub struct CVec_OutPointZ {
15842 /// The elements in the array.
15843 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15844 pub data: *mut crate::lightning::chain::transaction::OutPoint,
15845 /// The number of elements pointed to by `data`.
15848 impl CVec_OutPointZ {
15849 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15850 if self.datalen == 0 { return Vec::new(); }
15851 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15852 self.data = core::ptr::null_mut();
15856 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15857 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15860 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15861 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15862 let datalen = v.len();
15863 let data = Box::into_raw(v.into_boxed_slice());
15864 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15868 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15869 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15870 impl Drop for CVec_OutPointZ {
15871 fn drop(&mut self) {
15872 if self.datalen == 0 { return; }
15873 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15876 impl Clone for CVec_OutPointZ {
15877 fn clone(&self) -> Self {
15878 let mut res = Vec::new();
15879 if self.datalen == 0 { return Self::from(res); }
15880 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });