2 use alloc::str::FromStr;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
11 /// The contents of CResult_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13 /// Note that this value is always NULL, as there are no contents in the OK variant
14 pub result: *mut core::ffi::c_void,
15 /// Note that this value is always NULL, as there are no contents in the Err variant
16 pub err: *mut core::ffi::c_void,
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23 /// The contents of this CResult_NoneNoneZ, accessible via either
24 /// `err` or `result` depending on the state of `result_ok`.
25 pub contents: CResult_NoneNoneZPtr,
26 /// Whether this CResult_NoneNoneZ represents a success state.
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
33 contents: CResult_NoneNoneZPtr {
34 result: core::ptr::null_mut(),
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
43 contents: CResult_NoneNoneZPtr {
44 err: core::ptr::null_mut(),
49 /// Checks if the given object is currently in the success state
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66 let contents = if o.result_ok {
67 let _ = unsafe { Box::from_raw(o.contents.result) };
68 o.contents.result = core::ptr::null_mut();
69 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
71 let _ = unsafe { Box::from_raw(o.contents.err) };
72 o.contents.err = core::ptr::null_mut();
73 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
77 result_ok: o.result_ok,
81 impl Clone for CResult_NoneNoneZ {
82 fn clone(&self) -> Self {
84 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85 result: core::ptr::null_mut()
88 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89 err: core::ptr::null_mut()
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101 /// A pointer to the contents in the success state.
102 /// Reading from this pointer when `result_ok` is not set is undefined.
103 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104 /// A pointer to the contents in the error state.
105 /// Reading from this pointer when `result_ok` is set is undefined.
106 pub err: *mut crate::lightning::ln::msgs::DecodeError,
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114 /// `err` or `result` depending on the state of `result_ok`.
115 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124 result: Box::into_raw(Box::new(o)),
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134 err: Box::into_raw(Box::new(e)),
139 /// Checks if the given object is currently in the success state
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
150 if unsafe { !(self.contents.result as *mut ()).is_null() } {
151 let _ = unsafe { Box::from_raw(self.contents.result) };
154 if unsafe { !(self.contents.err as *mut ()).is_null() } {
155 let _ = unsafe { Box::from_raw(self.contents.err) };
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162 let contents = if o.result_ok {
163 let result = unsafe { o.contents.result };
164 unsafe { o.contents.result = core::ptr::null_mut() };
165 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
167 let err = unsafe { o.contents.err };
168 unsafe { o.contents.err = core::ptr::null_mut(); }
169 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
173 result_ok: o.result_ok,
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178 fn clone(&self) -> Self {
180 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
184 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197 /// A pointer to the contents in the success state.
198 /// Reading from this pointer when `result_ok` is not set is undefined.
199 pub result: *mut crate::c_types::SecretKey,
200 /// A pointer to the contents in the error state.
201 /// Reading from this pointer when `result_ok` is set is undefined.
202 pub err: *mut crate::c_types::Secp256k1Error,
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210 /// `err` or `result` depending on the state of `result_ok`.
211 pub contents: CResult_SecretKeyErrorZPtr,
212 /// Whether this CResult_SecretKeyErrorZ represents a success state.
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218 CResult_SecretKeyErrorZ {
219 contents: CResult_SecretKeyErrorZPtr {
220 result: Box::into_raw(Box::new(o)),
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228 CResult_SecretKeyErrorZ {
229 contents: CResult_SecretKeyErrorZPtr {
230 err: Box::into_raw(Box::new(e)),
235 /// Checks if the given object is currently in the success state
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
247 let _ = unsafe { Box::from_raw(self.contents.result) };
250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
251 let _ = unsafe { Box::from_raw(self.contents.err) };
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258 let contents = if o.result_ok {
259 let result = unsafe { o.contents.result };
260 unsafe { o.contents.result = core::ptr::null_mut() };
261 CResult_SecretKeyErrorZPtr { result }
263 let err = unsafe { o.contents.err };
264 unsafe { o.contents.err = core::ptr::null_mut(); }
265 CResult_SecretKeyErrorZPtr { err }
269 result_ok: o.result_ok,
273 impl Clone for CResult_SecretKeyErrorZ {
274 fn clone(&self) -> Self {
276 Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
280 Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293 /// A pointer to the contents in the success state.
294 /// Reading from this pointer when `result_ok` is not set is undefined.
295 pub result: *mut crate::c_types::PublicKey,
296 /// A pointer to the contents in the error state.
297 /// Reading from this pointer when `result_ok` is set is undefined.
298 pub err: *mut crate::c_types::Secp256k1Error,
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306 /// `err` or `result` depending on the state of `result_ok`.
307 pub contents: CResult_PublicKeyErrorZPtr,
308 /// Whether this CResult_PublicKeyErrorZ represents a success state.
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314 CResult_PublicKeyErrorZ {
315 contents: CResult_PublicKeyErrorZPtr {
316 result: Box::into_raw(Box::new(o)),
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324 CResult_PublicKeyErrorZ {
325 contents: CResult_PublicKeyErrorZPtr {
326 err: Box::into_raw(Box::new(e)),
331 /// Checks if the given object is currently in the success state
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
343 let _ = unsafe { Box::from_raw(self.contents.result) };
346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
347 let _ = unsafe { Box::from_raw(self.contents.err) };
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354 let contents = if o.result_ok {
355 let result = unsafe { o.contents.result };
356 unsafe { o.contents.result = core::ptr::null_mut() };
357 CResult_PublicKeyErrorZPtr { result }
359 let err = unsafe { o.contents.err };
360 unsafe { o.contents.err = core::ptr::null_mut(); }
361 CResult_PublicKeyErrorZPtr { err }
365 result_ok: o.result_ok,
369 impl Clone for CResult_PublicKeyErrorZ {
370 fn clone(&self) -> Self {
372 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
376 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389 /// A pointer to the contents in the success state.
390 /// Reading from this pointer when `result_ok` is not set is undefined.
391 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392 /// A pointer to the contents in the error state.
393 /// Reading from this pointer when `result_ok` is set is undefined.
394 pub err: *mut crate::lightning::ln::msgs::DecodeError,
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402 /// `err` or `result` depending on the state of `result_ok`.
403 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410 CResult_TxCreationKeysDecodeErrorZ {
411 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412 result: Box::into_raw(Box::new(o)),
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420 CResult_TxCreationKeysDecodeErrorZ {
421 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422 err: Box::into_raw(Box::new(e)),
427 /// Checks if the given object is currently in the success state
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
438 if unsafe { !(self.contents.result as *mut ()).is_null() } {
439 let _ = unsafe { Box::from_raw(self.contents.result) };
442 if unsafe { !(self.contents.err as *mut ()).is_null() } {
443 let _ = unsafe { Box::from_raw(self.contents.err) };
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450 let contents = if o.result_ok {
451 let result = unsafe { o.contents.result };
452 unsafe { o.contents.result = core::ptr::null_mut() };
453 CResult_TxCreationKeysDecodeErrorZPtr { result }
455 let err = unsafe { o.contents.err };
456 unsafe { o.contents.err = core::ptr::null_mut(); }
457 CResult_TxCreationKeysDecodeErrorZPtr { err }
461 result_ok: o.result_ok,
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466 fn clone(&self) -> Self {
468 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
472 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485 /// A pointer to the contents in the success state.
486 /// Reading from this pointer when `result_ok` is not set is undefined.
487 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488 /// A pointer to the contents in the error state.
489 /// Reading from this pointer when `result_ok` is set is undefined.
490 pub err: *mut crate::lightning::ln::msgs::DecodeError,
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498 /// `err` or `result` depending on the state of `result_ok`.
499 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506 CResult_ChannelPublicKeysDecodeErrorZ {
507 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508 result: Box::into_raw(Box::new(o)),
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516 CResult_ChannelPublicKeysDecodeErrorZ {
517 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518 err: Box::into_raw(Box::new(e)),
523 /// Checks if the given object is currently in the success state
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
534 if unsafe { !(self.contents.result as *mut ()).is_null() } {
535 let _ = unsafe { Box::from_raw(self.contents.result) };
538 if unsafe { !(self.contents.err as *mut ()).is_null() } {
539 let _ = unsafe { Box::from_raw(self.contents.err) };
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546 let contents = if o.result_ok {
547 let result = unsafe { o.contents.result };
548 unsafe { o.contents.result = core::ptr::null_mut() };
549 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
551 let err = unsafe { o.contents.err };
552 unsafe { o.contents.err = core::ptr::null_mut(); }
553 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
557 result_ok: o.result_ok,
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562 fn clone(&self) -> Self {
564 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
568 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581 /// A pointer to the contents in the success state.
582 /// Reading from this pointer when `result_ok` is not set is undefined.
583 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584 /// A pointer to the contents in the error state.
585 /// Reading from this pointer when `result_ok` is set is undefined.
586 pub err: *mut crate::c_types::Secp256k1Error,
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594 /// `err` or `result` depending on the state of `result_ok`.
595 pub contents: CResult_TxCreationKeysErrorZPtr,
596 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602 CResult_TxCreationKeysErrorZ {
603 contents: CResult_TxCreationKeysErrorZPtr {
604 result: Box::into_raw(Box::new(o)),
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612 CResult_TxCreationKeysErrorZ {
613 contents: CResult_TxCreationKeysErrorZPtr {
614 err: Box::into_raw(Box::new(e)),
619 /// Checks if the given object is currently in the success state
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
630 if unsafe { !(self.contents.result as *mut ()).is_null() } {
631 let _ = unsafe { Box::from_raw(self.contents.result) };
634 if unsafe { !(self.contents.err as *mut ()).is_null() } {
635 let _ = unsafe { Box::from_raw(self.contents.err) };
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642 let contents = if o.result_ok {
643 let result = unsafe { o.contents.result };
644 unsafe { o.contents.result = core::ptr::null_mut() };
645 CResult_TxCreationKeysErrorZPtr { result }
647 let err = unsafe { o.contents.err };
648 unsafe { o.contents.err = core::ptr::null_mut(); }
649 CResult_TxCreationKeysErrorZPtr { err }
653 result_ok: o.result_ok,
657 impl Clone for CResult_TxCreationKeysErrorZ {
658 fn clone(&self) -> Self {
660 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
664 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678 /// When we're in this state, this COption_u32Z contains a u32
680 /// When we're in this state, this COption_u32Z contains nothing
684 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685 if let Self::None = self { false } else { true }
687 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
690 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691 if let Self::Some(v) = self { v } else { unreachable!() }
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697 COption_u32Z::Some(o)
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714 /// A pointer to the contents in the success state.
715 /// Reading from this pointer when `result_ok` is not set is undefined.
716 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717 /// A pointer to the contents in the error state.
718 /// Reading from this pointer when `result_ok` is set is undefined.
719 pub err: *mut crate::lightning::ln::msgs::DecodeError,
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727 /// `err` or `result` depending on the state of `result_ok`.
728 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735 CResult_HTLCOutputInCommitmentDecodeErrorZ {
736 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737 result: Box::into_raw(Box::new(o)),
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745 CResult_HTLCOutputInCommitmentDecodeErrorZ {
746 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747 err: Box::into_raw(Box::new(e)),
752 /// Checks if the given object is currently in the success state
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
763 if unsafe { !(self.contents.result as *mut ()).is_null() } {
764 let _ = unsafe { Box::from_raw(self.contents.result) };
767 if unsafe { !(self.contents.err as *mut ()).is_null() } {
768 let _ = unsafe { Box::from_raw(self.contents.err) };
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775 let contents = if o.result_ok {
776 let result = unsafe { o.contents.result };
777 unsafe { o.contents.result = core::ptr::null_mut() };
778 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
780 let err = unsafe { o.contents.err };
781 unsafe { o.contents.err = core::ptr::null_mut(); }
782 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
786 result_ok: o.result_ok,
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791 fn clone(&self) -> Self {
793 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
797 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
808 /// An enum which can either contain a or not
809 pub enum COption_NoneZ {
810 /// When we're in this state, this COption_NoneZ contains a
812 /// When we're in this state, this COption_NoneZ contains nothing
816 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817 if let Self::None = self { false } else { true }
819 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
824 /// Constructs a new COption_NoneZ containing a
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839 /// A pointer to the contents in the success state.
840 /// Reading from this pointer when `result_ok` is not set is undefined.
841 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842 /// A pointer to the contents in the error state.
843 /// Reading from this pointer when `result_ok` is set is undefined.
844 pub err: *mut crate::lightning::ln::msgs::DecodeError,
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852 /// `err` or `result` depending on the state of `result_ok`.
853 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862 result: Box::into_raw(Box::new(o)),
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872 err: Box::into_raw(Box::new(e)),
877 /// Checks if the given object is currently in the success state
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
888 if unsafe { !(self.contents.result as *mut ()).is_null() } {
889 let _ = unsafe { Box::from_raw(self.contents.result) };
892 if unsafe { !(self.contents.err as *mut ()).is_null() } {
893 let _ = unsafe { Box::from_raw(self.contents.err) };
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900 let contents = if o.result_ok {
901 let result = unsafe { o.contents.result };
902 unsafe { o.contents.result = core::ptr::null_mut() };
903 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
905 let err = unsafe { o.contents.err };
906 unsafe { o.contents.err = core::ptr::null_mut(); }
907 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
911 result_ok: o.result_ok,
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916 fn clone(&self) -> Self {
918 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
922 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935 /// A pointer to the contents in the success state.
936 /// Reading from this pointer when `result_ok` is not set is undefined.
937 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938 /// A pointer to the contents in the error state.
939 /// Reading from this pointer when `result_ok` is set is undefined.
940 pub err: *mut crate::lightning::ln::msgs::DecodeError,
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948 /// `err` or `result` depending on the state of `result_ok`.
949 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956 CResult_ChannelTransactionParametersDecodeErrorZ {
957 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958 result: Box::into_raw(Box::new(o)),
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966 CResult_ChannelTransactionParametersDecodeErrorZ {
967 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968 err: Box::into_raw(Box::new(e)),
973 /// Checks if the given object is currently in the success state
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
984 if unsafe { !(self.contents.result as *mut ()).is_null() } {
985 let _ = unsafe { Box::from_raw(self.contents.result) };
988 if unsafe { !(self.contents.err as *mut ()).is_null() } {
989 let _ = unsafe { Box::from_raw(self.contents.err) };
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996 let contents = if o.result_ok {
997 let result = unsafe { o.contents.result };
998 unsafe { o.contents.result = core::ptr::null_mut() };
999 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1001 let err = unsafe { o.contents.err };
1002 unsafe { o.contents.err = core::ptr::null_mut(); }
1003 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1007 result_ok: o.result_ok,
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012 fn clone(&self) -> Self {
1014 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1018 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032 /// The elements in the array.
1033 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034 pub data: *mut crate::c_types::Signature,
1035 /// The number of elements pointed to by `data`.
1038 impl CVec_SignatureZ {
1039 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040 if self.datalen == 0 { return Vec::new(); }
1041 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042 self.data = core::ptr::null_mut();
1046 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051 fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052 let datalen = v.len();
1053 let data = Box::into_raw(v.into_boxed_slice());
1054 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061 fn drop(&mut self) {
1062 if self.datalen == 0 { return; }
1063 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1066 impl Clone for CVec_SignatureZ {
1067 fn clone(&self) -> Self {
1068 let mut res = Vec::new();
1069 if self.datalen == 0 { return Self::from(res); }
1070 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077 /// A pointer to the contents in the success state.
1078 /// Reading from this pointer when `result_ok` is not set is undefined.
1079 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080 /// A pointer to the contents in the error state.
1081 /// Reading from this pointer when `result_ok` is set is undefined.
1082 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090 /// `err` or `result` depending on the state of `result_ok`.
1091 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093 pub result_ok: bool,
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098 CResult_HolderCommitmentTransactionDecodeErrorZ {
1099 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100 result: Box::into_raw(Box::new(o)),
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108 CResult_HolderCommitmentTransactionDecodeErrorZ {
1109 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110 err: Box::into_raw(Box::new(e)),
1115 /// Checks if the given object is currently in the success state
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124 fn drop(&mut self) {
1126 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127 let _ = unsafe { Box::from_raw(self.contents.result) };
1130 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131 let _ = unsafe { Box::from_raw(self.contents.err) };
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138 let contents = if o.result_ok {
1139 let result = unsafe { o.contents.result };
1140 unsafe { o.contents.result = core::ptr::null_mut() };
1141 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1143 let err = unsafe { o.contents.err };
1144 unsafe { o.contents.err = core::ptr::null_mut(); }
1145 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1149 result_ok: o.result_ok,
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154 fn clone(&self) -> Self {
1156 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1160 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173 /// A pointer to the contents in the success state.
1174 /// Reading from this pointer when `result_ok` is not set is undefined.
1175 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176 /// A pointer to the contents in the error state.
1177 /// Reading from this pointer when `result_ok` is set is undefined.
1178 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186 /// `err` or `result` depending on the state of `result_ok`.
1187 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189 pub result_ok: bool,
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196 result: Box::into_raw(Box::new(o)),
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206 err: Box::into_raw(Box::new(e)),
1211 /// Checks if the given object is currently in the success state
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220 fn drop(&mut self) {
1222 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223 let _ = unsafe { Box::from_raw(self.contents.result) };
1226 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227 let _ = unsafe { Box::from_raw(self.contents.err) };
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234 let contents = if o.result_ok {
1235 let result = unsafe { o.contents.result };
1236 unsafe { o.contents.result = core::ptr::null_mut() };
1237 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1239 let err = unsafe { o.contents.err };
1240 unsafe { o.contents.err = core::ptr::null_mut(); }
1241 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1245 result_ok: o.result_ok,
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250 fn clone(&self) -> Self {
1252 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1256 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269 /// A pointer to the contents in the success state.
1270 /// Reading from this pointer when `result_ok` is not set is undefined.
1271 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272 /// Note that this value is always NULL, as there are no contents in the Err variant
1273 pub err: *mut core::ffi::c_void,
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281 /// `err` or `result` depending on the state of `result_ok`.
1282 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284 pub result_ok: bool,
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289 CResult_TrustedClosingTransactionNoneZ {
1290 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291 result: Box::into_raw(Box::new(o)),
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299 CResult_TrustedClosingTransactionNoneZ {
1300 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301 err: core::ptr::null_mut(),
1306 /// Checks if the given object is currently in the success state
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315 fn drop(&mut self) {
1317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318 let _ = unsafe { Box::from_raw(self.contents.result) };
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326 let contents = if o.result_ok {
1327 let result = unsafe { o.contents.result };
1328 unsafe { o.contents.result = core::ptr::null_mut() };
1329 CResult_TrustedClosingTransactionNoneZPtr { result }
1331 let _ = unsafe { Box::from_raw(o.contents.err) };
1332 o.contents.err = core::ptr::null_mut();
1333 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1337 result_ok: o.result_ok,
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344 /// A pointer to the contents in the success state.
1345 /// Reading from this pointer when `result_ok` is not set is undefined.
1346 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347 /// A pointer to the contents in the error state.
1348 /// Reading from this pointer when `result_ok` is set is undefined.
1349 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357 /// `err` or `result` depending on the state of `result_ok`.
1358 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360 pub result_ok: bool,
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365 CResult_CommitmentTransactionDecodeErrorZ {
1366 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367 result: Box::into_raw(Box::new(o)),
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375 CResult_CommitmentTransactionDecodeErrorZ {
1376 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377 err: Box::into_raw(Box::new(e)),
1382 /// Checks if the given object is currently in the success state
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391 fn drop(&mut self) {
1393 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394 let _ = unsafe { Box::from_raw(self.contents.result) };
1397 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398 let _ = unsafe { Box::from_raw(self.contents.err) };
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405 let contents = if o.result_ok {
1406 let result = unsafe { o.contents.result };
1407 unsafe { o.contents.result = core::ptr::null_mut() };
1408 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1410 let err = unsafe { o.contents.err };
1411 unsafe { o.contents.err = core::ptr::null_mut(); }
1412 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1416 result_ok: o.result_ok,
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421 fn clone(&self) -> Self {
1423 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1427 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440 /// A pointer to the contents in the success state.
1441 /// Reading from this pointer when `result_ok` is not set is undefined.
1442 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443 /// Note that this value is always NULL, as there are no contents in the Err variant
1444 pub err: *mut core::ffi::c_void,
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452 /// `err` or `result` depending on the state of `result_ok`.
1453 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455 pub result_ok: bool,
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460 CResult_TrustedCommitmentTransactionNoneZ {
1461 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462 result: Box::into_raw(Box::new(o)),
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470 CResult_TrustedCommitmentTransactionNoneZ {
1471 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472 err: core::ptr::null_mut(),
1477 /// Checks if the given object is currently in the success state
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486 fn drop(&mut self) {
1488 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489 let _ = unsafe { Box::from_raw(self.contents.result) };
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497 let contents = if o.result_ok {
1498 let result = unsafe { o.contents.result };
1499 unsafe { o.contents.result = core::ptr::null_mut() };
1500 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1502 let _ = unsafe { Box::from_raw(o.contents.err) };
1503 o.contents.err = core::ptr::null_mut();
1504 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1508 result_ok: o.result_ok,
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515 /// A pointer to the contents in the success state.
1516 /// Reading from this pointer when `result_ok` is not set is undefined.
1517 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518 /// Note that this value is always NULL, as there are no contents in the Err variant
1519 pub err: *mut core::ffi::c_void,
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527 /// `err` or `result` depending on the state of `result_ok`.
1528 pub contents: CResult_CVec_SignatureZNoneZPtr,
1529 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530 pub result_ok: bool,
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535 CResult_CVec_SignatureZNoneZ {
1536 contents: CResult_CVec_SignatureZNoneZPtr {
1537 result: Box::into_raw(Box::new(o)),
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545 CResult_CVec_SignatureZNoneZ {
1546 contents: CResult_CVec_SignatureZNoneZPtr {
1547 err: core::ptr::null_mut(),
1552 /// Checks if the given object is currently in the success state
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561 fn drop(&mut self) {
1563 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564 let _ = unsafe { Box::from_raw(self.contents.result) };
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572 let contents = if o.result_ok {
1573 let result = unsafe { o.contents.result };
1574 unsafe { o.contents.result = core::ptr::null_mut() };
1575 CResult_CVec_SignatureZNoneZPtr { result }
1577 let _ = unsafe { Box::from_raw(o.contents.err) };
1578 o.contents.err = core::ptr::null_mut();
1579 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1583 result_ok: o.result_ok,
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588 fn clone(&self) -> Self {
1590 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1594 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595 err: core::ptr::null_mut()
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607 /// A pointer to the contents in the success state.
1608 /// Reading from this pointer when `result_ok` is not set is undefined.
1609 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610 /// A pointer to the contents in the error state.
1611 /// Reading from this pointer when `result_ok` is set is undefined.
1612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620 /// `err` or `result` depending on the state of `result_ok`.
1621 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623 pub result_ok: bool,
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628 CResult_ShutdownScriptDecodeErrorZ {
1629 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630 result: Box::into_raw(Box::new(o)),
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638 CResult_ShutdownScriptDecodeErrorZ {
1639 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640 err: Box::into_raw(Box::new(e)),
1645 /// Checks if the given object is currently in the success state
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654 fn drop(&mut self) {
1656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657 let _ = unsafe { Box::from_raw(self.contents.result) };
1660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661 let _ = unsafe { Box::from_raw(self.contents.err) };
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668 let contents = if o.result_ok {
1669 let result = unsafe { o.contents.result };
1670 unsafe { o.contents.result = core::ptr::null_mut() };
1671 CResult_ShutdownScriptDecodeErrorZPtr { result }
1673 let err = unsafe { o.contents.err };
1674 unsafe { o.contents.err = core::ptr::null_mut(); }
1675 CResult_ShutdownScriptDecodeErrorZPtr { err }
1679 result_ok: o.result_ok,
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684 fn clone(&self) -> Self {
1686 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1690 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703 /// A pointer to the contents in the success state.
1704 /// Reading from this pointer when `result_ok` is not set is undefined.
1705 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706 /// A pointer to the contents in the error state.
1707 /// Reading from this pointer when `result_ok` is set is undefined.
1708 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716 /// `err` or `result` depending on the state of `result_ok`.
1717 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719 pub result_ok: bool,
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724 CResult_ShutdownScriptInvalidShutdownScriptZ {
1725 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726 result: Box::into_raw(Box::new(o)),
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734 CResult_ShutdownScriptInvalidShutdownScriptZ {
1735 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736 err: Box::into_raw(Box::new(e)),
1741 /// Checks if the given object is currently in the success state
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750 fn drop(&mut self) {
1752 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753 let _ = unsafe { Box::from_raw(self.contents.result) };
1756 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757 let _ = unsafe { Box::from_raw(self.contents.err) };
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764 let contents = if o.result_ok {
1765 let result = unsafe { o.contents.result };
1766 unsafe { o.contents.result = core::ptr::null_mut() };
1767 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1769 let err = unsafe { o.contents.err };
1770 unsafe { o.contents.err = core::ptr::null_mut(); }
1771 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1775 result_ok: o.result_ok,
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780 fn clone(&self) -> Self {
1782 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1786 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799 /// Note that this value is always NULL, as there are no contents in the OK variant
1800 pub result: *mut core::ffi::c_void,
1801 /// A pointer to the contents in the error state.
1802 /// Reading from this pointer when `result_ok` is set is undefined.
1803 pub err: *mut crate::c_types::IOError,
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810 /// The contents of this CResult_NoneErrorZ, accessible via either
1811 /// `err` or `result` depending on the state of `result_ok`.
1812 pub contents: CResult_NoneErrorZPtr,
1813 /// Whether this CResult_NoneErrorZ represents a success state.
1814 pub result_ok: bool,
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819 CResult_NoneErrorZ {
1820 contents: CResult_NoneErrorZPtr {
1821 result: core::ptr::null_mut(),
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829 CResult_NoneErrorZ {
1830 contents: CResult_NoneErrorZPtr {
1831 err: Box::into_raw(Box::new(e)),
1836 /// Checks if the given object is currently in the success state
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845 fn drop(&mut self) {
1848 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849 let _ = unsafe { Box::from_raw(self.contents.err) };
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856 let contents = if o.result_ok {
1857 let _ = unsafe { Box::from_raw(o.contents.result) };
1858 o.contents.result = core::ptr::null_mut();
1859 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1861 let err = unsafe { o.contents.err };
1862 unsafe { o.contents.err = core::ptr::null_mut(); }
1863 CResult_NoneErrorZPtr { err }
1867 result_ok: o.result_ok,
1871 impl Clone for CResult_NoneErrorZ {
1872 fn clone(&self) -> Self {
1874 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875 result: core::ptr::null_mut()
1878 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891 /// A pointer to the contents in the success state.
1892 /// Reading from this pointer when `result_ok` is not set is undefined.
1893 pub result: *mut crate::lightning::routing::router::RouteHop,
1894 /// A pointer to the contents in the error state.
1895 /// Reading from this pointer when `result_ok` is set is undefined.
1896 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904 /// `err` or `result` depending on the state of `result_ok`.
1905 pub contents: CResult_RouteHopDecodeErrorZPtr,
1906 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907 pub result_ok: bool,
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912 CResult_RouteHopDecodeErrorZ {
1913 contents: CResult_RouteHopDecodeErrorZPtr {
1914 result: Box::into_raw(Box::new(o)),
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922 CResult_RouteHopDecodeErrorZ {
1923 contents: CResult_RouteHopDecodeErrorZPtr {
1924 err: Box::into_raw(Box::new(e)),
1929 /// Checks if the given object is currently in the success state
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938 fn drop(&mut self) {
1940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941 let _ = unsafe { Box::from_raw(self.contents.result) };
1944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945 let _ = unsafe { Box::from_raw(self.contents.err) };
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952 let contents = if o.result_ok {
1953 let result = unsafe { o.contents.result };
1954 unsafe { o.contents.result = core::ptr::null_mut() };
1955 CResult_RouteHopDecodeErrorZPtr { result }
1957 let err = unsafe { o.contents.err };
1958 unsafe { o.contents.err = core::ptr::null_mut(); }
1959 CResult_RouteHopDecodeErrorZPtr { err }
1963 result_ok: o.result_ok,
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968 fn clone(&self) -> Self {
1970 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1974 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988 /// The elements in the array.
1989 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990 pub data: *mut crate::lightning::routing::router::RouteHop,
1991 /// The number of elements pointed to by `data`.
1994 impl CVec_RouteHopZ {
1995 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996 if self.datalen == 0 { return Vec::new(); }
1997 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998 self.data = core::ptr::null_mut();
2002 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008 let datalen = v.len();
2009 let data = Box::into_raw(v.into_boxed_slice());
2010 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017 fn drop(&mut self) {
2018 if self.datalen == 0 { return; }
2019 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2022 impl Clone for CVec_RouteHopZ {
2023 fn clone(&self) -> Self {
2024 let mut res = Vec::new();
2025 if self.datalen == 0 { return Self::from(res); }
2026 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034 /// The elements in the array.
2035 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037 /// The number of elements pointed to by `data`.
2040 impl CVec_CVec_RouteHopZZ {
2041 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042 if self.datalen == 0 { return Vec::new(); }
2043 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044 self.data = core::ptr::null_mut();
2048 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054 let datalen = v.len();
2055 let data = Box::into_raw(v.into_boxed_slice());
2056 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063 fn drop(&mut self) {
2064 if self.datalen == 0 { return; }
2065 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069 fn clone(&self) -> Self {
2070 let mut res = Vec::new();
2071 if self.datalen == 0 { return Self::from(res); }
2072 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079 /// A pointer to the contents in the success state.
2080 /// Reading from this pointer when `result_ok` is not set is undefined.
2081 pub result: *mut crate::lightning::routing::router::Route,
2082 /// A pointer to the contents in the error state.
2083 /// Reading from this pointer when `result_ok` is set is undefined.
2084 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092 /// `err` or `result` depending on the state of `result_ok`.
2093 pub contents: CResult_RouteDecodeErrorZPtr,
2094 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095 pub result_ok: bool,
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100 CResult_RouteDecodeErrorZ {
2101 contents: CResult_RouteDecodeErrorZPtr {
2102 result: Box::into_raw(Box::new(o)),
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110 CResult_RouteDecodeErrorZ {
2111 contents: CResult_RouteDecodeErrorZPtr {
2112 err: Box::into_raw(Box::new(e)),
2117 /// Checks if the given object is currently in the success state
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126 fn drop(&mut self) {
2128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129 let _ = unsafe { Box::from_raw(self.contents.result) };
2132 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133 let _ = unsafe { Box::from_raw(self.contents.err) };
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140 let contents = if o.result_ok {
2141 let result = unsafe { o.contents.result };
2142 unsafe { o.contents.result = core::ptr::null_mut() };
2143 CResult_RouteDecodeErrorZPtr { result }
2145 let err = unsafe { o.contents.err };
2146 unsafe { o.contents.err = core::ptr::null_mut(); }
2147 CResult_RouteDecodeErrorZPtr { err }
2151 result_ok: o.result_ok,
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156 fn clone(&self) -> Self {
2158 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2162 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175 /// A pointer to the contents in the success state.
2176 /// Reading from this pointer when `result_ok` is not set is undefined.
2177 pub result: *mut crate::lightning::routing::router::RouteParameters,
2178 /// A pointer to the contents in the error state.
2179 /// Reading from this pointer when `result_ok` is set is undefined.
2180 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188 /// `err` or `result` depending on the state of `result_ok`.
2189 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191 pub result_ok: bool,
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196 CResult_RouteParametersDecodeErrorZ {
2197 contents: CResult_RouteParametersDecodeErrorZPtr {
2198 result: Box::into_raw(Box::new(o)),
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206 CResult_RouteParametersDecodeErrorZ {
2207 contents: CResult_RouteParametersDecodeErrorZPtr {
2208 err: Box::into_raw(Box::new(e)),
2213 /// Checks if the given object is currently in the success state
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222 fn drop(&mut self) {
2224 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225 let _ = unsafe { Box::from_raw(self.contents.result) };
2228 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229 let _ = unsafe { Box::from_raw(self.contents.err) };
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236 let contents = if o.result_ok {
2237 let result = unsafe { o.contents.result };
2238 unsafe { o.contents.result = core::ptr::null_mut() };
2239 CResult_RouteParametersDecodeErrorZPtr { result }
2241 let err = unsafe { o.contents.err };
2242 unsafe { o.contents.err = core::ptr::null_mut(); }
2243 CResult_RouteParametersDecodeErrorZPtr { err }
2247 result_ok: o.result_ok,
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252 fn clone(&self) -> Self {
2254 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2258 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272 /// The elements in the array.
2273 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274 pub data: *mut crate::lightning::routing::router::RouteHint,
2275 /// The number of elements pointed to by `data`.
2278 impl CVec_RouteHintZ {
2279 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280 if self.datalen == 0 { return Vec::new(); }
2281 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282 self.data = core::ptr::null_mut();
2286 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292 let datalen = v.len();
2293 let data = Box::into_raw(v.into_boxed_slice());
2294 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301 fn drop(&mut self) {
2302 if self.datalen == 0 { return; }
2303 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2306 impl Clone for CVec_RouteHintZ {
2307 fn clone(&self) -> Self {
2308 let mut res = Vec::new();
2309 if self.datalen == 0 { return Self::from(res); }
2310 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318 /// When we're in this state, this COption_u64Z contains a u64
2320 /// When we're in this state, this COption_u64Z contains nothing
2324 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325 if let Self::None = self { false } else { true }
2327 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2330 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331 if let Self::Some(v) = self { v } else { unreachable!() }
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337 COption_u64Z::Some(o)
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354 /// A pointer to the contents in the success state.
2355 /// Reading from this pointer when `result_ok` is not set is undefined.
2356 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357 /// A pointer to the contents in the error state.
2358 /// Reading from this pointer when `result_ok` is set is undefined.
2359 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367 /// `err` or `result` depending on the state of `result_ok`.
2368 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370 pub result_ok: bool,
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375 CResult_PaymentParametersDecodeErrorZ {
2376 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377 result: Box::into_raw(Box::new(o)),
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385 CResult_PaymentParametersDecodeErrorZ {
2386 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387 err: Box::into_raw(Box::new(e)),
2392 /// Checks if the given object is currently in the success state
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401 fn drop(&mut self) {
2403 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404 let _ = unsafe { Box::from_raw(self.contents.result) };
2407 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408 let _ = unsafe { Box::from_raw(self.contents.err) };
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415 let contents = if o.result_ok {
2416 let result = unsafe { o.contents.result };
2417 unsafe { o.contents.result = core::ptr::null_mut() };
2418 CResult_PaymentParametersDecodeErrorZPtr { result }
2420 let err = unsafe { o.contents.err };
2421 unsafe { o.contents.err = core::ptr::null_mut(); }
2422 CResult_PaymentParametersDecodeErrorZPtr { err }
2426 result_ok: o.result_ok,
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431 fn clone(&self) -> Self {
2433 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2437 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451 /// The elements in the array.
2452 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454 /// The number of elements pointed to by `data`.
2457 impl CVec_RouteHintHopZ {
2458 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459 if self.datalen == 0 { return Vec::new(); }
2460 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461 self.data = core::ptr::null_mut();
2465 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471 let datalen = v.len();
2472 let data = Box::into_raw(v.into_boxed_slice());
2473 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480 fn drop(&mut self) {
2481 if self.datalen == 0 { return; }
2482 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2485 impl Clone for CVec_RouteHintHopZ {
2486 fn clone(&self) -> Self {
2487 let mut res = Vec::new();
2488 if self.datalen == 0 { return Self::from(res); }
2489 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496 /// A pointer to the contents in the success state.
2497 /// Reading from this pointer when `result_ok` is not set is undefined.
2498 pub result: *mut crate::lightning::routing::router::RouteHint,
2499 /// A pointer to the contents in the error state.
2500 /// Reading from this pointer when `result_ok` is set is undefined.
2501 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509 /// `err` or `result` depending on the state of `result_ok`.
2510 pub contents: CResult_RouteHintDecodeErrorZPtr,
2511 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512 pub result_ok: bool,
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517 CResult_RouteHintDecodeErrorZ {
2518 contents: CResult_RouteHintDecodeErrorZPtr {
2519 result: Box::into_raw(Box::new(o)),
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527 CResult_RouteHintDecodeErrorZ {
2528 contents: CResult_RouteHintDecodeErrorZPtr {
2529 err: Box::into_raw(Box::new(e)),
2534 /// Checks if the given object is currently in the success state
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543 fn drop(&mut self) {
2545 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546 let _ = unsafe { Box::from_raw(self.contents.result) };
2549 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550 let _ = unsafe { Box::from_raw(self.contents.err) };
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557 let contents = if o.result_ok {
2558 let result = unsafe { o.contents.result };
2559 unsafe { o.contents.result = core::ptr::null_mut() };
2560 CResult_RouteHintDecodeErrorZPtr { result }
2562 let err = unsafe { o.contents.err };
2563 unsafe { o.contents.err = core::ptr::null_mut(); }
2564 CResult_RouteHintDecodeErrorZPtr { err }
2568 result_ok: o.result_ok,
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573 fn clone(&self) -> Self {
2575 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2579 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592 /// A pointer to the contents in the success state.
2593 /// Reading from this pointer when `result_ok` is not set is undefined.
2594 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595 /// A pointer to the contents in the error state.
2596 /// Reading from this pointer when `result_ok` is set is undefined.
2597 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605 /// `err` or `result` depending on the state of `result_ok`.
2606 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608 pub result_ok: bool,
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613 CResult_RouteHintHopDecodeErrorZ {
2614 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615 result: Box::into_raw(Box::new(o)),
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623 CResult_RouteHintHopDecodeErrorZ {
2624 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625 err: Box::into_raw(Box::new(e)),
2630 /// Checks if the given object is currently in the success state
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639 fn drop(&mut self) {
2641 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642 let _ = unsafe { Box::from_raw(self.contents.result) };
2645 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646 let _ = unsafe { Box::from_raw(self.contents.err) };
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653 let contents = if o.result_ok {
2654 let result = unsafe { o.contents.result };
2655 unsafe { o.contents.result = core::ptr::null_mut() };
2656 CResult_RouteHintHopDecodeErrorZPtr { result }
2658 let err = unsafe { o.contents.err };
2659 unsafe { o.contents.err = core::ptr::null_mut(); }
2660 CResult_RouteHintHopDecodeErrorZPtr { err }
2664 result_ok: o.result_ok,
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669 fn clone(&self) -> Self {
2671 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2675 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689 /// The elements in the array.
2690 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692 /// The number of elements pointed to by `data`.
2695 impl CVec_ChannelDetailsZ {
2696 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697 if self.datalen == 0 { return Vec::new(); }
2698 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699 self.data = core::ptr::null_mut();
2703 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709 let datalen = v.len();
2710 let data = Box::into_raw(v.into_boxed_slice());
2711 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718 fn drop(&mut self) {
2719 if self.datalen == 0 { return; }
2720 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2723 impl Clone for CVec_ChannelDetailsZ {
2724 fn clone(&self) -> Self {
2725 let mut res = Vec::new();
2726 if self.datalen == 0 { return Self::from(res); }
2727 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734 /// A pointer to the contents in the success state.
2735 /// Reading from this pointer when `result_ok` is not set is undefined.
2736 pub result: *mut crate::lightning::routing::router::Route,
2737 /// A pointer to the contents in the error state.
2738 /// Reading from this pointer when `result_ok` is set is undefined.
2739 pub err: *mut crate::lightning::ln::msgs::LightningError,
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747 /// `err` or `result` depending on the state of `result_ok`.
2748 pub contents: CResult_RouteLightningErrorZPtr,
2749 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750 pub result_ok: bool,
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755 CResult_RouteLightningErrorZ {
2756 contents: CResult_RouteLightningErrorZPtr {
2757 result: Box::into_raw(Box::new(o)),
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765 CResult_RouteLightningErrorZ {
2766 contents: CResult_RouteLightningErrorZPtr {
2767 err: Box::into_raw(Box::new(e)),
2772 /// Checks if the given object is currently in the success state
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781 fn drop(&mut self) {
2783 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784 let _ = unsafe { Box::from_raw(self.contents.result) };
2787 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788 let _ = unsafe { Box::from_raw(self.contents.err) };
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795 let contents = if o.result_ok {
2796 let result = unsafe { o.contents.result };
2797 unsafe { o.contents.result = core::ptr::null_mut() };
2798 CResult_RouteLightningErrorZPtr { result }
2800 let err = unsafe { o.contents.err };
2801 unsafe { o.contents.err = core::ptr::null_mut(); }
2802 CResult_RouteLightningErrorZPtr { err }
2806 result_ok: o.result_ok,
2810 impl Clone for CResult_RouteLightningErrorZ {
2811 fn clone(&self) -> Self {
2813 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2817 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2828 /// The contents of CResult_TxOutAccessErrorZ
2829 pub union CResult_TxOutAccessErrorZPtr {
2830 /// A pointer to the contents in the success state.
2831 /// Reading from this pointer when `result_ok` is not set is undefined.
2832 pub result: *mut crate::c_types::TxOut,
2833 /// A pointer to the contents in the error state.
2834 /// Reading from this pointer when `result_ok` is set is undefined.
2835 pub err: *mut crate::lightning::chain::AccessError,
2838 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2839 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2841 pub struct CResult_TxOutAccessErrorZ {
2842 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2843 /// `err` or `result` depending on the state of `result_ok`.
2844 pub contents: CResult_TxOutAccessErrorZPtr,
2845 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2846 pub result_ok: bool,
2849 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2850 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2851 CResult_TxOutAccessErrorZ {
2852 contents: CResult_TxOutAccessErrorZPtr {
2853 result: Box::into_raw(Box::new(o)),
2859 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2860 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2861 CResult_TxOutAccessErrorZ {
2862 contents: CResult_TxOutAccessErrorZPtr {
2863 err: Box::into_raw(Box::new(e)),
2868 /// Checks if the given object is currently in the success state
2870 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2874 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2875 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2876 impl Drop for CResult_TxOutAccessErrorZ {
2877 fn drop(&mut self) {
2879 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2880 let _ = unsafe { Box::from_raw(self.contents.result) };
2883 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2884 let _ = unsafe { Box::from_raw(self.contents.err) };
2889 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2890 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2891 let contents = if o.result_ok {
2892 let result = unsafe { o.contents.result };
2893 unsafe { o.contents.result = core::ptr::null_mut() };
2894 CResult_TxOutAccessErrorZPtr { result }
2896 let err = unsafe { o.contents.err };
2897 unsafe { o.contents.err = core::ptr::null_mut(); }
2898 CResult_TxOutAccessErrorZPtr { err }
2902 result_ok: o.result_ok,
2906 impl Clone for CResult_TxOutAccessErrorZ {
2907 fn clone(&self) -> Self {
2909 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2910 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2913 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2914 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2920 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2921 /// but with all dynamically-allocated buffers duplicated in new buffers.
2922 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2924 /// A tuple of 2 elements. See the individual fields for the types contained.
2925 pub struct C2Tuple_usizeTransactionZ {
2926 /// The element at position 0
2928 /// The element at position 1
2929 pub b: crate::c_types::Transaction,
2931 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2932 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2939 impl C2Tuple_usizeTransactionZ {
2940 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2944 impl Clone for C2Tuple_usizeTransactionZ {
2945 fn clone(&self) -> Self {
2947 a: Clone::clone(&self.a),
2948 b: Clone::clone(&self.b),
2953 /// Creates a new tuple which has the same data as `orig`
2954 /// but with all dynamically-allocated buffers duplicated in new buffers.
2955 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2956 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2958 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2959 C2Tuple_usizeTransactionZ { a, b, }
2963 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2964 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2967 /// This corresponds to std::vector in C++
2968 pub struct CVec_C2Tuple_usizeTransactionZZ {
2969 /// The elements in the array.
2970 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2971 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2972 /// The number of elements pointed to by `data`.
2975 impl CVec_C2Tuple_usizeTransactionZZ {
2976 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2977 if self.datalen == 0 { return Vec::new(); }
2978 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2979 self.data = core::ptr::null_mut();
2983 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2984 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2987 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2988 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2989 let datalen = v.len();
2990 let data = Box::into_raw(v.into_boxed_slice());
2991 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2996 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2997 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2998 fn drop(&mut self) {
2999 if self.datalen == 0 { return; }
3000 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3003 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3004 fn clone(&self) -> Self {
3005 let mut res = Vec::new();
3006 if self.datalen == 0 { return Self::from(res); }
3007 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3012 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3013 /// This corresponds to std::vector in C++
3014 pub struct CVec_TxidZ {
3015 /// The elements in the array.
3016 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3017 pub data: *mut crate::c_types::ThirtyTwoBytes,
3018 /// The number of elements pointed to by `data`.
3022 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3023 if self.datalen == 0 { return Vec::new(); }
3024 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3025 self.data = core::ptr::null_mut();
3029 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3030 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3033 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3034 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3035 let datalen = v.len();
3036 let data = Box::into_raw(v.into_boxed_slice());
3037 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3042 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3043 impl Drop for CVec_TxidZ {
3044 fn drop(&mut self) {
3045 if self.datalen == 0 { return; }
3046 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3049 impl Clone for CVec_TxidZ {
3050 fn clone(&self) -> Self {
3051 let mut res = Vec::new();
3052 if self.datalen == 0 { return Self::from(res); }
3053 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3058 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3059 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3060 /// Note that this value is always NULL, as there are no contents in the OK variant
3061 pub result: *mut core::ffi::c_void,
3062 /// A pointer to the contents in the error state.
3063 /// Reading from this pointer when `result_ok` is set is undefined.
3064 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3067 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3068 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3070 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3071 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3072 /// `err` or `result` depending on the state of `result_ok`.
3073 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3074 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3075 pub result_ok: bool,
3078 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3079 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3080 CResult_NoneChannelMonitorUpdateErrZ {
3081 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3082 result: core::ptr::null_mut(),
3088 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3089 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3090 CResult_NoneChannelMonitorUpdateErrZ {
3091 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3092 err: Box::into_raw(Box::new(e)),
3097 /// Checks if the given object is currently in the success state
3099 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3103 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3104 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3105 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3106 fn drop(&mut self) {
3109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3110 let _ = unsafe { Box::from_raw(self.contents.err) };
3115 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3116 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3117 let contents = if o.result_ok {
3118 let _ = unsafe { Box::from_raw(o.contents.result) };
3119 o.contents.result = core::ptr::null_mut();
3120 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3122 let err = unsafe { o.contents.err };
3123 unsafe { o.contents.err = core::ptr::null_mut(); }
3124 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3128 result_ok: o.result_ok,
3132 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3133 fn clone(&self) -> Self {
3135 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3136 result: core::ptr::null_mut()
3139 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3140 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3146 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3147 /// but with all dynamically-allocated buffers duplicated in new buffers.
3148 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3150 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3151 /// This corresponds to std::vector in C++
3152 pub struct CVec_MonitorEventZ {
3153 /// The elements in the array.
3154 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3155 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3156 /// The number of elements pointed to by `data`.
3159 impl CVec_MonitorEventZ {
3160 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3161 if self.datalen == 0 { return Vec::new(); }
3162 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3163 self.data = core::ptr::null_mut();
3167 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3168 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3171 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3172 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3173 let datalen = v.len();
3174 let data = Box::into_raw(v.into_boxed_slice());
3175 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3180 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3181 impl Drop for CVec_MonitorEventZ {
3182 fn drop(&mut self) {
3183 if self.datalen == 0 { return; }
3184 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3187 impl Clone for CVec_MonitorEventZ {
3188 fn clone(&self) -> Self {
3189 let mut res = Vec::new();
3190 if self.datalen == 0 { return Self::from(res); }
3191 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3197 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3198 pub enum COption_C2Tuple_usizeTransactionZZ {
3199 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3201 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3204 impl COption_C2Tuple_usizeTransactionZZ {
3205 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3206 if let Self::None = self { false } else { true }
3208 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3211 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3212 if let Self::Some(v) = self { v } else { unreachable!() }
3216 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3217 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3218 COption_C2Tuple_usizeTransactionZZ::Some(o)
3221 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3222 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3223 COption_C2Tuple_usizeTransactionZZ::None
3226 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3227 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3229 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3230 /// but with all dynamically-allocated buffers duplicated in new buffers.
3231 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3234 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3235 pub enum COption_ClosureReasonZ {
3236 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3237 Some(crate::lightning::util::events::ClosureReason),
3238 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3241 impl COption_ClosureReasonZ {
3242 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243 if let Self::None = self { false } else { true }
3245 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3248 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3249 if let Self::Some(v) = self { v } else { unreachable!() }
3253 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3254 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3255 COption_ClosureReasonZ::Some(o)
3258 /// Constructs a new COption_ClosureReasonZ containing nothing
3259 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3260 COption_ClosureReasonZ::None
3263 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3264 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3266 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3267 /// but with all dynamically-allocated buffers duplicated in new buffers.
3268 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3270 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3271 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3272 /// A pointer to the contents in the success state.
3273 /// Reading from this pointer when `result_ok` is not set is undefined.
3274 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3275 /// A pointer to the contents in the error state.
3276 /// Reading from this pointer when `result_ok` is set is undefined.
3277 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3280 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3281 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3283 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3284 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3285 /// `err` or `result` depending on the state of `result_ok`.
3286 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3287 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3288 pub result_ok: bool,
3291 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3292 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3293 CResult_COption_ClosureReasonZDecodeErrorZ {
3294 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295 result: Box::into_raw(Box::new(o)),
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3302 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3303 CResult_COption_ClosureReasonZDecodeErrorZ {
3304 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3305 err: Box::into_raw(Box::new(e)),
3310 /// Checks if the given object is currently in the success state
3312 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3316 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3317 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3318 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3319 fn drop(&mut self) {
3321 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3322 let _ = unsafe { Box::from_raw(self.contents.result) };
3325 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3326 let _ = unsafe { Box::from_raw(self.contents.err) };
3331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3332 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3333 let contents = if o.result_ok {
3334 let result = unsafe { o.contents.result };
3335 unsafe { o.contents.result = core::ptr::null_mut() };
3336 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3338 let err = unsafe { o.contents.err };
3339 unsafe { o.contents.err = core::ptr::null_mut(); }
3340 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3344 result_ok: o.result_ok,
3348 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3349 fn clone(&self) -> Self {
3351 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3352 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3355 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3356 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3362 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3363 /// but with all dynamically-allocated buffers duplicated in new buffers.
3364 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3367 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3368 pub enum COption_NetworkUpdateZ {
3369 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3370 Some(crate::lightning::routing::network_graph::NetworkUpdate),
3371 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3374 impl COption_NetworkUpdateZ {
3375 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376 if let Self::None = self { false } else { true }
3378 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3381 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3382 if let Self::Some(v) = self { v } else { unreachable!() }
3386 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3387 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3388 COption_NetworkUpdateZ::Some(o)
3391 /// Constructs a new COption_NetworkUpdateZ containing nothing
3392 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3393 COption_NetworkUpdateZ::None
3396 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3397 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3399 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3403 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_SpendableOutputDescriptorZ {
3406 /// The elements in the array.
3407 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3409 /// The number of elements pointed to by `data`.
3412 impl CVec_SpendableOutputDescriptorZ {
3413 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3414 if self.datalen == 0 { return Vec::new(); }
3415 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416 self.data = core::ptr::null_mut();
3420 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3421 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3424 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3425 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3426 let datalen = v.len();
3427 let data = Box::into_raw(v.into_boxed_slice());
3428 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3434 impl Drop for CVec_SpendableOutputDescriptorZ {
3435 fn drop(&mut self) {
3436 if self.datalen == 0 { return; }
3437 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3440 impl Clone for CVec_SpendableOutputDescriptorZ {
3441 fn clone(&self) -> Self {
3442 let mut res = Vec::new();
3443 if self.datalen == 0 { return Self::from(res); }
3444 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3450 /// An enum which can either contain a crate::lightning::util::events::Event or not
3451 pub enum COption_EventZ {
3452 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3453 Some(crate::lightning::util::events::Event),
3454 /// When we're in this state, this COption_EventZ contains nothing
3457 impl COption_EventZ {
3458 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3459 if let Self::None = self { false } else { true }
3461 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3464 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3465 if let Self::Some(v) = self { v } else { unreachable!() }
3469 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3470 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3471 COption_EventZ::Some(o)
3474 /// Constructs a new COption_EventZ containing nothing
3475 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3476 COption_EventZ::None
3479 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3480 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3482 /// Creates a new COption_EventZ which has the same data as `orig`
3483 /// but with all dynamically-allocated buffers duplicated in new buffers.
3484 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3486 /// The contents of CResult_COption_EventZDecodeErrorZ
3487 pub union CResult_COption_EventZDecodeErrorZPtr {
3488 /// A pointer to the contents in the success state.
3489 /// Reading from this pointer when `result_ok` is not set is undefined.
3490 pub result: *mut crate::c_types::derived::COption_EventZ,
3491 /// A pointer to the contents in the error state.
3492 /// Reading from this pointer when `result_ok` is set is undefined.
3493 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3496 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3497 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3499 pub struct CResult_COption_EventZDecodeErrorZ {
3500 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3501 /// `err` or `result` depending on the state of `result_ok`.
3502 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3503 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3504 pub result_ok: bool,
3507 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3508 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3509 CResult_COption_EventZDecodeErrorZ {
3510 contents: CResult_COption_EventZDecodeErrorZPtr {
3511 result: Box::into_raw(Box::new(o)),
3517 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3518 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3519 CResult_COption_EventZDecodeErrorZ {
3520 contents: CResult_COption_EventZDecodeErrorZPtr {
3521 err: Box::into_raw(Box::new(e)),
3526 /// Checks if the given object is currently in the success state
3528 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3532 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3533 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3534 impl Drop for CResult_COption_EventZDecodeErrorZ {
3535 fn drop(&mut self) {
3537 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3538 let _ = unsafe { Box::from_raw(self.contents.result) };
3541 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3542 let _ = unsafe { Box::from_raw(self.contents.err) };
3547 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3548 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3549 let contents = if o.result_ok {
3550 let result = unsafe { o.contents.result };
3551 unsafe { o.contents.result = core::ptr::null_mut() };
3552 CResult_COption_EventZDecodeErrorZPtr { result }
3554 let err = unsafe { o.contents.err };
3555 unsafe { o.contents.err = core::ptr::null_mut(); }
3556 CResult_COption_EventZDecodeErrorZPtr { err }
3560 result_ok: o.result_ok,
3564 impl Clone for CResult_COption_EventZDecodeErrorZ {
3565 fn clone(&self) -> Self {
3567 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3568 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3571 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3572 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3578 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3579 /// but with all dynamically-allocated buffers duplicated in new buffers.
3580 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3582 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3583 /// This corresponds to std::vector in C++
3584 pub struct CVec_MessageSendEventZ {
3585 /// The elements in the array.
3586 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3587 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3588 /// The number of elements pointed to by `data`.
3591 impl CVec_MessageSendEventZ {
3592 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3593 if self.datalen == 0 { return Vec::new(); }
3594 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3595 self.data = core::ptr::null_mut();
3599 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3600 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3603 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3604 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3605 let datalen = v.len();
3606 let data = Box::into_raw(v.into_boxed_slice());
3607 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3612 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3613 impl Drop for CVec_MessageSendEventZ {
3614 fn drop(&mut self) {
3615 if self.datalen == 0 { return; }
3616 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3619 impl Clone for CVec_MessageSendEventZ {
3620 fn clone(&self) -> Self {
3621 let mut res = Vec::new();
3622 if self.datalen == 0 { return Self::from(res); }
3623 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3628 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3629 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3630 /// A pointer to the contents in the success state.
3631 /// Reading from this pointer when `result_ok` is not set is undefined.
3632 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3633 /// A pointer to the contents in the error state.
3634 /// Reading from this pointer when `result_ok` is set is undefined.
3635 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3638 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3639 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3640 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3641 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3642 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3643 /// `err` or `result` depending on the state of `result_ok`.
3644 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3645 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3646 pub result_ok: bool,
3649 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3650 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3651 CResult_FixedPenaltyScorerDecodeErrorZ {
3652 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3653 result: Box::into_raw(Box::new(o)),
3659 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3660 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3661 CResult_FixedPenaltyScorerDecodeErrorZ {
3662 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3663 err: Box::into_raw(Box::new(e)),
3668 /// Checks if the given object is currently in the success state
3670 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3674 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3675 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3676 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3677 fn drop(&mut self) {
3679 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3680 let _ = unsafe { Box::from_raw(self.contents.result) };
3683 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3684 let _ = unsafe { Box::from_raw(self.contents.err) };
3689 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3690 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3691 let contents = if o.result_ok {
3692 let result = unsafe { o.contents.result };
3693 unsafe { o.contents.result = core::ptr::null_mut() };
3694 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3696 let err = unsafe { o.contents.err };
3697 unsafe { o.contents.err = core::ptr::null_mut(); }
3698 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3702 result_ok: o.result_ok,
3707 /// The contents of CResult_ScoringParametersDecodeErrorZ
3708 pub union CResult_ScoringParametersDecodeErrorZPtr {
3709 /// A pointer to the contents in the success state.
3710 /// Reading from this pointer when `result_ok` is not set is undefined.
3711 pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3712 /// A pointer to the contents in the error state.
3713 /// Reading from this pointer when `result_ok` is set is undefined.
3714 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3717 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3718 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3720 pub struct CResult_ScoringParametersDecodeErrorZ {
3721 /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3722 /// `err` or `result` depending on the state of `result_ok`.
3723 pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3724 /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3725 pub result_ok: bool,
3728 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3729 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3730 CResult_ScoringParametersDecodeErrorZ {
3731 contents: CResult_ScoringParametersDecodeErrorZPtr {
3732 result: Box::into_raw(Box::new(o)),
3738 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3739 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3740 CResult_ScoringParametersDecodeErrorZ {
3741 contents: CResult_ScoringParametersDecodeErrorZPtr {
3742 err: Box::into_raw(Box::new(e)),
3747 /// Checks if the given object is currently in the success state
3749 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3753 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3754 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3755 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3756 fn drop(&mut self) {
3758 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3759 let _ = unsafe { Box::from_raw(self.contents.result) };
3762 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3763 let _ = unsafe { Box::from_raw(self.contents.err) };
3768 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3769 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3770 let contents = if o.result_ok {
3771 let result = unsafe { o.contents.result };
3772 unsafe { o.contents.result = core::ptr::null_mut() };
3773 CResult_ScoringParametersDecodeErrorZPtr { result }
3775 let err = unsafe { o.contents.err };
3776 unsafe { o.contents.err = core::ptr::null_mut(); }
3777 CResult_ScoringParametersDecodeErrorZPtr { err }
3781 result_ok: o.result_ok,
3786 /// The contents of CResult_ScorerDecodeErrorZ
3787 pub union CResult_ScorerDecodeErrorZPtr {
3788 /// A pointer to the contents in the success state.
3789 /// Reading from this pointer when `result_ok` is not set is undefined.
3790 pub result: *mut crate::lightning::routing::scoring::Scorer,
3791 /// A pointer to the contents in the error state.
3792 /// Reading from this pointer when `result_ok` is set is undefined.
3793 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3796 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3797 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3799 pub struct CResult_ScorerDecodeErrorZ {
3800 /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3801 /// `err` or `result` depending on the state of `result_ok`.
3802 pub contents: CResult_ScorerDecodeErrorZPtr,
3803 /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3804 pub result_ok: bool,
3807 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3808 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3809 CResult_ScorerDecodeErrorZ {
3810 contents: CResult_ScorerDecodeErrorZPtr {
3811 result: Box::into_raw(Box::new(o)),
3817 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3818 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3819 CResult_ScorerDecodeErrorZ {
3820 contents: CResult_ScorerDecodeErrorZPtr {
3821 err: Box::into_raw(Box::new(e)),
3826 /// Checks if the given object is currently in the success state
3828 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3832 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3833 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3834 impl Drop for CResult_ScorerDecodeErrorZ {
3835 fn drop(&mut self) {
3837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3838 let _ = unsafe { Box::from_raw(self.contents.result) };
3841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3842 let _ = unsafe { Box::from_raw(self.contents.err) };
3847 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3848 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3849 let contents = if o.result_ok {
3850 let result = unsafe { o.contents.result };
3851 unsafe { o.contents.result = core::ptr::null_mut() };
3852 CResult_ScorerDecodeErrorZPtr { result }
3854 let err = unsafe { o.contents.err };
3855 unsafe { o.contents.err = core::ptr::null_mut(); }
3856 CResult_ScorerDecodeErrorZPtr { err }
3860 result_ok: o.result_ok,
3865 /// The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
3866 pub union CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3867 /// A pointer to the contents in the success state.
3868 /// Reading from this pointer when `result_ok` is not set is undefined.
3869 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3870 /// A pointer to the contents in the error state.
3871 /// Reading from this pointer when `result_ok` is set is undefined.
3872 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3875 /// A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
3876 /// containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3878 pub struct CResult_ProbabilisticScoringParametersDecodeErrorZ {
3879 /// The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
3880 /// `err` or `result` depending on the state of `result_ok`.
3881 pub contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr,
3882 /// Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
3883 pub result_ok: bool,
3886 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
3887 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScoringParameters) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3888 CResult_ProbabilisticScoringParametersDecodeErrorZ {
3889 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3890 result: Box::into_raw(Box::new(o)),
3896 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
3897 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3898 CResult_ProbabilisticScoringParametersDecodeErrorZ {
3899 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3900 err: Box::into_raw(Box::new(e)),
3905 /// Checks if the given object is currently in the success state
3907 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> bool {
3911 /// Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
3912 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res: CResult_ProbabilisticScoringParametersDecodeErrorZ) { }
3913 impl Drop for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3914 fn drop(&mut self) {
3916 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3917 let _ = unsafe { Box::from_raw(self.contents.result) };
3920 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3921 let _ = unsafe { Box::from_raw(self.contents.err) };
3926 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3927 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3928 let contents = if o.result_ok {
3929 let result = unsafe { o.contents.result };
3930 unsafe { o.contents.result = core::ptr::null_mut() };
3931 CResult_ProbabilisticScoringParametersDecodeErrorZPtr { result }
3933 let err = unsafe { o.contents.err };
3934 unsafe { o.contents.err = core::ptr::null_mut(); }
3935 CResult_ProbabilisticScoringParametersDecodeErrorZPtr { err }
3939 result_ok: o.result_ok,
3943 impl Clone for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3944 fn clone(&self) -> Self {
3946 Self { result_ok: true, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3947 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ProbabilisticScoringParameters>::clone(unsafe { &*self.contents.result })))
3950 Self { result_ok: false, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3951 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3957 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
3958 /// but with all dynamically-allocated buffers duplicated in new buffers.
3959 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> CResult_ProbabilisticScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3961 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3962 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3963 /// A pointer to the contents in the success state.
3964 /// Reading from this pointer when `result_ok` is not set is undefined.
3965 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3966 /// A pointer to the contents in the error state.
3967 /// Reading from this pointer when `result_ok` is set is undefined.
3968 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3971 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3972 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3974 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
3975 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
3976 /// `err` or `result` depending on the state of `result_ok`.
3977 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
3978 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
3979 pub result_ok: bool,
3982 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
3983 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
3984 CResult_ProbabilisticScorerDecodeErrorZ {
3985 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3986 result: Box::into_raw(Box::new(o)),
3992 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
3993 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
3994 CResult_ProbabilisticScorerDecodeErrorZ {
3995 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3996 err: Box::into_raw(Box::new(e)),
4001 /// Checks if the given object is currently in the success state
4003 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4007 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4008 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4009 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4010 fn drop(&mut self) {
4012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4013 let _ = unsafe { Box::from_raw(self.contents.result) };
4016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4017 let _ = unsafe { Box::from_raw(self.contents.err) };
4022 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4023 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4024 let contents = if o.result_ok {
4025 let result = unsafe { o.contents.result };
4026 unsafe { o.contents.result = core::ptr::null_mut() };
4027 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4029 let err = unsafe { o.contents.err };
4030 unsafe { o.contents.err = core::ptr::null_mut(); }
4031 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4035 result_ok: o.result_ok,
4040 /// The contents of CResult_InitFeaturesDecodeErrorZ
4041 pub union CResult_InitFeaturesDecodeErrorZPtr {
4042 /// A pointer to the contents in the success state.
4043 /// Reading from this pointer when `result_ok` is not set is undefined.
4044 pub result: *mut crate::lightning::ln::features::InitFeatures,
4045 /// A pointer to the contents in the error state.
4046 /// Reading from this pointer when `result_ok` is set is undefined.
4047 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4050 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4051 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4053 pub struct CResult_InitFeaturesDecodeErrorZ {
4054 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4055 /// `err` or `result` depending on the state of `result_ok`.
4056 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4057 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4058 pub result_ok: bool,
4061 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4062 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4063 CResult_InitFeaturesDecodeErrorZ {
4064 contents: CResult_InitFeaturesDecodeErrorZPtr {
4065 result: Box::into_raw(Box::new(o)),
4071 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4072 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4073 CResult_InitFeaturesDecodeErrorZ {
4074 contents: CResult_InitFeaturesDecodeErrorZPtr {
4075 err: Box::into_raw(Box::new(e)),
4080 /// Checks if the given object is currently in the success state
4082 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4086 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4087 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4088 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4089 fn drop(&mut self) {
4091 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4092 let _ = unsafe { Box::from_raw(self.contents.result) };
4095 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4096 let _ = unsafe { Box::from_raw(self.contents.err) };
4101 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4102 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4103 let contents = if o.result_ok {
4104 let result = unsafe { o.contents.result };
4105 unsafe { o.contents.result = core::ptr::null_mut() };
4106 CResult_InitFeaturesDecodeErrorZPtr { result }
4108 let err = unsafe { o.contents.err };
4109 unsafe { o.contents.err = core::ptr::null_mut(); }
4110 CResult_InitFeaturesDecodeErrorZPtr { err }
4114 result_ok: o.result_ok,
4119 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4120 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4121 /// A pointer to the contents in the success state.
4122 /// Reading from this pointer when `result_ok` is not set is undefined.
4123 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4124 /// A pointer to the contents in the error state.
4125 /// Reading from this pointer when `result_ok` is set is undefined.
4126 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4129 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4130 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4132 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4133 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4134 /// `err` or `result` depending on the state of `result_ok`.
4135 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4136 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4137 pub result_ok: bool,
4140 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4141 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4142 CResult_ChannelFeaturesDecodeErrorZ {
4143 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4144 result: Box::into_raw(Box::new(o)),
4150 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4151 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4152 CResult_ChannelFeaturesDecodeErrorZ {
4153 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4154 err: Box::into_raw(Box::new(e)),
4159 /// Checks if the given object is currently in the success state
4161 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4165 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4166 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4167 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4168 fn drop(&mut self) {
4170 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4171 let _ = unsafe { Box::from_raw(self.contents.result) };
4174 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4175 let _ = unsafe { Box::from_raw(self.contents.err) };
4180 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4181 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4182 let contents = if o.result_ok {
4183 let result = unsafe { o.contents.result };
4184 unsafe { o.contents.result = core::ptr::null_mut() };
4185 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4187 let err = unsafe { o.contents.err };
4188 unsafe { o.contents.err = core::ptr::null_mut(); }
4189 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4193 result_ok: o.result_ok,
4198 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4199 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4200 /// A pointer to the contents in the success state.
4201 /// Reading from this pointer when `result_ok` is not set is undefined.
4202 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4203 /// A pointer to the contents in the error state.
4204 /// Reading from this pointer when `result_ok` is set is undefined.
4205 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4208 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4209 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4210 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4211 pub struct CResult_NodeFeaturesDecodeErrorZ {
4212 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4213 /// `err` or `result` depending on the state of `result_ok`.
4214 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4215 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4216 pub result_ok: bool,
4219 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4220 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4221 CResult_NodeFeaturesDecodeErrorZ {
4222 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4223 result: Box::into_raw(Box::new(o)),
4229 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4230 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4231 CResult_NodeFeaturesDecodeErrorZ {
4232 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4233 err: Box::into_raw(Box::new(e)),
4238 /// Checks if the given object is currently in the success state
4240 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4244 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4245 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4246 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4247 fn drop(&mut self) {
4249 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4250 let _ = unsafe { Box::from_raw(self.contents.result) };
4253 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4254 let _ = unsafe { Box::from_raw(self.contents.err) };
4259 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4260 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4261 let contents = if o.result_ok {
4262 let result = unsafe { o.contents.result };
4263 unsafe { o.contents.result = core::ptr::null_mut() };
4264 CResult_NodeFeaturesDecodeErrorZPtr { result }
4266 let err = unsafe { o.contents.err };
4267 unsafe { o.contents.err = core::ptr::null_mut(); }
4268 CResult_NodeFeaturesDecodeErrorZPtr { err }
4272 result_ok: o.result_ok,
4277 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4278 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4279 /// A pointer to the contents in the success state.
4280 /// Reading from this pointer when `result_ok` is not set is undefined.
4281 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4282 /// A pointer to the contents in the error state.
4283 /// Reading from this pointer when `result_ok` is set is undefined.
4284 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4287 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4288 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4289 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4290 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4291 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4292 /// `err` or `result` depending on the state of `result_ok`.
4293 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4294 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4295 pub result_ok: bool,
4298 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4299 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4300 CResult_InvoiceFeaturesDecodeErrorZ {
4301 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4302 result: Box::into_raw(Box::new(o)),
4308 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4309 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4310 CResult_InvoiceFeaturesDecodeErrorZ {
4311 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4312 err: Box::into_raw(Box::new(e)),
4317 /// Checks if the given object is currently in the success state
4319 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4323 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4324 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4325 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4326 fn drop(&mut self) {
4328 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4329 let _ = unsafe { Box::from_raw(self.contents.result) };
4332 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4333 let _ = unsafe { Box::from_raw(self.contents.err) };
4338 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4339 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4340 let contents = if o.result_ok {
4341 let result = unsafe { o.contents.result };
4342 unsafe { o.contents.result = core::ptr::null_mut() };
4343 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4345 let err = unsafe { o.contents.err };
4346 unsafe { o.contents.err = core::ptr::null_mut(); }
4347 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4351 result_ok: o.result_ok,
4356 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4357 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4358 /// A pointer to the contents in the success state.
4359 /// Reading from this pointer when `result_ok` is not set is undefined.
4360 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4361 /// A pointer to the contents in the error state.
4362 /// Reading from this pointer when `result_ok` is set is undefined.
4363 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4366 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4367 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4368 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4369 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4370 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4371 /// `err` or `result` depending on the state of `result_ok`.
4372 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4373 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4374 pub result_ok: bool,
4377 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4378 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4379 CResult_ChannelTypeFeaturesDecodeErrorZ {
4380 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4381 result: Box::into_raw(Box::new(o)),
4387 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4388 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4389 CResult_ChannelTypeFeaturesDecodeErrorZ {
4390 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4391 err: Box::into_raw(Box::new(e)),
4396 /// Checks if the given object is currently in the success state
4398 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4402 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4403 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4404 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4405 fn drop(&mut self) {
4407 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4408 let _ = unsafe { Box::from_raw(self.contents.result) };
4411 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4412 let _ = unsafe { Box::from_raw(self.contents.err) };
4417 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4418 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4419 let contents = if o.result_ok {
4420 let result = unsafe { o.contents.result };
4421 unsafe { o.contents.result = core::ptr::null_mut() };
4422 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4424 let err = unsafe { o.contents.err };
4425 unsafe { o.contents.err = core::ptr::null_mut(); }
4426 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4430 result_ok: o.result_ok,
4435 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4436 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4437 /// A pointer to the contents in the success state.
4438 /// Reading from this pointer when `result_ok` is not set is undefined.
4439 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4440 /// A pointer to the contents in the error state.
4441 /// Reading from this pointer when `result_ok` is set is undefined.
4442 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4445 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4446 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4448 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4449 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4450 /// `err` or `result` depending on the state of `result_ok`.
4451 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4452 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4453 pub result_ok: bool,
4456 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4457 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4458 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4459 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4460 result: Box::into_raw(Box::new(o)),
4466 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4467 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4468 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4469 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4470 err: Box::into_raw(Box::new(e)),
4475 /// Checks if the given object is currently in the success state
4477 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4481 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4482 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4483 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4484 fn drop(&mut self) {
4486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4487 let _ = unsafe { Box::from_raw(self.contents.result) };
4490 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4491 let _ = unsafe { Box::from_raw(self.contents.err) };
4496 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4497 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4498 let contents = if o.result_ok {
4499 let result = unsafe { o.contents.result };
4500 unsafe { o.contents.result = core::ptr::null_mut() };
4501 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4503 let err = unsafe { o.contents.err };
4504 unsafe { o.contents.err = core::ptr::null_mut(); }
4505 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4509 result_ok: o.result_ok,
4513 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4514 fn clone(&self) -> Self {
4516 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4517 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4520 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4521 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4527 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4528 /// but with all dynamically-allocated buffers duplicated in new buffers.
4529 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4531 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4532 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4533 /// A pointer to the contents in the success state.
4534 /// Reading from this pointer when `result_ok` is not set is undefined.
4535 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4536 /// A pointer to the contents in the error state.
4537 /// Reading from this pointer when `result_ok` is set is undefined.
4538 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4541 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4542 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4544 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4545 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4546 /// `err` or `result` depending on the state of `result_ok`.
4547 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4548 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4549 pub result_ok: bool,
4552 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4553 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4554 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4555 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4556 result: Box::into_raw(Box::new(o)),
4562 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4563 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4564 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4565 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4566 err: Box::into_raw(Box::new(e)),
4571 /// Checks if the given object is currently in the success state
4573 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4577 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4578 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4579 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4580 fn drop(&mut self) {
4582 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4583 let _ = unsafe { Box::from_raw(self.contents.result) };
4586 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4587 let _ = unsafe { Box::from_raw(self.contents.err) };
4592 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4593 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4594 let contents = if o.result_ok {
4595 let result = unsafe { o.contents.result };
4596 unsafe { o.contents.result = core::ptr::null_mut() };
4597 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4599 let err = unsafe { o.contents.err };
4600 unsafe { o.contents.err = core::ptr::null_mut(); }
4601 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4605 result_ok: o.result_ok,
4609 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4610 fn clone(&self) -> Self {
4612 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4613 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4616 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4617 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4623 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4624 /// but with all dynamically-allocated buffers duplicated in new buffers.
4625 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4627 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4628 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4629 /// A pointer to the contents in the success state.
4630 /// Reading from this pointer when `result_ok` is not set is undefined.
4631 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4632 /// A pointer to the contents in the error state.
4633 /// Reading from this pointer when `result_ok` is set is undefined.
4634 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4637 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4638 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4640 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4641 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4642 /// `err` or `result` depending on the state of `result_ok`.
4643 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4644 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4645 pub result_ok: bool,
4648 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4649 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4650 CResult_SpendableOutputDescriptorDecodeErrorZ {
4651 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4652 result: Box::into_raw(Box::new(o)),
4658 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4659 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4660 CResult_SpendableOutputDescriptorDecodeErrorZ {
4661 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4662 err: Box::into_raw(Box::new(e)),
4667 /// Checks if the given object is currently in the success state
4669 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4673 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4674 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4675 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4676 fn drop(&mut self) {
4678 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4679 let _ = unsafe { Box::from_raw(self.contents.result) };
4682 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4683 let _ = unsafe { Box::from_raw(self.contents.err) };
4688 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4689 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4690 let contents = if o.result_ok {
4691 let result = unsafe { o.contents.result };
4692 unsafe { o.contents.result = core::ptr::null_mut() };
4693 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4695 let err = unsafe { o.contents.err };
4696 unsafe { o.contents.err = core::ptr::null_mut(); }
4697 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4701 result_ok: o.result_ok,
4705 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4706 fn clone(&self) -> Self {
4708 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4709 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4712 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4713 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4719 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4720 /// but with all dynamically-allocated buffers duplicated in new buffers.
4721 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4723 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4724 /// This corresponds to std::vector in C++
4725 pub struct CVec_PaymentPreimageZ {
4726 /// The elements in the array.
4727 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4728 pub data: *mut crate::c_types::ThirtyTwoBytes,
4729 /// The number of elements pointed to by `data`.
4732 impl CVec_PaymentPreimageZ {
4733 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4734 if self.datalen == 0 { return Vec::new(); }
4735 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4736 self.data = core::ptr::null_mut();
4740 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4741 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4744 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4745 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4746 let datalen = v.len();
4747 let data = Box::into_raw(v.into_boxed_slice());
4748 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4752 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4753 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4754 impl Drop for CVec_PaymentPreimageZ {
4755 fn drop(&mut self) {
4756 if self.datalen == 0 { return; }
4757 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4760 impl Clone for CVec_PaymentPreimageZ {
4761 fn clone(&self) -> Self {
4762 let mut res = Vec::new();
4763 if self.datalen == 0 { return Self::from(res); }
4764 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4769 /// A tuple of 2 elements. See the individual fields for the types contained.
4770 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4771 /// The element at position 0
4772 pub a: crate::c_types::Signature,
4773 /// The element at position 1
4774 pub b: crate::c_types::derived::CVec_SignatureZ,
4776 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4777 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4784 impl C2Tuple_SignatureCVec_SignatureZZ {
4785 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4789 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4790 fn clone(&self) -> Self {
4792 a: Clone::clone(&self.a),
4793 b: Clone::clone(&self.b),
4798 /// Creates a new tuple which has the same data as `orig`
4799 /// but with all dynamically-allocated buffers duplicated in new buffers.
4800 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4801 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4803 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4804 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4808 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4809 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4811 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4812 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4813 /// A pointer to the contents in the success state.
4814 /// Reading from this pointer when `result_ok` is not set is undefined.
4815 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4816 /// Note that this value is always NULL, as there are no contents in the Err variant
4817 pub err: *mut core::ffi::c_void,
4820 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4821 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4822 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4823 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4824 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4825 /// `err` or `result` depending on the state of `result_ok`.
4826 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4827 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4828 pub result_ok: bool,
4831 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4832 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4833 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4834 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4835 result: Box::into_raw(Box::new(o)),
4841 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4842 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4843 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4844 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4845 err: core::ptr::null_mut(),
4850 /// Checks if the given object is currently in the success state
4852 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4856 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4857 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4858 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4859 fn drop(&mut self) {
4861 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4862 let _ = unsafe { Box::from_raw(self.contents.result) };
4868 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4869 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4870 let contents = if o.result_ok {
4871 let result = unsafe { o.contents.result };
4872 unsafe { o.contents.result = core::ptr::null_mut() };
4873 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4875 let _ = unsafe { Box::from_raw(o.contents.err) };
4876 o.contents.err = core::ptr::null_mut();
4877 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4881 result_ok: o.result_ok,
4885 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4886 fn clone(&self) -> Self {
4888 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4889 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4892 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4893 err: core::ptr::null_mut()
4899 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4900 /// but with all dynamically-allocated buffers duplicated in new buffers.
4901 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4903 /// The contents of CResult_SignatureNoneZ
4904 pub union CResult_SignatureNoneZPtr {
4905 /// A pointer to the contents in the success state.
4906 /// Reading from this pointer when `result_ok` is not set is undefined.
4907 pub result: *mut crate::c_types::Signature,
4908 /// Note that this value is always NULL, as there are no contents in the Err variant
4909 pub err: *mut core::ffi::c_void,
4912 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4913 /// containing a crate::c_types::Signature on success and a () on failure.
4914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4915 pub struct CResult_SignatureNoneZ {
4916 /// The contents of this CResult_SignatureNoneZ, accessible via either
4917 /// `err` or `result` depending on the state of `result_ok`.
4918 pub contents: CResult_SignatureNoneZPtr,
4919 /// Whether this CResult_SignatureNoneZ represents a success state.
4920 pub result_ok: bool,
4923 /// Creates a new CResult_SignatureNoneZ in the success state.
4924 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4925 CResult_SignatureNoneZ {
4926 contents: CResult_SignatureNoneZPtr {
4927 result: Box::into_raw(Box::new(o)),
4933 /// Creates a new CResult_SignatureNoneZ in the error state.
4934 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4935 CResult_SignatureNoneZ {
4936 contents: CResult_SignatureNoneZPtr {
4937 err: core::ptr::null_mut(),
4942 /// Checks if the given object is currently in the success state
4944 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4948 /// Frees any resources used by the CResult_SignatureNoneZ.
4949 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4950 impl Drop for CResult_SignatureNoneZ {
4951 fn drop(&mut self) {
4953 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4954 let _ = unsafe { Box::from_raw(self.contents.result) };
4960 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4961 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4962 let contents = if o.result_ok {
4963 let result = unsafe { o.contents.result };
4964 unsafe { o.contents.result = core::ptr::null_mut() };
4965 CResult_SignatureNoneZPtr { result }
4967 let _ = unsafe { Box::from_raw(o.contents.err) };
4968 o.contents.err = core::ptr::null_mut();
4969 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
4973 result_ok: o.result_ok,
4977 impl Clone for CResult_SignatureNoneZ {
4978 fn clone(&self) -> Self {
4980 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4981 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4984 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4985 err: core::ptr::null_mut()
4991 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4992 /// but with all dynamically-allocated buffers duplicated in new buffers.
4993 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4995 /// A tuple of 2 elements. See the individual fields for the types contained.
4996 pub struct C2Tuple_SignatureSignatureZ {
4997 /// The element at position 0
4998 pub a: crate::c_types::Signature,
4999 /// The element at position 1
5000 pub b: crate::c_types::Signature,
5002 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
5003 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
5010 impl C2Tuple_SignatureSignatureZ {
5011 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
5015 impl Clone for C2Tuple_SignatureSignatureZ {
5016 fn clone(&self) -> Self {
5018 a: Clone::clone(&self.a),
5019 b: Clone::clone(&self.b),
5024 /// Creates a new tuple which has the same data as `orig`
5025 /// but with all dynamically-allocated buffers duplicated in new buffers.
5026 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
5027 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
5029 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
5030 C2Tuple_SignatureSignatureZ { a, b, }
5034 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
5035 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
5037 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
5038 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5039 /// A pointer to the contents in the success state.
5040 /// Reading from this pointer when `result_ok` is not set is undefined.
5041 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
5042 /// Note that this value is always NULL, as there are no contents in the Err variant
5043 pub err: *mut core::ffi::c_void,
5046 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
5047 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
5048 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5049 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
5050 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
5051 /// `err` or `result` depending on the state of `result_ok`.
5052 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
5053 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
5054 pub result_ok: bool,
5057 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
5058 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5059 CResult_C2Tuple_SignatureSignatureZNoneZ {
5060 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5061 result: Box::into_raw(Box::new(o)),
5067 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
5068 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5069 CResult_C2Tuple_SignatureSignatureZNoneZ {
5070 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5071 err: core::ptr::null_mut(),
5076 /// Checks if the given object is currently in the success state
5078 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
5082 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
5083 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
5084 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
5085 fn drop(&mut self) {
5087 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5088 let _ = unsafe { Box::from_raw(self.contents.result) };
5094 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
5095 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5096 let contents = if o.result_ok {
5097 let result = unsafe { o.contents.result };
5098 unsafe { o.contents.result = core::ptr::null_mut() };
5099 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5101 let _ = unsafe { Box::from_raw(o.contents.err) };
5102 o.contents.err = core::ptr::null_mut();
5103 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5107 result_ok: o.result_ok,
5111 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5112 fn clone(&self) -> Self {
5114 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5115 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5118 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5119 err: core::ptr::null_mut()
5125 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5126 /// but with all dynamically-allocated buffers duplicated in new buffers.
5127 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5129 /// The contents of CResult_SecretKeyNoneZ
5130 pub union CResult_SecretKeyNoneZPtr {
5131 /// A pointer to the contents in the success state.
5132 /// Reading from this pointer when `result_ok` is not set is undefined.
5133 pub result: *mut crate::c_types::SecretKey,
5134 /// Note that this value is always NULL, as there are no contents in the Err variant
5135 pub err: *mut core::ffi::c_void,
5138 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5139 /// containing a crate::c_types::SecretKey on success and a () on failure.
5140 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5141 pub struct CResult_SecretKeyNoneZ {
5142 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5143 /// `err` or `result` depending on the state of `result_ok`.
5144 pub contents: CResult_SecretKeyNoneZPtr,
5145 /// Whether this CResult_SecretKeyNoneZ represents a success state.
5146 pub result_ok: bool,
5149 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5150 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5151 CResult_SecretKeyNoneZ {
5152 contents: CResult_SecretKeyNoneZPtr {
5153 result: Box::into_raw(Box::new(o)),
5159 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5160 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5161 CResult_SecretKeyNoneZ {
5162 contents: CResult_SecretKeyNoneZPtr {
5163 err: core::ptr::null_mut(),
5168 /// Checks if the given object is currently in the success state
5170 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5174 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5175 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5176 impl Drop for CResult_SecretKeyNoneZ {
5177 fn drop(&mut self) {
5179 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5180 let _ = unsafe { Box::from_raw(self.contents.result) };
5186 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5187 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5188 let contents = if o.result_ok {
5189 let result = unsafe { o.contents.result };
5190 unsafe { o.contents.result = core::ptr::null_mut() };
5191 CResult_SecretKeyNoneZPtr { result }
5193 let _ = unsafe { Box::from_raw(o.contents.err) };
5194 o.contents.err = core::ptr::null_mut();
5195 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5199 result_ok: o.result_ok,
5203 impl Clone for CResult_SecretKeyNoneZ {
5204 fn clone(&self) -> Self {
5206 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
5207 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
5210 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
5211 err: core::ptr::null_mut()
5217 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
5218 /// but with all dynamically-allocated buffers duplicated in new buffers.
5219 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
5221 /// The contents of CResult_SignDecodeErrorZ
5222 pub union CResult_SignDecodeErrorZPtr {
5223 /// A pointer to the contents in the success state.
5224 /// Reading from this pointer when `result_ok` is not set is undefined.
5225 pub result: *mut crate::lightning::chain::keysinterface::Sign,
5226 /// A pointer to the contents in the error state.
5227 /// Reading from this pointer when `result_ok` is set is undefined.
5228 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5231 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5232 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5234 pub struct CResult_SignDecodeErrorZ {
5235 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5236 /// `err` or `result` depending on the state of `result_ok`.
5237 pub contents: CResult_SignDecodeErrorZPtr,
5238 /// Whether this CResult_SignDecodeErrorZ represents a success state.
5239 pub result_ok: bool,
5242 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5243 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5244 CResult_SignDecodeErrorZ {
5245 contents: CResult_SignDecodeErrorZPtr {
5246 result: Box::into_raw(Box::new(o)),
5252 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5253 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5254 CResult_SignDecodeErrorZ {
5255 contents: CResult_SignDecodeErrorZPtr {
5256 err: Box::into_raw(Box::new(e)),
5261 /// Checks if the given object is currently in the success state
5263 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5267 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5268 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5269 impl Drop for CResult_SignDecodeErrorZ {
5270 fn drop(&mut self) {
5272 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5273 let _ = unsafe { Box::from_raw(self.contents.result) };
5276 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5277 let _ = unsafe { Box::from_raw(self.contents.err) };
5282 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5283 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5284 let contents = if o.result_ok {
5285 let result = unsafe { o.contents.result };
5286 unsafe { o.contents.result = core::ptr::null_mut() };
5287 CResult_SignDecodeErrorZPtr { result }
5289 let err = unsafe { o.contents.err };
5290 unsafe { o.contents.err = core::ptr::null_mut(); }
5291 CResult_SignDecodeErrorZPtr { err }
5295 result_ok: o.result_ok,
5299 impl Clone for CResult_SignDecodeErrorZ {
5300 fn clone(&self) -> Self {
5302 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5303 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5306 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5307 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5313 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5314 /// but with all dynamically-allocated buffers duplicated in new buffers.
5315 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5317 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5318 /// This corresponds to std::vector in C++
5319 pub struct CVec_u5Z {
5320 /// The elements in the array.
5321 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5322 pub data: *mut crate::c_types::u5,
5323 /// The number of elements pointed to by `data`.
5327 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5328 if self.datalen == 0 { return Vec::new(); }
5329 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5330 self.data = core::ptr::null_mut();
5334 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5335 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5338 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5339 fn from(v: Vec<crate::c_types::u5>) -> Self {
5340 let datalen = v.len();
5341 let data = Box::into_raw(v.into_boxed_slice());
5342 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5346 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5347 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5348 impl Drop for CVec_u5Z {
5349 fn drop(&mut self) {
5350 if self.datalen == 0 { return; }
5351 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5354 impl Clone for CVec_u5Z {
5355 fn clone(&self) -> Self {
5356 let mut res = Vec::new();
5357 if self.datalen == 0 { return Self::from(res); }
5358 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5363 /// The contents of CResult_RecoverableSignatureNoneZ
5364 pub union CResult_RecoverableSignatureNoneZPtr {
5365 /// A pointer to the contents in the success state.
5366 /// Reading from this pointer when `result_ok` is not set is undefined.
5367 pub result: *mut crate::c_types::RecoverableSignature,
5368 /// Note that this value is always NULL, as there are no contents in the Err variant
5369 pub err: *mut core::ffi::c_void,
5372 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5373 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5375 pub struct CResult_RecoverableSignatureNoneZ {
5376 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5377 /// `err` or `result` depending on the state of `result_ok`.
5378 pub contents: CResult_RecoverableSignatureNoneZPtr,
5379 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5380 pub result_ok: bool,
5383 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5384 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5385 CResult_RecoverableSignatureNoneZ {
5386 contents: CResult_RecoverableSignatureNoneZPtr {
5387 result: Box::into_raw(Box::new(o)),
5393 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5394 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5395 CResult_RecoverableSignatureNoneZ {
5396 contents: CResult_RecoverableSignatureNoneZPtr {
5397 err: core::ptr::null_mut(),
5402 /// Checks if the given object is currently in the success state
5404 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5408 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5409 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5410 impl Drop for CResult_RecoverableSignatureNoneZ {
5411 fn drop(&mut self) {
5413 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5414 let _ = unsafe { Box::from_raw(self.contents.result) };
5420 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5421 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5422 let contents = if o.result_ok {
5423 let result = unsafe { o.contents.result };
5424 unsafe { o.contents.result = core::ptr::null_mut() };
5425 CResult_RecoverableSignatureNoneZPtr { result }
5427 let _ = unsafe { Box::from_raw(o.contents.err) };
5428 o.contents.err = core::ptr::null_mut();
5429 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5433 result_ok: o.result_ok,
5437 impl Clone for CResult_RecoverableSignatureNoneZ {
5438 fn clone(&self) -> Self {
5440 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5441 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5444 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5445 err: core::ptr::null_mut()
5451 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5452 /// but with all dynamically-allocated buffers duplicated in new buffers.
5453 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5455 /// A dynamically-allocated array of u8s of arbitrary size.
5456 /// This corresponds to std::vector in C++
5457 pub struct CVec_u8Z {
5458 /// The elements in the array.
5459 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5461 /// The number of elements pointed to by `data`.
5465 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5466 if self.datalen == 0 { return Vec::new(); }
5467 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5468 self.data = core::ptr::null_mut();
5472 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5473 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5476 impl From<Vec<u8>> for CVec_u8Z {
5477 fn from(v: Vec<u8>) -> Self {
5478 let datalen = v.len();
5479 let data = Box::into_raw(v.into_boxed_slice());
5480 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5484 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5485 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5486 impl Drop for CVec_u8Z {
5487 fn drop(&mut self) {
5488 if self.datalen == 0 { return; }
5489 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5492 impl Clone for CVec_u8Z {
5493 fn clone(&self) -> Self {
5494 let mut res = Vec::new();
5495 if self.datalen == 0 { return Self::from(res); }
5496 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5501 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5502 /// This corresponds to std::vector in C++
5503 pub struct CVec_CVec_u8ZZ {
5504 /// The elements in the array.
5505 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5506 pub data: *mut crate::c_types::derived::CVec_u8Z,
5507 /// The number of elements pointed to by `data`.
5510 impl CVec_CVec_u8ZZ {
5511 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5512 if self.datalen == 0 { return Vec::new(); }
5513 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5514 self.data = core::ptr::null_mut();
5518 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5519 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5522 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5523 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5524 let datalen = v.len();
5525 let data = Box::into_raw(v.into_boxed_slice());
5526 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5530 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5531 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5532 impl Drop for CVec_CVec_u8ZZ {
5533 fn drop(&mut self) {
5534 if self.datalen == 0 { return; }
5535 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5538 impl Clone for CVec_CVec_u8ZZ {
5539 fn clone(&self) -> Self {
5540 let mut res = Vec::new();
5541 if self.datalen == 0 { return Self::from(res); }
5542 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5547 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5548 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5549 /// A pointer to the contents in the success state.
5550 /// Reading from this pointer when `result_ok` is not set is undefined.
5551 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5552 /// Note that this value is always NULL, as there are no contents in the Err variant
5553 pub err: *mut core::ffi::c_void,
5556 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5557 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5559 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5560 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5561 /// `err` or `result` depending on the state of `result_ok`.
5562 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5563 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5564 pub result_ok: bool,
5567 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5568 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5569 CResult_CVec_CVec_u8ZZNoneZ {
5570 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5571 result: Box::into_raw(Box::new(o)),
5577 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5578 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5579 CResult_CVec_CVec_u8ZZNoneZ {
5580 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5581 err: core::ptr::null_mut(),
5586 /// Checks if the given object is currently in the success state
5588 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5592 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5593 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5594 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5595 fn drop(&mut self) {
5597 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5598 let _ = unsafe { Box::from_raw(self.contents.result) };
5604 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5605 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5606 let contents = if o.result_ok {
5607 let result = unsafe { o.contents.result };
5608 unsafe { o.contents.result = core::ptr::null_mut() };
5609 CResult_CVec_CVec_u8ZZNoneZPtr { result }
5611 let _ = unsafe { Box::from_raw(o.contents.err) };
5612 o.contents.err = core::ptr::null_mut();
5613 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5617 result_ok: o.result_ok,
5621 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5622 fn clone(&self) -> Self {
5624 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5625 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5628 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5629 err: core::ptr::null_mut()
5635 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5636 /// but with all dynamically-allocated buffers duplicated in new buffers.
5637 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5639 /// The contents of CResult_InMemorySignerDecodeErrorZ
5640 pub union CResult_InMemorySignerDecodeErrorZPtr {
5641 /// A pointer to the contents in the success state.
5642 /// Reading from this pointer when `result_ok` is not set is undefined.
5643 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5644 /// A pointer to the contents in the error state.
5645 /// Reading from this pointer when `result_ok` is set is undefined.
5646 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5649 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5650 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5652 pub struct CResult_InMemorySignerDecodeErrorZ {
5653 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5654 /// `err` or `result` depending on the state of `result_ok`.
5655 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5656 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5657 pub result_ok: bool,
5660 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5661 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5662 CResult_InMemorySignerDecodeErrorZ {
5663 contents: CResult_InMemorySignerDecodeErrorZPtr {
5664 result: Box::into_raw(Box::new(o)),
5670 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5671 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5672 CResult_InMemorySignerDecodeErrorZ {
5673 contents: CResult_InMemorySignerDecodeErrorZPtr {
5674 err: Box::into_raw(Box::new(e)),
5679 /// Checks if the given object is currently in the success state
5681 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5685 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5686 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5687 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5688 fn drop(&mut self) {
5690 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5691 let _ = unsafe { Box::from_raw(self.contents.result) };
5694 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5695 let _ = unsafe { Box::from_raw(self.contents.err) };
5700 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5701 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5702 let contents = if o.result_ok {
5703 let result = unsafe { o.contents.result };
5704 unsafe { o.contents.result = core::ptr::null_mut() };
5705 CResult_InMemorySignerDecodeErrorZPtr { result }
5707 let err = unsafe { o.contents.err };
5708 unsafe { o.contents.err = core::ptr::null_mut(); }
5709 CResult_InMemorySignerDecodeErrorZPtr { err }
5713 result_ok: o.result_ok,
5717 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5718 fn clone(&self) -> Self {
5720 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5721 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5724 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5725 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5731 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5732 /// but with all dynamically-allocated buffers duplicated in new buffers.
5733 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5735 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5736 /// This corresponds to std::vector in C++
5737 pub struct CVec_TxOutZ {
5738 /// The elements in the array.
5739 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5740 pub data: *mut crate::c_types::TxOut,
5741 /// The number of elements pointed to by `data`.
5745 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5746 if self.datalen == 0 { return Vec::new(); }
5747 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5748 self.data = core::ptr::null_mut();
5752 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5753 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5756 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5757 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5758 let datalen = v.len();
5759 let data = Box::into_raw(v.into_boxed_slice());
5760 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5764 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5765 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5766 impl Drop for CVec_TxOutZ {
5767 fn drop(&mut self) {
5768 if self.datalen == 0 { return; }
5769 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5772 impl Clone for CVec_TxOutZ {
5773 fn clone(&self) -> Self {
5774 let mut res = Vec::new();
5775 if self.datalen == 0 { return Self::from(res); }
5776 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5781 /// The contents of CResult_TransactionNoneZ
5782 pub union CResult_TransactionNoneZPtr {
5783 /// A pointer to the contents in the success state.
5784 /// Reading from this pointer when `result_ok` is not set is undefined.
5785 pub result: *mut crate::c_types::Transaction,
5786 /// Note that this value is always NULL, as there are no contents in the Err variant
5787 pub err: *mut core::ffi::c_void,
5790 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5791 /// containing a crate::c_types::Transaction on success and a () on failure.
5792 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5793 pub struct CResult_TransactionNoneZ {
5794 /// The contents of this CResult_TransactionNoneZ, accessible via either
5795 /// `err` or `result` depending on the state of `result_ok`.
5796 pub contents: CResult_TransactionNoneZPtr,
5797 /// Whether this CResult_TransactionNoneZ represents a success state.
5798 pub result_ok: bool,
5801 /// Creates a new CResult_TransactionNoneZ in the success state.
5802 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5803 CResult_TransactionNoneZ {
5804 contents: CResult_TransactionNoneZPtr {
5805 result: Box::into_raw(Box::new(o)),
5811 /// Creates a new CResult_TransactionNoneZ in the error state.
5812 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5813 CResult_TransactionNoneZ {
5814 contents: CResult_TransactionNoneZPtr {
5815 err: core::ptr::null_mut(),
5820 /// Checks if the given object is currently in the success state
5822 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5826 /// Frees any resources used by the CResult_TransactionNoneZ.
5827 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5828 impl Drop for CResult_TransactionNoneZ {
5829 fn drop(&mut self) {
5831 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5832 let _ = unsafe { Box::from_raw(self.contents.result) };
5838 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5839 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5840 let contents = if o.result_ok {
5841 let result = unsafe { o.contents.result };
5842 unsafe { o.contents.result = core::ptr::null_mut() };
5843 CResult_TransactionNoneZPtr { result }
5845 let _ = unsafe { Box::from_raw(o.contents.err) };
5846 o.contents.err = core::ptr::null_mut();
5847 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5851 result_ok: o.result_ok,
5855 impl Clone for CResult_TransactionNoneZ {
5856 fn clone(&self) -> Self {
5858 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5859 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5862 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5863 err: core::ptr::null_mut()
5869 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5870 /// but with all dynamically-allocated buffers duplicated in new buffers.
5871 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5873 /// A tuple of 2 elements. See the individual fields for the types contained.
5874 pub struct C2Tuple_BlockHashChannelMonitorZ {
5875 /// The element at position 0
5876 pub a: crate::c_types::ThirtyTwoBytes,
5877 /// The element at position 1
5878 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5880 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5881 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5888 impl C2Tuple_BlockHashChannelMonitorZ {
5889 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5893 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5895 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5896 C2Tuple_BlockHashChannelMonitorZ { a, b, }
5900 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5901 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5903 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5904 /// This corresponds to std::vector in C++
5905 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5906 /// The elements in the array.
5907 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5908 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5909 /// The number of elements pointed to by `data`.
5912 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5913 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5914 if self.datalen == 0 { return Vec::new(); }
5915 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5916 self.data = core::ptr::null_mut();
5920 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5921 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5924 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5925 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5926 let datalen = v.len();
5927 let data = Box::into_raw(v.into_boxed_slice());
5928 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5932 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5933 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5934 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5935 fn drop(&mut self) {
5936 if self.datalen == 0 { return; }
5937 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5941 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5942 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5943 /// A pointer to the contents in the success state.
5944 /// Reading from this pointer when `result_ok` is not set is undefined.
5945 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5946 /// A pointer to the contents in the error state.
5947 /// Reading from this pointer when `result_ok` is set is undefined.
5948 pub err: *mut crate::c_types::IOError,
5951 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5952 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5953 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5954 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5955 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5956 /// `err` or `result` depending on the state of `result_ok`.
5957 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5958 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5959 pub result_ok: bool,
5962 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5963 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5964 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5965 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5966 result: Box::into_raw(Box::new(o)),
5972 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5973 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5974 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5975 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5976 err: Box::into_raw(Box::new(e)),
5981 /// Checks if the given object is currently in the success state
5983 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5987 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5988 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5989 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5990 fn drop(&mut self) {
5992 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5993 let _ = unsafe { Box::from_raw(self.contents.result) };
5996 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5997 let _ = unsafe { Box::from_raw(self.contents.err) };
6002 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6003 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
6004 let contents = if o.result_ok {
6005 let result = unsafe { o.contents.result };
6006 unsafe { o.contents.result = core::ptr::null_mut() };
6007 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
6009 let err = unsafe { o.contents.err };
6010 unsafe { o.contents.err = core::ptr::null_mut(); }
6011 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
6015 result_ok: o.result_ok,
6021 /// An enum which can either contain a u16 or not
6022 pub enum COption_u16Z {
6023 /// When we're in this state, this COption_u16Z contains a u16
6025 /// When we're in this state, this COption_u16Z contains nothing
6029 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6030 if let Self::None = self { false } else { true }
6032 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6035 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
6036 if let Self::Some(v) = self { v } else { unreachable!() }
6040 /// Constructs a new COption_u16Z containing a u16
6041 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
6042 COption_u16Z::Some(o)
6045 /// Constructs a new COption_u16Z containing nothing
6046 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
6050 /// Frees any resources associated with the u16, if we are in the Some state
6051 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
6053 /// Creates a new COption_u16Z which has the same data as `orig`
6054 /// but with all dynamically-allocated buffers duplicated in new buffers.
6055 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
6057 /// The contents of CResult_NoneAPIErrorZ
6058 pub union CResult_NoneAPIErrorZPtr {
6059 /// Note that this value is always NULL, as there are no contents in the OK variant
6060 pub result: *mut core::ffi::c_void,
6061 /// A pointer to the contents in the error state.
6062 /// Reading from this pointer when `result_ok` is set is undefined.
6063 pub err: *mut crate::lightning::util::errors::APIError,
6066 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6067 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
6068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6069 pub struct CResult_NoneAPIErrorZ {
6070 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
6071 /// `err` or `result` depending on the state of `result_ok`.
6072 pub contents: CResult_NoneAPIErrorZPtr,
6073 /// Whether this CResult_NoneAPIErrorZ represents a success state.
6074 pub result_ok: bool,
6077 /// Creates a new CResult_NoneAPIErrorZ in the success state.
6078 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
6079 CResult_NoneAPIErrorZ {
6080 contents: CResult_NoneAPIErrorZPtr {
6081 result: core::ptr::null_mut(),
6087 /// Creates a new CResult_NoneAPIErrorZ in the error state.
6088 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
6089 CResult_NoneAPIErrorZ {
6090 contents: CResult_NoneAPIErrorZPtr {
6091 err: Box::into_raw(Box::new(e)),
6096 /// Checks if the given object is currently in the success state
6098 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
6102 /// Frees any resources used by the CResult_NoneAPIErrorZ.
6103 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
6104 impl Drop for CResult_NoneAPIErrorZ {
6105 fn drop(&mut self) {
6108 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6109 let _ = unsafe { Box::from_raw(self.contents.err) };
6114 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6115 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6116 let contents = if o.result_ok {
6117 let _ = unsafe { Box::from_raw(o.contents.result) };
6118 o.contents.result = core::ptr::null_mut();
6119 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6121 let err = unsafe { o.contents.err };
6122 unsafe { o.contents.err = core::ptr::null_mut(); }
6123 CResult_NoneAPIErrorZPtr { err }
6127 result_ok: o.result_ok,
6131 impl Clone for CResult_NoneAPIErrorZ {
6132 fn clone(&self) -> Self {
6134 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6135 result: core::ptr::null_mut()
6138 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6139 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6145 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6146 /// but with all dynamically-allocated buffers duplicated in new buffers.
6147 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6149 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6150 /// This corresponds to std::vector in C++
6151 pub struct CVec_CResult_NoneAPIErrorZZ {
6152 /// The elements in the array.
6153 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6154 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6155 /// The number of elements pointed to by `data`.
6158 impl CVec_CResult_NoneAPIErrorZZ {
6159 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6160 if self.datalen == 0 { return Vec::new(); }
6161 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6162 self.data = core::ptr::null_mut();
6166 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6167 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6170 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6171 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6172 let datalen = v.len();
6173 let data = Box::into_raw(v.into_boxed_slice());
6174 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6178 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6179 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6180 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6181 fn drop(&mut self) {
6182 if self.datalen == 0 { return; }
6183 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6186 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6187 fn clone(&self) -> Self {
6188 let mut res = Vec::new();
6189 if self.datalen == 0 { return Self::from(res); }
6190 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6195 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6196 /// This corresponds to std::vector in C++
6197 pub struct CVec_APIErrorZ {
6198 /// The elements in the array.
6199 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6200 pub data: *mut crate::lightning::util::errors::APIError,
6201 /// The number of elements pointed to by `data`.
6204 impl CVec_APIErrorZ {
6205 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6206 if self.datalen == 0 { return Vec::new(); }
6207 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6208 self.data = core::ptr::null_mut();
6212 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6213 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6216 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6217 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6218 let datalen = v.len();
6219 let data = Box::into_raw(v.into_boxed_slice());
6220 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6224 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6225 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6226 impl Drop for CVec_APIErrorZ {
6227 fn drop(&mut self) {
6228 if self.datalen == 0 { return; }
6229 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6232 impl Clone for CVec_APIErrorZ {
6233 fn clone(&self) -> Self {
6234 let mut res = Vec::new();
6235 if self.datalen == 0 { return Self::from(res); }
6236 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6241 /// The contents of CResult__u832APIErrorZ
6242 pub union CResult__u832APIErrorZPtr {
6243 /// A pointer to the contents in the success state.
6244 /// Reading from this pointer when `result_ok` is not set is undefined.
6245 pub result: *mut crate::c_types::ThirtyTwoBytes,
6246 /// A pointer to the contents in the error state.
6247 /// Reading from this pointer when `result_ok` is set is undefined.
6248 pub err: *mut crate::lightning::util::errors::APIError,
6251 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6252 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6254 pub struct CResult__u832APIErrorZ {
6255 /// The contents of this CResult__u832APIErrorZ, accessible via either
6256 /// `err` or `result` depending on the state of `result_ok`.
6257 pub contents: CResult__u832APIErrorZPtr,
6258 /// Whether this CResult__u832APIErrorZ represents a success state.
6259 pub result_ok: bool,
6262 /// Creates a new CResult__u832APIErrorZ in the success state.
6263 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6264 CResult__u832APIErrorZ {
6265 contents: CResult__u832APIErrorZPtr {
6266 result: Box::into_raw(Box::new(o)),
6272 /// Creates a new CResult__u832APIErrorZ in the error state.
6273 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6274 CResult__u832APIErrorZ {
6275 contents: CResult__u832APIErrorZPtr {
6276 err: Box::into_raw(Box::new(e)),
6281 /// Checks if the given object is currently in the success state
6283 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6287 /// Frees any resources used by the CResult__u832APIErrorZ.
6288 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6289 impl Drop for CResult__u832APIErrorZ {
6290 fn drop(&mut self) {
6292 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6293 let _ = unsafe { Box::from_raw(self.contents.result) };
6296 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6297 let _ = unsafe { Box::from_raw(self.contents.err) };
6302 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6303 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6304 let contents = if o.result_ok {
6305 let result = unsafe { o.contents.result };
6306 unsafe { o.contents.result = core::ptr::null_mut() };
6307 CResult__u832APIErrorZPtr { result }
6309 let err = unsafe { o.contents.err };
6310 unsafe { o.contents.err = core::ptr::null_mut(); }
6311 CResult__u832APIErrorZPtr { err }
6315 result_ok: o.result_ok,
6319 impl Clone for CResult__u832APIErrorZ {
6320 fn clone(&self) -> Self {
6322 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6323 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6326 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6327 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6333 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6334 /// but with all dynamically-allocated buffers duplicated in new buffers.
6335 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6337 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6338 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6339 /// A pointer to the contents in the success state.
6340 /// Reading from this pointer when `result_ok` is not set is undefined.
6341 pub result: *mut crate::c_types::ThirtyTwoBytes,
6342 /// A pointer to the contents in the error state.
6343 /// Reading from this pointer when `result_ok` is set is undefined.
6344 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6347 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6348 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6350 pub struct CResult_PaymentIdPaymentSendFailureZ {
6351 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6352 /// `err` or `result` depending on the state of `result_ok`.
6353 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6354 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6355 pub result_ok: bool,
6358 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6359 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6360 CResult_PaymentIdPaymentSendFailureZ {
6361 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6362 result: Box::into_raw(Box::new(o)),
6368 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6369 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6370 CResult_PaymentIdPaymentSendFailureZ {
6371 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6372 err: Box::into_raw(Box::new(e)),
6377 /// Checks if the given object is currently in the success state
6379 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6383 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6384 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6385 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6386 fn drop(&mut self) {
6388 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6389 let _ = unsafe { Box::from_raw(self.contents.result) };
6392 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6393 let _ = unsafe { Box::from_raw(self.contents.err) };
6398 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6399 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6400 let contents = if o.result_ok {
6401 let result = unsafe { o.contents.result };
6402 unsafe { o.contents.result = core::ptr::null_mut() };
6403 CResult_PaymentIdPaymentSendFailureZPtr { result }
6405 let err = unsafe { o.contents.err };
6406 unsafe { o.contents.err = core::ptr::null_mut(); }
6407 CResult_PaymentIdPaymentSendFailureZPtr { err }
6411 result_ok: o.result_ok,
6415 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6416 fn clone(&self) -> Self {
6418 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6419 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6422 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6423 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6429 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6430 /// but with all dynamically-allocated buffers duplicated in new buffers.
6431 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6433 /// The contents of CResult_NonePaymentSendFailureZ
6434 pub union CResult_NonePaymentSendFailureZPtr {
6435 /// Note that this value is always NULL, as there are no contents in the OK variant
6436 pub result: *mut core::ffi::c_void,
6437 /// A pointer to the contents in the error state.
6438 /// Reading from this pointer when `result_ok` is set is undefined.
6439 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6442 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6443 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6444 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6445 pub struct CResult_NonePaymentSendFailureZ {
6446 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6447 /// `err` or `result` depending on the state of `result_ok`.
6448 pub contents: CResult_NonePaymentSendFailureZPtr,
6449 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6450 pub result_ok: bool,
6453 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6454 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6455 CResult_NonePaymentSendFailureZ {
6456 contents: CResult_NonePaymentSendFailureZPtr {
6457 result: core::ptr::null_mut(),
6463 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6464 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6465 CResult_NonePaymentSendFailureZ {
6466 contents: CResult_NonePaymentSendFailureZPtr {
6467 err: Box::into_raw(Box::new(e)),
6472 /// Checks if the given object is currently in the success state
6474 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6478 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6479 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6480 impl Drop for CResult_NonePaymentSendFailureZ {
6481 fn drop(&mut self) {
6484 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6485 let _ = unsafe { Box::from_raw(self.contents.err) };
6490 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6491 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6492 let contents = if o.result_ok {
6493 let _ = unsafe { Box::from_raw(o.contents.result) };
6494 o.contents.result = core::ptr::null_mut();
6495 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6497 let err = unsafe { o.contents.err };
6498 unsafe { o.contents.err = core::ptr::null_mut(); }
6499 CResult_NonePaymentSendFailureZPtr { err }
6503 result_ok: o.result_ok,
6507 impl Clone for CResult_NonePaymentSendFailureZ {
6508 fn clone(&self) -> Self {
6510 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6511 result: core::ptr::null_mut()
6514 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6515 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6521 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6522 /// but with all dynamically-allocated buffers duplicated in new buffers.
6523 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6525 /// A tuple of 2 elements. See the individual fields for the types contained.
6526 pub struct C2Tuple_PaymentHashPaymentIdZ {
6527 /// The element at position 0
6528 pub a: crate::c_types::ThirtyTwoBytes,
6529 /// The element at position 1
6530 pub b: crate::c_types::ThirtyTwoBytes,
6532 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6533 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6540 impl C2Tuple_PaymentHashPaymentIdZ {
6541 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6545 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6546 fn clone(&self) -> Self {
6548 a: Clone::clone(&self.a),
6549 b: Clone::clone(&self.b),
6554 /// Creates a new tuple which has the same data as `orig`
6555 /// but with all dynamically-allocated buffers duplicated in new buffers.
6556 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6557 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6559 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6560 C2Tuple_PaymentHashPaymentIdZ { a, b, }
6564 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6565 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6567 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6568 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6569 /// A pointer to the contents in the success state.
6570 /// Reading from this pointer when `result_ok` is not set is undefined.
6571 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6572 /// A pointer to the contents in the error state.
6573 /// Reading from this pointer when `result_ok` is set is undefined.
6574 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6577 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6578 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6579 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6580 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6581 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6582 /// `err` or `result` depending on the state of `result_ok`.
6583 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6584 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6585 pub result_ok: bool,
6588 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6589 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6590 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6591 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6592 result: Box::into_raw(Box::new(o)),
6598 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6599 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6600 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6601 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6602 err: Box::into_raw(Box::new(e)),
6607 /// Checks if the given object is currently in the success state
6609 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6613 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6614 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6615 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6616 fn drop(&mut self) {
6618 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6619 let _ = unsafe { Box::from_raw(self.contents.result) };
6622 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6623 let _ = unsafe { Box::from_raw(self.contents.err) };
6628 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6629 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6630 let contents = if o.result_ok {
6631 let result = unsafe { o.contents.result };
6632 unsafe { o.contents.result = core::ptr::null_mut() };
6633 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6635 let err = unsafe { o.contents.err };
6636 unsafe { o.contents.err = core::ptr::null_mut(); }
6637 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6641 result_ok: o.result_ok,
6645 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6646 fn clone(&self) -> Self {
6648 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6649 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6652 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6653 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6659 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6660 /// but with all dynamically-allocated buffers duplicated in new buffers.
6661 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6663 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6664 /// This corresponds to std::vector in C++
6665 pub struct CVec_NetAddressZ {
6666 /// The elements in the array.
6667 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6668 pub data: *mut crate::lightning::ln::msgs::NetAddress,
6669 /// The number of elements pointed to by `data`.
6672 impl CVec_NetAddressZ {
6673 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6674 if self.datalen == 0 { return Vec::new(); }
6675 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6676 self.data = core::ptr::null_mut();
6680 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6681 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6684 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6685 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6686 let datalen = v.len();
6687 let data = Box::into_raw(v.into_boxed_slice());
6688 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6692 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6693 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6694 impl Drop for CVec_NetAddressZ {
6695 fn drop(&mut self) {
6696 if self.datalen == 0 { return; }
6697 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6700 impl Clone for CVec_NetAddressZ {
6701 fn clone(&self) -> Self {
6702 let mut res = Vec::new();
6703 if self.datalen == 0 { return Self::from(res); }
6704 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6709 /// A tuple of 2 elements. See the individual fields for the types contained.
6710 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6711 /// The element at position 0
6712 pub a: crate::c_types::ThirtyTwoBytes,
6713 /// The element at position 1
6714 pub b: crate::c_types::ThirtyTwoBytes,
6716 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6717 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6724 impl C2Tuple_PaymentHashPaymentSecretZ {
6725 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6729 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6730 fn clone(&self) -> Self {
6732 a: Clone::clone(&self.a),
6733 b: Clone::clone(&self.b),
6738 /// Creates a new tuple which has the same data as `orig`
6739 /// but with all dynamically-allocated buffers duplicated in new buffers.
6740 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6741 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6743 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6744 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6748 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6749 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6751 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6752 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6753 /// A pointer to the contents in the success state.
6754 /// Reading from this pointer when `result_ok` is not set is undefined.
6755 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6756 /// Note that this value is always NULL, as there are no contents in the Err variant
6757 pub err: *mut core::ffi::c_void,
6760 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6761 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6762 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6763 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6764 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6765 /// `err` or `result` depending on the state of `result_ok`.
6766 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6767 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6768 pub result_ok: bool,
6771 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6772 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6773 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6774 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6775 result: Box::into_raw(Box::new(o)),
6781 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6782 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6783 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6784 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6785 err: core::ptr::null_mut(),
6790 /// Checks if the given object is currently in the success state
6792 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6796 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6797 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6798 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6799 fn drop(&mut self) {
6801 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6802 let _ = unsafe { Box::from_raw(self.contents.result) };
6808 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6809 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6810 let contents = if o.result_ok {
6811 let result = unsafe { o.contents.result };
6812 unsafe { o.contents.result = core::ptr::null_mut() };
6813 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6815 let _ = unsafe { Box::from_raw(o.contents.err) };
6816 o.contents.err = core::ptr::null_mut();
6817 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6821 result_ok: o.result_ok,
6825 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6826 fn clone(&self) -> Self {
6828 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6829 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6832 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6833 err: core::ptr::null_mut()
6839 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6840 /// but with all dynamically-allocated buffers duplicated in new buffers.
6841 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6843 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6844 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6845 /// A pointer to the contents in the success state.
6846 /// Reading from this pointer when `result_ok` is not set is undefined.
6847 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6848 /// A pointer to the contents in the error state.
6849 /// Reading from this pointer when `result_ok` is set is undefined.
6850 pub err: *mut crate::lightning::util::errors::APIError,
6853 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6854 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6856 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6857 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6858 /// `err` or `result` depending on the state of `result_ok`.
6859 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6860 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6861 pub result_ok: bool,
6864 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6865 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6866 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6867 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6868 result: Box::into_raw(Box::new(o)),
6874 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6875 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6876 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6877 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6878 err: Box::into_raw(Box::new(e)),
6883 /// Checks if the given object is currently in the success state
6885 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6889 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6890 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6891 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6892 fn drop(&mut self) {
6894 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6895 let _ = unsafe { Box::from_raw(self.contents.result) };
6898 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6899 let _ = unsafe { Box::from_raw(self.contents.err) };
6904 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6905 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6906 let contents = if o.result_ok {
6907 let result = unsafe { o.contents.result };
6908 unsafe { o.contents.result = core::ptr::null_mut() };
6909 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6911 let err = unsafe { o.contents.err };
6912 unsafe { o.contents.err = core::ptr::null_mut(); }
6913 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6917 result_ok: o.result_ok,
6921 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6922 fn clone(&self) -> Self {
6924 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6925 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6928 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6929 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6935 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6936 /// but with all dynamically-allocated buffers duplicated in new buffers.
6937 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6939 /// The contents of CResult_PaymentSecretNoneZ
6940 pub union CResult_PaymentSecretNoneZPtr {
6941 /// A pointer to the contents in the success state.
6942 /// Reading from this pointer when `result_ok` is not set is undefined.
6943 pub result: *mut crate::c_types::ThirtyTwoBytes,
6944 /// Note that this value is always NULL, as there are no contents in the Err variant
6945 pub err: *mut core::ffi::c_void,
6948 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6949 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6951 pub struct CResult_PaymentSecretNoneZ {
6952 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6953 /// `err` or `result` depending on the state of `result_ok`.
6954 pub contents: CResult_PaymentSecretNoneZPtr,
6955 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6956 pub result_ok: bool,
6959 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6960 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6961 CResult_PaymentSecretNoneZ {
6962 contents: CResult_PaymentSecretNoneZPtr {
6963 result: Box::into_raw(Box::new(o)),
6969 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6970 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6971 CResult_PaymentSecretNoneZ {
6972 contents: CResult_PaymentSecretNoneZPtr {
6973 err: core::ptr::null_mut(),
6978 /// Checks if the given object is currently in the success state
6980 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6984 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6985 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6986 impl Drop for CResult_PaymentSecretNoneZ {
6987 fn drop(&mut self) {
6989 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6990 let _ = unsafe { Box::from_raw(self.contents.result) };
6996 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6997 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6998 let contents = if o.result_ok {
6999 let result = unsafe { o.contents.result };
7000 unsafe { o.contents.result = core::ptr::null_mut() };
7001 CResult_PaymentSecretNoneZPtr { result }
7003 let _ = unsafe { Box::from_raw(o.contents.err) };
7004 o.contents.err = core::ptr::null_mut();
7005 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
7009 result_ok: o.result_ok,
7013 impl Clone for CResult_PaymentSecretNoneZ {
7014 fn clone(&self) -> Self {
7016 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
7017 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7020 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
7021 err: core::ptr::null_mut()
7027 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
7028 /// but with all dynamically-allocated buffers duplicated in new buffers.
7029 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
7031 /// The contents of CResult_PaymentSecretAPIErrorZ
7032 pub union CResult_PaymentSecretAPIErrorZPtr {
7033 /// A pointer to the contents in the success state.
7034 /// Reading from this pointer when `result_ok` is not set is undefined.
7035 pub result: *mut crate::c_types::ThirtyTwoBytes,
7036 /// A pointer to the contents in the error state.
7037 /// Reading from this pointer when `result_ok` is set is undefined.
7038 pub err: *mut crate::lightning::util::errors::APIError,
7041 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7042 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7044 pub struct CResult_PaymentSecretAPIErrorZ {
7045 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7046 /// `err` or `result` depending on the state of `result_ok`.
7047 pub contents: CResult_PaymentSecretAPIErrorZPtr,
7048 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7049 pub result_ok: bool,
7052 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
7053 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
7054 CResult_PaymentSecretAPIErrorZ {
7055 contents: CResult_PaymentSecretAPIErrorZPtr {
7056 result: Box::into_raw(Box::new(o)),
7062 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
7063 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
7064 CResult_PaymentSecretAPIErrorZ {
7065 contents: CResult_PaymentSecretAPIErrorZPtr {
7066 err: Box::into_raw(Box::new(e)),
7071 /// Checks if the given object is currently in the success state
7073 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
7077 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
7078 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
7079 impl Drop for CResult_PaymentSecretAPIErrorZ {
7080 fn drop(&mut self) {
7082 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7083 let _ = unsafe { Box::from_raw(self.contents.result) };
7086 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7087 let _ = unsafe { Box::from_raw(self.contents.err) };
7092 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
7093 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7094 let contents = if o.result_ok {
7095 let result = unsafe { o.contents.result };
7096 unsafe { o.contents.result = core::ptr::null_mut() };
7097 CResult_PaymentSecretAPIErrorZPtr { result }
7099 let err = unsafe { o.contents.err };
7100 unsafe { o.contents.err = core::ptr::null_mut(); }
7101 CResult_PaymentSecretAPIErrorZPtr { err }
7105 result_ok: o.result_ok,
7109 impl Clone for CResult_PaymentSecretAPIErrorZ {
7110 fn clone(&self) -> Self {
7112 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7113 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7116 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7117 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7123 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7124 /// but with all dynamically-allocated buffers duplicated in new buffers.
7125 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7127 /// The contents of CResult_PaymentPreimageAPIErrorZ
7128 pub union CResult_PaymentPreimageAPIErrorZPtr {
7129 /// A pointer to the contents in the success state.
7130 /// Reading from this pointer when `result_ok` is not set is undefined.
7131 pub result: *mut crate::c_types::ThirtyTwoBytes,
7132 /// A pointer to the contents in the error state.
7133 /// Reading from this pointer when `result_ok` is set is undefined.
7134 pub err: *mut crate::lightning::util::errors::APIError,
7137 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7138 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7139 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7140 pub struct CResult_PaymentPreimageAPIErrorZ {
7141 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7142 /// `err` or `result` depending on the state of `result_ok`.
7143 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7144 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7145 pub result_ok: bool,
7148 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7149 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7150 CResult_PaymentPreimageAPIErrorZ {
7151 contents: CResult_PaymentPreimageAPIErrorZPtr {
7152 result: Box::into_raw(Box::new(o)),
7158 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7159 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7160 CResult_PaymentPreimageAPIErrorZ {
7161 contents: CResult_PaymentPreimageAPIErrorZPtr {
7162 err: Box::into_raw(Box::new(e)),
7167 /// Checks if the given object is currently in the success state
7169 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7173 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7174 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7175 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7176 fn drop(&mut self) {
7178 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7179 let _ = unsafe { Box::from_raw(self.contents.result) };
7182 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7183 let _ = unsafe { Box::from_raw(self.contents.err) };
7188 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7189 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7190 let contents = if o.result_ok {
7191 let result = unsafe { o.contents.result };
7192 unsafe { o.contents.result = core::ptr::null_mut() };
7193 CResult_PaymentPreimageAPIErrorZPtr { result }
7195 let err = unsafe { o.contents.err };
7196 unsafe { o.contents.err = core::ptr::null_mut(); }
7197 CResult_PaymentPreimageAPIErrorZPtr { err }
7201 result_ok: o.result_ok,
7205 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7206 fn clone(&self) -> Self {
7208 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7209 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7212 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7213 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7219 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7220 /// but with all dynamically-allocated buffers duplicated in new buffers.
7221 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7223 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7224 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7225 /// A pointer to the contents in the success state.
7226 /// Reading from this pointer when `result_ok` is not set is undefined.
7227 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7228 /// A pointer to the contents in the error state.
7229 /// Reading from this pointer when `result_ok` is set is undefined.
7230 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7233 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7234 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7236 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7237 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7238 /// `err` or `result` depending on the state of `result_ok`.
7239 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7240 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7241 pub result_ok: bool,
7244 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7245 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7246 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7247 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7248 result: Box::into_raw(Box::new(o)),
7254 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7255 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7256 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7257 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7258 err: Box::into_raw(Box::new(e)),
7263 /// Checks if the given object is currently in the success state
7265 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7269 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7270 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7271 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7272 fn drop(&mut self) {
7274 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7275 let _ = unsafe { Box::from_raw(self.contents.result) };
7278 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7279 let _ = unsafe { Box::from_raw(self.contents.err) };
7284 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7285 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7286 let contents = if o.result_ok {
7287 let result = unsafe { o.contents.result };
7288 unsafe { o.contents.result = core::ptr::null_mut() };
7289 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7291 let err = unsafe { o.contents.err };
7292 unsafe { o.contents.err = core::ptr::null_mut(); }
7293 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7297 result_ok: o.result_ok,
7301 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7302 fn clone(&self) -> Self {
7304 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7305 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7308 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7309 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7315 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7316 /// but with all dynamically-allocated buffers duplicated in new buffers.
7317 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7319 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7320 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7321 /// A pointer to the contents in the success state.
7322 /// Reading from this pointer when `result_ok` is not set is undefined.
7323 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7324 /// A pointer to the contents in the error state.
7325 /// Reading from this pointer when `result_ok` is set is undefined.
7326 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7329 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7330 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7332 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7333 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7334 /// `err` or `result` depending on the state of `result_ok`.
7335 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7336 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7337 pub result_ok: bool,
7340 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7341 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7342 CResult_ChannelCounterpartyDecodeErrorZ {
7343 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7344 result: Box::into_raw(Box::new(o)),
7350 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7351 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7352 CResult_ChannelCounterpartyDecodeErrorZ {
7353 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7354 err: Box::into_raw(Box::new(e)),
7359 /// Checks if the given object is currently in the success state
7361 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7365 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7366 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7367 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7368 fn drop(&mut self) {
7370 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7371 let _ = unsafe { Box::from_raw(self.contents.result) };
7374 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7375 let _ = unsafe { Box::from_raw(self.contents.err) };
7380 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7381 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7382 let contents = if o.result_ok {
7383 let result = unsafe { o.contents.result };
7384 unsafe { o.contents.result = core::ptr::null_mut() };
7385 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7387 let err = unsafe { o.contents.err };
7388 unsafe { o.contents.err = core::ptr::null_mut(); }
7389 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7393 result_ok: o.result_ok,
7397 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7398 fn clone(&self) -> Self {
7400 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7401 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7404 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7405 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7411 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7412 /// but with all dynamically-allocated buffers duplicated in new buffers.
7413 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7415 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7416 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7417 /// A pointer to the contents in the success state.
7418 /// Reading from this pointer when `result_ok` is not set is undefined.
7419 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7420 /// A pointer to the contents in the error state.
7421 /// Reading from this pointer when `result_ok` is set is undefined.
7422 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7425 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7426 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7427 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7428 pub struct CResult_ChannelDetailsDecodeErrorZ {
7429 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7430 /// `err` or `result` depending on the state of `result_ok`.
7431 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7432 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7433 pub result_ok: bool,
7436 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7437 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7438 CResult_ChannelDetailsDecodeErrorZ {
7439 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7440 result: Box::into_raw(Box::new(o)),
7446 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7447 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7448 CResult_ChannelDetailsDecodeErrorZ {
7449 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7450 err: Box::into_raw(Box::new(e)),
7455 /// Checks if the given object is currently in the success state
7457 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7461 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7462 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7463 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7464 fn drop(&mut self) {
7466 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7467 let _ = unsafe { Box::from_raw(self.contents.result) };
7470 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7471 let _ = unsafe { Box::from_raw(self.contents.err) };
7476 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7477 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7478 let contents = if o.result_ok {
7479 let result = unsafe { o.contents.result };
7480 unsafe { o.contents.result = core::ptr::null_mut() };
7481 CResult_ChannelDetailsDecodeErrorZPtr { result }
7483 let err = unsafe { o.contents.err };
7484 unsafe { o.contents.err = core::ptr::null_mut(); }
7485 CResult_ChannelDetailsDecodeErrorZPtr { err }
7489 result_ok: o.result_ok,
7493 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7494 fn clone(&self) -> Self {
7496 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7497 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7500 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7501 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7507 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7508 /// but with all dynamically-allocated buffers duplicated in new buffers.
7509 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7511 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7512 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7513 /// A pointer to the contents in the success state.
7514 /// Reading from this pointer when `result_ok` is not set is undefined.
7515 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7516 /// A pointer to the contents in the error state.
7517 /// Reading from this pointer when `result_ok` is set is undefined.
7518 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7521 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7522 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7523 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7524 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7525 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7526 /// `err` or `result` depending on the state of `result_ok`.
7527 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7528 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7529 pub result_ok: bool,
7532 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7533 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7534 CResult_PhantomRouteHintsDecodeErrorZ {
7535 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7536 result: Box::into_raw(Box::new(o)),
7542 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7543 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7544 CResult_PhantomRouteHintsDecodeErrorZ {
7545 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7546 err: Box::into_raw(Box::new(e)),
7551 /// Checks if the given object is currently in the success state
7553 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7557 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7558 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7559 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7560 fn drop(&mut self) {
7562 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7563 let _ = unsafe { Box::from_raw(self.contents.result) };
7566 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7567 let _ = unsafe { Box::from_raw(self.contents.err) };
7572 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7573 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7574 let contents = if o.result_ok {
7575 let result = unsafe { o.contents.result };
7576 unsafe { o.contents.result = core::ptr::null_mut() };
7577 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7579 let err = unsafe { o.contents.err };
7580 unsafe { o.contents.err = core::ptr::null_mut(); }
7581 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7585 result_ok: o.result_ok,
7590 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7591 /// This corresponds to std::vector in C++
7592 pub struct CVec_ChannelMonitorZ {
7593 /// The elements in the array.
7594 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7595 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7596 /// The number of elements pointed to by `data`.
7599 impl CVec_ChannelMonitorZ {
7600 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7601 if self.datalen == 0 { return Vec::new(); }
7602 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7603 self.data = core::ptr::null_mut();
7607 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7608 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7611 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7612 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7613 let datalen = v.len();
7614 let data = Box::into_raw(v.into_boxed_slice());
7615 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7619 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7620 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7621 impl Drop for CVec_ChannelMonitorZ {
7622 fn drop(&mut self) {
7623 if self.datalen == 0 { return; }
7624 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7628 /// A tuple of 2 elements. See the individual fields for the types contained.
7629 pub struct C2Tuple_BlockHashChannelManagerZ {
7630 /// The element at position 0
7631 pub a: crate::c_types::ThirtyTwoBytes,
7632 /// The element at position 1
7633 pub b: crate::lightning::ln::channelmanager::ChannelManager,
7635 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7636 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7643 impl C2Tuple_BlockHashChannelManagerZ {
7644 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7648 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7650 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7651 C2Tuple_BlockHashChannelManagerZ { a, b, }
7655 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7656 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7658 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7659 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7660 /// A pointer to the contents in the success state.
7661 /// Reading from this pointer when `result_ok` is not set is undefined.
7662 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7663 /// A pointer to the contents in the error state.
7664 /// Reading from this pointer when `result_ok` is set is undefined.
7665 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7668 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7669 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7670 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7671 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7672 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7673 /// `err` or `result` depending on the state of `result_ok`.
7674 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7675 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7676 pub result_ok: bool,
7679 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7680 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7681 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7682 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7683 result: Box::into_raw(Box::new(o)),
7689 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7690 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7691 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7692 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7693 err: Box::into_raw(Box::new(e)),
7698 /// Checks if the given object is currently in the success state
7700 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7704 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7705 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7706 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7707 fn drop(&mut self) {
7709 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7710 let _ = unsafe { Box::from_raw(self.contents.result) };
7713 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7714 let _ = unsafe { Box::from_raw(self.contents.err) };
7719 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7720 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7721 let contents = if o.result_ok {
7722 let result = unsafe { o.contents.result };
7723 unsafe { o.contents.result = core::ptr::null_mut() };
7724 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7726 let err = unsafe { o.contents.err };
7727 unsafe { o.contents.err = core::ptr::null_mut(); }
7728 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7732 result_ok: o.result_ok,
7737 /// The contents of CResult_ChannelConfigDecodeErrorZ
7738 pub union CResult_ChannelConfigDecodeErrorZPtr {
7739 /// A pointer to the contents in the success state.
7740 /// Reading from this pointer when `result_ok` is not set is undefined.
7741 pub result: *mut crate::lightning::util::config::ChannelConfig,
7742 /// A pointer to the contents in the error state.
7743 /// Reading from this pointer when `result_ok` is set is undefined.
7744 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7747 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7748 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7749 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7750 pub struct CResult_ChannelConfigDecodeErrorZ {
7751 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7752 /// `err` or `result` depending on the state of `result_ok`.
7753 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7754 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7755 pub result_ok: bool,
7758 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7759 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7760 CResult_ChannelConfigDecodeErrorZ {
7761 contents: CResult_ChannelConfigDecodeErrorZPtr {
7762 result: Box::into_raw(Box::new(o)),
7768 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7769 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7770 CResult_ChannelConfigDecodeErrorZ {
7771 contents: CResult_ChannelConfigDecodeErrorZPtr {
7772 err: Box::into_raw(Box::new(e)),
7777 /// Checks if the given object is currently in the success state
7779 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7783 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7784 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7785 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7786 fn drop(&mut self) {
7788 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7789 let _ = unsafe { Box::from_raw(self.contents.result) };
7792 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7793 let _ = unsafe { Box::from_raw(self.contents.err) };
7798 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7799 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7800 let contents = if o.result_ok {
7801 let result = unsafe { o.contents.result };
7802 unsafe { o.contents.result = core::ptr::null_mut() };
7803 CResult_ChannelConfigDecodeErrorZPtr { result }
7805 let err = unsafe { o.contents.err };
7806 unsafe { o.contents.err = core::ptr::null_mut(); }
7807 CResult_ChannelConfigDecodeErrorZPtr { err }
7811 result_ok: o.result_ok,
7815 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7816 fn clone(&self) -> Self {
7818 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7819 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7822 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7823 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7829 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7830 /// but with all dynamically-allocated buffers duplicated in new buffers.
7831 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7833 /// The contents of CResult_OutPointDecodeErrorZ
7834 pub union CResult_OutPointDecodeErrorZPtr {
7835 /// A pointer to the contents in the success state.
7836 /// Reading from this pointer when `result_ok` is not set is undefined.
7837 pub result: *mut crate::lightning::chain::transaction::OutPoint,
7838 /// A pointer to the contents in the error state.
7839 /// Reading from this pointer when `result_ok` is set is undefined.
7840 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7843 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7844 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7845 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7846 pub struct CResult_OutPointDecodeErrorZ {
7847 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7848 /// `err` or `result` depending on the state of `result_ok`.
7849 pub contents: CResult_OutPointDecodeErrorZPtr,
7850 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7851 pub result_ok: bool,
7854 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7855 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7856 CResult_OutPointDecodeErrorZ {
7857 contents: CResult_OutPointDecodeErrorZPtr {
7858 result: Box::into_raw(Box::new(o)),
7864 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7865 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7866 CResult_OutPointDecodeErrorZ {
7867 contents: CResult_OutPointDecodeErrorZPtr {
7868 err: Box::into_raw(Box::new(e)),
7873 /// Checks if the given object is currently in the success state
7875 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7879 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7880 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7881 impl Drop for CResult_OutPointDecodeErrorZ {
7882 fn drop(&mut self) {
7884 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7885 let _ = unsafe { Box::from_raw(self.contents.result) };
7888 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7889 let _ = unsafe { Box::from_raw(self.contents.err) };
7894 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7895 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7896 let contents = if o.result_ok {
7897 let result = unsafe { o.contents.result };
7898 unsafe { o.contents.result = core::ptr::null_mut() };
7899 CResult_OutPointDecodeErrorZPtr { result }
7901 let err = unsafe { o.contents.err };
7902 unsafe { o.contents.err = core::ptr::null_mut(); }
7903 CResult_OutPointDecodeErrorZPtr { err }
7907 result_ok: o.result_ok,
7911 impl Clone for CResult_OutPointDecodeErrorZ {
7912 fn clone(&self) -> Self {
7914 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7915 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7918 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7919 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7925 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7926 /// but with all dynamically-allocated buffers duplicated in new buffers.
7927 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7929 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7930 pub enum COption_TypeZ {
7931 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7932 Some(crate::lightning::ln::wire::Type),
7933 /// When we're in this state, this COption_TypeZ contains nothing
7936 impl COption_TypeZ {
7937 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7938 if let Self::None = self { false } else { true }
7940 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7943 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7944 if let Self::Some(v) = self { v } else { unreachable!() }
7948 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7949 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7950 COption_TypeZ::Some(o)
7953 /// Constructs a new COption_TypeZ containing nothing
7954 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7958 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
7959 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
7961 /// The contents of CResult_COption_TypeZDecodeErrorZ
7962 pub union CResult_COption_TypeZDecodeErrorZPtr {
7963 /// A pointer to the contents in the success state.
7964 /// Reading from this pointer when `result_ok` is not set is undefined.
7965 pub result: *mut crate::c_types::derived::COption_TypeZ,
7966 /// A pointer to the contents in the error state.
7967 /// Reading from this pointer when `result_ok` is set is undefined.
7968 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7971 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7972 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7974 pub struct CResult_COption_TypeZDecodeErrorZ {
7975 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7976 /// `err` or `result` depending on the state of `result_ok`.
7977 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
7978 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7979 pub result_ok: bool,
7982 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
7983 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
7984 CResult_COption_TypeZDecodeErrorZ {
7985 contents: CResult_COption_TypeZDecodeErrorZPtr {
7986 result: Box::into_raw(Box::new(o)),
7992 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
7993 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
7994 CResult_COption_TypeZDecodeErrorZ {
7995 contents: CResult_COption_TypeZDecodeErrorZPtr {
7996 err: Box::into_raw(Box::new(e)),
8001 /// Checks if the given object is currently in the success state
8003 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
8007 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
8008 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
8009 impl Drop for CResult_COption_TypeZDecodeErrorZ {
8010 fn drop(&mut self) {
8012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8013 let _ = unsafe { Box::from_raw(self.contents.result) };
8016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8017 let _ = unsafe { Box::from_raw(self.contents.err) };
8022 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
8023 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8024 let contents = if o.result_ok {
8025 let result = unsafe { o.contents.result };
8026 unsafe { o.contents.result = core::ptr::null_mut() };
8027 CResult_COption_TypeZDecodeErrorZPtr { result }
8029 let err = unsafe { o.contents.err };
8030 unsafe { o.contents.err = core::ptr::null_mut(); }
8031 CResult_COption_TypeZDecodeErrorZPtr { err }
8035 result_ok: o.result_ok,
8040 /// The contents of CResult_PaymentIdPaymentErrorZ
8041 pub union CResult_PaymentIdPaymentErrorZPtr {
8042 /// A pointer to the contents in the success state.
8043 /// Reading from this pointer when `result_ok` is not set is undefined.
8044 pub result: *mut crate::c_types::ThirtyTwoBytes,
8045 /// A pointer to the contents in the error state.
8046 /// Reading from this pointer when `result_ok` is set is undefined.
8047 pub err: *mut crate::lightning_invoice::payment::PaymentError,
8050 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8051 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8053 pub struct CResult_PaymentIdPaymentErrorZ {
8054 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8055 /// `err` or `result` depending on the state of `result_ok`.
8056 pub contents: CResult_PaymentIdPaymentErrorZPtr,
8057 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8058 pub result_ok: bool,
8061 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
8062 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
8063 CResult_PaymentIdPaymentErrorZ {
8064 contents: CResult_PaymentIdPaymentErrorZPtr {
8065 result: Box::into_raw(Box::new(o)),
8071 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
8072 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
8073 CResult_PaymentIdPaymentErrorZ {
8074 contents: CResult_PaymentIdPaymentErrorZPtr {
8075 err: Box::into_raw(Box::new(e)),
8080 /// Checks if the given object is currently in the success state
8082 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
8086 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
8087 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
8088 impl Drop for CResult_PaymentIdPaymentErrorZ {
8089 fn drop(&mut self) {
8091 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8092 let _ = unsafe { Box::from_raw(self.contents.result) };
8095 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8096 let _ = unsafe { Box::from_raw(self.contents.err) };
8101 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
8102 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
8103 let contents = if o.result_ok {
8104 let result = unsafe { o.contents.result };
8105 unsafe { o.contents.result = core::ptr::null_mut() };
8106 CResult_PaymentIdPaymentErrorZPtr { result }
8108 let err = unsafe { o.contents.err };
8109 unsafe { o.contents.err = core::ptr::null_mut(); }
8110 CResult_PaymentIdPaymentErrorZPtr { err }
8114 result_ok: o.result_ok,
8118 impl Clone for CResult_PaymentIdPaymentErrorZ {
8119 fn clone(&self) -> Self {
8121 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8122 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8125 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8126 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8132 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8133 /// but with all dynamically-allocated buffers duplicated in new buffers.
8134 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8136 /// The contents of CResult_SiPrefixNoneZ
8137 pub union CResult_SiPrefixNoneZPtr {
8138 /// A pointer to the contents in the success state.
8139 /// Reading from this pointer when `result_ok` is not set is undefined.
8140 pub result: *mut crate::lightning_invoice::SiPrefix,
8141 /// Note that this value is always NULL, as there are no contents in the Err variant
8142 pub err: *mut core::ffi::c_void,
8145 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
8146 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
8147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8148 pub struct CResult_SiPrefixNoneZ {
8149 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
8150 /// `err` or `result` depending on the state of `result_ok`.
8151 pub contents: CResult_SiPrefixNoneZPtr,
8152 /// Whether this CResult_SiPrefixNoneZ represents a success state.
8153 pub result_ok: bool,
8156 /// Creates a new CResult_SiPrefixNoneZ in the success state.
8157 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
8158 CResult_SiPrefixNoneZ {
8159 contents: CResult_SiPrefixNoneZPtr {
8160 result: Box::into_raw(Box::new(o)),
8166 /// Creates a new CResult_SiPrefixNoneZ in the error state.
8167 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
8168 CResult_SiPrefixNoneZ {
8169 contents: CResult_SiPrefixNoneZPtr {
8170 err: core::ptr::null_mut(),
8175 /// Checks if the given object is currently in the success state
8177 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
8181 /// Frees any resources used by the CResult_SiPrefixNoneZ.
8182 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
8183 impl Drop for CResult_SiPrefixNoneZ {
8184 fn drop(&mut self) {
8186 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8187 let _ = unsafe { Box::from_raw(self.contents.result) };
8193 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
8194 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
8195 let contents = if o.result_ok {
8196 let result = unsafe { o.contents.result };
8197 unsafe { o.contents.result = core::ptr::null_mut() };
8198 CResult_SiPrefixNoneZPtr { result }
8200 let _ = unsafe { Box::from_raw(o.contents.err) };
8201 o.contents.err = core::ptr::null_mut();
8202 CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
8206 result_ok: o.result_ok,
8210 impl Clone for CResult_SiPrefixNoneZ {
8211 fn clone(&self) -> Self {
8213 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
8214 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8217 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
8218 err: core::ptr::null_mut()
8224 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
8225 /// but with all dynamically-allocated buffers duplicated in new buffers.
8226 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
8228 /// The contents of CResult_InvoiceNoneZ
8229 pub union CResult_InvoiceNoneZPtr {
8230 /// A pointer to the contents in the success state.
8231 /// Reading from this pointer when `result_ok` is not set is undefined.
8232 pub result: *mut crate::lightning_invoice::Invoice,
8233 /// Note that this value is always NULL, as there are no contents in the Err variant
8234 pub err: *mut core::ffi::c_void,
8237 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
8238 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
8239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8240 pub struct CResult_InvoiceNoneZ {
8241 /// The contents of this CResult_InvoiceNoneZ, accessible via either
8242 /// `err` or `result` depending on the state of `result_ok`.
8243 pub contents: CResult_InvoiceNoneZPtr,
8244 /// Whether this CResult_InvoiceNoneZ represents a success state.
8245 pub result_ok: bool,
8248 /// Creates a new CResult_InvoiceNoneZ in the success state.
8249 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
8250 CResult_InvoiceNoneZ {
8251 contents: CResult_InvoiceNoneZPtr {
8252 result: Box::into_raw(Box::new(o)),
8258 /// Creates a new CResult_InvoiceNoneZ in the error state.
8259 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
8260 CResult_InvoiceNoneZ {
8261 contents: CResult_InvoiceNoneZPtr {
8262 err: core::ptr::null_mut(),
8267 /// Checks if the given object is currently in the success state
8269 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
8273 /// Frees any resources used by the CResult_InvoiceNoneZ.
8274 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
8275 impl Drop for CResult_InvoiceNoneZ {
8276 fn drop(&mut self) {
8278 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8279 let _ = unsafe { Box::from_raw(self.contents.result) };
8285 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
8286 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
8287 let contents = if o.result_ok {
8288 let result = unsafe { o.contents.result };
8289 unsafe { o.contents.result = core::ptr::null_mut() };
8290 CResult_InvoiceNoneZPtr { result }
8292 let _ = unsafe { Box::from_raw(o.contents.err) };
8293 o.contents.err = core::ptr::null_mut();
8294 CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
8298 result_ok: o.result_ok,
8302 impl Clone for CResult_InvoiceNoneZ {
8303 fn clone(&self) -> Self {
8305 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
8306 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8309 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
8310 err: core::ptr::null_mut()
8316 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
8317 /// but with all dynamically-allocated buffers duplicated in new buffers.
8318 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
8320 /// The contents of CResult_SignedRawInvoiceNoneZ
8321 pub union CResult_SignedRawInvoiceNoneZPtr {
8322 /// A pointer to the contents in the success state.
8323 /// Reading from this pointer when `result_ok` is not set is undefined.
8324 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8325 /// Note that this value is always NULL, as there are no contents in the Err variant
8326 pub err: *mut core::ffi::c_void,
8329 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
8330 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
8331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8332 pub struct CResult_SignedRawInvoiceNoneZ {
8333 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
8334 /// `err` or `result` depending on the state of `result_ok`.
8335 pub contents: CResult_SignedRawInvoiceNoneZPtr,
8336 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
8337 pub result_ok: bool,
8340 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
8341 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
8342 CResult_SignedRawInvoiceNoneZ {
8343 contents: CResult_SignedRawInvoiceNoneZPtr {
8344 result: Box::into_raw(Box::new(o)),
8350 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
8351 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
8352 CResult_SignedRawInvoiceNoneZ {
8353 contents: CResult_SignedRawInvoiceNoneZPtr {
8354 err: core::ptr::null_mut(),
8359 /// Checks if the given object is currently in the success state
8361 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
8365 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
8366 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
8367 impl Drop for CResult_SignedRawInvoiceNoneZ {
8368 fn drop(&mut self) {
8370 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8371 let _ = unsafe { Box::from_raw(self.contents.result) };
8377 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
8378 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
8379 let contents = if o.result_ok {
8380 let result = unsafe { o.contents.result };
8381 unsafe { o.contents.result = core::ptr::null_mut() };
8382 CResult_SignedRawInvoiceNoneZPtr { result }
8384 let _ = unsafe { Box::from_raw(o.contents.err) };
8385 o.contents.err = core::ptr::null_mut();
8386 CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
8390 result_ok: o.result_ok,
8394 impl Clone for CResult_SignedRawInvoiceNoneZ {
8395 fn clone(&self) -> Self {
8397 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
8398 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8401 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
8402 err: core::ptr::null_mut()
8408 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
8409 /// but with all dynamically-allocated buffers duplicated in new buffers.
8410 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
8412 /// A tuple of 3 elements. See the individual fields for the types contained.
8413 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8414 /// The element at position 0
8415 pub a: crate::lightning_invoice::RawInvoice,
8416 /// The element at position 1
8417 pub b: crate::c_types::ThirtyTwoBytes,
8418 /// The element at position 2
8419 pub c: crate::lightning_invoice::InvoiceSignature,
8421 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8422 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8430 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8431 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8432 (self.a, self.b, self.c)
8435 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8436 fn clone(&self) -> Self {
8438 a: Clone::clone(&self.a),
8439 b: Clone::clone(&self.b),
8440 c: Clone::clone(&self.c),
8445 /// Creates a new tuple which has the same data as `orig`
8446 /// but with all dynamically-allocated buffers duplicated in new buffers.
8447 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8448 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8450 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 {
8451 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8455 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8456 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8458 /// The contents of CResult_PayeePubKeyErrorZ
8459 pub union CResult_PayeePubKeyErrorZPtr {
8460 /// A pointer to the contents in the success state.
8461 /// Reading from this pointer when `result_ok` is not set is undefined.
8462 pub result: *mut crate::lightning_invoice::PayeePubKey,
8463 /// A pointer to the contents in the error state.
8464 /// Reading from this pointer when `result_ok` is set is undefined.
8465 pub err: *mut crate::c_types::Secp256k1Error,
8468 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8469 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8471 pub struct CResult_PayeePubKeyErrorZ {
8472 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8473 /// `err` or `result` depending on the state of `result_ok`.
8474 pub contents: CResult_PayeePubKeyErrorZPtr,
8475 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8476 pub result_ok: bool,
8479 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8480 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8481 CResult_PayeePubKeyErrorZ {
8482 contents: CResult_PayeePubKeyErrorZPtr {
8483 result: Box::into_raw(Box::new(o)),
8489 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8490 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8491 CResult_PayeePubKeyErrorZ {
8492 contents: CResult_PayeePubKeyErrorZPtr {
8493 err: Box::into_raw(Box::new(e)),
8498 /// Checks if the given object is currently in the success state
8500 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8504 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8505 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8506 impl Drop for CResult_PayeePubKeyErrorZ {
8507 fn drop(&mut self) {
8509 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8510 let _ = unsafe { Box::from_raw(self.contents.result) };
8513 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8514 let _ = unsafe { Box::from_raw(self.contents.err) };
8519 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8520 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8521 let contents = if o.result_ok {
8522 let result = unsafe { o.contents.result };
8523 unsafe { o.contents.result = core::ptr::null_mut() };
8524 CResult_PayeePubKeyErrorZPtr { result }
8526 let err = unsafe { o.contents.err };
8527 unsafe { o.contents.err = core::ptr::null_mut(); }
8528 CResult_PayeePubKeyErrorZPtr { err }
8532 result_ok: o.result_ok,
8536 impl Clone for CResult_PayeePubKeyErrorZ {
8537 fn clone(&self) -> Self {
8539 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8540 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8543 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8544 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8550 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8551 /// but with all dynamically-allocated buffers duplicated in new buffers.
8552 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8554 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8555 /// This corresponds to std::vector in C++
8556 pub struct CVec_PrivateRouteZ {
8557 /// The elements in the array.
8558 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8559 pub data: *mut crate::lightning_invoice::PrivateRoute,
8560 /// The number of elements pointed to by `data`.
8563 impl CVec_PrivateRouteZ {
8564 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8565 if self.datalen == 0 { return Vec::new(); }
8566 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8567 self.data = core::ptr::null_mut();
8571 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8572 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8575 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8576 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8577 let datalen = v.len();
8578 let data = Box::into_raw(v.into_boxed_slice());
8579 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8583 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8584 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8585 impl Drop for CVec_PrivateRouteZ {
8586 fn drop(&mut self) {
8587 if self.datalen == 0 { return; }
8588 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8591 impl Clone for CVec_PrivateRouteZ {
8592 fn clone(&self) -> Self {
8593 let mut res = Vec::new();
8594 if self.datalen == 0 { return Self::from(res); }
8595 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8600 /// The contents of CResult_PositiveTimestampCreationErrorZ
8601 pub union CResult_PositiveTimestampCreationErrorZPtr {
8602 /// A pointer to the contents in the success state.
8603 /// Reading from this pointer when `result_ok` is not set is undefined.
8604 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8605 /// A pointer to the contents in the error state.
8606 /// Reading from this pointer when `result_ok` is set is undefined.
8607 pub err: *mut crate::lightning_invoice::CreationError,
8610 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8611 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8613 pub struct CResult_PositiveTimestampCreationErrorZ {
8614 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8615 /// `err` or `result` depending on the state of `result_ok`.
8616 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8617 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8618 pub result_ok: bool,
8621 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8622 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8623 CResult_PositiveTimestampCreationErrorZ {
8624 contents: CResult_PositiveTimestampCreationErrorZPtr {
8625 result: Box::into_raw(Box::new(o)),
8631 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8632 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8633 CResult_PositiveTimestampCreationErrorZ {
8634 contents: CResult_PositiveTimestampCreationErrorZPtr {
8635 err: Box::into_raw(Box::new(e)),
8640 /// Checks if the given object is currently in the success state
8642 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8646 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8647 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8648 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8649 fn drop(&mut self) {
8651 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8652 let _ = unsafe { Box::from_raw(self.contents.result) };
8655 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8656 let _ = unsafe { Box::from_raw(self.contents.err) };
8661 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8662 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8663 let contents = if o.result_ok {
8664 let result = unsafe { o.contents.result };
8665 unsafe { o.contents.result = core::ptr::null_mut() };
8666 CResult_PositiveTimestampCreationErrorZPtr { result }
8668 let err = unsafe { o.contents.err };
8669 unsafe { o.contents.err = core::ptr::null_mut(); }
8670 CResult_PositiveTimestampCreationErrorZPtr { err }
8674 result_ok: o.result_ok,
8678 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8679 fn clone(&self) -> Self {
8681 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8682 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8685 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8686 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8692 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8693 /// but with all dynamically-allocated buffers duplicated in new buffers.
8694 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8696 /// The contents of CResult_NoneSemanticErrorZ
8697 pub union CResult_NoneSemanticErrorZPtr {
8698 /// Note that this value is always NULL, as there are no contents in the OK variant
8699 pub result: *mut core::ffi::c_void,
8700 /// A pointer to the contents in the error state.
8701 /// Reading from this pointer when `result_ok` is set is undefined.
8702 pub err: *mut crate::lightning_invoice::SemanticError,
8705 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8706 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8708 pub struct CResult_NoneSemanticErrorZ {
8709 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8710 /// `err` or `result` depending on the state of `result_ok`.
8711 pub contents: CResult_NoneSemanticErrorZPtr,
8712 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8713 pub result_ok: bool,
8716 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8717 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8718 CResult_NoneSemanticErrorZ {
8719 contents: CResult_NoneSemanticErrorZPtr {
8720 result: core::ptr::null_mut(),
8726 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8727 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8728 CResult_NoneSemanticErrorZ {
8729 contents: CResult_NoneSemanticErrorZPtr {
8730 err: Box::into_raw(Box::new(e)),
8735 /// Checks if the given object is currently in the success state
8737 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8741 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8742 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8743 impl Drop for CResult_NoneSemanticErrorZ {
8744 fn drop(&mut self) {
8747 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8748 let _ = unsafe { Box::from_raw(self.contents.err) };
8753 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8754 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8755 let contents = if o.result_ok {
8756 let _ = unsafe { Box::from_raw(o.contents.result) };
8757 o.contents.result = core::ptr::null_mut();
8758 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8760 let err = unsafe { o.contents.err };
8761 unsafe { o.contents.err = core::ptr::null_mut(); }
8762 CResult_NoneSemanticErrorZPtr { err }
8766 result_ok: o.result_ok,
8770 impl Clone for CResult_NoneSemanticErrorZ {
8771 fn clone(&self) -> Self {
8773 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8774 result: core::ptr::null_mut()
8777 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8778 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8784 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8785 /// but with all dynamically-allocated buffers duplicated in new buffers.
8786 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8788 /// The contents of CResult_InvoiceSemanticErrorZ
8789 pub union CResult_InvoiceSemanticErrorZPtr {
8790 /// A pointer to the contents in the success state.
8791 /// Reading from this pointer when `result_ok` is not set is undefined.
8792 pub result: *mut crate::lightning_invoice::Invoice,
8793 /// A pointer to the contents in the error state.
8794 /// Reading from this pointer when `result_ok` is set is undefined.
8795 pub err: *mut crate::lightning_invoice::SemanticError,
8798 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8799 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8801 pub struct CResult_InvoiceSemanticErrorZ {
8802 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8803 /// `err` or `result` depending on the state of `result_ok`.
8804 pub contents: CResult_InvoiceSemanticErrorZPtr,
8805 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8806 pub result_ok: bool,
8809 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8810 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8811 CResult_InvoiceSemanticErrorZ {
8812 contents: CResult_InvoiceSemanticErrorZPtr {
8813 result: Box::into_raw(Box::new(o)),
8819 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8820 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8821 CResult_InvoiceSemanticErrorZ {
8822 contents: CResult_InvoiceSemanticErrorZPtr {
8823 err: Box::into_raw(Box::new(e)),
8828 /// Checks if the given object is currently in the success state
8830 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8834 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8835 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8836 impl Drop for CResult_InvoiceSemanticErrorZ {
8837 fn drop(&mut self) {
8839 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8840 let _ = unsafe { Box::from_raw(self.contents.result) };
8843 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8844 let _ = unsafe { Box::from_raw(self.contents.err) };
8849 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8850 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8851 let contents = if o.result_ok {
8852 let result = unsafe { o.contents.result };
8853 unsafe { o.contents.result = core::ptr::null_mut() };
8854 CResult_InvoiceSemanticErrorZPtr { result }
8856 let err = unsafe { o.contents.err };
8857 unsafe { o.contents.err = core::ptr::null_mut(); }
8858 CResult_InvoiceSemanticErrorZPtr { err }
8862 result_ok: o.result_ok,
8866 impl Clone for CResult_InvoiceSemanticErrorZ {
8867 fn clone(&self) -> Self {
8869 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8870 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8873 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8874 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8880 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8881 /// but with all dynamically-allocated buffers duplicated in new buffers.
8882 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8884 /// The contents of CResult_DescriptionCreationErrorZ
8885 pub union CResult_DescriptionCreationErrorZPtr {
8886 /// A pointer to the contents in the success state.
8887 /// Reading from this pointer when `result_ok` is not set is undefined.
8888 pub result: *mut crate::lightning_invoice::Description,
8889 /// A pointer to the contents in the error state.
8890 /// Reading from this pointer when `result_ok` is set is undefined.
8891 pub err: *mut crate::lightning_invoice::CreationError,
8894 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8895 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8897 pub struct CResult_DescriptionCreationErrorZ {
8898 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8899 /// `err` or `result` depending on the state of `result_ok`.
8900 pub contents: CResult_DescriptionCreationErrorZPtr,
8901 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8902 pub result_ok: bool,
8905 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8906 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8907 CResult_DescriptionCreationErrorZ {
8908 contents: CResult_DescriptionCreationErrorZPtr {
8909 result: Box::into_raw(Box::new(o)),
8915 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8916 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8917 CResult_DescriptionCreationErrorZ {
8918 contents: CResult_DescriptionCreationErrorZPtr {
8919 err: Box::into_raw(Box::new(e)),
8924 /// Checks if the given object is currently in the success state
8926 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8930 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8931 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8932 impl Drop for CResult_DescriptionCreationErrorZ {
8933 fn drop(&mut self) {
8935 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8936 let _ = unsafe { Box::from_raw(self.contents.result) };
8939 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8940 let _ = unsafe { Box::from_raw(self.contents.err) };
8945 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8946 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8947 let contents = if o.result_ok {
8948 let result = unsafe { o.contents.result };
8949 unsafe { o.contents.result = core::ptr::null_mut() };
8950 CResult_DescriptionCreationErrorZPtr { result }
8952 let err = unsafe { o.contents.err };
8953 unsafe { o.contents.err = core::ptr::null_mut(); }
8954 CResult_DescriptionCreationErrorZPtr { err }
8958 result_ok: o.result_ok,
8962 impl Clone for CResult_DescriptionCreationErrorZ {
8963 fn clone(&self) -> Self {
8965 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
8966 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
8969 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
8970 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8976 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
8977 /// but with all dynamically-allocated buffers duplicated in new buffers.
8978 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
8980 /// The contents of CResult_PrivateRouteCreationErrorZ
8981 pub union CResult_PrivateRouteCreationErrorZPtr {
8982 /// A pointer to the contents in the success state.
8983 /// Reading from this pointer when `result_ok` is not set is undefined.
8984 pub result: *mut crate::lightning_invoice::PrivateRoute,
8985 /// A pointer to the contents in the error state.
8986 /// Reading from this pointer when `result_ok` is set is undefined.
8987 pub err: *mut crate::lightning_invoice::CreationError,
8990 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8991 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8993 pub struct CResult_PrivateRouteCreationErrorZ {
8994 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8995 /// `err` or `result` depending on the state of `result_ok`.
8996 pub contents: CResult_PrivateRouteCreationErrorZPtr,
8997 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8998 pub result_ok: bool,
9001 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
9002 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
9003 CResult_PrivateRouteCreationErrorZ {
9004 contents: CResult_PrivateRouteCreationErrorZPtr {
9005 result: Box::into_raw(Box::new(o)),
9011 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
9012 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
9013 CResult_PrivateRouteCreationErrorZ {
9014 contents: CResult_PrivateRouteCreationErrorZPtr {
9015 err: Box::into_raw(Box::new(e)),
9020 /// Checks if the given object is currently in the success state
9022 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
9026 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
9027 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
9028 impl Drop for CResult_PrivateRouteCreationErrorZ {
9029 fn drop(&mut self) {
9031 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9032 let _ = unsafe { Box::from_raw(self.contents.result) };
9035 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9036 let _ = unsafe { Box::from_raw(self.contents.err) };
9041 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
9042 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
9043 let contents = if o.result_ok {
9044 let result = unsafe { o.contents.result };
9045 unsafe { o.contents.result = core::ptr::null_mut() };
9046 CResult_PrivateRouteCreationErrorZPtr { result }
9048 let err = unsafe { o.contents.err };
9049 unsafe { o.contents.err = core::ptr::null_mut(); }
9050 CResult_PrivateRouteCreationErrorZPtr { err }
9054 result_ok: o.result_ok,
9058 impl Clone for CResult_PrivateRouteCreationErrorZ {
9059 fn clone(&self) -> Self {
9061 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
9062 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
9065 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
9066 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9072 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
9073 /// but with all dynamically-allocated buffers duplicated in new buffers.
9074 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
9076 /// The contents of CResult_StringErrorZ
9077 pub union CResult_StringErrorZPtr {
9078 /// A pointer to the contents in the success state.
9079 /// Reading from this pointer when `result_ok` is not set is undefined.
9080 pub result: *mut crate::c_types::Str,
9081 /// A pointer to the contents in the error state.
9082 /// Reading from this pointer when `result_ok` is set is undefined.
9083 pub err: *mut crate::c_types::Secp256k1Error,
9086 /// A CResult_StringErrorZ represents the result of a fallible operation,
9087 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9089 pub struct CResult_StringErrorZ {
9090 /// The contents of this CResult_StringErrorZ, accessible via either
9091 /// `err` or `result` depending on the state of `result_ok`.
9092 pub contents: CResult_StringErrorZPtr,
9093 /// Whether this CResult_StringErrorZ represents a success state.
9094 pub result_ok: bool,
9097 /// Creates a new CResult_StringErrorZ in the success state.
9098 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
9099 CResult_StringErrorZ {
9100 contents: CResult_StringErrorZPtr {
9101 result: Box::into_raw(Box::new(o)),
9107 /// Creates a new CResult_StringErrorZ in the error state.
9108 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
9109 CResult_StringErrorZ {
9110 contents: CResult_StringErrorZPtr {
9111 err: Box::into_raw(Box::new(e)),
9116 /// Checks if the given object is currently in the success state
9118 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9122 /// Frees any resources used by the CResult_StringErrorZ.
9123 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9124 impl Drop for CResult_StringErrorZ {
9125 fn drop(&mut self) {
9127 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9128 let _ = unsafe { Box::from_raw(self.contents.result) };
9131 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9132 let _ = unsafe { Box::from_raw(self.contents.err) };
9137 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9138 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9139 let contents = if o.result_ok {
9140 let result = unsafe { o.contents.result };
9141 unsafe { o.contents.result = core::ptr::null_mut() };
9142 CResult_StringErrorZPtr { result }
9144 let err = unsafe { o.contents.err };
9145 unsafe { o.contents.err = core::ptr::null_mut(); }
9146 CResult_StringErrorZPtr { err }
9150 result_ok: o.result_ok,
9155 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9156 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9157 /// A pointer to the contents in the success state.
9158 /// Reading from this pointer when `result_ok` is not set is undefined.
9159 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9160 /// A pointer to the contents in the error state.
9161 /// Reading from this pointer when `result_ok` is set is undefined.
9162 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9165 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9166 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9167 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9168 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9169 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9170 /// `err` or `result` depending on the state of `result_ok`.
9171 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9172 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9173 pub result_ok: bool,
9176 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9177 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9178 CResult_ChannelMonitorUpdateDecodeErrorZ {
9179 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9180 result: Box::into_raw(Box::new(o)),
9186 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9187 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9188 CResult_ChannelMonitorUpdateDecodeErrorZ {
9189 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9190 err: Box::into_raw(Box::new(e)),
9195 /// Checks if the given object is currently in the success state
9197 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9201 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9202 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9203 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9204 fn drop(&mut self) {
9206 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9207 let _ = unsafe { Box::from_raw(self.contents.result) };
9210 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9211 let _ = unsafe { Box::from_raw(self.contents.err) };
9216 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9217 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9218 let contents = if o.result_ok {
9219 let result = unsafe { o.contents.result };
9220 unsafe { o.contents.result = core::ptr::null_mut() };
9221 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9223 let err = unsafe { o.contents.err };
9224 unsafe { o.contents.err = core::ptr::null_mut(); }
9225 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9229 result_ok: o.result_ok,
9233 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9234 fn clone(&self) -> Self {
9236 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9237 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9240 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9241 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9247 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9248 /// but with all dynamically-allocated buffers duplicated in new buffers.
9249 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9252 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9253 pub enum COption_MonitorEventZ {
9254 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9255 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9256 /// When we're in this state, this COption_MonitorEventZ contains nothing
9259 impl COption_MonitorEventZ {
9260 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9261 if let Self::None = self { false } else { true }
9263 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9266 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9267 if let Self::Some(v) = self { v } else { unreachable!() }
9271 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9272 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9273 COption_MonitorEventZ::Some(o)
9276 /// Constructs a new COption_MonitorEventZ containing nothing
9277 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9278 COption_MonitorEventZ::None
9281 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9282 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9284 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9285 /// but with all dynamically-allocated buffers duplicated in new buffers.
9286 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9288 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9289 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9290 /// A pointer to the contents in the success state.
9291 /// Reading from this pointer when `result_ok` is not set is undefined.
9292 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9293 /// A pointer to the contents in the error state.
9294 /// Reading from this pointer when `result_ok` is set is undefined.
9295 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9298 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9299 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9300 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9301 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9302 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9303 /// `err` or `result` depending on the state of `result_ok`.
9304 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9305 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9306 pub result_ok: bool,
9309 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9310 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9311 CResult_COption_MonitorEventZDecodeErrorZ {
9312 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9313 result: Box::into_raw(Box::new(o)),
9319 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9320 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9321 CResult_COption_MonitorEventZDecodeErrorZ {
9322 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9323 err: Box::into_raw(Box::new(e)),
9328 /// Checks if the given object is currently in the success state
9330 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9334 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9335 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9336 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9337 fn drop(&mut self) {
9339 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9340 let _ = unsafe { Box::from_raw(self.contents.result) };
9343 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9344 let _ = unsafe { Box::from_raw(self.contents.err) };
9349 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9350 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9351 let contents = if o.result_ok {
9352 let result = unsafe { o.contents.result };
9353 unsafe { o.contents.result = core::ptr::null_mut() };
9354 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9356 let err = unsafe { o.contents.err };
9357 unsafe { o.contents.err = core::ptr::null_mut(); }
9358 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9362 result_ok: o.result_ok,
9366 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9367 fn clone(&self) -> Self {
9369 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9370 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9373 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9374 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9380 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9381 /// but with all dynamically-allocated buffers duplicated in new buffers.
9382 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9384 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9385 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9386 /// A pointer to the contents in the success state.
9387 /// Reading from this pointer when `result_ok` is not set is undefined.
9388 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9389 /// A pointer to the contents in the error state.
9390 /// Reading from this pointer when `result_ok` is set is undefined.
9391 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9394 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9395 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9397 pub struct CResult_HTLCUpdateDecodeErrorZ {
9398 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9399 /// `err` or `result` depending on the state of `result_ok`.
9400 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9401 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9402 pub result_ok: bool,
9405 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9406 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9407 CResult_HTLCUpdateDecodeErrorZ {
9408 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9409 result: Box::into_raw(Box::new(o)),
9415 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9416 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9417 CResult_HTLCUpdateDecodeErrorZ {
9418 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9419 err: Box::into_raw(Box::new(e)),
9424 /// Checks if the given object is currently in the success state
9426 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9430 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9431 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9432 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9433 fn drop(&mut self) {
9435 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9436 let _ = unsafe { Box::from_raw(self.contents.result) };
9439 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9440 let _ = unsafe { Box::from_raw(self.contents.err) };
9445 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9446 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9447 let contents = if o.result_ok {
9448 let result = unsafe { o.contents.result };
9449 unsafe { o.contents.result = core::ptr::null_mut() };
9450 CResult_HTLCUpdateDecodeErrorZPtr { result }
9452 let err = unsafe { o.contents.err };
9453 unsafe { o.contents.err = core::ptr::null_mut(); }
9454 CResult_HTLCUpdateDecodeErrorZPtr { err }
9458 result_ok: o.result_ok,
9462 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9463 fn clone(&self) -> Self {
9465 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9466 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9469 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9470 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9476 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9477 /// but with all dynamically-allocated buffers duplicated in new buffers.
9478 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9480 /// A tuple of 2 elements. See the individual fields for the types contained.
9481 pub struct C2Tuple_OutPointScriptZ {
9482 /// The element at position 0
9483 pub a: crate::lightning::chain::transaction::OutPoint,
9484 /// The element at position 1
9485 pub b: crate::c_types::derived::CVec_u8Z,
9487 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9488 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9495 impl C2Tuple_OutPointScriptZ {
9496 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9500 impl Clone for C2Tuple_OutPointScriptZ {
9501 fn clone(&self) -> Self {
9503 a: Clone::clone(&self.a),
9504 b: Clone::clone(&self.b),
9509 /// Creates a new tuple which has the same data as `orig`
9510 /// but with all dynamically-allocated buffers duplicated in new buffers.
9511 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9512 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9514 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9515 C2Tuple_OutPointScriptZ { a, b, }
9519 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9520 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9522 /// A tuple of 2 elements. See the individual fields for the types contained.
9523 pub struct C2Tuple_u32ScriptZ {
9524 /// The element at position 0
9526 /// The element at position 1
9527 pub b: crate::c_types::derived::CVec_u8Z,
9529 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9530 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9537 impl C2Tuple_u32ScriptZ {
9538 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9542 impl Clone for C2Tuple_u32ScriptZ {
9543 fn clone(&self) -> Self {
9545 a: Clone::clone(&self.a),
9546 b: Clone::clone(&self.b),
9551 /// Creates a new tuple which has the same data as `orig`
9552 /// but with all dynamically-allocated buffers duplicated in new buffers.
9553 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9554 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9556 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9557 C2Tuple_u32ScriptZ { a, b, }
9561 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9562 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9564 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9565 /// This corresponds to std::vector in C++
9566 pub struct CVec_C2Tuple_u32ScriptZZ {
9567 /// The elements in the array.
9568 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9569 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9570 /// The number of elements pointed to by `data`.
9573 impl CVec_C2Tuple_u32ScriptZZ {
9574 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9575 if self.datalen == 0 { return Vec::new(); }
9576 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9577 self.data = core::ptr::null_mut();
9581 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9582 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9585 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9586 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9587 let datalen = v.len();
9588 let data = Box::into_raw(v.into_boxed_slice());
9589 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9593 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9594 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9595 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9596 fn drop(&mut self) {
9597 if self.datalen == 0 { return; }
9598 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9601 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9602 fn clone(&self) -> Self {
9603 let mut res = Vec::new();
9604 if self.datalen == 0 { return Self::from(res); }
9605 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9610 /// A tuple of 2 elements. See the individual fields for the types contained.
9611 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9612 /// The element at position 0
9613 pub a: crate::c_types::ThirtyTwoBytes,
9614 /// The element at position 1
9615 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9617 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9618 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9625 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9626 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9630 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9631 fn clone(&self) -> Self {
9633 a: Clone::clone(&self.a),
9634 b: Clone::clone(&self.b),
9639 /// Creates a new tuple which has the same data as `orig`
9640 /// but with all dynamically-allocated buffers duplicated in new buffers.
9641 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9642 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9644 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 {
9645 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9649 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9650 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9652 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9653 /// This corresponds to std::vector in C++
9654 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9655 /// The elements in the array.
9656 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9657 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9658 /// The number of elements pointed to by `data`.
9661 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9662 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9663 if self.datalen == 0 { return Vec::new(); }
9664 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9665 self.data = core::ptr::null_mut();
9669 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9670 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9673 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9674 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9675 let datalen = v.len();
9676 let data = Box::into_raw(v.into_boxed_slice());
9677 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9681 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9682 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9683 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9684 fn drop(&mut self) {
9685 if self.datalen == 0 { return; }
9686 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9689 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9690 fn clone(&self) -> Self {
9691 let mut res = Vec::new();
9692 if self.datalen == 0 { return Self::from(res); }
9693 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9698 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9699 /// This corresponds to std::vector in C++
9700 pub struct CVec_EventZ {
9701 /// The elements in the array.
9702 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9703 pub data: *mut crate::lightning::util::events::Event,
9704 /// The number of elements pointed to by `data`.
9708 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9709 if self.datalen == 0 { return Vec::new(); }
9710 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9711 self.data = core::ptr::null_mut();
9715 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9716 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9719 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9720 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9721 let datalen = v.len();
9722 let data = Box::into_raw(v.into_boxed_slice());
9723 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9727 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9728 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9729 impl Drop for CVec_EventZ {
9730 fn drop(&mut self) {
9731 if self.datalen == 0 { return; }
9732 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9735 impl Clone for CVec_EventZ {
9736 fn clone(&self) -> Self {
9737 let mut res = Vec::new();
9738 if self.datalen == 0 { return Self::from(res); }
9739 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9744 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9745 /// This corresponds to std::vector in C++
9746 pub struct CVec_TransactionZ {
9747 /// The elements in the array.
9748 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9749 pub data: *mut crate::c_types::Transaction,
9750 /// The number of elements pointed to by `data`.
9753 impl CVec_TransactionZ {
9754 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9755 if self.datalen == 0 { return Vec::new(); }
9756 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9757 self.data = core::ptr::null_mut();
9761 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9762 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9765 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9766 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9767 let datalen = v.len();
9768 let data = Box::into_raw(v.into_boxed_slice());
9769 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9773 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9774 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9775 impl Drop for CVec_TransactionZ {
9776 fn drop(&mut self) {
9777 if self.datalen == 0 { return; }
9778 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9781 impl Clone for CVec_TransactionZ {
9782 fn clone(&self) -> Self {
9783 let mut res = Vec::new();
9784 if self.datalen == 0 { return Self::from(res); }
9785 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9790 /// A tuple of 2 elements. See the individual fields for the types contained.
9791 pub struct C2Tuple_u32TxOutZ {
9792 /// The element at position 0
9794 /// The element at position 1
9795 pub b: crate::c_types::TxOut,
9797 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9798 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9805 impl C2Tuple_u32TxOutZ {
9806 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9810 impl Clone for C2Tuple_u32TxOutZ {
9811 fn clone(&self) -> Self {
9813 a: Clone::clone(&self.a),
9814 b: Clone::clone(&self.b),
9819 /// Creates a new tuple which has the same data as `orig`
9820 /// but with all dynamically-allocated buffers duplicated in new buffers.
9821 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9822 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9824 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9825 C2Tuple_u32TxOutZ { a, b, }
9829 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9830 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9832 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9833 /// This corresponds to std::vector in C++
9834 pub struct CVec_C2Tuple_u32TxOutZZ {
9835 /// The elements in the array.
9836 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9837 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9838 /// The number of elements pointed to by `data`.
9841 impl CVec_C2Tuple_u32TxOutZZ {
9842 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9843 if self.datalen == 0 { return Vec::new(); }
9844 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9845 self.data = core::ptr::null_mut();
9849 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9850 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9853 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9854 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9855 let datalen = v.len();
9856 let data = Box::into_raw(v.into_boxed_slice());
9857 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9861 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9862 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9863 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9864 fn drop(&mut self) {
9865 if self.datalen == 0 { return; }
9866 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9869 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9870 fn clone(&self) -> Self {
9871 let mut res = Vec::new();
9872 if self.datalen == 0 { return Self::from(res); }
9873 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9878 /// A tuple of 2 elements. See the individual fields for the types contained.
9879 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9880 /// The element at position 0
9881 pub a: crate::c_types::ThirtyTwoBytes,
9882 /// The element at position 1
9883 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9885 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9886 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9893 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9894 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9898 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9899 fn clone(&self) -> Self {
9901 a: Clone::clone(&self.a),
9902 b: Clone::clone(&self.b),
9907 /// Creates a new tuple which has the same data as `orig`
9908 /// but with all dynamically-allocated buffers duplicated in new buffers.
9909 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9910 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9912 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 {
9913 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9917 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9918 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9920 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9921 /// This corresponds to std::vector in C++
9922 pub struct CVec_TransactionOutputsZ {
9923 /// The elements in the array.
9924 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9925 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9926 /// The number of elements pointed to by `data`.
9929 impl CVec_TransactionOutputsZ {
9930 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9931 if self.datalen == 0 { return Vec::new(); }
9932 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9933 self.data = core::ptr::null_mut();
9937 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9938 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9941 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9942 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9943 let datalen = v.len();
9944 let data = Box::into_raw(v.into_boxed_slice());
9945 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9949 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9950 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9951 impl Drop for CVec_TransactionOutputsZ {
9952 fn drop(&mut self) {
9953 if self.datalen == 0 { return; }
9954 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9957 impl Clone for CVec_TransactionOutputsZ {
9958 fn clone(&self) -> Self {
9959 let mut res = Vec::new();
9960 if self.datalen == 0 { return Self::from(res); }
9961 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9966 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9967 /// This corresponds to std::vector in C++
9968 pub struct CVec_BalanceZ {
9969 /// The elements in the array.
9970 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9971 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9972 /// The number of elements pointed to by `data`.
9975 impl CVec_BalanceZ {
9976 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9977 if self.datalen == 0 { return Vec::new(); }
9978 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9979 self.data = core::ptr::null_mut();
9983 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9984 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9987 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9988 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9989 let datalen = v.len();
9990 let data = Box::into_raw(v.into_boxed_slice());
9991 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9996 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9997 impl Drop for CVec_BalanceZ {
9998 fn drop(&mut self) {
9999 if self.datalen == 0 { return; }
10000 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10003 impl Clone for CVec_BalanceZ {
10004 fn clone(&self) -> Self {
10005 let mut res = Vec::new();
10006 if self.datalen == 0 { return Self::from(res); }
10007 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10012 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
10013 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10014 /// A pointer to the contents in the success state.
10015 /// Reading from this pointer when `result_ok` is not set is undefined.
10016 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
10017 /// A pointer to the contents in the error state.
10018 /// Reading from this pointer when `result_ok` is set is undefined.
10019 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10022 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
10023 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10024 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10025 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10026 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
10027 /// `err` or `result` depending on the state of `result_ok`.
10028 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
10029 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
10030 pub result_ok: bool,
10033 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10034 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10035 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10036 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10037 result: Box::into_raw(Box::new(o)),
10043 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10044 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10045 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10046 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10047 err: Box::into_raw(Box::new(e)),
10052 /// Checks if the given object is currently in the success state
10054 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10058 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10059 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10060 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10061 fn drop(&mut self) {
10062 if self.result_ok {
10063 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10064 let _ = unsafe { Box::from_raw(self.contents.result) };
10067 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10068 let _ = unsafe { Box::from_raw(self.contents.err) };
10073 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10074 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10075 let contents = if o.result_ok {
10076 let result = unsafe { o.contents.result };
10077 unsafe { o.contents.result = core::ptr::null_mut() };
10078 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10080 let err = unsafe { o.contents.err };
10081 unsafe { o.contents.err = core::ptr::null_mut(); }
10082 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10086 result_ok: o.result_ok,
10091 /// The contents of CResult_NoneLightningErrorZ
10092 pub union CResult_NoneLightningErrorZPtr {
10093 /// Note that this value is always NULL, as there are no contents in the OK variant
10094 pub result: *mut core::ffi::c_void,
10095 /// A pointer to the contents in the error state.
10096 /// Reading from this pointer when `result_ok` is set is undefined.
10097 pub err: *mut crate::lightning::ln::msgs::LightningError,
10100 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
10101 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
10102 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10103 pub struct CResult_NoneLightningErrorZ {
10104 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
10105 /// `err` or `result` depending on the state of `result_ok`.
10106 pub contents: CResult_NoneLightningErrorZPtr,
10107 /// Whether this CResult_NoneLightningErrorZ represents a success state.
10108 pub result_ok: bool,
10111 /// Creates a new CResult_NoneLightningErrorZ in the success state.
10112 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10113 CResult_NoneLightningErrorZ {
10114 contents: CResult_NoneLightningErrorZPtr {
10115 result: core::ptr::null_mut(),
10121 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10122 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10123 CResult_NoneLightningErrorZ {
10124 contents: CResult_NoneLightningErrorZPtr {
10125 err: Box::into_raw(Box::new(e)),
10130 /// Checks if the given object is currently in the success state
10132 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10136 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10137 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10138 impl Drop for CResult_NoneLightningErrorZ {
10139 fn drop(&mut self) {
10140 if self.result_ok {
10142 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10143 let _ = unsafe { Box::from_raw(self.contents.err) };
10148 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10149 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10150 let contents = if o.result_ok {
10151 let _ = unsafe { Box::from_raw(o.contents.result) };
10152 o.contents.result = core::ptr::null_mut();
10153 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10155 let err = unsafe { o.contents.err };
10156 unsafe { o.contents.err = core::ptr::null_mut(); }
10157 CResult_NoneLightningErrorZPtr { err }
10161 result_ok: o.result_ok,
10165 impl Clone for CResult_NoneLightningErrorZ {
10166 fn clone(&self) -> Self {
10167 if self.result_ok {
10168 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10169 result: core::ptr::null_mut()
10172 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10173 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10179 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10180 /// but with all dynamically-allocated buffers duplicated in new buffers.
10181 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10183 /// A tuple of 2 elements. See the individual fields for the types contained.
10184 pub struct C2Tuple_PublicKeyTypeZ {
10185 /// The element at position 0
10186 pub a: crate::c_types::PublicKey,
10187 /// The element at position 1
10188 pub b: crate::lightning::ln::wire::Type,
10190 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10191 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10198 impl C2Tuple_PublicKeyTypeZ {
10199 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10203 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10205 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10206 C2Tuple_PublicKeyTypeZ { a, b, }
10210 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10211 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10213 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10214 /// This corresponds to std::vector in C++
10215 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10216 /// The elements in the array.
10217 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10218 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10219 /// The number of elements pointed to by `data`.
10222 impl CVec_C2Tuple_PublicKeyTypeZZ {
10223 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10224 if self.datalen == 0 { return Vec::new(); }
10225 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10226 self.data = core::ptr::null_mut();
10230 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10231 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10234 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10235 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10236 let datalen = v.len();
10237 let data = Box::into_raw(v.into_boxed_slice());
10238 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10242 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10243 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10244 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10245 fn drop(&mut self) {
10246 if self.datalen == 0 { return; }
10247 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10251 /// The contents of CResult_boolLightningErrorZ
10252 pub union CResult_boolLightningErrorZPtr {
10253 /// A pointer to the contents in the success state.
10254 /// Reading from this pointer when `result_ok` is not set is undefined.
10255 pub result: *mut bool,
10256 /// A pointer to the contents in the error state.
10257 /// Reading from this pointer when `result_ok` is set is undefined.
10258 pub err: *mut crate::lightning::ln::msgs::LightningError,
10261 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10262 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10264 pub struct CResult_boolLightningErrorZ {
10265 /// The contents of this CResult_boolLightningErrorZ, accessible via either
10266 /// `err` or `result` depending on the state of `result_ok`.
10267 pub contents: CResult_boolLightningErrorZPtr,
10268 /// Whether this CResult_boolLightningErrorZ represents a success state.
10269 pub result_ok: bool,
10272 /// Creates a new CResult_boolLightningErrorZ in the success state.
10273 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10274 CResult_boolLightningErrorZ {
10275 contents: CResult_boolLightningErrorZPtr {
10276 result: Box::into_raw(Box::new(o)),
10282 /// Creates a new CResult_boolLightningErrorZ in the error state.
10283 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10284 CResult_boolLightningErrorZ {
10285 contents: CResult_boolLightningErrorZPtr {
10286 err: Box::into_raw(Box::new(e)),
10291 /// Checks if the given object is currently in the success state
10293 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10297 /// Frees any resources used by the CResult_boolLightningErrorZ.
10298 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10299 impl Drop for CResult_boolLightningErrorZ {
10300 fn drop(&mut self) {
10301 if self.result_ok {
10302 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10303 let _ = unsafe { Box::from_raw(self.contents.result) };
10306 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10307 let _ = unsafe { Box::from_raw(self.contents.err) };
10312 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10313 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10314 let contents = if o.result_ok {
10315 let result = unsafe { o.contents.result };
10316 unsafe { o.contents.result = core::ptr::null_mut() };
10317 CResult_boolLightningErrorZPtr { result }
10319 let err = unsafe { o.contents.err };
10320 unsafe { o.contents.err = core::ptr::null_mut(); }
10321 CResult_boolLightningErrorZPtr { err }
10325 result_ok: o.result_ok,
10329 impl Clone for CResult_boolLightningErrorZ {
10330 fn clone(&self) -> Self {
10331 if self.result_ok {
10332 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10333 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10336 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10337 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10343 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10344 /// but with all dynamically-allocated buffers duplicated in new buffers.
10345 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10347 /// A tuple of 3 elements. See the individual fields for the types contained.
10348 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10349 /// The element at position 0
10350 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10351 /// The element at position 1
10352 pub b: crate::lightning::ln::msgs::ChannelUpdate,
10353 /// The element at position 2
10354 pub c: crate::lightning::ln::msgs::ChannelUpdate,
10356 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10357 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10365 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10366 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10367 (self.a, self.b, self.c)
10370 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10371 fn clone(&self) -> Self {
10373 a: Clone::clone(&self.a),
10374 b: Clone::clone(&self.b),
10375 c: Clone::clone(&self.c),
10380 /// Creates a new tuple which has the same data as `orig`
10381 /// but with all dynamically-allocated buffers duplicated in new buffers.
10382 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10383 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10385 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 {
10386 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10390 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10391 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10393 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10394 /// This corresponds to std::vector in C++
10395 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10396 /// The elements in the array.
10397 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10398 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10399 /// The number of elements pointed to by `data`.
10402 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10403 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10404 if self.datalen == 0 { return Vec::new(); }
10405 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10406 self.data = core::ptr::null_mut();
10410 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10411 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10414 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10415 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10416 let datalen = v.len();
10417 let data = Box::into_raw(v.into_boxed_slice());
10418 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10422 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10423 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10424 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10425 fn drop(&mut self) {
10426 if self.datalen == 0 { return; }
10427 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10430 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10431 fn clone(&self) -> Self {
10432 let mut res = Vec::new();
10433 if self.datalen == 0 { return Self::from(res); }
10434 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10439 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10440 /// This corresponds to std::vector in C++
10441 pub struct CVec_NodeAnnouncementZ {
10442 /// The elements in the array.
10443 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10444 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10445 /// The number of elements pointed to by `data`.
10448 impl CVec_NodeAnnouncementZ {
10449 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10450 if self.datalen == 0 { return Vec::new(); }
10451 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10452 self.data = core::ptr::null_mut();
10456 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10457 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10460 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10461 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10462 let datalen = v.len();
10463 let data = Box::into_raw(v.into_boxed_slice());
10464 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10468 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10469 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10470 impl Drop for CVec_NodeAnnouncementZ {
10471 fn drop(&mut self) {
10472 if self.datalen == 0 { return; }
10473 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10476 impl Clone for CVec_NodeAnnouncementZ {
10477 fn clone(&self) -> Self {
10478 let mut res = Vec::new();
10479 if self.datalen == 0 { return Self::from(res); }
10480 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10485 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10486 /// This corresponds to std::vector in C++
10487 pub struct CVec_PublicKeyZ {
10488 /// The elements in the array.
10489 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10490 pub data: *mut crate::c_types::PublicKey,
10491 /// The number of elements pointed to by `data`.
10494 impl CVec_PublicKeyZ {
10495 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10496 if self.datalen == 0 { return Vec::new(); }
10497 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10498 self.data = core::ptr::null_mut();
10502 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10503 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10506 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10507 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10508 let datalen = v.len();
10509 let data = Box::into_raw(v.into_boxed_slice());
10510 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10514 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10515 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10516 impl Drop for CVec_PublicKeyZ {
10517 fn drop(&mut self) {
10518 if self.datalen == 0 { return; }
10519 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10522 impl Clone for CVec_PublicKeyZ {
10523 fn clone(&self) -> Self {
10524 let mut res = Vec::new();
10525 if self.datalen == 0 { return Self::from(res); }
10526 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10531 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10532 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10533 /// A pointer to the contents in the success state.
10534 /// Reading from this pointer when `result_ok` is not set is undefined.
10535 pub result: *mut crate::c_types::derived::CVec_u8Z,
10536 /// A pointer to the contents in the error state.
10537 /// Reading from this pointer when `result_ok` is set is undefined.
10538 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10541 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10542 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10544 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10545 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10546 /// `err` or `result` depending on the state of `result_ok`.
10547 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10548 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10549 pub result_ok: bool,
10552 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10553 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10554 CResult_CVec_u8ZPeerHandleErrorZ {
10555 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10556 result: Box::into_raw(Box::new(o)),
10562 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10563 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10564 CResult_CVec_u8ZPeerHandleErrorZ {
10565 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10566 err: Box::into_raw(Box::new(e)),
10571 /// Checks if the given object is currently in the success state
10573 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10577 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10578 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10579 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10580 fn drop(&mut self) {
10581 if self.result_ok {
10582 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10583 let _ = unsafe { Box::from_raw(self.contents.result) };
10586 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10587 let _ = unsafe { Box::from_raw(self.contents.err) };
10592 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10593 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10594 let contents = if o.result_ok {
10595 let result = unsafe { o.contents.result };
10596 unsafe { o.contents.result = core::ptr::null_mut() };
10597 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10599 let err = unsafe { o.contents.err };
10600 unsafe { o.contents.err = core::ptr::null_mut(); }
10601 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10605 result_ok: o.result_ok,
10609 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10610 fn clone(&self) -> Self {
10611 if self.result_ok {
10612 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10613 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10616 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10617 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10623 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10624 /// but with all dynamically-allocated buffers duplicated in new buffers.
10625 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10627 /// The contents of CResult_NonePeerHandleErrorZ
10628 pub union CResult_NonePeerHandleErrorZPtr {
10629 /// Note that this value is always NULL, as there are no contents in the OK variant
10630 pub result: *mut core::ffi::c_void,
10631 /// A pointer to the contents in the error state.
10632 /// Reading from this pointer when `result_ok` is set is undefined.
10633 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10636 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10637 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10638 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10639 pub struct CResult_NonePeerHandleErrorZ {
10640 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10641 /// `err` or `result` depending on the state of `result_ok`.
10642 pub contents: CResult_NonePeerHandleErrorZPtr,
10643 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10644 pub result_ok: bool,
10647 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10648 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10649 CResult_NonePeerHandleErrorZ {
10650 contents: CResult_NonePeerHandleErrorZPtr {
10651 result: core::ptr::null_mut(),
10657 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10658 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10659 CResult_NonePeerHandleErrorZ {
10660 contents: CResult_NonePeerHandleErrorZPtr {
10661 err: Box::into_raw(Box::new(e)),
10666 /// Checks if the given object is currently in the success state
10668 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10672 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10673 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10674 impl Drop for CResult_NonePeerHandleErrorZ {
10675 fn drop(&mut self) {
10676 if self.result_ok {
10678 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10679 let _ = unsafe { Box::from_raw(self.contents.err) };
10684 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10685 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10686 let contents = if o.result_ok {
10687 let _ = unsafe { Box::from_raw(o.contents.result) };
10688 o.contents.result = core::ptr::null_mut();
10689 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10691 let err = unsafe { o.contents.err };
10692 unsafe { o.contents.err = core::ptr::null_mut(); }
10693 CResult_NonePeerHandleErrorZPtr { err }
10697 result_ok: o.result_ok,
10701 impl Clone for CResult_NonePeerHandleErrorZ {
10702 fn clone(&self) -> Self {
10703 if self.result_ok {
10704 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10705 result: core::ptr::null_mut()
10708 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10709 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10715 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10716 /// but with all dynamically-allocated buffers duplicated in new buffers.
10717 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10719 /// The contents of CResult_boolPeerHandleErrorZ
10720 pub union CResult_boolPeerHandleErrorZPtr {
10721 /// A pointer to the contents in the success state.
10722 /// Reading from this pointer when `result_ok` is not set is undefined.
10723 pub result: *mut bool,
10724 /// A pointer to the contents in the error state.
10725 /// Reading from this pointer when `result_ok` is set is undefined.
10726 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10729 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10730 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10731 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10732 pub struct CResult_boolPeerHandleErrorZ {
10733 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10734 /// `err` or `result` depending on the state of `result_ok`.
10735 pub contents: CResult_boolPeerHandleErrorZPtr,
10736 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10737 pub result_ok: bool,
10740 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10741 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10742 CResult_boolPeerHandleErrorZ {
10743 contents: CResult_boolPeerHandleErrorZPtr {
10744 result: Box::into_raw(Box::new(o)),
10750 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10751 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10752 CResult_boolPeerHandleErrorZ {
10753 contents: CResult_boolPeerHandleErrorZPtr {
10754 err: Box::into_raw(Box::new(e)),
10759 /// Checks if the given object is currently in the success state
10761 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10765 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10766 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10767 impl Drop for CResult_boolPeerHandleErrorZ {
10768 fn drop(&mut self) {
10769 if self.result_ok {
10770 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10771 let _ = unsafe { Box::from_raw(self.contents.result) };
10774 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10775 let _ = unsafe { Box::from_raw(self.contents.err) };
10780 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10781 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10782 let contents = if o.result_ok {
10783 let result = unsafe { o.contents.result };
10784 unsafe { o.contents.result = core::ptr::null_mut() };
10785 CResult_boolPeerHandleErrorZPtr { result }
10787 let err = unsafe { o.contents.err };
10788 unsafe { o.contents.err = core::ptr::null_mut(); }
10789 CResult_boolPeerHandleErrorZPtr { err }
10793 result_ok: o.result_ok,
10797 impl Clone for CResult_boolPeerHandleErrorZ {
10798 fn clone(&self) -> Self {
10799 if self.result_ok {
10800 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10801 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10804 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10805 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10811 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10812 /// but with all dynamically-allocated buffers duplicated in new buffers.
10813 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10815 /// The contents of CResult_NodeIdDecodeErrorZ
10816 pub union CResult_NodeIdDecodeErrorZPtr {
10817 /// A pointer to the contents in the success state.
10818 /// Reading from this pointer when `result_ok` is not set is undefined.
10819 pub result: *mut crate::lightning::routing::network_graph::NodeId,
10820 /// A pointer to the contents in the error state.
10821 /// Reading from this pointer when `result_ok` is set is undefined.
10822 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10825 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10826 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10827 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10828 pub struct CResult_NodeIdDecodeErrorZ {
10829 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10830 /// `err` or `result` depending on the state of `result_ok`.
10831 pub contents: CResult_NodeIdDecodeErrorZPtr,
10832 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10833 pub result_ok: bool,
10836 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10837 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10838 CResult_NodeIdDecodeErrorZ {
10839 contents: CResult_NodeIdDecodeErrorZPtr {
10840 result: Box::into_raw(Box::new(o)),
10846 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10847 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10848 CResult_NodeIdDecodeErrorZ {
10849 contents: CResult_NodeIdDecodeErrorZPtr {
10850 err: Box::into_raw(Box::new(e)),
10855 /// Checks if the given object is currently in the success state
10857 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10861 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10862 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10863 impl Drop for CResult_NodeIdDecodeErrorZ {
10864 fn drop(&mut self) {
10865 if self.result_ok {
10866 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10867 let _ = unsafe { Box::from_raw(self.contents.result) };
10870 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10871 let _ = unsafe { Box::from_raw(self.contents.err) };
10876 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10877 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10878 let contents = if o.result_ok {
10879 let result = unsafe { o.contents.result };
10880 unsafe { o.contents.result = core::ptr::null_mut() };
10881 CResult_NodeIdDecodeErrorZPtr { result }
10883 let err = unsafe { o.contents.err };
10884 unsafe { o.contents.err = core::ptr::null_mut(); }
10885 CResult_NodeIdDecodeErrorZPtr { err }
10889 result_ok: o.result_ok,
10893 impl Clone for CResult_NodeIdDecodeErrorZ {
10894 fn clone(&self) -> Self {
10895 if self.result_ok {
10896 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10897 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10900 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10901 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10907 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10908 /// but with all dynamically-allocated buffers duplicated in new buffers.
10909 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10911 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10912 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10913 /// A pointer to the contents in the success state.
10914 /// Reading from this pointer when `result_ok` is not set is undefined.
10915 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10916 /// A pointer to the contents in the error state.
10917 /// Reading from this pointer when `result_ok` is set is undefined.
10918 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10921 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10922 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10923 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10924 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10925 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10926 /// `err` or `result` depending on the state of `result_ok`.
10927 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10928 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10929 pub result_ok: bool,
10932 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10933 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10934 CResult_COption_NetworkUpdateZDecodeErrorZ {
10935 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10936 result: Box::into_raw(Box::new(o)),
10942 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10943 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10944 CResult_COption_NetworkUpdateZDecodeErrorZ {
10945 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10946 err: Box::into_raw(Box::new(e)),
10951 /// Checks if the given object is currently in the success state
10953 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10957 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10958 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10959 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10960 fn drop(&mut self) {
10961 if self.result_ok {
10962 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10963 let _ = unsafe { Box::from_raw(self.contents.result) };
10966 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10967 let _ = unsafe { Box::from_raw(self.contents.err) };
10972 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10973 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10974 let contents = if o.result_ok {
10975 let result = unsafe { o.contents.result };
10976 unsafe { o.contents.result = core::ptr::null_mut() };
10977 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10979 let err = unsafe { o.contents.err };
10980 unsafe { o.contents.err = core::ptr::null_mut(); }
10981 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10985 result_ok: o.result_ok,
10989 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10990 fn clone(&self) -> Self {
10991 if self.result_ok {
10992 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10993 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10996 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10997 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11003 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
11004 /// but with all dynamically-allocated buffers duplicated in new buffers.
11005 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
11007 /// An enum which can either contain a crate::lightning::chain::Access or not
11008 pub enum COption_AccessZ {
11009 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
11010 Some(crate::lightning::chain::Access),
11011 /// When we're in this state, this COption_AccessZ contains nothing
11014 impl COption_AccessZ {
11015 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11016 if let Self::None = self { false } else { true }
11018 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11021 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
11022 if let Self::Some(v) = self { v } else { unreachable!() }
11026 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11027 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
11028 COption_AccessZ::Some(o)
11031 /// Constructs a new COption_AccessZ containing nothing
11032 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
11033 COption_AccessZ::None
11036 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11037 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
11039 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
11040 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
11041 /// A pointer to the contents in the success state.
11042 /// Reading from this pointer when `result_ok` is not set is undefined.
11043 pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
11044 /// A pointer to the contents in the error state.
11045 /// Reading from this pointer when `result_ok` is set is undefined.
11046 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11049 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
11050 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11052 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
11053 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
11054 /// `err` or `result` depending on the state of `result_ok`.
11055 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
11056 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
11057 pub result_ok: bool,
11060 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
11061 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11062 CResult_ChannelUpdateInfoDecodeErrorZ {
11063 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11064 result: Box::into_raw(Box::new(o)),
11070 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
11071 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11072 CResult_ChannelUpdateInfoDecodeErrorZ {
11073 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11074 err: Box::into_raw(Box::new(e)),
11079 /// Checks if the given object is currently in the success state
11081 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
11085 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
11086 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
11087 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
11088 fn drop(&mut self) {
11089 if self.result_ok {
11090 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11091 let _ = unsafe { Box::from_raw(self.contents.result) };
11094 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11095 let _ = unsafe { Box::from_raw(self.contents.err) };
11100 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
11101 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11102 let contents = if o.result_ok {
11103 let result = unsafe { o.contents.result };
11104 unsafe { o.contents.result = core::ptr::null_mut() };
11105 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
11107 let err = unsafe { o.contents.err };
11108 unsafe { o.contents.err = core::ptr::null_mut(); }
11109 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11113 result_ok: o.result_ok,
11117 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11118 fn clone(&self) -> Self {
11119 if self.result_ok {
11120 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11121 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11124 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11125 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11131 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11132 /// but with all dynamically-allocated buffers duplicated in new buffers.
11133 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11135 /// The contents of CResult_ChannelInfoDecodeErrorZ
11136 pub union CResult_ChannelInfoDecodeErrorZPtr {
11137 /// A pointer to the contents in the success state.
11138 /// Reading from this pointer when `result_ok` is not set is undefined.
11139 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11140 /// A pointer to the contents in the error state.
11141 /// Reading from this pointer when `result_ok` is set is undefined.
11142 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11145 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11146 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11148 pub struct CResult_ChannelInfoDecodeErrorZ {
11149 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11150 /// `err` or `result` depending on the state of `result_ok`.
11151 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11152 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11153 pub result_ok: bool,
11156 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11157 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11158 CResult_ChannelInfoDecodeErrorZ {
11159 contents: CResult_ChannelInfoDecodeErrorZPtr {
11160 result: Box::into_raw(Box::new(o)),
11166 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11167 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11168 CResult_ChannelInfoDecodeErrorZ {
11169 contents: CResult_ChannelInfoDecodeErrorZPtr {
11170 err: Box::into_raw(Box::new(e)),
11175 /// Checks if the given object is currently in the success state
11177 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11181 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11182 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11183 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11184 fn drop(&mut self) {
11185 if self.result_ok {
11186 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11187 let _ = unsafe { Box::from_raw(self.contents.result) };
11190 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11191 let _ = unsafe { Box::from_raw(self.contents.err) };
11196 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11197 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11198 let contents = if o.result_ok {
11199 let result = unsafe { o.contents.result };
11200 unsafe { o.contents.result = core::ptr::null_mut() };
11201 CResult_ChannelInfoDecodeErrorZPtr { result }
11203 let err = unsafe { o.contents.err };
11204 unsafe { o.contents.err = core::ptr::null_mut(); }
11205 CResult_ChannelInfoDecodeErrorZPtr { err }
11209 result_ok: o.result_ok,
11213 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11214 fn clone(&self) -> Self {
11215 if self.result_ok {
11216 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11217 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11220 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11221 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11227 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11228 /// but with all dynamically-allocated buffers duplicated in new buffers.
11229 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11231 /// The contents of CResult_RoutingFeesDecodeErrorZ
11232 pub union CResult_RoutingFeesDecodeErrorZPtr {
11233 /// A pointer to the contents in the success state.
11234 /// Reading from this pointer when `result_ok` is not set is undefined.
11235 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11236 /// A pointer to the contents in the error state.
11237 /// Reading from this pointer when `result_ok` is set is undefined.
11238 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11241 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11242 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11244 pub struct CResult_RoutingFeesDecodeErrorZ {
11245 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11246 /// `err` or `result` depending on the state of `result_ok`.
11247 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11248 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11249 pub result_ok: bool,
11252 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11253 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11254 CResult_RoutingFeesDecodeErrorZ {
11255 contents: CResult_RoutingFeesDecodeErrorZPtr {
11256 result: Box::into_raw(Box::new(o)),
11262 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11263 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11264 CResult_RoutingFeesDecodeErrorZ {
11265 contents: CResult_RoutingFeesDecodeErrorZPtr {
11266 err: Box::into_raw(Box::new(e)),
11271 /// Checks if the given object is currently in the success state
11273 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11277 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11278 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11279 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11280 fn drop(&mut self) {
11281 if self.result_ok {
11282 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11283 let _ = unsafe { Box::from_raw(self.contents.result) };
11286 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11287 let _ = unsafe { Box::from_raw(self.contents.err) };
11292 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11293 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11294 let contents = if o.result_ok {
11295 let result = unsafe { o.contents.result };
11296 unsafe { o.contents.result = core::ptr::null_mut() };
11297 CResult_RoutingFeesDecodeErrorZPtr { result }
11299 let err = unsafe { o.contents.err };
11300 unsafe { o.contents.err = core::ptr::null_mut(); }
11301 CResult_RoutingFeesDecodeErrorZPtr { err }
11305 result_ok: o.result_ok,
11309 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11310 fn clone(&self) -> Self {
11311 if self.result_ok {
11312 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11313 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11316 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11317 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11323 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11324 /// but with all dynamically-allocated buffers duplicated in new buffers.
11325 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11327 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11328 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11329 /// A pointer to the contents in the success state.
11330 /// Reading from this pointer when `result_ok` is not set is undefined.
11331 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11332 /// A pointer to the contents in the error state.
11333 /// Reading from this pointer when `result_ok` is set is undefined.
11334 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11337 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11338 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11340 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11341 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11342 /// `err` or `result` depending on the state of `result_ok`.
11343 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11344 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11345 pub result_ok: bool,
11348 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11349 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11350 CResult_NodeAnnouncementInfoDecodeErrorZ {
11351 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11352 result: Box::into_raw(Box::new(o)),
11358 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11359 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11360 CResult_NodeAnnouncementInfoDecodeErrorZ {
11361 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11362 err: Box::into_raw(Box::new(e)),
11367 /// Checks if the given object is currently in the success state
11369 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11373 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11374 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11375 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11376 fn drop(&mut self) {
11377 if self.result_ok {
11378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11379 let _ = unsafe { Box::from_raw(self.contents.result) };
11382 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11383 let _ = unsafe { Box::from_raw(self.contents.err) };
11388 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11389 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11390 let contents = if o.result_ok {
11391 let result = unsafe { o.contents.result };
11392 unsafe { o.contents.result = core::ptr::null_mut() };
11393 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11395 let err = unsafe { o.contents.err };
11396 unsafe { o.contents.err = core::ptr::null_mut(); }
11397 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11401 result_ok: o.result_ok,
11405 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11406 fn clone(&self) -> Self {
11407 if self.result_ok {
11408 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11409 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11412 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11413 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11419 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11420 /// but with all dynamically-allocated buffers duplicated in new buffers.
11421 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11423 /// A dynamically-allocated array of u64s of arbitrary size.
11424 /// This corresponds to std::vector in C++
11425 pub struct CVec_u64Z {
11426 /// The elements in the array.
11427 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11428 pub data: *mut u64,
11429 /// The number of elements pointed to by `data`.
11433 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11434 if self.datalen == 0 { return Vec::new(); }
11435 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11436 self.data = core::ptr::null_mut();
11440 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11441 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11444 impl From<Vec<u64>> for CVec_u64Z {
11445 fn from(v: Vec<u64>) -> Self {
11446 let datalen = v.len();
11447 let data = Box::into_raw(v.into_boxed_slice());
11448 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11452 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11453 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11454 impl Drop for CVec_u64Z {
11455 fn drop(&mut self) {
11456 if self.datalen == 0 { return; }
11457 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11460 impl Clone for CVec_u64Z {
11461 fn clone(&self) -> Self {
11462 let mut res = Vec::new();
11463 if self.datalen == 0 { return Self::from(res); }
11464 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11469 /// The contents of CResult_NodeInfoDecodeErrorZ
11470 pub union CResult_NodeInfoDecodeErrorZPtr {
11471 /// A pointer to the contents in the success state.
11472 /// Reading from this pointer when `result_ok` is not set is undefined.
11473 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11474 /// A pointer to the contents in the error state.
11475 /// Reading from this pointer when `result_ok` is set is undefined.
11476 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11479 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11480 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11481 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11482 pub struct CResult_NodeInfoDecodeErrorZ {
11483 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11484 /// `err` or `result` depending on the state of `result_ok`.
11485 pub contents: CResult_NodeInfoDecodeErrorZPtr,
11486 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11487 pub result_ok: bool,
11490 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11491 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11492 CResult_NodeInfoDecodeErrorZ {
11493 contents: CResult_NodeInfoDecodeErrorZPtr {
11494 result: Box::into_raw(Box::new(o)),
11500 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11501 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11502 CResult_NodeInfoDecodeErrorZ {
11503 contents: CResult_NodeInfoDecodeErrorZPtr {
11504 err: Box::into_raw(Box::new(e)),
11509 /// Checks if the given object is currently in the success state
11511 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11515 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11516 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11517 impl Drop for CResult_NodeInfoDecodeErrorZ {
11518 fn drop(&mut self) {
11519 if self.result_ok {
11520 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11521 let _ = unsafe { Box::from_raw(self.contents.result) };
11524 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11525 let _ = unsafe { Box::from_raw(self.contents.err) };
11530 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11531 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11532 let contents = if o.result_ok {
11533 let result = unsafe { o.contents.result };
11534 unsafe { o.contents.result = core::ptr::null_mut() };
11535 CResult_NodeInfoDecodeErrorZPtr { result }
11537 let err = unsafe { o.contents.err };
11538 unsafe { o.contents.err = core::ptr::null_mut(); }
11539 CResult_NodeInfoDecodeErrorZPtr { err }
11543 result_ok: o.result_ok,
11547 impl Clone for CResult_NodeInfoDecodeErrorZ {
11548 fn clone(&self) -> Self {
11549 if self.result_ok {
11550 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11551 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11554 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11555 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11561 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11562 /// but with all dynamically-allocated buffers duplicated in new buffers.
11563 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11565 /// The contents of CResult_NetworkGraphDecodeErrorZ
11566 pub union CResult_NetworkGraphDecodeErrorZPtr {
11567 /// A pointer to the contents in the success state.
11568 /// Reading from this pointer when `result_ok` is not set is undefined.
11569 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11570 /// A pointer to the contents in the error state.
11571 /// Reading from this pointer when `result_ok` is set is undefined.
11572 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11575 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11576 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11578 pub struct CResult_NetworkGraphDecodeErrorZ {
11579 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11580 /// `err` or `result` depending on the state of `result_ok`.
11581 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11582 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11583 pub result_ok: bool,
11586 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11587 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11588 CResult_NetworkGraphDecodeErrorZ {
11589 contents: CResult_NetworkGraphDecodeErrorZPtr {
11590 result: Box::into_raw(Box::new(o)),
11596 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11597 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11598 CResult_NetworkGraphDecodeErrorZ {
11599 contents: CResult_NetworkGraphDecodeErrorZPtr {
11600 err: Box::into_raw(Box::new(e)),
11605 /// Checks if the given object is currently in the success state
11607 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11611 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11612 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11613 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11614 fn drop(&mut self) {
11615 if self.result_ok {
11616 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11617 let _ = unsafe { Box::from_raw(self.contents.result) };
11620 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11621 let _ = unsafe { Box::from_raw(self.contents.err) };
11626 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11627 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11628 let contents = if o.result_ok {
11629 let result = unsafe { o.contents.result };
11630 unsafe { o.contents.result = core::ptr::null_mut() };
11631 CResult_NetworkGraphDecodeErrorZPtr { result }
11633 let err = unsafe { o.contents.err };
11634 unsafe { o.contents.err = core::ptr::null_mut(); }
11635 CResult_NetworkGraphDecodeErrorZPtr { err }
11639 result_ok: o.result_ok,
11643 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11644 fn clone(&self) -> Self {
11645 if self.result_ok {
11646 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11647 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11650 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11651 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11657 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11658 /// but with all dynamically-allocated buffers duplicated in new buffers.
11659 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11662 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11663 pub enum COption_CVec_NetAddressZZ {
11664 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11665 Some(crate::c_types::derived::CVec_NetAddressZ),
11666 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11669 impl COption_CVec_NetAddressZZ {
11670 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11671 if let Self::None = self { false } else { true }
11673 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11676 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11677 if let Self::Some(v) = self { v } else { unreachable!() }
11681 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11682 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11683 COption_CVec_NetAddressZZ::Some(o)
11686 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11687 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11688 COption_CVec_NetAddressZZ::None
11691 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11692 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11694 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11695 /// but with all dynamically-allocated buffers duplicated in new buffers.
11696 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11698 /// The contents of CResult_NetAddressDecodeErrorZ
11699 pub union CResult_NetAddressDecodeErrorZPtr {
11700 /// A pointer to the contents in the success state.
11701 /// Reading from this pointer when `result_ok` is not set is undefined.
11702 pub result: *mut crate::lightning::ln::msgs::NetAddress,
11703 /// A pointer to the contents in the error state.
11704 /// Reading from this pointer when `result_ok` is set is undefined.
11705 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11708 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11709 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11711 pub struct CResult_NetAddressDecodeErrorZ {
11712 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11713 /// `err` or `result` depending on the state of `result_ok`.
11714 pub contents: CResult_NetAddressDecodeErrorZPtr,
11715 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11716 pub result_ok: bool,
11719 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11720 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11721 CResult_NetAddressDecodeErrorZ {
11722 contents: CResult_NetAddressDecodeErrorZPtr {
11723 result: Box::into_raw(Box::new(o)),
11729 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11730 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11731 CResult_NetAddressDecodeErrorZ {
11732 contents: CResult_NetAddressDecodeErrorZPtr {
11733 err: Box::into_raw(Box::new(e)),
11738 /// Checks if the given object is currently in the success state
11740 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11744 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11745 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11746 impl Drop for CResult_NetAddressDecodeErrorZ {
11747 fn drop(&mut self) {
11748 if self.result_ok {
11749 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11750 let _ = unsafe { Box::from_raw(self.contents.result) };
11753 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11754 let _ = unsafe { Box::from_raw(self.contents.err) };
11759 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11760 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11761 let contents = if o.result_ok {
11762 let result = unsafe { o.contents.result };
11763 unsafe { o.contents.result = core::ptr::null_mut() };
11764 CResult_NetAddressDecodeErrorZPtr { result }
11766 let err = unsafe { o.contents.err };
11767 unsafe { o.contents.err = core::ptr::null_mut(); }
11768 CResult_NetAddressDecodeErrorZPtr { err }
11772 result_ok: o.result_ok,
11776 impl Clone for CResult_NetAddressDecodeErrorZ {
11777 fn clone(&self) -> Self {
11778 if self.result_ok {
11779 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11780 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11783 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11784 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11790 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11791 /// but with all dynamically-allocated buffers duplicated in new buffers.
11792 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11794 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11795 /// This corresponds to std::vector in C++
11796 pub struct CVec_UpdateAddHTLCZ {
11797 /// The elements in the array.
11798 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11799 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11800 /// The number of elements pointed to by `data`.
11803 impl CVec_UpdateAddHTLCZ {
11804 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11805 if self.datalen == 0 { return Vec::new(); }
11806 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11807 self.data = core::ptr::null_mut();
11811 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11812 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11815 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11816 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11817 let datalen = v.len();
11818 let data = Box::into_raw(v.into_boxed_slice());
11819 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11823 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11824 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11825 impl Drop for CVec_UpdateAddHTLCZ {
11826 fn drop(&mut self) {
11827 if self.datalen == 0 { return; }
11828 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11831 impl Clone for CVec_UpdateAddHTLCZ {
11832 fn clone(&self) -> Self {
11833 let mut res = Vec::new();
11834 if self.datalen == 0 { return Self::from(res); }
11835 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11840 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11841 /// This corresponds to std::vector in C++
11842 pub struct CVec_UpdateFulfillHTLCZ {
11843 /// The elements in the array.
11844 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11845 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11846 /// The number of elements pointed to by `data`.
11849 impl CVec_UpdateFulfillHTLCZ {
11850 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11851 if self.datalen == 0 { return Vec::new(); }
11852 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11853 self.data = core::ptr::null_mut();
11857 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11858 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11861 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11862 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11863 let datalen = v.len();
11864 let data = Box::into_raw(v.into_boxed_slice());
11865 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11869 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11870 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11871 impl Drop for CVec_UpdateFulfillHTLCZ {
11872 fn drop(&mut self) {
11873 if self.datalen == 0 { return; }
11874 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11877 impl Clone for CVec_UpdateFulfillHTLCZ {
11878 fn clone(&self) -> Self {
11879 let mut res = Vec::new();
11880 if self.datalen == 0 { return Self::from(res); }
11881 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11886 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11887 /// This corresponds to std::vector in C++
11888 pub struct CVec_UpdateFailHTLCZ {
11889 /// The elements in the array.
11890 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11891 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11892 /// The number of elements pointed to by `data`.
11895 impl CVec_UpdateFailHTLCZ {
11896 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11897 if self.datalen == 0 { return Vec::new(); }
11898 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11899 self.data = core::ptr::null_mut();
11903 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11904 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11907 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11908 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11909 let datalen = v.len();
11910 let data = Box::into_raw(v.into_boxed_slice());
11911 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11915 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11916 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11917 impl Drop for CVec_UpdateFailHTLCZ {
11918 fn drop(&mut self) {
11919 if self.datalen == 0 { return; }
11920 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11923 impl Clone for CVec_UpdateFailHTLCZ {
11924 fn clone(&self) -> Self {
11925 let mut res = Vec::new();
11926 if self.datalen == 0 { return Self::from(res); }
11927 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11932 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11933 /// This corresponds to std::vector in C++
11934 pub struct CVec_UpdateFailMalformedHTLCZ {
11935 /// The elements in the array.
11936 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11937 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11938 /// The number of elements pointed to by `data`.
11941 impl CVec_UpdateFailMalformedHTLCZ {
11942 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11943 if self.datalen == 0 { return Vec::new(); }
11944 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11945 self.data = core::ptr::null_mut();
11949 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11950 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11953 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11954 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11955 let datalen = v.len();
11956 let data = Box::into_raw(v.into_boxed_slice());
11957 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11961 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11962 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11963 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11964 fn drop(&mut self) {
11965 if self.datalen == 0 { return; }
11966 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11969 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11970 fn clone(&self) -> Self {
11971 let mut res = Vec::new();
11972 if self.datalen == 0 { return Self::from(res); }
11973 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11978 /// The contents of CResult_AcceptChannelDecodeErrorZ
11979 pub union CResult_AcceptChannelDecodeErrorZPtr {
11980 /// A pointer to the contents in the success state.
11981 /// Reading from this pointer when `result_ok` is not set is undefined.
11982 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11983 /// A pointer to the contents in the error state.
11984 /// Reading from this pointer when `result_ok` is set is undefined.
11985 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11988 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11989 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11991 pub struct CResult_AcceptChannelDecodeErrorZ {
11992 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11993 /// `err` or `result` depending on the state of `result_ok`.
11994 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11995 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11996 pub result_ok: bool,
11999 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12000 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12001 CResult_AcceptChannelDecodeErrorZ {
12002 contents: CResult_AcceptChannelDecodeErrorZPtr {
12003 result: Box::into_raw(Box::new(o)),
12009 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12010 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12011 CResult_AcceptChannelDecodeErrorZ {
12012 contents: CResult_AcceptChannelDecodeErrorZPtr {
12013 err: Box::into_raw(Box::new(e)),
12018 /// Checks if the given object is currently in the success state
12020 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12024 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12025 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12026 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12027 fn drop(&mut self) {
12028 if self.result_ok {
12029 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12030 let _ = unsafe { Box::from_raw(self.contents.result) };
12033 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12034 let _ = unsafe { Box::from_raw(self.contents.err) };
12039 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12040 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12041 let contents = if o.result_ok {
12042 let result = unsafe { o.contents.result };
12043 unsafe { o.contents.result = core::ptr::null_mut() };
12044 CResult_AcceptChannelDecodeErrorZPtr { result }
12046 let err = unsafe { o.contents.err };
12047 unsafe { o.contents.err = core::ptr::null_mut(); }
12048 CResult_AcceptChannelDecodeErrorZPtr { err }
12052 result_ok: o.result_ok,
12056 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12057 fn clone(&self) -> Self {
12058 if self.result_ok {
12059 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12060 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12063 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12064 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12070 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12071 /// but with all dynamically-allocated buffers duplicated in new buffers.
12072 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12074 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12075 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12076 /// A pointer to the contents in the success state.
12077 /// Reading from this pointer when `result_ok` is not set is undefined.
12078 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12079 /// A pointer to the contents in the error state.
12080 /// Reading from this pointer when `result_ok` is set is undefined.
12081 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12084 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12085 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12087 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12088 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12089 /// `err` or `result` depending on the state of `result_ok`.
12090 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12091 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12092 pub result_ok: bool,
12095 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12096 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12097 CResult_AnnouncementSignaturesDecodeErrorZ {
12098 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12099 result: Box::into_raw(Box::new(o)),
12105 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12106 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12107 CResult_AnnouncementSignaturesDecodeErrorZ {
12108 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12109 err: Box::into_raw(Box::new(e)),
12114 /// Checks if the given object is currently in the success state
12116 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12120 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12121 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12122 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12123 fn drop(&mut self) {
12124 if self.result_ok {
12125 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12126 let _ = unsafe { Box::from_raw(self.contents.result) };
12129 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12130 let _ = unsafe { Box::from_raw(self.contents.err) };
12135 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12136 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12137 let contents = if o.result_ok {
12138 let result = unsafe { o.contents.result };
12139 unsafe { o.contents.result = core::ptr::null_mut() };
12140 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12142 let err = unsafe { o.contents.err };
12143 unsafe { o.contents.err = core::ptr::null_mut(); }
12144 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12148 result_ok: o.result_ok,
12152 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12153 fn clone(&self) -> Self {
12154 if self.result_ok {
12155 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12156 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12159 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12160 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12166 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12167 /// but with all dynamically-allocated buffers duplicated in new buffers.
12168 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12170 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12171 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12172 /// A pointer to the contents in the success state.
12173 /// Reading from this pointer when `result_ok` is not set is undefined.
12174 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12175 /// A pointer to the contents in the error state.
12176 /// Reading from this pointer when `result_ok` is set is undefined.
12177 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12180 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12181 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12182 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12183 pub struct CResult_ChannelReestablishDecodeErrorZ {
12184 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12185 /// `err` or `result` depending on the state of `result_ok`.
12186 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12187 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12188 pub result_ok: bool,
12191 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12192 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12193 CResult_ChannelReestablishDecodeErrorZ {
12194 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12195 result: Box::into_raw(Box::new(o)),
12201 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12202 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12203 CResult_ChannelReestablishDecodeErrorZ {
12204 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12205 err: Box::into_raw(Box::new(e)),
12210 /// Checks if the given object is currently in the success state
12212 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12216 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12217 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12218 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12219 fn drop(&mut self) {
12220 if self.result_ok {
12221 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12222 let _ = unsafe { Box::from_raw(self.contents.result) };
12225 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12226 let _ = unsafe { Box::from_raw(self.contents.err) };
12231 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12232 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12233 let contents = if o.result_ok {
12234 let result = unsafe { o.contents.result };
12235 unsafe { o.contents.result = core::ptr::null_mut() };
12236 CResult_ChannelReestablishDecodeErrorZPtr { result }
12238 let err = unsafe { o.contents.err };
12239 unsafe { o.contents.err = core::ptr::null_mut(); }
12240 CResult_ChannelReestablishDecodeErrorZPtr { err }
12244 result_ok: o.result_ok,
12248 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12249 fn clone(&self) -> Self {
12250 if self.result_ok {
12251 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12252 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12255 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12256 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12262 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12263 /// but with all dynamically-allocated buffers duplicated in new buffers.
12264 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12266 /// The contents of CResult_ClosingSignedDecodeErrorZ
12267 pub union CResult_ClosingSignedDecodeErrorZPtr {
12268 /// A pointer to the contents in the success state.
12269 /// Reading from this pointer when `result_ok` is not set is undefined.
12270 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12271 /// A pointer to the contents in the error state.
12272 /// Reading from this pointer when `result_ok` is set is undefined.
12273 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12276 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12277 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12279 pub struct CResult_ClosingSignedDecodeErrorZ {
12280 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12281 /// `err` or `result` depending on the state of `result_ok`.
12282 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12283 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12284 pub result_ok: bool,
12287 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12288 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12289 CResult_ClosingSignedDecodeErrorZ {
12290 contents: CResult_ClosingSignedDecodeErrorZPtr {
12291 result: Box::into_raw(Box::new(o)),
12297 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12298 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12299 CResult_ClosingSignedDecodeErrorZ {
12300 contents: CResult_ClosingSignedDecodeErrorZPtr {
12301 err: Box::into_raw(Box::new(e)),
12306 /// Checks if the given object is currently in the success state
12308 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12312 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12313 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12314 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12315 fn drop(&mut self) {
12316 if self.result_ok {
12317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12318 let _ = unsafe { Box::from_raw(self.contents.result) };
12321 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12322 let _ = unsafe { Box::from_raw(self.contents.err) };
12327 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12328 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12329 let contents = if o.result_ok {
12330 let result = unsafe { o.contents.result };
12331 unsafe { o.contents.result = core::ptr::null_mut() };
12332 CResult_ClosingSignedDecodeErrorZPtr { result }
12334 let err = unsafe { o.contents.err };
12335 unsafe { o.contents.err = core::ptr::null_mut(); }
12336 CResult_ClosingSignedDecodeErrorZPtr { err }
12340 result_ok: o.result_ok,
12344 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12345 fn clone(&self) -> Self {
12346 if self.result_ok {
12347 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12348 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12351 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12352 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12358 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12359 /// but with all dynamically-allocated buffers duplicated in new buffers.
12360 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12362 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12363 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12364 /// A pointer to the contents in the success state.
12365 /// Reading from this pointer when `result_ok` is not set is undefined.
12366 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12367 /// A pointer to the contents in the error state.
12368 /// Reading from this pointer when `result_ok` is set is undefined.
12369 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12372 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12373 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12375 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12376 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12377 /// `err` or `result` depending on the state of `result_ok`.
12378 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12379 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12380 pub result_ok: bool,
12383 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12384 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12385 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12386 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12387 result: Box::into_raw(Box::new(o)),
12393 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12394 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12395 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12396 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12397 err: Box::into_raw(Box::new(e)),
12402 /// Checks if the given object is currently in the success state
12404 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12408 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12409 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12410 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12411 fn drop(&mut self) {
12412 if self.result_ok {
12413 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12414 let _ = unsafe { Box::from_raw(self.contents.result) };
12417 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12418 let _ = unsafe { Box::from_raw(self.contents.err) };
12423 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12424 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12425 let contents = if o.result_ok {
12426 let result = unsafe { o.contents.result };
12427 unsafe { o.contents.result = core::ptr::null_mut() };
12428 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12430 let err = unsafe { o.contents.err };
12431 unsafe { o.contents.err = core::ptr::null_mut(); }
12432 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12436 result_ok: o.result_ok,
12440 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12441 fn clone(&self) -> Self {
12442 if self.result_ok {
12443 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12444 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12447 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12448 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12454 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12455 /// but with all dynamically-allocated buffers duplicated in new buffers.
12456 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12458 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12459 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12460 /// A pointer to the contents in the success state.
12461 /// Reading from this pointer when `result_ok` is not set is undefined.
12462 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12463 /// A pointer to the contents in the error state.
12464 /// Reading from this pointer when `result_ok` is set is undefined.
12465 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12468 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12469 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12471 pub struct CResult_CommitmentSignedDecodeErrorZ {
12472 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12473 /// `err` or `result` depending on the state of `result_ok`.
12474 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12475 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12476 pub result_ok: bool,
12479 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12480 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12481 CResult_CommitmentSignedDecodeErrorZ {
12482 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12483 result: Box::into_raw(Box::new(o)),
12489 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12490 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12491 CResult_CommitmentSignedDecodeErrorZ {
12492 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12493 err: Box::into_raw(Box::new(e)),
12498 /// Checks if the given object is currently in the success state
12500 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12504 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12505 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12506 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12507 fn drop(&mut self) {
12508 if self.result_ok {
12509 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12510 let _ = unsafe { Box::from_raw(self.contents.result) };
12513 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12514 let _ = unsafe { Box::from_raw(self.contents.err) };
12519 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12520 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12521 let contents = if o.result_ok {
12522 let result = unsafe { o.contents.result };
12523 unsafe { o.contents.result = core::ptr::null_mut() };
12524 CResult_CommitmentSignedDecodeErrorZPtr { result }
12526 let err = unsafe { o.contents.err };
12527 unsafe { o.contents.err = core::ptr::null_mut(); }
12528 CResult_CommitmentSignedDecodeErrorZPtr { err }
12532 result_ok: o.result_ok,
12536 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12537 fn clone(&self) -> Self {
12538 if self.result_ok {
12539 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12540 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12543 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12544 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12550 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12551 /// but with all dynamically-allocated buffers duplicated in new buffers.
12552 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12554 /// The contents of CResult_FundingCreatedDecodeErrorZ
12555 pub union CResult_FundingCreatedDecodeErrorZPtr {
12556 /// A pointer to the contents in the success state.
12557 /// Reading from this pointer when `result_ok` is not set is undefined.
12558 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12559 /// A pointer to the contents in the error state.
12560 /// Reading from this pointer when `result_ok` is set is undefined.
12561 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12564 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12565 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12567 pub struct CResult_FundingCreatedDecodeErrorZ {
12568 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12569 /// `err` or `result` depending on the state of `result_ok`.
12570 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12571 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12572 pub result_ok: bool,
12575 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12576 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12577 CResult_FundingCreatedDecodeErrorZ {
12578 contents: CResult_FundingCreatedDecodeErrorZPtr {
12579 result: Box::into_raw(Box::new(o)),
12585 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12586 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12587 CResult_FundingCreatedDecodeErrorZ {
12588 contents: CResult_FundingCreatedDecodeErrorZPtr {
12589 err: Box::into_raw(Box::new(e)),
12594 /// Checks if the given object is currently in the success state
12596 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12600 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12601 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12602 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12603 fn drop(&mut self) {
12604 if self.result_ok {
12605 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12606 let _ = unsafe { Box::from_raw(self.contents.result) };
12609 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12610 let _ = unsafe { Box::from_raw(self.contents.err) };
12615 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12616 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12617 let contents = if o.result_ok {
12618 let result = unsafe { o.contents.result };
12619 unsafe { o.contents.result = core::ptr::null_mut() };
12620 CResult_FundingCreatedDecodeErrorZPtr { result }
12622 let err = unsafe { o.contents.err };
12623 unsafe { o.contents.err = core::ptr::null_mut(); }
12624 CResult_FundingCreatedDecodeErrorZPtr { err }
12628 result_ok: o.result_ok,
12632 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12633 fn clone(&self) -> Self {
12634 if self.result_ok {
12635 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12636 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12639 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12640 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12646 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12647 /// but with all dynamically-allocated buffers duplicated in new buffers.
12648 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12650 /// The contents of CResult_FundingSignedDecodeErrorZ
12651 pub union CResult_FundingSignedDecodeErrorZPtr {
12652 /// A pointer to the contents in the success state.
12653 /// Reading from this pointer when `result_ok` is not set is undefined.
12654 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12655 /// A pointer to the contents in the error state.
12656 /// Reading from this pointer when `result_ok` is set is undefined.
12657 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12660 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12661 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12663 pub struct CResult_FundingSignedDecodeErrorZ {
12664 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12665 /// `err` or `result` depending on the state of `result_ok`.
12666 pub contents: CResult_FundingSignedDecodeErrorZPtr,
12667 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12668 pub result_ok: bool,
12671 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12672 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12673 CResult_FundingSignedDecodeErrorZ {
12674 contents: CResult_FundingSignedDecodeErrorZPtr {
12675 result: Box::into_raw(Box::new(o)),
12681 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12682 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12683 CResult_FundingSignedDecodeErrorZ {
12684 contents: CResult_FundingSignedDecodeErrorZPtr {
12685 err: Box::into_raw(Box::new(e)),
12690 /// Checks if the given object is currently in the success state
12692 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12696 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12697 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12698 impl Drop for CResult_FundingSignedDecodeErrorZ {
12699 fn drop(&mut self) {
12700 if self.result_ok {
12701 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12702 let _ = unsafe { Box::from_raw(self.contents.result) };
12705 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12706 let _ = unsafe { Box::from_raw(self.contents.err) };
12711 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12712 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12713 let contents = if o.result_ok {
12714 let result = unsafe { o.contents.result };
12715 unsafe { o.contents.result = core::ptr::null_mut() };
12716 CResult_FundingSignedDecodeErrorZPtr { result }
12718 let err = unsafe { o.contents.err };
12719 unsafe { o.contents.err = core::ptr::null_mut(); }
12720 CResult_FundingSignedDecodeErrorZPtr { err }
12724 result_ok: o.result_ok,
12728 impl Clone for CResult_FundingSignedDecodeErrorZ {
12729 fn clone(&self) -> Self {
12730 if self.result_ok {
12731 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12732 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12735 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12736 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12742 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12743 /// but with all dynamically-allocated buffers duplicated in new buffers.
12744 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12746 /// The contents of CResult_FundingLockedDecodeErrorZ
12747 pub union CResult_FundingLockedDecodeErrorZPtr {
12748 /// A pointer to the contents in the success state.
12749 /// Reading from this pointer when `result_ok` is not set is undefined.
12750 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12751 /// A pointer to the contents in the error state.
12752 /// Reading from this pointer when `result_ok` is set is undefined.
12753 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12756 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12757 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12759 pub struct CResult_FundingLockedDecodeErrorZ {
12760 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12761 /// `err` or `result` depending on the state of `result_ok`.
12762 pub contents: CResult_FundingLockedDecodeErrorZPtr,
12763 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12764 pub result_ok: bool,
12767 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12768 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12769 CResult_FundingLockedDecodeErrorZ {
12770 contents: CResult_FundingLockedDecodeErrorZPtr {
12771 result: Box::into_raw(Box::new(o)),
12777 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12778 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12779 CResult_FundingLockedDecodeErrorZ {
12780 contents: CResult_FundingLockedDecodeErrorZPtr {
12781 err: Box::into_raw(Box::new(e)),
12786 /// Checks if the given object is currently in the success state
12788 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12792 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12793 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12794 impl Drop for CResult_FundingLockedDecodeErrorZ {
12795 fn drop(&mut self) {
12796 if self.result_ok {
12797 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12798 let _ = unsafe { Box::from_raw(self.contents.result) };
12801 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12802 let _ = unsafe { Box::from_raw(self.contents.err) };
12807 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12808 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12809 let contents = if o.result_ok {
12810 let result = unsafe { o.contents.result };
12811 unsafe { o.contents.result = core::ptr::null_mut() };
12812 CResult_FundingLockedDecodeErrorZPtr { result }
12814 let err = unsafe { o.contents.err };
12815 unsafe { o.contents.err = core::ptr::null_mut(); }
12816 CResult_FundingLockedDecodeErrorZPtr { err }
12820 result_ok: o.result_ok,
12824 impl Clone for CResult_FundingLockedDecodeErrorZ {
12825 fn clone(&self) -> Self {
12826 if self.result_ok {
12827 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12828 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12831 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12832 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12838 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12839 /// but with all dynamically-allocated buffers duplicated in new buffers.
12840 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12842 /// The contents of CResult_InitDecodeErrorZ
12843 pub union CResult_InitDecodeErrorZPtr {
12844 /// A pointer to the contents in the success state.
12845 /// Reading from this pointer when `result_ok` is not set is undefined.
12846 pub result: *mut crate::lightning::ln::msgs::Init,
12847 /// A pointer to the contents in the error state.
12848 /// Reading from this pointer when `result_ok` is set is undefined.
12849 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12852 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12853 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12854 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12855 pub struct CResult_InitDecodeErrorZ {
12856 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12857 /// `err` or `result` depending on the state of `result_ok`.
12858 pub contents: CResult_InitDecodeErrorZPtr,
12859 /// Whether this CResult_InitDecodeErrorZ represents a success state.
12860 pub result_ok: bool,
12863 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12864 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12865 CResult_InitDecodeErrorZ {
12866 contents: CResult_InitDecodeErrorZPtr {
12867 result: Box::into_raw(Box::new(o)),
12873 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12874 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12875 CResult_InitDecodeErrorZ {
12876 contents: CResult_InitDecodeErrorZPtr {
12877 err: Box::into_raw(Box::new(e)),
12882 /// Checks if the given object is currently in the success state
12884 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12888 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12889 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12890 impl Drop for CResult_InitDecodeErrorZ {
12891 fn drop(&mut self) {
12892 if self.result_ok {
12893 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12894 let _ = unsafe { Box::from_raw(self.contents.result) };
12897 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12898 let _ = unsafe { Box::from_raw(self.contents.err) };
12903 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12904 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12905 let contents = if o.result_ok {
12906 let result = unsafe { o.contents.result };
12907 unsafe { o.contents.result = core::ptr::null_mut() };
12908 CResult_InitDecodeErrorZPtr { result }
12910 let err = unsafe { o.contents.err };
12911 unsafe { o.contents.err = core::ptr::null_mut(); }
12912 CResult_InitDecodeErrorZPtr { err }
12916 result_ok: o.result_ok,
12920 impl Clone for CResult_InitDecodeErrorZ {
12921 fn clone(&self) -> Self {
12922 if self.result_ok {
12923 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12924 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12927 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12928 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12934 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12935 /// but with all dynamically-allocated buffers duplicated in new buffers.
12936 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12938 /// The contents of CResult_OpenChannelDecodeErrorZ
12939 pub union CResult_OpenChannelDecodeErrorZPtr {
12940 /// A pointer to the contents in the success state.
12941 /// Reading from this pointer when `result_ok` is not set is undefined.
12942 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12943 /// A pointer to the contents in the error state.
12944 /// Reading from this pointer when `result_ok` is set is undefined.
12945 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12948 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12949 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12951 pub struct CResult_OpenChannelDecodeErrorZ {
12952 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12953 /// `err` or `result` depending on the state of `result_ok`.
12954 pub contents: CResult_OpenChannelDecodeErrorZPtr,
12955 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12956 pub result_ok: bool,
12959 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12960 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12961 CResult_OpenChannelDecodeErrorZ {
12962 contents: CResult_OpenChannelDecodeErrorZPtr {
12963 result: Box::into_raw(Box::new(o)),
12969 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12970 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12971 CResult_OpenChannelDecodeErrorZ {
12972 contents: CResult_OpenChannelDecodeErrorZPtr {
12973 err: Box::into_raw(Box::new(e)),
12978 /// Checks if the given object is currently in the success state
12980 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12984 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12985 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12986 impl Drop for CResult_OpenChannelDecodeErrorZ {
12987 fn drop(&mut self) {
12988 if self.result_ok {
12989 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12990 let _ = unsafe { Box::from_raw(self.contents.result) };
12993 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12994 let _ = unsafe { Box::from_raw(self.contents.err) };
12999 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13000 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13001 let contents = if o.result_ok {
13002 let result = unsafe { o.contents.result };
13003 unsafe { o.contents.result = core::ptr::null_mut() };
13004 CResult_OpenChannelDecodeErrorZPtr { result }
13006 let err = unsafe { o.contents.err };
13007 unsafe { o.contents.err = core::ptr::null_mut(); }
13008 CResult_OpenChannelDecodeErrorZPtr { err }
13012 result_ok: o.result_ok,
13016 impl Clone for CResult_OpenChannelDecodeErrorZ {
13017 fn clone(&self) -> Self {
13018 if self.result_ok {
13019 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13020 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13023 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13024 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13030 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13031 /// but with all dynamically-allocated buffers duplicated in new buffers.
13032 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13034 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13035 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13036 /// A pointer to the contents in the success state.
13037 /// Reading from this pointer when `result_ok` is not set is undefined.
13038 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13039 /// A pointer to the contents in the error state.
13040 /// Reading from this pointer when `result_ok` is set is undefined.
13041 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13044 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13045 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13047 pub struct CResult_RevokeAndACKDecodeErrorZ {
13048 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13049 /// `err` or `result` depending on the state of `result_ok`.
13050 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13051 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13052 pub result_ok: bool,
13055 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13056 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13057 CResult_RevokeAndACKDecodeErrorZ {
13058 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13059 result: Box::into_raw(Box::new(o)),
13065 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13066 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13067 CResult_RevokeAndACKDecodeErrorZ {
13068 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13069 err: Box::into_raw(Box::new(e)),
13074 /// Checks if the given object is currently in the success state
13076 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13080 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13081 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13082 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13083 fn drop(&mut self) {
13084 if self.result_ok {
13085 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13086 let _ = unsafe { Box::from_raw(self.contents.result) };
13089 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13090 let _ = unsafe { Box::from_raw(self.contents.err) };
13095 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13096 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13097 let contents = if o.result_ok {
13098 let result = unsafe { o.contents.result };
13099 unsafe { o.contents.result = core::ptr::null_mut() };
13100 CResult_RevokeAndACKDecodeErrorZPtr { result }
13102 let err = unsafe { o.contents.err };
13103 unsafe { o.contents.err = core::ptr::null_mut(); }
13104 CResult_RevokeAndACKDecodeErrorZPtr { err }
13108 result_ok: o.result_ok,
13112 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13113 fn clone(&self) -> Self {
13114 if self.result_ok {
13115 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13116 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13119 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13120 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13126 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13127 /// but with all dynamically-allocated buffers duplicated in new buffers.
13128 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13130 /// The contents of CResult_ShutdownDecodeErrorZ
13131 pub union CResult_ShutdownDecodeErrorZPtr {
13132 /// A pointer to the contents in the success state.
13133 /// Reading from this pointer when `result_ok` is not set is undefined.
13134 pub result: *mut crate::lightning::ln::msgs::Shutdown,
13135 /// A pointer to the contents in the error state.
13136 /// Reading from this pointer when `result_ok` is set is undefined.
13137 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13140 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13141 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13143 pub struct CResult_ShutdownDecodeErrorZ {
13144 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13145 /// `err` or `result` depending on the state of `result_ok`.
13146 pub contents: CResult_ShutdownDecodeErrorZPtr,
13147 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13148 pub result_ok: bool,
13151 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13152 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13153 CResult_ShutdownDecodeErrorZ {
13154 contents: CResult_ShutdownDecodeErrorZPtr {
13155 result: Box::into_raw(Box::new(o)),
13161 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13162 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13163 CResult_ShutdownDecodeErrorZ {
13164 contents: CResult_ShutdownDecodeErrorZPtr {
13165 err: Box::into_raw(Box::new(e)),
13170 /// Checks if the given object is currently in the success state
13172 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13176 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13177 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13178 impl Drop for CResult_ShutdownDecodeErrorZ {
13179 fn drop(&mut self) {
13180 if self.result_ok {
13181 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13182 let _ = unsafe { Box::from_raw(self.contents.result) };
13185 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13186 let _ = unsafe { Box::from_raw(self.contents.err) };
13191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13192 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13193 let contents = if o.result_ok {
13194 let result = unsafe { o.contents.result };
13195 unsafe { o.contents.result = core::ptr::null_mut() };
13196 CResult_ShutdownDecodeErrorZPtr { result }
13198 let err = unsafe { o.contents.err };
13199 unsafe { o.contents.err = core::ptr::null_mut(); }
13200 CResult_ShutdownDecodeErrorZPtr { err }
13204 result_ok: o.result_ok,
13208 impl Clone for CResult_ShutdownDecodeErrorZ {
13209 fn clone(&self) -> Self {
13210 if self.result_ok {
13211 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13212 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13215 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13216 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13222 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13223 /// but with all dynamically-allocated buffers duplicated in new buffers.
13224 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13226 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13227 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13228 /// A pointer to the contents in the success state.
13229 /// Reading from this pointer when `result_ok` is not set is undefined.
13230 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13231 /// A pointer to the contents in the error state.
13232 /// Reading from this pointer when `result_ok` is set is undefined.
13233 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13236 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13237 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13239 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13240 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13241 /// `err` or `result` depending on the state of `result_ok`.
13242 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13243 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13244 pub result_ok: bool,
13247 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13248 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13249 CResult_UpdateFailHTLCDecodeErrorZ {
13250 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13251 result: Box::into_raw(Box::new(o)),
13257 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13258 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13259 CResult_UpdateFailHTLCDecodeErrorZ {
13260 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13261 err: Box::into_raw(Box::new(e)),
13266 /// Checks if the given object is currently in the success state
13268 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13272 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13273 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13274 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13275 fn drop(&mut self) {
13276 if self.result_ok {
13277 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13278 let _ = unsafe { Box::from_raw(self.contents.result) };
13281 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13282 let _ = unsafe { Box::from_raw(self.contents.err) };
13287 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13288 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13289 let contents = if o.result_ok {
13290 let result = unsafe { o.contents.result };
13291 unsafe { o.contents.result = core::ptr::null_mut() };
13292 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13294 let err = unsafe { o.contents.err };
13295 unsafe { o.contents.err = core::ptr::null_mut(); }
13296 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13300 result_ok: o.result_ok,
13304 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13305 fn clone(&self) -> Self {
13306 if self.result_ok {
13307 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13308 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13311 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13312 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13318 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13319 /// but with all dynamically-allocated buffers duplicated in new buffers.
13320 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13322 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13323 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13324 /// A pointer to the contents in the success state.
13325 /// Reading from this pointer when `result_ok` is not set is undefined.
13326 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13327 /// A pointer to the contents in the error state.
13328 /// Reading from this pointer when `result_ok` is set is undefined.
13329 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13332 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13333 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13335 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13336 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13337 /// `err` or `result` depending on the state of `result_ok`.
13338 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13339 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13340 pub result_ok: bool,
13343 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13344 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13345 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13346 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13347 result: Box::into_raw(Box::new(o)),
13353 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13354 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13355 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13356 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13357 err: Box::into_raw(Box::new(e)),
13362 /// Checks if the given object is currently in the success state
13364 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13368 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13369 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13370 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13371 fn drop(&mut self) {
13372 if self.result_ok {
13373 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13374 let _ = unsafe { Box::from_raw(self.contents.result) };
13377 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13378 let _ = unsafe { Box::from_raw(self.contents.err) };
13383 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13384 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13385 let contents = if o.result_ok {
13386 let result = unsafe { o.contents.result };
13387 unsafe { o.contents.result = core::ptr::null_mut() };
13388 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13390 let err = unsafe { o.contents.err };
13391 unsafe { o.contents.err = core::ptr::null_mut(); }
13392 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13396 result_ok: o.result_ok,
13400 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13401 fn clone(&self) -> Self {
13402 if self.result_ok {
13403 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13404 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13407 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13408 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13414 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13415 /// but with all dynamically-allocated buffers duplicated in new buffers.
13416 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13418 /// The contents of CResult_UpdateFeeDecodeErrorZ
13419 pub union CResult_UpdateFeeDecodeErrorZPtr {
13420 /// A pointer to the contents in the success state.
13421 /// Reading from this pointer when `result_ok` is not set is undefined.
13422 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13423 /// A pointer to the contents in the error state.
13424 /// Reading from this pointer when `result_ok` is set is undefined.
13425 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13428 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13429 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13431 pub struct CResult_UpdateFeeDecodeErrorZ {
13432 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13433 /// `err` or `result` depending on the state of `result_ok`.
13434 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13435 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13436 pub result_ok: bool,
13439 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13440 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13441 CResult_UpdateFeeDecodeErrorZ {
13442 contents: CResult_UpdateFeeDecodeErrorZPtr {
13443 result: Box::into_raw(Box::new(o)),
13449 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13450 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13451 CResult_UpdateFeeDecodeErrorZ {
13452 contents: CResult_UpdateFeeDecodeErrorZPtr {
13453 err: Box::into_raw(Box::new(e)),
13458 /// Checks if the given object is currently in the success state
13460 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13464 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13465 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13466 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13467 fn drop(&mut self) {
13468 if self.result_ok {
13469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13470 let _ = unsafe { Box::from_raw(self.contents.result) };
13473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13474 let _ = unsafe { Box::from_raw(self.contents.err) };
13479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13480 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13481 let contents = if o.result_ok {
13482 let result = unsafe { o.contents.result };
13483 unsafe { o.contents.result = core::ptr::null_mut() };
13484 CResult_UpdateFeeDecodeErrorZPtr { result }
13486 let err = unsafe { o.contents.err };
13487 unsafe { o.contents.err = core::ptr::null_mut(); }
13488 CResult_UpdateFeeDecodeErrorZPtr { err }
13492 result_ok: o.result_ok,
13496 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13497 fn clone(&self) -> Self {
13498 if self.result_ok {
13499 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13500 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13503 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13504 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13510 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13511 /// but with all dynamically-allocated buffers duplicated in new buffers.
13512 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13514 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13515 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13516 /// A pointer to the contents in the success state.
13517 /// Reading from this pointer when `result_ok` is not set is undefined.
13518 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13519 /// A pointer to the contents in the error state.
13520 /// Reading from this pointer when `result_ok` is set is undefined.
13521 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13524 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13525 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13527 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13528 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13529 /// `err` or `result` depending on the state of `result_ok`.
13530 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13531 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13532 pub result_ok: bool,
13535 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13536 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13537 CResult_UpdateFulfillHTLCDecodeErrorZ {
13538 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13539 result: Box::into_raw(Box::new(o)),
13545 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13546 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13547 CResult_UpdateFulfillHTLCDecodeErrorZ {
13548 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13549 err: Box::into_raw(Box::new(e)),
13554 /// Checks if the given object is currently in the success state
13556 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13560 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13561 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13562 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13563 fn drop(&mut self) {
13564 if self.result_ok {
13565 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13566 let _ = unsafe { Box::from_raw(self.contents.result) };
13569 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13570 let _ = unsafe { Box::from_raw(self.contents.err) };
13575 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13576 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13577 let contents = if o.result_ok {
13578 let result = unsafe { o.contents.result };
13579 unsafe { o.contents.result = core::ptr::null_mut() };
13580 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13582 let err = unsafe { o.contents.err };
13583 unsafe { o.contents.err = core::ptr::null_mut(); }
13584 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13588 result_ok: o.result_ok,
13592 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13593 fn clone(&self) -> Self {
13594 if self.result_ok {
13595 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13596 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13599 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13600 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13606 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13607 /// but with all dynamically-allocated buffers duplicated in new buffers.
13608 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13610 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13611 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13612 /// A pointer to the contents in the success state.
13613 /// Reading from this pointer when `result_ok` is not set is undefined.
13614 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13615 /// A pointer to the contents in the error state.
13616 /// Reading from this pointer when `result_ok` is set is undefined.
13617 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13620 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13621 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13623 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13624 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13625 /// `err` or `result` depending on the state of `result_ok`.
13626 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13627 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13628 pub result_ok: bool,
13631 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13632 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13633 CResult_UpdateAddHTLCDecodeErrorZ {
13634 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13635 result: Box::into_raw(Box::new(o)),
13641 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13642 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13643 CResult_UpdateAddHTLCDecodeErrorZ {
13644 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13645 err: Box::into_raw(Box::new(e)),
13650 /// Checks if the given object is currently in the success state
13652 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13656 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13657 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13658 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13659 fn drop(&mut self) {
13660 if self.result_ok {
13661 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13662 let _ = unsafe { Box::from_raw(self.contents.result) };
13665 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13666 let _ = unsafe { Box::from_raw(self.contents.err) };
13671 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13672 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13673 let contents = if o.result_ok {
13674 let result = unsafe { o.contents.result };
13675 unsafe { o.contents.result = core::ptr::null_mut() };
13676 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13678 let err = unsafe { o.contents.err };
13679 unsafe { o.contents.err = core::ptr::null_mut(); }
13680 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13684 result_ok: o.result_ok,
13688 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13689 fn clone(&self) -> Self {
13690 if self.result_ok {
13691 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13692 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13695 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13696 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13702 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13703 /// but with all dynamically-allocated buffers duplicated in new buffers.
13704 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13706 /// The contents of CResult_PingDecodeErrorZ
13707 pub union CResult_PingDecodeErrorZPtr {
13708 /// A pointer to the contents in the success state.
13709 /// Reading from this pointer when `result_ok` is not set is undefined.
13710 pub result: *mut crate::lightning::ln::msgs::Ping,
13711 /// A pointer to the contents in the error state.
13712 /// Reading from this pointer when `result_ok` is set is undefined.
13713 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13716 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13717 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13718 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13719 pub struct CResult_PingDecodeErrorZ {
13720 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13721 /// `err` or `result` depending on the state of `result_ok`.
13722 pub contents: CResult_PingDecodeErrorZPtr,
13723 /// Whether this CResult_PingDecodeErrorZ represents a success state.
13724 pub result_ok: bool,
13727 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13728 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13729 CResult_PingDecodeErrorZ {
13730 contents: CResult_PingDecodeErrorZPtr {
13731 result: Box::into_raw(Box::new(o)),
13737 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13738 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13739 CResult_PingDecodeErrorZ {
13740 contents: CResult_PingDecodeErrorZPtr {
13741 err: Box::into_raw(Box::new(e)),
13746 /// Checks if the given object is currently in the success state
13748 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13752 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13753 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13754 impl Drop for CResult_PingDecodeErrorZ {
13755 fn drop(&mut self) {
13756 if self.result_ok {
13757 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13758 let _ = unsafe { Box::from_raw(self.contents.result) };
13761 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13762 let _ = unsafe { Box::from_raw(self.contents.err) };
13767 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13768 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13769 let contents = if o.result_ok {
13770 let result = unsafe { o.contents.result };
13771 unsafe { o.contents.result = core::ptr::null_mut() };
13772 CResult_PingDecodeErrorZPtr { result }
13774 let err = unsafe { o.contents.err };
13775 unsafe { o.contents.err = core::ptr::null_mut(); }
13776 CResult_PingDecodeErrorZPtr { err }
13780 result_ok: o.result_ok,
13784 impl Clone for CResult_PingDecodeErrorZ {
13785 fn clone(&self) -> Self {
13786 if self.result_ok {
13787 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13788 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13791 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13792 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13798 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13799 /// but with all dynamically-allocated buffers duplicated in new buffers.
13800 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13802 /// The contents of CResult_PongDecodeErrorZ
13803 pub union CResult_PongDecodeErrorZPtr {
13804 /// A pointer to the contents in the success state.
13805 /// Reading from this pointer when `result_ok` is not set is undefined.
13806 pub result: *mut crate::lightning::ln::msgs::Pong,
13807 /// A pointer to the contents in the error state.
13808 /// Reading from this pointer when `result_ok` is set is undefined.
13809 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13812 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13813 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13814 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13815 pub struct CResult_PongDecodeErrorZ {
13816 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13817 /// `err` or `result` depending on the state of `result_ok`.
13818 pub contents: CResult_PongDecodeErrorZPtr,
13819 /// Whether this CResult_PongDecodeErrorZ represents a success state.
13820 pub result_ok: bool,
13823 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13824 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13825 CResult_PongDecodeErrorZ {
13826 contents: CResult_PongDecodeErrorZPtr {
13827 result: Box::into_raw(Box::new(o)),
13833 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13834 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13835 CResult_PongDecodeErrorZ {
13836 contents: CResult_PongDecodeErrorZPtr {
13837 err: Box::into_raw(Box::new(e)),
13842 /// Checks if the given object is currently in the success state
13844 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13848 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13849 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13850 impl Drop for CResult_PongDecodeErrorZ {
13851 fn drop(&mut self) {
13852 if self.result_ok {
13853 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13854 let _ = unsafe { Box::from_raw(self.contents.result) };
13857 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13858 let _ = unsafe { Box::from_raw(self.contents.err) };
13863 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13864 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13865 let contents = if o.result_ok {
13866 let result = unsafe { o.contents.result };
13867 unsafe { o.contents.result = core::ptr::null_mut() };
13868 CResult_PongDecodeErrorZPtr { result }
13870 let err = unsafe { o.contents.err };
13871 unsafe { o.contents.err = core::ptr::null_mut(); }
13872 CResult_PongDecodeErrorZPtr { err }
13876 result_ok: o.result_ok,
13880 impl Clone for CResult_PongDecodeErrorZ {
13881 fn clone(&self) -> Self {
13882 if self.result_ok {
13883 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13884 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13887 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13888 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13894 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13895 /// but with all dynamically-allocated buffers duplicated in new buffers.
13896 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13898 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13899 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13900 /// A pointer to the contents in the success state.
13901 /// Reading from this pointer when `result_ok` is not set is undefined.
13902 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13903 /// A pointer to the contents in the error state.
13904 /// Reading from this pointer when `result_ok` is set is undefined.
13905 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13908 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13909 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13910 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13911 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13912 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13913 /// `err` or `result` depending on the state of `result_ok`.
13914 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13915 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13916 pub result_ok: bool,
13919 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13920 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13921 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13922 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13923 result: Box::into_raw(Box::new(o)),
13929 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13930 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13931 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13932 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13933 err: Box::into_raw(Box::new(e)),
13938 /// Checks if the given object is currently in the success state
13940 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13944 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13945 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13946 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13947 fn drop(&mut self) {
13948 if self.result_ok {
13949 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13950 let _ = unsafe { Box::from_raw(self.contents.result) };
13953 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13954 let _ = unsafe { Box::from_raw(self.contents.err) };
13959 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13960 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13961 let contents = if o.result_ok {
13962 let result = unsafe { o.contents.result };
13963 unsafe { o.contents.result = core::ptr::null_mut() };
13964 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13966 let err = unsafe { o.contents.err };
13967 unsafe { o.contents.err = core::ptr::null_mut(); }
13968 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13972 result_ok: o.result_ok,
13976 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13977 fn clone(&self) -> Self {
13978 if self.result_ok {
13979 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13980 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13983 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13984 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13990 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13991 /// but with all dynamically-allocated buffers duplicated in new buffers.
13992 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13994 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13995 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
13996 /// A pointer to the contents in the success state.
13997 /// Reading from this pointer when `result_ok` is not set is undefined.
13998 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
13999 /// A pointer to the contents in the error state.
14000 /// Reading from this pointer when `result_ok` is set is undefined.
14001 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14004 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14005 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14006 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14007 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14008 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14009 /// `err` or `result` depending on the state of `result_ok`.
14010 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14011 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14012 pub result_ok: bool,
14015 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14016 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14017 CResult_ChannelAnnouncementDecodeErrorZ {
14018 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14019 result: Box::into_raw(Box::new(o)),
14025 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14026 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14027 CResult_ChannelAnnouncementDecodeErrorZ {
14028 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14029 err: Box::into_raw(Box::new(e)),
14034 /// Checks if the given object is currently in the success state
14036 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14040 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14041 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14042 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14043 fn drop(&mut self) {
14044 if self.result_ok {
14045 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14046 let _ = unsafe { Box::from_raw(self.contents.result) };
14049 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14050 let _ = unsafe { Box::from_raw(self.contents.err) };
14055 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14056 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14057 let contents = if o.result_ok {
14058 let result = unsafe { o.contents.result };
14059 unsafe { o.contents.result = core::ptr::null_mut() };
14060 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14062 let err = unsafe { o.contents.err };
14063 unsafe { o.contents.err = core::ptr::null_mut(); }
14064 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14068 result_ok: o.result_ok,
14072 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14073 fn clone(&self) -> Self {
14074 if self.result_ok {
14075 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14076 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14079 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14080 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14086 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14087 /// but with all dynamically-allocated buffers duplicated in new buffers.
14088 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14090 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14091 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14092 /// A pointer to the contents in the success state.
14093 /// Reading from this pointer when `result_ok` is not set is undefined.
14094 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14095 /// A pointer to the contents in the error state.
14096 /// Reading from this pointer when `result_ok` is set is undefined.
14097 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14100 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14101 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14102 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14103 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14104 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14105 /// `err` or `result` depending on the state of `result_ok`.
14106 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14107 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14108 pub result_ok: bool,
14111 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14112 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14113 CResult_UnsignedChannelUpdateDecodeErrorZ {
14114 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14115 result: Box::into_raw(Box::new(o)),
14121 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14122 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14123 CResult_UnsignedChannelUpdateDecodeErrorZ {
14124 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14125 err: Box::into_raw(Box::new(e)),
14130 /// Checks if the given object is currently in the success state
14132 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14136 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14137 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14138 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14139 fn drop(&mut self) {
14140 if self.result_ok {
14141 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14142 let _ = unsafe { Box::from_raw(self.contents.result) };
14145 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14146 let _ = unsafe { Box::from_raw(self.contents.err) };
14151 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14152 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14153 let contents = if o.result_ok {
14154 let result = unsafe { o.contents.result };
14155 unsafe { o.contents.result = core::ptr::null_mut() };
14156 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14158 let err = unsafe { o.contents.err };
14159 unsafe { o.contents.err = core::ptr::null_mut(); }
14160 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14164 result_ok: o.result_ok,
14168 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14169 fn clone(&self) -> Self {
14170 if self.result_ok {
14171 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14172 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14175 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14176 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14182 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14183 /// but with all dynamically-allocated buffers duplicated in new buffers.
14184 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14186 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14187 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14188 /// A pointer to the contents in the success state.
14189 /// Reading from this pointer when `result_ok` is not set is undefined.
14190 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14191 /// A pointer to the contents in the error state.
14192 /// Reading from this pointer when `result_ok` is set is undefined.
14193 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14196 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14197 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14198 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14199 pub struct CResult_ChannelUpdateDecodeErrorZ {
14200 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14201 /// `err` or `result` depending on the state of `result_ok`.
14202 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14203 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14204 pub result_ok: bool,
14207 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14208 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14209 CResult_ChannelUpdateDecodeErrorZ {
14210 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14211 result: Box::into_raw(Box::new(o)),
14217 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14218 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14219 CResult_ChannelUpdateDecodeErrorZ {
14220 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14221 err: Box::into_raw(Box::new(e)),
14226 /// Checks if the given object is currently in the success state
14228 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14232 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14233 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14234 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14235 fn drop(&mut self) {
14236 if self.result_ok {
14237 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14238 let _ = unsafe { Box::from_raw(self.contents.result) };
14241 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14242 let _ = unsafe { Box::from_raw(self.contents.err) };
14247 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14248 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14249 let contents = if o.result_ok {
14250 let result = unsafe { o.contents.result };
14251 unsafe { o.contents.result = core::ptr::null_mut() };
14252 CResult_ChannelUpdateDecodeErrorZPtr { result }
14254 let err = unsafe { o.contents.err };
14255 unsafe { o.contents.err = core::ptr::null_mut(); }
14256 CResult_ChannelUpdateDecodeErrorZPtr { err }
14260 result_ok: o.result_ok,
14264 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14265 fn clone(&self) -> Self {
14266 if self.result_ok {
14267 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14268 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14271 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14272 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14278 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14279 /// but with all dynamically-allocated buffers duplicated in new buffers.
14280 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14282 /// The contents of CResult_ErrorMessageDecodeErrorZ
14283 pub union CResult_ErrorMessageDecodeErrorZPtr {
14284 /// A pointer to the contents in the success state.
14285 /// Reading from this pointer when `result_ok` is not set is undefined.
14286 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14287 /// A pointer to the contents in the error state.
14288 /// Reading from this pointer when `result_ok` is set is undefined.
14289 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14292 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14293 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14295 pub struct CResult_ErrorMessageDecodeErrorZ {
14296 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14297 /// `err` or `result` depending on the state of `result_ok`.
14298 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14299 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14300 pub result_ok: bool,
14303 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14304 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14305 CResult_ErrorMessageDecodeErrorZ {
14306 contents: CResult_ErrorMessageDecodeErrorZPtr {
14307 result: Box::into_raw(Box::new(o)),
14313 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14314 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14315 CResult_ErrorMessageDecodeErrorZ {
14316 contents: CResult_ErrorMessageDecodeErrorZPtr {
14317 err: Box::into_raw(Box::new(e)),
14322 /// Checks if the given object is currently in the success state
14324 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14328 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14329 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14330 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14331 fn drop(&mut self) {
14332 if self.result_ok {
14333 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14334 let _ = unsafe { Box::from_raw(self.contents.result) };
14337 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14338 let _ = unsafe { Box::from_raw(self.contents.err) };
14343 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14344 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14345 let contents = if o.result_ok {
14346 let result = unsafe { o.contents.result };
14347 unsafe { o.contents.result = core::ptr::null_mut() };
14348 CResult_ErrorMessageDecodeErrorZPtr { result }
14350 let err = unsafe { o.contents.err };
14351 unsafe { o.contents.err = core::ptr::null_mut(); }
14352 CResult_ErrorMessageDecodeErrorZPtr { err }
14356 result_ok: o.result_ok,
14360 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14361 fn clone(&self) -> Self {
14362 if self.result_ok {
14363 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14364 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14367 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14368 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14374 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14375 /// but with all dynamically-allocated buffers duplicated in new buffers.
14376 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14378 /// The contents of CResult_WarningMessageDecodeErrorZ
14379 pub union CResult_WarningMessageDecodeErrorZPtr {
14380 /// A pointer to the contents in the success state.
14381 /// Reading from this pointer when `result_ok` is not set is undefined.
14382 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14383 /// A pointer to the contents in the error state.
14384 /// Reading from this pointer when `result_ok` is set is undefined.
14385 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14388 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14389 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14391 pub struct CResult_WarningMessageDecodeErrorZ {
14392 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14393 /// `err` or `result` depending on the state of `result_ok`.
14394 pub contents: CResult_WarningMessageDecodeErrorZPtr,
14395 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14396 pub result_ok: bool,
14399 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14400 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14401 CResult_WarningMessageDecodeErrorZ {
14402 contents: CResult_WarningMessageDecodeErrorZPtr {
14403 result: Box::into_raw(Box::new(o)),
14409 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14410 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14411 CResult_WarningMessageDecodeErrorZ {
14412 contents: CResult_WarningMessageDecodeErrorZPtr {
14413 err: Box::into_raw(Box::new(e)),
14418 /// Checks if the given object is currently in the success state
14420 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14424 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14425 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14426 impl Drop for CResult_WarningMessageDecodeErrorZ {
14427 fn drop(&mut self) {
14428 if self.result_ok {
14429 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14430 let _ = unsafe { Box::from_raw(self.contents.result) };
14433 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14434 let _ = unsafe { Box::from_raw(self.contents.err) };
14439 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14440 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14441 let contents = if o.result_ok {
14442 let result = unsafe { o.contents.result };
14443 unsafe { o.contents.result = core::ptr::null_mut() };
14444 CResult_WarningMessageDecodeErrorZPtr { result }
14446 let err = unsafe { o.contents.err };
14447 unsafe { o.contents.err = core::ptr::null_mut(); }
14448 CResult_WarningMessageDecodeErrorZPtr { err }
14452 result_ok: o.result_ok,
14456 impl Clone for CResult_WarningMessageDecodeErrorZ {
14457 fn clone(&self) -> Self {
14458 if self.result_ok {
14459 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14460 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14463 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14464 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14470 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14471 /// but with all dynamically-allocated buffers duplicated in new buffers.
14472 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14474 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14475 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14476 /// A pointer to the contents in the success state.
14477 /// Reading from this pointer when `result_ok` is not set is undefined.
14478 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14479 /// A pointer to the contents in the error state.
14480 /// Reading from this pointer when `result_ok` is set is undefined.
14481 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14484 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14485 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14487 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14488 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14489 /// `err` or `result` depending on the state of `result_ok`.
14490 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14491 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14492 pub result_ok: bool,
14495 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14496 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14497 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14498 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14499 result: Box::into_raw(Box::new(o)),
14505 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14506 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14507 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14508 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14509 err: Box::into_raw(Box::new(e)),
14514 /// Checks if the given object is currently in the success state
14516 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14520 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14521 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14522 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14523 fn drop(&mut self) {
14524 if self.result_ok {
14525 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14526 let _ = unsafe { Box::from_raw(self.contents.result) };
14529 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14530 let _ = unsafe { Box::from_raw(self.contents.err) };
14535 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14536 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14537 let contents = if o.result_ok {
14538 let result = unsafe { o.contents.result };
14539 unsafe { o.contents.result = core::ptr::null_mut() };
14540 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14542 let err = unsafe { o.contents.err };
14543 unsafe { o.contents.err = core::ptr::null_mut(); }
14544 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14548 result_ok: o.result_ok,
14552 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14553 fn clone(&self) -> Self {
14554 if self.result_ok {
14555 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14556 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14559 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14560 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14566 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14567 /// but with all dynamically-allocated buffers duplicated in new buffers.
14568 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14570 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14571 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14572 /// A pointer to the contents in the success state.
14573 /// Reading from this pointer when `result_ok` is not set is undefined.
14574 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14575 /// A pointer to the contents in the error state.
14576 /// Reading from this pointer when `result_ok` is set is undefined.
14577 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14580 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14581 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14582 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14583 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14584 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14585 /// `err` or `result` depending on the state of `result_ok`.
14586 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14587 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14588 pub result_ok: bool,
14591 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14592 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14593 CResult_NodeAnnouncementDecodeErrorZ {
14594 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14595 result: Box::into_raw(Box::new(o)),
14601 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14602 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14603 CResult_NodeAnnouncementDecodeErrorZ {
14604 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14605 err: Box::into_raw(Box::new(e)),
14610 /// Checks if the given object is currently in the success state
14612 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14616 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14617 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14618 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14619 fn drop(&mut self) {
14620 if self.result_ok {
14621 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14622 let _ = unsafe { Box::from_raw(self.contents.result) };
14625 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14626 let _ = unsafe { Box::from_raw(self.contents.err) };
14631 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14632 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14633 let contents = if o.result_ok {
14634 let result = unsafe { o.contents.result };
14635 unsafe { o.contents.result = core::ptr::null_mut() };
14636 CResult_NodeAnnouncementDecodeErrorZPtr { result }
14638 let err = unsafe { o.contents.err };
14639 unsafe { o.contents.err = core::ptr::null_mut(); }
14640 CResult_NodeAnnouncementDecodeErrorZPtr { err }
14644 result_ok: o.result_ok,
14648 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14649 fn clone(&self) -> Self {
14650 if self.result_ok {
14651 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14652 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14655 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14656 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14662 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14663 /// but with all dynamically-allocated buffers duplicated in new buffers.
14664 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14666 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14667 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14668 /// A pointer to the contents in the success state.
14669 /// Reading from this pointer when `result_ok` is not set is undefined.
14670 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14671 /// A pointer to the contents in the error state.
14672 /// Reading from this pointer when `result_ok` is set is undefined.
14673 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14676 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14677 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14678 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14679 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14680 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14681 /// `err` or `result` depending on the state of `result_ok`.
14682 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14683 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14684 pub result_ok: bool,
14687 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14688 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14689 CResult_QueryShortChannelIdsDecodeErrorZ {
14690 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14691 result: Box::into_raw(Box::new(o)),
14697 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14698 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14699 CResult_QueryShortChannelIdsDecodeErrorZ {
14700 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14701 err: Box::into_raw(Box::new(e)),
14706 /// Checks if the given object is currently in the success state
14708 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14712 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14713 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14714 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14715 fn drop(&mut self) {
14716 if self.result_ok {
14717 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14718 let _ = unsafe { Box::from_raw(self.contents.result) };
14721 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14722 let _ = unsafe { Box::from_raw(self.contents.err) };
14727 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14728 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14729 let contents = if o.result_ok {
14730 let result = unsafe { o.contents.result };
14731 unsafe { o.contents.result = core::ptr::null_mut() };
14732 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14734 let err = unsafe { o.contents.err };
14735 unsafe { o.contents.err = core::ptr::null_mut(); }
14736 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14740 result_ok: o.result_ok,
14744 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14745 fn clone(&self) -> Self {
14746 if self.result_ok {
14747 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14748 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14751 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14752 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14758 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14759 /// but with all dynamically-allocated buffers duplicated in new buffers.
14760 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14762 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14763 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14764 /// A pointer to the contents in the success state.
14765 /// Reading from this pointer when `result_ok` is not set is undefined.
14766 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14767 /// A pointer to the contents in the error state.
14768 /// Reading from this pointer when `result_ok` is set is undefined.
14769 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14772 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14773 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14775 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14776 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14777 /// `err` or `result` depending on the state of `result_ok`.
14778 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14779 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14780 pub result_ok: bool,
14783 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14784 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14785 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14786 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14787 result: Box::into_raw(Box::new(o)),
14793 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14794 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14795 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14796 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14797 err: Box::into_raw(Box::new(e)),
14802 /// Checks if the given object is currently in the success state
14804 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14808 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14809 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14810 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14811 fn drop(&mut self) {
14812 if self.result_ok {
14813 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14814 let _ = unsafe { Box::from_raw(self.contents.result) };
14817 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14818 let _ = unsafe { Box::from_raw(self.contents.err) };
14823 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14824 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14825 let contents = if o.result_ok {
14826 let result = unsafe { o.contents.result };
14827 unsafe { o.contents.result = core::ptr::null_mut() };
14828 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14830 let err = unsafe { o.contents.err };
14831 unsafe { o.contents.err = core::ptr::null_mut(); }
14832 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14836 result_ok: o.result_ok,
14840 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14841 fn clone(&self) -> Self {
14842 if self.result_ok {
14843 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14844 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14847 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14848 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14854 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14855 /// but with all dynamically-allocated buffers duplicated in new buffers.
14856 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14858 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14859 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14860 /// A pointer to the contents in the success state.
14861 /// Reading from this pointer when `result_ok` is not set is undefined.
14862 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14863 /// A pointer to the contents in the error state.
14864 /// Reading from this pointer when `result_ok` is set is undefined.
14865 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14868 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14869 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14871 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14872 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14873 /// `err` or `result` depending on the state of `result_ok`.
14874 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14875 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14876 pub result_ok: bool,
14879 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14880 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14881 CResult_QueryChannelRangeDecodeErrorZ {
14882 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14883 result: Box::into_raw(Box::new(o)),
14889 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14890 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14891 CResult_QueryChannelRangeDecodeErrorZ {
14892 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14893 err: Box::into_raw(Box::new(e)),
14898 /// Checks if the given object is currently in the success state
14900 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14904 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14905 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14906 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14907 fn drop(&mut self) {
14908 if self.result_ok {
14909 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14910 let _ = unsafe { Box::from_raw(self.contents.result) };
14913 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14914 let _ = unsafe { Box::from_raw(self.contents.err) };
14919 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14920 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14921 let contents = if o.result_ok {
14922 let result = unsafe { o.contents.result };
14923 unsafe { o.contents.result = core::ptr::null_mut() };
14924 CResult_QueryChannelRangeDecodeErrorZPtr { result }
14926 let err = unsafe { o.contents.err };
14927 unsafe { o.contents.err = core::ptr::null_mut(); }
14928 CResult_QueryChannelRangeDecodeErrorZPtr { err }
14932 result_ok: o.result_ok,
14936 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14937 fn clone(&self) -> Self {
14938 if self.result_ok {
14939 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14940 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14943 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14944 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14950 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14951 /// but with all dynamically-allocated buffers duplicated in new buffers.
14952 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14954 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14955 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14956 /// A pointer to the contents in the success state.
14957 /// Reading from this pointer when `result_ok` is not set is undefined.
14958 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
14959 /// A pointer to the contents in the error state.
14960 /// Reading from this pointer when `result_ok` is set is undefined.
14961 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14964 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
14965 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14967 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
14968 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
14969 /// `err` or `result` depending on the state of `result_ok`.
14970 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
14971 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
14972 pub result_ok: bool,
14975 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
14976 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
14977 CResult_ReplyChannelRangeDecodeErrorZ {
14978 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14979 result: Box::into_raw(Box::new(o)),
14985 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
14986 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
14987 CResult_ReplyChannelRangeDecodeErrorZ {
14988 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14989 err: Box::into_raw(Box::new(e)),
14994 /// Checks if the given object is currently in the success state
14996 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15000 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15001 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15002 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15003 fn drop(&mut self) {
15004 if self.result_ok {
15005 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15006 let _ = unsafe { Box::from_raw(self.contents.result) };
15009 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15010 let _ = unsafe { Box::from_raw(self.contents.err) };
15015 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15016 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15017 let contents = if o.result_ok {
15018 let result = unsafe { o.contents.result };
15019 unsafe { o.contents.result = core::ptr::null_mut() };
15020 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15022 let err = unsafe { o.contents.err };
15023 unsafe { o.contents.err = core::ptr::null_mut(); }
15024 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15028 result_ok: o.result_ok,
15032 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15033 fn clone(&self) -> Self {
15034 if self.result_ok {
15035 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15036 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15039 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15040 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15046 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15047 /// but with all dynamically-allocated buffers duplicated in new buffers.
15048 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15050 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15051 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15052 /// A pointer to the contents in the success state.
15053 /// Reading from this pointer when `result_ok` is not set is undefined.
15054 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15055 /// A pointer to the contents in the error state.
15056 /// Reading from this pointer when `result_ok` is set is undefined.
15057 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15060 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15061 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15062 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15063 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15064 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15065 /// `err` or `result` depending on the state of `result_ok`.
15066 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15067 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15068 pub result_ok: bool,
15071 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15072 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15073 CResult_GossipTimestampFilterDecodeErrorZ {
15074 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15075 result: Box::into_raw(Box::new(o)),
15081 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15082 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15083 CResult_GossipTimestampFilterDecodeErrorZ {
15084 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15085 err: Box::into_raw(Box::new(e)),
15090 /// Checks if the given object is currently in the success state
15092 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15096 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15097 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15098 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15099 fn drop(&mut self) {
15100 if self.result_ok {
15101 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15102 let _ = unsafe { Box::from_raw(self.contents.result) };
15105 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15106 let _ = unsafe { Box::from_raw(self.contents.err) };
15111 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15112 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15113 let contents = if o.result_ok {
15114 let result = unsafe { o.contents.result };
15115 unsafe { o.contents.result = core::ptr::null_mut() };
15116 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15118 let err = unsafe { o.contents.err };
15119 unsafe { o.contents.err = core::ptr::null_mut(); }
15120 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15124 result_ok: o.result_ok,
15128 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15129 fn clone(&self) -> Self {
15130 if self.result_ok {
15131 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15132 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15135 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15136 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15142 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15143 /// but with all dynamically-allocated buffers duplicated in new buffers.
15144 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15146 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15147 /// This corresponds to std::vector in C++
15148 pub struct CVec_PhantomRouteHintsZ {
15149 /// The elements in the array.
15150 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15151 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15152 /// The number of elements pointed to by `data`.
15155 impl CVec_PhantomRouteHintsZ {
15156 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15157 if self.datalen == 0 { return Vec::new(); }
15158 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15159 self.data = core::ptr::null_mut();
15163 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15164 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15167 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15168 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15169 let datalen = v.len();
15170 let data = Box::into_raw(v.into_boxed_slice());
15171 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15175 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15176 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15177 impl Drop for CVec_PhantomRouteHintsZ {
15178 fn drop(&mut self) {
15179 if self.datalen == 0 { return; }
15180 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15184 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15185 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15186 /// A pointer to the contents in the success state.
15187 /// Reading from this pointer when `result_ok` is not set is undefined.
15188 pub result: *mut crate::lightning_invoice::Invoice,
15189 /// A pointer to the contents in the error state.
15190 /// Reading from this pointer when `result_ok` is set is undefined.
15191 pub err: *mut crate::lightning_invoice::SignOrCreationError,
15194 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15195 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15197 pub struct CResult_InvoiceSignOrCreationErrorZ {
15198 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15199 /// `err` or `result` depending on the state of `result_ok`.
15200 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15201 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15202 pub result_ok: bool,
15205 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15206 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15207 CResult_InvoiceSignOrCreationErrorZ {
15208 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15209 result: Box::into_raw(Box::new(o)),
15215 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15216 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15217 CResult_InvoiceSignOrCreationErrorZ {
15218 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15219 err: Box::into_raw(Box::new(e)),
15224 /// Checks if the given object is currently in the success state
15226 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15230 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15231 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15232 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15233 fn drop(&mut self) {
15234 if self.result_ok {
15235 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15236 let _ = unsafe { Box::from_raw(self.contents.result) };
15239 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15240 let _ = unsafe { Box::from_raw(self.contents.err) };
15245 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15246 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15247 let contents = if o.result_ok {
15248 let result = unsafe { o.contents.result };
15249 unsafe { o.contents.result = core::ptr::null_mut() };
15250 CResult_InvoiceSignOrCreationErrorZPtr { result }
15252 let err = unsafe { o.contents.err };
15253 unsafe { o.contents.err = core::ptr::null_mut(); }
15254 CResult_InvoiceSignOrCreationErrorZPtr { err }
15258 result_ok: o.result_ok,
15262 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15263 fn clone(&self) -> Self {
15264 if self.result_ok {
15265 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15266 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15269 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15270 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15276 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15277 /// but with all dynamically-allocated buffers duplicated in new buffers.
15278 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15280 /// An enum which can either contain a crate::lightning::chain::Filter or not
15281 pub enum COption_FilterZ {
15282 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15283 Some(crate::lightning::chain::Filter),
15284 /// When we're in this state, this COption_FilterZ contains nothing
15287 impl COption_FilterZ {
15288 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15289 if let Self::None = self { false } else { true }
15291 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15294 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15295 if let Self::Some(v) = self { v } else { unreachable!() }
15299 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15300 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15301 COption_FilterZ::Some(o)
15304 /// Constructs a new COption_FilterZ containing nothing
15305 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15306 COption_FilterZ::None
15309 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15310 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15312 /// The contents of CResult_LockedChannelMonitorNoneZ
15313 pub union CResult_LockedChannelMonitorNoneZPtr {
15314 /// A pointer to the contents in the success state.
15315 /// Reading from this pointer when `result_ok` is not set is undefined.
15316 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15317 /// Note that this value is always NULL, as there are no contents in the Err variant
15318 pub err: *mut core::ffi::c_void,
15321 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15322 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15324 pub struct CResult_LockedChannelMonitorNoneZ {
15325 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15326 /// `err` or `result` depending on the state of `result_ok`.
15327 pub contents: CResult_LockedChannelMonitorNoneZPtr,
15328 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15329 pub result_ok: bool,
15332 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15333 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15334 CResult_LockedChannelMonitorNoneZ {
15335 contents: CResult_LockedChannelMonitorNoneZPtr {
15336 result: Box::into_raw(Box::new(o)),
15342 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15343 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15344 CResult_LockedChannelMonitorNoneZ {
15345 contents: CResult_LockedChannelMonitorNoneZPtr {
15346 err: core::ptr::null_mut(),
15351 /// Checks if the given object is currently in the success state
15353 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15357 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15358 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15359 impl Drop for CResult_LockedChannelMonitorNoneZ {
15360 fn drop(&mut self) {
15361 if self.result_ok {
15362 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15363 let _ = unsafe { Box::from_raw(self.contents.result) };
15369 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15370 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15371 let contents = if o.result_ok {
15372 let result = unsafe { o.contents.result };
15373 unsafe { o.contents.result = core::ptr::null_mut() };
15374 CResult_LockedChannelMonitorNoneZPtr { result }
15376 let _ = unsafe { Box::from_raw(o.contents.err) };
15377 o.contents.err = core::ptr::null_mut();
15378 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15382 result_ok: o.result_ok,
15387 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15388 /// This corresponds to std::vector in C++
15389 pub struct CVec_OutPointZ {
15390 /// The elements in the array.
15391 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15392 pub data: *mut crate::lightning::chain::transaction::OutPoint,
15393 /// The number of elements pointed to by `data`.
15396 impl CVec_OutPointZ {
15397 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15398 if self.datalen == 0 { return Vec::new(); }
15399 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15400 self.data = core::ptr::null_mut();
15404 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15405 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15408 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15409 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15410 let datalen = v.len();
15411 let data = Box::into_raw(v.into_boxed_slice());
15412 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15416 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15417 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15418 impl Drop for CVec_OutPointZ {
15419 fn drop(&mut self) {
15420 if self.datalen == 0 { return; }
15421 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15424 impl Clone for CVec_OutPointZ {
15425 fn clone(&self) -> Self {
15426 let mut res = Vec::new();
15427 if self.datalen == 0 { return Self::from(res); }
15428 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });