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 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
1798 pub enum COption_WriteableScoreZ {
1799 /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
1800 Some(crate::lightning::routing::scoring::WriteableScore),
1801 /// When we're in this state, this COption_WriteableScoreZ contains nothing
1804 impl COption_WriteableScoreZ {
1805 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1806 if let Self::None = self { false } else { true }
1808 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1811 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
1812 if let Self::Some(v) = self { v } else { unreachable!() }
1816 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
1817 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
1818 COption_WriteableScoreZ::Some(o)
1821 /// Constructs a new COption_WriteableScoreZ containing nothing
1822 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
1823 COption_WriteableScoreZ::None
1826 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
1827 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
1829 /// The contents of CResult_NoneErrorZ
1830 pub union CResult_NoneErrorZPtr {
1831 /// Note that this value is always NULL, as there are no contents in the OK variant
1832 pub result: *mut core::ffi::c_void,
1833 /// A pointer to the contents in the error state.
1834 /// Reading from this pointer when `result_ok` is set is undefined.
1835 pub err: *mut crate::c_types::IOError,
1838 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1839 /// containing a () on success and a crate::c_types::IOError on failure.
1840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1841 pub struct CResult_NoneErrorZ {
1842 /// The contents of this CResult_NoneErrorZ, accessible via either
1843 /// `err` or `result` depending on the state of `result_ok`.
1844 pub contents: CResult_NoneErrorZPtr,
1845 /// Whether this CResult_NoneErrorZ represents a success state.
1846 pub result_ok: bool,
1849 /// Creates a new CResult_NoneErrorZ in the success state.
1850 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1851 CResult_NoneErrorZ {
1852 contents: CResult_NoneErrorZPtr {
1853 result: core::ptr::null_mut(),
1859 /// Creates a new CResult_NoneErrorZ in the error state.
1860 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1861 CResult_NoneErrorZ {
1862 contents: CResult_NoneErrorZPtr {
1863 err: Box::into_raw(Box::new(e)),
1868 /// Checks if the given object is currently in the success state
1870 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1874 /// Frees any resources used by the CResult_NoneErrorZ.
1875 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1876 impl Drop for CResult_NoneErrorZ {
1877 fn drop(&mut self) {
1880 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1881 let _ = unsafe { Box::from_raw(self.contents.err) };
1886 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1887 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1888 let contents = if o.result_ok {
1889 let _ = unsafe { Box::from_raw(o.contents.result) };
1890 o.contents.result = core::ptr::null_mut();
1891 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1893 let err = unsafe { o.contents.err };
1894 unsafe { o.contents.err = core::ptr::null_mut(); }
1895 CResult_NoneErrorZPtr { err }
1899 result_ok: o.result_ok,
1903 impl Clone for CResult_NoneErrorZ {
1904 fn clone(&self) -> Self {
1906 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1907 result: core::ptr::null_mut()
1910 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1911 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1917 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1918 /// but with all dynamically-allocated buffers duplicated in new buffers.
1919 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1921 /// The contents of CResult_RouteHopDecodeErrorZ
1922 pub union CResult_RouteHopDecodeErrorZPtr {
1923 /// A pointer to the contents in the success state.
1924 /// Reading from this pointer when `result_ok` is not set is undefined.
1925 pub result: *mut crate::lightning::routing::router::RouteHop,
1926 /// A pointer to the contents in the error state.
1927 /// Reading from this pointer when `result_ok` is set is undefined.
1928 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1931 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1932 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1933 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1934 pub struct CResult_RouteHopDecodeErrorZ {
1935 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1936 /// `err` or `result` depending on the state of `result_ok`.
1937 pub contents: CResult_RouteHopDecodeErrorZPtr,
1938 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1939 pub result_ok: bool,
1942 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1943 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1944 CResult_RouteHopDecodeErrorZ {
1945 contents: CResult_RouteHopDecodeErrorZPtr {
1946 result: Box::into_raw(Box::new(o)),
1952 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1953 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1954 CResult_RouteHopDecodeErrorZ {
1955 contents: CResult_RouteHopDecodeErrorZPtr {
1956 err: Box::into_raw(Box::new(e)),
1961 /// Checks if the given object is currently in the success state
1963 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1967 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1968 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1969 impl Drop for CResult_RouteHopDecodeErrorZ {
1970 fn drop(&mut self) {
1972 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1973 let _ = unsafe { Box::from_raw(self.contents.result) };
1976 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1977 let _ = unsafe { Box::from_raw(self.contents.err) };
1982 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1983 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1984 let contents = if o.result_ok {
1985 let result = unsafe { o.contents.result };
1986 unsafe { o.contents.result = core::ptr::null_mut() };
1987 CResult_RouteHopDecodeErrorZPtr { result }
1989 let err = unsafe { o.contents.err };
1990 unsafe { o.contents.err = core::ptr::null_mut(); }
1991 CResult_RouteHopDecodeErrorZPtr { err }
1995 result_ok: o.result_ok,
1999 impl Clone for CResult_RouteHopDecodeErrorZ {
2000 fn clone(&self) -> Self {
2002 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2003 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2006 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2007 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2013 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2014 /// but with all dynamically-allocated buffers duplicated in new buffers.
2015 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2017 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2018 /// This corresponds to std::vector in C++
2019 pub struct CVec_RouteHopZ {
2020 /// The elements in the array.
2021 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2022 pub data: *mut crate::lightning::routing::router::RouteHop,
2023 /// The number of elements pointed to by `data`.
2026 impl CVec_RouteHopZ {
2027 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2028 if self.datalen == 0 { return Vec::new(); }
2029 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2030 self.data = core::ptr::null_mut();
2034 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2035 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2038 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2039 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2040 let datalen = v.len();
2041 let data = Box::into_raw(v.into_boxed_slice());
2042 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2046 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2047 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2048 impl Drop for CVec_RouteHopZ {
2049 fn drop(&mut self) {
2050 if self.datalen == 0 { return; }
2051 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2054 impl Clone for CVec_RouteHopZ {
2055 fn clone(&self) -> Self {
2056 let mut res = Vec::new();
2057 if self.datalen == 0 { return Self::from(res); }
2058 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2063 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2064 /// This corresponds to std::vector in C++
2065 pub struct CVec_CVec_RouteHopZZ {
2066 /// The elements in the array.
2067 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2068 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2069 /// The number of elements pointed to by `data`.
2072 impl CVec_CVec_RouteHopZZ {
2073 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2074 if self.datalen == 0 { return Vec::new(); }
2075 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2076 self.data = core::ptr::null_mut();
2080 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2081 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2084 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2085 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2086 let datalen = v.len();
2087 let data = Box::into_raw(v.into_boxed_slice());
2088 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2092 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2093 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2094 impl Drop for CVec_CVec_RouteHopZZ {
2095 fn drop(&mut self) {
2096 if self.datalen == 0 { return; }
2097 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2100 impl Clone for CVec_CVec_RouteHopZZ {
2101 fn clone(&self) -> Self {
2102 let mut res = Vec::new();
2103 if self.datalen == 0 { return Self::from(res); }
2104 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2109 /// The contents of CResult_RouteDecodeErrorZ
2110 pub union CResult_RouteDecodeErrorZPtr {
2111 /// A pointer to the contents in the success state.
2112 /// Reading from this pointer when `result_ok` is not set is undefined.
2113 pub result: *mut crate::lightning::routing::router::Route,
2114 /// A pointer to the contents in the error state.
2115 /// Reading from this pointer when `result_ok` is set is undefined.
2116 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2119 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2120 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2121 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2122 pub struct CResult_RouteDecodeErrorZ {
2123 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2124 /// `err` or `result` depending on the state of `result_ok`.
2125 pub contents: CResult_RouteDecodeErrorZPtr,
2126 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2127 pub result_ok: bool,
2130 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2131 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2132 CResult_RouteDecodeErrorZ {
2133 contents: CResult_RouteDecodeErrorZPtr {
2134 result: Box::into_raw(Box::new(o)),
2140 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2141 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2142 CResult_RouteDecodeErrorZ {
2143 contents: CResult_RouteDecodeErrorZPtr {
2144 err: Box::into_raw(Box::new(e)),
2149 /// Checks if the given object is currently in the success state
2151 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2155 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2156 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2157 impl Drop for CResult_RouteDecodeErrorZ {
2158 fn drop(&mut self) {
2160 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2161 let _ = unsafe { Box::from_raw(self.contents.result) };
2164 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2165 let _ = unsafe { Box::from_raw(self.contents.err) };
2170 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2171 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2172 let contents = if o.result_ok {
2173 let result = unsafe { o.contents.result };
2174 unsafe { o.contents.result = core::ptr::null_mut() };
2175 CResult_RouteDecodeErrorZPtr { result }
2177 let err = unsafe { o.contents.err };
2178 unsafe { o.contents.err = core::ptr::null_mut(); }
2179 CResult_RouteDecodeErrorZPtr { err }
2183 result_ok: o.result_ok,
2187 impl Clone for CResult_RouteDecodeErrorZ {
2188 fn clone(&self) -> Self {
2190 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2191 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2194 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2195 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2201 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2202 /// but with all dynamically-allocated buffers duplicated in new buffers.
2203 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2205 /// The contents of CResult_RouteParametersDecodeErrorZ
2206 pub union CResult_RouteParametersDecodeErrorZPtr {
2207 /// A pointer to the contents in the success state.
2208 /// Reading from this pointer when `result_ok` is not set is undefined.
2209 pub result: *mut crate::lightning::routing::router::RouteParameters,
2210 /// A pointer to the contents in the error state.
2211 /// Reading from this pointer when `result_ok` is set is undefined.
2212 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2215 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2216 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2217 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2218 pub struct CResult_RouteParametersDecodeErrorZ {
2219 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2220 /// `err` or `result` depending on the state of `result_ok`.
2221 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2222 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2223 pub result_ok: bool,
2226 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2227 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2228 CResult_RouteParametersDecodeErrorZ {
2229 contents: CResult_RouteParametersDecodeErrorZPtr {
2230 result: Box::into_raw(Box::new(o)),
2236 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2237 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2238 CResult_RouteParametersDecodeErrorZ {
2239 contents: CResult_RouteParametersDecodeErrorZPtr {
2240 err: Box::into_raw(Box::new(e)),
2245 /// Checks if the given object is currently in the success state
2247 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2251 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2252 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2253 impl Drop for CResult_RouteParametersDecodeErrorZ {
2254 fn drop(&mut self) {
2256 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2257 let _ = unsafe { Box::from_raw(self.contents.result) };
2260 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2261 let _ = unsafe { Box::from_raw(self.contents.err) };
2266 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2267 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2268 let contents = if o.result_ok {
2269 let result = unsafe { o.contents.result };
2270 unsafe { o.contents.result = core::ptr::null_mut() };
2271 CResult_RouteParametersDecodeErrorZPtr { result }
2273 let err = unsafe { o.contents.err };
2274 unsafe { o.contents.err = core::ptr::null_mut(); }
2275 CResult_RouteParametersDecodeErrorZPtr { err }
2279 result_ok: o.result_ok,
2283 impl Clone for CResult_RouteParametersDecodeErrorZ {
2284 fn clone(&self) -> Self {
2286 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2287 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2290 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2291 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2297 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2298 /// but with all dynamically-allocated buffers duplicated in new buffers.
2299 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2301 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2302 /// This corresponds to std::vector in C++
2303 pub struct CVec_RouteHintZ {
2304 /// The elements in the array.
2305 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2306 pub data: *mut crate::lightning::routing::router::RouteHint,
2307 /// The number of elements pointed to by `data`.
2310 impl CVec_RouteHintZ {
2311 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2312 if self.datalen == 0 { return Vec::new(); }
2313 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2314 self.data = core::ptr::null_mut();
2318 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2319 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2322 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2323 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2324 let datalen = v.len();
2325 let data = Box::into_raw(v.into_boxed_slice());
2326 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2330 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2331 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2332 impl Drop for CVec_RouteHintZ {
2333 fn drop(&mut self) {
2334 if self.datalen == 0 { return; }
2335 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2338 impl Clone for CVec_RouteHintZ {
2339 fn clone(&self) -> Self {
2340 let mut res = Vec::new();
2341 if self.datalen == 0 { return Self::from(res); }
2342 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2348 /// An enum which can either contain a u64 or not
2349 pub enum COption_u64Z {
2350 /// When we're in this state, this COption_u64Z contains a u64
2352 /// When we're in this state, this COption_u64Z contains nothing
2356 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2357 if let Self::None = self { false } else { true }
2359 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2362 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2363 if let Self::Some(v) = self { v } else { unreachable!() }
2367 /// Constructs a new COption_u64Z containing a u64
2368 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2369 COption_u64Z::Some(o)
2372 /// Constructs a new COption_u64Z containing nothing
2373 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2377 /// Frees any resources associated with the u64, if we are in the Some state
2378 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2380 /// Creates a new COption_u64Z which has the same data as `orig`
2381 /// but with all dynamically-allocated buffers duplicated in new buffers.
2382 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2384 /// The contents of CResult_PaymentParametersDecodeErrorZ
2385 pub union CResult_PaymentParametersDecodeErrorZPtr {
2386 /// A pointer to the contents in the success state.
2387 /// Reading from this pointer when `result_ok` is not set is undefined.
2388 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2389 /// A pointer to the contents in the error state.
2390 /// Reading from this pointer when `result_ok` is set is undefined.
2391 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2394 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2395 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2397 pub struct CResult_PaymentParametersDecodeErrorZ {
2398 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2399 /// `err` or `result` depending on the state of `result_ok`.
2400 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2401 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2402 pub result_ok: bool,
2405 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2406 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2407 CResult_PaymentParametersDecodeErrorZ {
2408 contents: CResult_PaymentParametersDecodeErrorZPtr {
2409 result: Box::into_raw(Box::new(o)),
2415 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2416 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2417 CResult_PaymentParametersDecodeErrorZ {
2418 contents: CResult_PaymentParametersDecodeErrorZPtr {
2419 err: Box::into_raw(Box::new(e)),
2424 /// Checks if the given object is currently in the success state
2426 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2430 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2431 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2432 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2433 fn drop(&mut self) {
2435 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2436 let _ = unsafe { Box::from_raw(self.contents.result) };
2439 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2440 let _ = unsafe { Box::from_raw(self.contents.err) };
2445 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2446 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2447 let contents = if o.result_ok {
2448 let result = unsafe { o.contents.result };
2449 unsafe { o.contents.result = core::ptr::null_mut() };
2450 CResult_PaymentParametersDecodeErrorZPtr { result }
2452 let err = unsafe { o.contents.err };
2453 unsafe { o.contents.err = core::ptr::null_mut(); }
2454 CResult_PaymentParametersDecodeErrorZPtr { err }
2458 result_ok: o.result_ok,
2462 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2463 fn clone(&self) -> Self {
2465 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2466 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2469 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2470 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2476 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2477 /// but with all dynamically-allocated buffers duplicated in new buffers.
2478 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2480 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2481 /// This corresponds to std::vector in C++
2482 pub struct CVec_RouteHintHopZ {
2483 /// The elements in the array.
2484 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2485 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2486 /// The number of elements pointed to by `data`.
2489 impl CVec_RouteHintHopZ {
2490 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2491 if self.datalen == 0 { return Vec::new(); }
2492 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2493 self.data = core::ptr::null_mut();
2497 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2498 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2501 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2502 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2503 let datalen = v.len();
2504 let data = Box::into_raw(v.into_boxed_slice());
2505 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2509 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2510 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2511 impl Drop for CVec_RouteHintHopZ {
2512 fn drop(&mut self) {
2513 if self.datalen == 0 { return; }
2514 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2517 impl Clone for CVec_RouteHintHopZ {
2518 fn clone(&self) -> Self {
2519 let mut res = Vec::new();
2520 if self.datalen == 0 { return Self::from(res); }
2521 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2526 /// The contents of CResult_RouteHintDecodeErrorZ
2527 pub union CResult_RouteHintDecodeErrorZPtr {
2528 /// A pointer to the contents in the success state.
2529 /// Reading from this pointer when `result_ok` is not set is undefined.
2530 pub result: *mut crate::lightning::routing::router::RouteHint,
2531 /// A pointer to the contents in the error state.
2532 /// Reading from this pointer when `result_ok` is set is undefined.
2533 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2536 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2537 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2538 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2539 pub struct CResult_RouteHintDecodeErrorZ {
2540 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2541 /// `err` or `result` depending on the state of `result_ok`.
2542 pub contents: CResult_RouteHintDecodeErrorZPtr,
2543 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2544 pub result_ok: bool,
2547 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2548 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2549 CResult_RouteHintDecodeErrorZ {
2550 contents: CResult_RouteHintDecodeErrorZPtr {
2551 result: Box::into_raw(Box::new(o)),
2557 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2558 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2559 CResult_RouteHintDecodeErrorZ {
2560 contents: CResult_RouteHintDecodeErrorZPtr {
2561 err: Box::into_raw(Box::new(e)),
2566 /// Checks if the given object is currently in the success state
2568 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2572 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2573 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2574 impl Drop for CResult_RouteHintDecodeErrorZ {
2575 fn drop(&mut self) {
2577 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2578 let _ = unsafe { Box::from_raw(self.contents.result) };
2581 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2582 let _ = unsafe { Box::from_raw(self.contents.err) };
2587 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2588 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2589 let contents = if o.result_ok {
2590 let result = unsafe { o.contents.result };
2591 unsafe { o.contents.result = core::ptr::null_mut() };
2592 CResult_RouteHintDecodeErrorZPtr { result }
2594 let err = unsafe { o.contents.err };
2595 unsafe { o.contents.err = core::ptr::null_mut(); }
2596 CResult_RouteHintDecodeErrorZPtr { err }
2600 result_ok: o.result_ok,
2604 impl Clone for CResult_RouteHintDecodeErrorZ {
2605 fn clone(&self) -> Self {
2607 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2608 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2611 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2612 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2618 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2619 /// but with all dynamically-allocated buffers duplicated in new buffers.
2620 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2622 /// The contents of CResult_RouteHintHopDecodeErrorZ
2623 pub union CResult_RouteHintHopDecodeErrorZPtr {
2624 /// A pointer to the contents in the success state.
2625 /// Reading from this pointer when `result_ok` is not set is undefined.
2626 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2627 /// A pointer to the contents in the error state.
2628 /// Reading from this pointer when `result_ok` is set is undefined.
2629 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2632 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2633 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2634 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2635 pub struct CResult_RouteHintHopDecodeErrorZ {
2636 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2637 /// `err` or `result` depending on the state of `result_ok`.
2638 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2639 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2640 pub result_ok: bool,
2643 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2644 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2645 CResult_RouteHintHopDecodeErrorZ {
2646 contents: CResult_RouteHintHopDecodeErrorZPtr {
2647 result: Box::into_raw(Box::new(o)),
2653 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2654 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2655 CResult_RouteHintHopDecodeErrorZ {
2656 contents: CResult_RouteHintHopDecodeErrorZPtr {
2657 err: Box::into_raw(Box::new(e)),
2662 /// Checks if the given object is currently in the success state
2664 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2668 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2669 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2670 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2671 fn drop(&mut self) {
2673 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2674 let _ = unsafe { Box::from_raw(self.contents.result) };
2677 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2678 let _ = unsafe { Box::from_raw(self.contents.err) };
2683 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2684 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2685 let contents = if o.result_ok {
2686 let result = unsafe { o.contents.result };
2687 unsafe { o.contents.result = core::ptr::null_mut() };
2688 CResult_RouteHintHopDecodeErrorZPtr { result }
2690 let err = unsafe { o.contents.err };
2691 unsafe { o.contents.err = core::ptr::null_mut(); }
2692 CResult_RouteHintHopDecodeErrorZPtr { err }
2696 result_ok: o.result_ok,
2700 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2701 fn clone(&self) -> Self {
2703 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2704 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2707 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2708 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2714 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2715 /// but with all dynamically-allocated buffers duplicated in new buffers.
2716 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2718 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2719 /// This corresponds to std::vector in C++
2720 pub struct CVec_ChannelDetailsZ {
2721 /// The elements in the array.
2722 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2723 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2724 /// The number of elements pointed to by `data`.
2727 impl CVec_ChannelDetailsZ {
2728 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2729 if self.datalen == 0 { return Vec::new(); }
2730 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2731 self.data = core::ptr::null_mut();
2735 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2736 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2739 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2740 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2741 let datalen = v.len();
2742 let data = Box::into_raw(v.into_boxed_slice());
2743 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2747 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2748 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2749 impl Drop for CVec_ChannelDetailsZ {
2750 fn drop(&mut self) {
2751 if self.datalen == 0 { return; }
2752 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2755 impl Clone for CVec_ChannelDetailsZ {
2756 fn clone(&self) -> Self {
2757 let mut res = Vec::new();
2758 if self.datalen == 0 { return Self::from(res); }
2759 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2764 /// The contents of CResult_RouteLightningErrorZ
2765 pub union CResult_RouteLightningErrorZPtr {
2766 /// A pointer to the contents in the success state.
2767 /// Reading from this pointer when `result_ok` is not set is undefined.
2768 pub result: *mut crate::lightning::routing::router::Route,
2769 /// A pointer to the contents in the error state.
2770 /// Reading from this pointer when `result_ok` is set is undefined.
2771 pub err: *mut crate::lightning::ln::msgs::LightningError,
2774 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2775 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2776 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2777 pub struct CResult_RouteLightningErrorZ {
2778 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2779 /// `err` or `result` depending on the state of `result_ok`.
2780 pub contents: CResult_RouteLightningErrorZPtr,
2781 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2782 pub result_ok: bool,
2785 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2786 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2787 CResult_RouteLightningErrorZ {
2788 contents: CResult_RouteLightningErrorZPtr {
2789 result: Box::into_raw(Box::new(o)),
2795 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2796 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2797 CResult_RouteLightningErrorZ {
2798 contents: CResult_RouteLightningErrorZPtr {
2799 err: Box::into_raw(Box::new(e)),
2804 /// Checks if the given object is currently in the success state
2806 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2810 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2811 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2812 impl Drop for CResult_RouteLightningErrorZ {
2813 fn drop(&mut self) {
2815 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2816 let _ = unsafe { Box::from_raw(self.contents.result) };
2819 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2820 let _ = unsafe { Box::from_raw(self.contents.err) };
2825 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2826 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2827 let contents = if o.result_ok {
2828 let result = unsafe { o.contents.result };
2829 unsafe { o.contents.result = core::ptr::null_mut() };
2830 CResult_RouteLightningErrorZPtr { result }
2832 let err = unsafe { o.contents.err };
2833 unsafe { o.contents.err = core::ptr::null_mut(); }
2834 CResult_RouteLightningErrorZPtr { err }
2838 result_ok: o.result_ok,
2842 impl Clone for CResult_RouteLightningErrorZ {
2843 fn clone(&self) -> Self {
2845 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2846 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2849 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2850 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2856 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2857 /// but with all dynamically-allocated buffers duplicated in new buffers.
2858 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2860 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2861 /// This corresponds to std::vector in C++
2862 pub struct CVec_PublicKeyZ {
2863 /// The elements in the array.
2864 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2865 pub data: *mut crate::c_types::PublicKey,
2866 /// The number of elements pointed to by `data`.
2869 impl CVec_PublicKeyZ {
2870 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
2871 if self.datalen == 0 { return Vec::new(); }
2872 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2873 self.data = core::ptr::null_mut();
2877 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
2878 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2881 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
2882 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
2883 let datalen = v.len();
2884 let data = Box::into_raw(v.into_boxed_slice());
2885 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2889 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2890 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
2891 impl Drop for CVec_PublicKeyZ {
2892 fn drop(&mut self) {
2893 if self.datalen == 0 { return; }
2894 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2897 impl Clone for CVec_PublicKeyZ {
2898 fn clone(&self) -> Self {
2899 let mut res = Vec::new();
2900 if self.datalen == 0 { return Self::from(res); }
2901 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2906 /// The contents of CResult_PaymentPurposeDecodeErrorZ
2907 pub union CResult_PaymentPurposeDecodeErrorZPtr {
2908 /// A pointer to the contents in the success state.
2909 /// Reading from this pointer when `result_ok` is not set is undefined.
2910 pub result: *mut crate::lightning::util::events::PaymentPurpose,
2911 /// A pointer to the contents in the error state.
2912 /// Reading from this pointer when `result_ok` is set is undefined.
2913 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2916 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2917 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2918 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2919 pub struct CResult_PaymentPurposeDecodeErrorZ {
2920 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2921 /// `err` or `result` depending on the state of `result_ok`.
2922 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
2923 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2924 pub result_ok: bool,
2927 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
2928 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
2929 CResult_PaymentPurposeDecodeErrorZ {
2930 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2931 result: Box::into_raw(Box::new(o)),
2937 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
2938 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
2939 CResult_PaymentPurposeDecodeErrorZ {
2940 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2941 err: Box::into_raw(Box::new(e)),
2946 /// Checks if the given object is currently in the success state
2948 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
2952 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
2953 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
2954 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
2955 fn drop(&mut self) {
2957 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2958 let _ = unsafe { Box::from_raw(self.contents.result) };
2961 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2962 let _ = unsafe { Box::from_raw(self.contents.err) };
2967 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
2968 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
2969 let contents = if o.result_ok {
2970 let result = unsafe { o.contents.result };
2971 unsafe { o.contents.result = core::ptr::null_mut() };
2972 CResult_PaymentPurposeDecodeErrorZPtr { result }
2974 let err = unsafe { o.contents.err };
2975 unsafe { o.contents.err = core::ptr::null_mut(); }
2976 CResult_PaymentPurposeDecodeErrorZPtr { err }
2980 result_ok: o.result_ok,
2984 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
2985 fn clone(&self) -> Self {
2987 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2988 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
2991 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2992 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2998 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
2999 /// but with all dynamically-allocated buffers duplicated in new buffers.
3000 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
3003 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3004 pub enum COption_ClosureReasonZ {
3005 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3006 Some(crate::lightning::util::events::ClosureReason),
3007 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3010 impl COption_ClosureReasonZ {
3011 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3012 if let Self::None = self { false } else { true }
3014 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3017 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3018 if let Self::Some(v) = self { v } else { unreachable!() }
3022 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3023 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3024 COption_ClosureReasonZ::Some(o)
3027 /// Constructs a new COption_ClosureReasonZ containing nothing
3028 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3029 COption_ClosureReasonZ::None
3032 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3033 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3035 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3036 /// but with all dynamically-allocated buffers duplicated in new buffers.
3037 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3039 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3040 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3041 /// A pointer to the contents in the success state.
3042 /// Reading from this pointer when `result_ok` is not set is undefined.
3043 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3044 /// A pointer to the contents in the error state.
3045 /// Reading from this pointer when `result_ok` is set is undefined.
3046 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3049 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3050 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3052 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3053 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3054 /// `err` or `result` depending on the state of `result_ok`.
3055 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3056 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3057 pub result_ok: bool,
3060 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3061 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3062 CResult_COption_ClosureReasonZDecodeErrorZ {
3063 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3064 result: Box::into_raw(Box::new(o)),
3070 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3071 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3072 CResult_COption_ClosureReasonZDecodeErrorZ {
3073 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3074 err: Box::into_raw(Box::new(e)),
3079 /// Checks if the given object is currently in the success state
3081 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3085 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3086 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3087 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3088 fn drop(&mut self) {
3090 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3091 let _ = unsafe { Box::from_raw(self.contents.result) };
3094 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3095 let _ = unsafe { Box::from_raw(self.contents.err) };
3100 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3101 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3102 let contents = if o.result_ok {
3103 let result = unsafe { o.contents.result };
3104 unsafe { o.contents.result = core::ptr::null_mut() };
3105 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3107 let err = unsafe { o.contents.err };
3108 unsafe { o.contents.err = core::ptr::null_mut(); }
3109 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3113 result_ok: o.result_ok,
3117 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3118 fn clone(&self) -> Self {
3120 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3121 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3124 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3125 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3131 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3132 /// but with all dynamically-allocated buffers duplicated in new buffers.
3133 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3136 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3137 pub enum COption_NetworkUpdateZ {
3138 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3139 Some(crate::lightning::routing::gossip::NetworkUpdate),
3140 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3143 impl COption_NetworkUpdateZ {
3144 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3145 if let Self::None = self { false } else { true }
3147 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3150 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3151 if let Self::Some(v) = self { v } else { unreachable!() }
3155 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3156 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3157 COption_NetworkUpdateZ::Some(o)
3160 /// Constructs a new COption_NetworkUpdateZ containing nothing
3161 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3162 COption_NetworkUpdateZ::None
3165 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3166 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3168 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3169 /// but with all dynamically-allocated buffers duplicated in new buffers.
3170 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3172 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3173 /// This corresponds to std::vector in C++
3174 pub struct CVec_SpendableOutputDescriptorZ {
3175 /// The elements in the array.
3176 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3177 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3178 /// The number of elements pointed to by `data`.
3181 impl CVec_SpendableOutputDescriptorZ {
3182 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3183 if self.datalen == 0 { return Vec::new(); }
3184 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3185 self.data = core::ptr::null_mut();
3189 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3190 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3193 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3194 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3195 let datalen = v.len();
3196 let data = Box::into_raw(v.into_boxed_slice());
3197 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3201 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3202 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3203 impl Drop for CVec_SpendableOutputDescriptorZ {
3204 fn drop(&mut self) {
3205 if self.datalen == 0 { return; }
3206 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3209 impl Clone for CVec_SpendableOutputDescriptorZ {
3210 fn clone(&self) -> Self {
3211 let mut res = Vec::new();
3212 if self.datalen == 0 { return Self::from(res); }
3213 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3219 /// An enum which can either contain a crate::lightning::util::events::Event or not
3220 pub enum COption_EventZ {
3221 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3222 Some(crate::lightning::util::events::Event),
3223 /// When we're in this state, this COption_EventZ contains nothing
3226 impl COption_EventZ {
3227 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3228 if let Self::None = self { false } else { true }
3230 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3233 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3234 if let Self::Some(v) = self { v } else { unreachable!() }
3238 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3239 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3240 COption_EventZ::Some(o)
3243 /// Constructs a new COption_EventZ containing nothing
3244 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3245 COption_EventZ::None
3248 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3249 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3251 /// Creates a new COption_EventZ which has the same data as `orig`
3252 /// but with all dynamically-allocated buffers duplicated in new buffers.
3253 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3255 /// The contents of CResult_COption_EventZDecodeErrorZ
3256 pub union CResult_COption_EventZDecodeErrorZPtr {
3257 /// A pointer to the contents in the success state.
3258 /// Reading from this pointer when `result_ok` is not set is undefined.
3259 pub result: *mut crate::c_types::derived::COption_EventZ,
3260 /// A pointer to the contents in the error state.
3261 /// Reading from this pointer when `result_ok` is set is undefined.
3262 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3265 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3266 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3268 pub struct CResult_COption_EventZDecodeErrorZ {
3269 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3270 /// `err` or `result` depending on the state of `result_ok`.
3271 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3272 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3273 pub result_ok: bool,
3276 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3277 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3278 CResult_COption_EventZDecodeErrorZ {
3279 contents: CResult_COption_EventZDecodeErrorZPtr {
3280 result: Box::into_raw(Box::new(o)),
3286 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3287 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3288 CResult_COption_EventZDecodeErrorZ {
3289 contents: CResult_COption_EventZDecodeErrorZPtr {
3290 err: Box::into_raw(Box::new(e)),
3295 /// Checks if the given object is currently in the success state
3297 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3301 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3302 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3303 impl Drop for CResult_COption_EventZDecodeErrorZ {
3304 fn drop(&mut self) {
3306 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3307 let _ = unsafe { Box::from_raw(self.contents.result) };
3310 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3311 let _ = unsafe { Box::from_raw(self.contents.err) };
3316 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3317 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3318 let contents = if o.result_ok {
3319 let result = unsafe { o.contents.result };
3320 unsafe { o.contents.result = core::ptr::null_mut() };
3321 CResult_COption_EventZDecodeErrorZPtr { result }
3323 let err = unsafe { o.contents.err };
3324 unsafe { o.contents.err = core::ptr::null_mut(); }
3325 CResult_COption_EventZDecodeErrorZPtr { err }
3329 result_ok: o.result_ok,
3333 impl Clone for CResult_COption_EventZDecodeErrorZ {
3334 fn clone(&self) -> Self {
3336 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3337 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3340 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3341 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3347 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3348 /// but with all dynamically-allocated buffers duplicated in new buffers.
3349 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3351 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3352 /// This corresponds to std::vector in C++
3353 pub struct CVec_MessageSendEventZ {
3354 /// The elements in the array.
3355 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3356 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3357 /// The number of elements pointed to by `data`.
3360 impl CVec_MessageSendEventZ {
3361 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3362 if self.datalen == 0 { return Vec::new(); }
3363 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3364 self.data = core::ptr::null_mut();
3368 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3369 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3372 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3373 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3374 let datalen = v.len();
3375 let data = Box::into_raw(v.into_boxed_slice());
3376 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3380 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3381 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3382 impl Drop for CVec_MessageSendEventZ {
3383 fn drop(&mut self) {
3384 if self.datalen == 0 { return; }
3385 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3388 impl Clone for CVec_MessageSendEventZ {
3389 fn clone(&self) -> Self {
3390 let mut res = Vec::new();
3391 if self.datalen == 0 { return Self::from(res); }
3392 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3397 /// The contents of CResult_TxOutAccessErrorZ
3398 pub union CResult_TxOutAccessErrorZPtr {
3399 /// A pointer to the contents in the success state.
3400 /// Reading from this pointer when `result_ok` is not set is undefined.
3401 pub result: *mut crate::c_types::TxOut,
3402 /// A pointer to the contents in the error state.
3403 /// Reading from this pointer when `result_ok` is set is undefined.
3404 pub err: *mut crate::lightning::chain::AccessError,
3407 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3408 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3410 pub struct CResult_TxOutAccessErrorZ {
3411 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3412 /// `err` or `result` depending on the state of `result_ok`.
3413 pub contents: CResult_TxOutAccessErrorZPtr,
3414 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3415 pub result_ok: bool,
3418 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3419 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3420 CResult_TxOutAccessErrorZ {
3421 contents: CResult_TxOutAccessErrorZPtr {
3422 result: Box::into_raw(Box::new(o)),
3428 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3429 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3430 CResult_TxOutAccessErrorZ {
3431 contents: CResult_TxOutAccessErrorZPtr {
3432 err: Box::into_raw(Box::new(e)),
3437 /// Checks if the given object is currently in the success state
3439 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3443 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3444 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3445 impl Drop for CResult_TxOutAccessErrorZ {
3446 fn drop(&mut self) {
3448 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3449 let _ = unsafe { Box::from_raw(self.contents.result) };
3452 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3453 let _ = unsafe { Box::from_raw(self.contents.err) };
3458 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3459 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3460 let contents = if o.result_ok {
3461 let result = unsafe { o.contents.result };
3462 unsafe { o.contents.result = core::ptr::null_mut() };
3463 CResult_TxOutAccessErrorZPtr { result }
3465 let err = unsafe { o.contents.err };
3466 unsafe { o.contents.err = core::ptr::null_mut(); }
3467 CResult_TxOutAccessErrorZPtr { err }
3471 result_ok: o.result_ok,
3475 impl Clone for CResult_TxOutAccessErrorZ {
3476 fn clone(&self) -> Self {
3478 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3479 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3482 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3483 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3489 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3490 /// but with all dynamically-allocated buffers duplicated in new buffers.
3491 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3493 /// A tuple of 2 elements. See the individual fields for the types contained.
3494 pub struct C2Tuple_usizeTransactionZ {
3495 /// The element at position 0
3497 /// The element at position 1
3498 pub b: crate::c_types::Transaction,
3500 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3501 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3508 impl C2Tuple_usizeTransactionZ {
3509 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3513 impl Clone for C2Tuple_usizeTransactionZ {
3514 fn clone(&self) -> Self {
3516 a: Clone::clone(&self.a),
3517 b: Clone::clone(&self.b),
3522 /// Creates a new tuple which has the same data as `orig`
3523 /// but with all dynamically-allocated buffers duplicated in new buffers.
3524 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3525 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3527 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3528 C2Tuple_usizeTransactionZ { a, b, }
3532 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3533 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3535 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3536 /// This corresponds to std::vector in C++
3537 pub struct CVec_C2Tuple_usizeTransactionZZ {
3538 /// The elements in the array.
3539 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3540 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3541 /// The number of elements pointed to by `data`.
3544 impl CVec_C2Tuple_usizeTransactionZZ {
3545 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3546 if self.datalen == 0 { return Vec::new(); }
3547 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3548 self.data = core::ptr::null_mut();
3552 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3553 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3556 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3557 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3558 let datalen = v.len();
3559 let data = Box::into_raw(v.into_boxed_slice());
3560 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3564 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3565 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3566 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3567 fn drop(&mut self) {
3568 if self.datalen == 0 { return; }
3569 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3572 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3573 fn clone(&self) -> Self {
3574 let mut res = Vec::new();
3575 if self.datalen == 0 { return Self::from(res); }
3576 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3581 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3582 /// This corresponds to std::vector in C++
3583 pub struct CVec_TxidZ {
3584 /// The elements in the array.
3585 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3586 pub data: *mut crate::c_types::ThirtyTwoBytes,
3587 /// The number of elements pointed to by `data`.
3591 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3592 if self.datalen == 0 { return Vec::new(); }
3593 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3594 self.data = core::ptr::null_mut();
3598 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3599 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3602 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3603 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3604 let datalen = v.len();
3605 let data = Box::into_raw(v.into_boxed_slice());
3606 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3610 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3611 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3612 impl Drop for CVec_TxidZ {
3613 fn drop(&mut self) {
3614 if self.datalen == 0 { return; }
3615 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3618 impl Clone for CVec_TxidZ {
3619 fn clone(&self) -> Self {
3620 let mut res = Vec::new();
3621 if self.datalen == 0 { return Self::from(res); }
3622 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3627 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3628 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3629 /// Note that this value is always NULL, as there are no contents in the OK variant
3630 pub result: *mut core::ffi::c_void,
3631 /// A pointer to the contents in the error state.
3632 /// Reading from this pointer when `result_ok` is set is undefined.
3633 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3636 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3637 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3638 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3639 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3640 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3641 /// `err` or `result` depending on the state of `result_ok`.
3642 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3643 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3644 pub result_ok: bool,
3647 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3648 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3649 CResult_NoneChannelMonitorUpdateErrZ {
3650 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3651 result: core::ptr::null_mut(),
3657 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3658 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3659 CResult_NoneChannelMonitorUpdateErrZ {
3660 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3661 err: Box::into_raw(Box::new(e)),
3666 /// Checks if the given object is currently in the success state
3668 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3672 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3673 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3674 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3675 fn drop(&mut self) {
3678 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3679 let _ = unsafe { Box::from_raw(self.contents.err) };
3684 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3685 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3686 let contents = if o.result_ok {
3687 let _ = unsafe { Box::from_raw(o.contents.result) };
3688 o.contents.result = core::ptr::null_mut();
3689 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3691 let err = unsafe { o.contents.err };
3692 unsafe { o.contents.err = core::ptr::null_mut(); }
3693 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3697 result_ok: o.result_ok,
3701 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3702 fn clone(&self) -> Self {
3704 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3705 result: core::ptr::null_mut()
3708 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3709 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3715 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3716 /// but with all dynamically-allocated buffers duplicated in new buffers.
3717 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3719 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3720 /// This corresponds to std::vector in C++
3721 pub struct CVec_MonitorEventZ {
3722 /// The elements in the array.
3723 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3724 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3725 /// The number of elements pointed to by `data`.
3728 impl CVec_MonitorEventZ {
3729 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3730 if self.datalen == 0 { return Vec::new(); }
3731 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3732 self.data = core::ptr::null_mut();
3736 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3737 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3740 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3741 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3742 let datalen = v.len();
3743 let data = Box::into_raw(v.into_boxed_slice());
3744 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3748 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3749 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3750 impl Drop for CVec_MonitorEventZ {
3751 fn drop(&mut self) {
3752 if self.datalen == 0 { return; }
3753 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3756 impl Clone for CVec_MonitorEventZ {
3757 fn clone(&self) -> Self {
3758 let mut res = Vec::new();
3759 if self.datalen == 0 { return Self::from(res); }
3760 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3765 /// A tuple of 2 elements. See the individual fields for the types contained.
3766 pub struct C2Tuple_OutPointCVec_MonitorEventZZ {
3767 /// The element at position 0
3768 pub a: crate::lightning::chain::transaction::OutPoint,
3769 /// The element at position 1
3770 pub b: crate::c_types::derived::CVec_MonitorEventZ,
3772 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)> for C2Tuple_OutPointCVec_MonitorEventZZ {
3773 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)) -> Self {
3780 impl C2Tuple_OutPointCVec_MonitorEventZZ {
3781 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ) {
3785 impl Clone for C2Tuple_OutPointCVec_MonitorEventZZ {
3786 fn clone(&self) -> Self {
3788 a: Clone::clone(&self.a),
3789 b: Clone::clone(&self.b),
3794 /// Creates a new tuple which has the same data as `orig`
3795 /// but with all dynamically-allocated buffers duplicated in new buffers.
3796 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorEventZZ) -> C2Tuple_OutPointCVec_MonitorEventZZ { Clone::clone(&orig) }
3797 /// Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
3799 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ) -> C2Tuple_OutPointCVec_MonitorEventZZ {
3800 C2Tuple_OutPointCVec_MonitorEventZZ { a, b, }
3804 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
3805 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_free(_res: C2Tuple_OutPointCVec_MonitorEventZZ) { }
3807 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
3808 /// This corresponds to std::vector in C++
3809 pub struct CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3810 /// The elements in the array.
3811 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3812 pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ,
3813 /// The number of elements pointed to by `data`.
3816 impl CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3817 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ> {
3818 if self.datalen == 0 { return Vec::new(); }
3819 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3820 self.data = core::ptr::null_mut();
3824 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ] {
3825 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3828 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>> for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3829 fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>) -> Self {
3830 let datalen = v.len();
3831 let data = Box::into_raw(v.into_boxed_slice());
3832 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3836 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3837 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorEventZZZ) { }
3838 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3839 fn drop(&mut self) {
3840 if self.datalen == 0 { return; }
3841 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3844 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3845 fn clone(&self) -> Self {
3846 let mut res = Vec::new();
3847 if self.datalen == 0 { return Self::from(res); }
3848 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3854 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3855 pub enum COption_C2Tuple_usizeTransactionZZ {
3856 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3857 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3858 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3861 impl COption_C2Tuple_usizeTransactionZZ {
3862 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3863 if let Self::None = self { false } else { true }
3865 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3868 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3869 if let Self::Some(v) = self { v } else { unreachable!() }
3873 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3874 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3875 COption_C2Tuple_usizeTransactionZZ::Some(o)
3878 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3879 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3880 COption_C2Tuple_usizeTransactionZZ::None
3883 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3884 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3886 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3887 /// but with all dynamically-allocated buffers duplicated in new buffers.
3888 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3890 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3891 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3892 /// A pointer to the contents in the success state.
3893 /// Reading from this pointer when `result_ok` is not set is undefined.
3894 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3895 /// A pointer to the contents in the error state.
3896 /// Reading from this pointer when `result_ok` is set is undefined.
3897 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3900 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3901 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3903 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3904 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3905 /// `err` or `result` depending on the state of `result_ok`.
3906 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3907 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3908 pub result_ok: bool,
3911 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3912 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3913 CResult_FixedPenaltyScorerDecodeErrorZ {
3914 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3915 result: Box::into_raw(Box::new(o)),
3921 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3922 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3923 CResult_FixedPenaltyScorerDecodeErrorZ {
3924 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3925 err: Box::into_raw(Box::new(e)),
3930 /// Checks if the given object is currently in the success state
3932 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3936 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3937 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3938 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3939 fn drop(&mut self) {
3941 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3942 let _ = unsafe { Box::from_raw(self.contents.result) };
3945 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3946 let _ = unsafe { Box::from_raw(self.contents.err) };
3951 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3952 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3953 let contents = if o.result_ok {
3954 let result = unsafe { o.contents.result };
3955 unsafe { o.contents.result = core::ptr::null_mut() };
3956 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3958 let err = unsafe { o.contents.err };
3959 unsafe { o.contents.err = core::ptr::null_mut(); }
3960 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3964 result_ok: o.result_ok,
3968 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3969 fn clone(&self) -> Self {
3971 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3972 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3975 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3976 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3982 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3983 /// but with all dynamically-allocated buffers duplicated in new buffers.
3984 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3986 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3987 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3988 /// A pointer to the contents in the success state.
3989 /// Reading from this pointer when `result_ok` is not set is undefined.
3990 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3991 /// A pointer to the contents in the error state.
3992 /// Reading from this pointer when `result_ok` is set is undefined.
3993 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3996 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3997 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3999 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4000 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4001 /// `err` or `result` depending on the state of `result_ok`.
4002 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4003 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4004 pub result_ok: bool,
4007 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4008 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4009 CResult_ProbabilisticScorerDecodeErrorZ {
4010 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4011 result: Box::into_raw(Box::new(o)),
4017 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4018 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4019 CResult_ProbabilisticScorerDecodeErrorZ {
4020 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4021 err: Box::into_raw(Box::new(e)),
4026 /// Checks if the given object is currently in the success state
4028 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4032 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4033 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4034 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4035 fn drop(&mut self) {
4037 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4038 let _ = unsafe { Box::from_raw(self.contents.result) };
4041 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4042 let _ = unsafe { Box::from_raw(self.contents.err) };
4047 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4048 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4049 let contents = if o.result_ok {
4050 let result = unsafe { o.contents.result };
4051 unsafe { o.contents.result = core::ptr::null_mut() };
4052 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4054 let err = unsafe { o.contents.err };
4055 unsafe { o.contents.err = core::ptr::null_mut(); }
4056 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4060 result_ok: o.result_ok,
4065 /// The contents of CResult_InitFeaturesDecodeErrorZ
4066 pub union CResult_InitFeaturesDecodeErrorZPtr {
4067 /// A pointer to the contents in the success state.
4068 /// Reading from this pointer when `result_ok` is not set is undefined.
4069 pub result: *mut crate::lightning::ln::features::InitFeatures,
4070 /// A pointer to the contents in the error state.
4071 /// Reading from this pointer when `result_ok` is set is undefined.
4072 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4075 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4076 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4078 pub struct CResult_InitFeaturesDecodeErrorZ {
4079 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4080 /// `err` or `result` depending on the state of `result_ok`.
4081 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4082 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4083 pub result_ok: bool,
4086 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4087 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4088 CResult_InitFeaturesDecodeErrorZ {
4089 contents: CResult_InitFeaturesDecodeErrorZPtr {
4090 result: Box::into_raw(Box::new(o)),
4096 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4097 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4098 CResult_InitFeaturesDecodeErrorZ {
4099 contents: CResult_InitFeaturesDecodeErrorZPtr {
4100 err: Box::into_raw(Box::new(e)),
4105 /// Checks if the given object is currently in the success state
4107 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4111 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4112 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4113 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4114 fn drop(&mut self) {
4116 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4117 let _ = unsafe { Box::from_raw(self.contents.result) };
4120 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4121 let _ = unsafe { Box::from_raw(self.contents.err) };
4126 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4127 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4128 let contents = if o.result_ok {
4129 let result = unsafe { o.contents.result };
4130 unsafe { o.contents.result = core::ptr::null_mut() };
4131 CResult_InitFeaturesDecodeErrorZPtr { result }
4133 let err = unsafe { o.contents.err };
4134 unsafe { o.contents.err = core::ptr::null_mut(); }
4135 CResult_InitFeaturesDecodeErrorZPtr { err }
4139 result_ok: o.result_ok,
4143 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4144 fn clone(&self) -> Self {
4146 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4147 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4150 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4151 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4157 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4158 /// but with all dynamically-allocated buffers duplicated in new buffers.
4159 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4161 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4162 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4163 /// A pointer to the contents in the success state.
4164 /// Reading from this pointer when `result_ok` is not set is undefined.
4165 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4166 /// A pointer to the contents in the error state.
4167 /// Reading from this pointer when `result_ok` is set is undefined.
4168 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4171 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4172 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4174 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4175 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4176 /// `err` or `result` depending on the state of `result_ok`.
4177 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4178 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4179 pub result_ok: bool,
4182 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4183 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4184 CResult_ChannelFeaturesDecodeErrorZ {
4185 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4186 result: Box::into_raw(Box::new(o)),
4192 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4193 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4194 CResult_ChannelFeaturesDecodeErrorZ {
4195 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4196 err: Box::into_raw(Box::new(e)),
4201 /// Checks if the given object is currently in the success state
4203 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4207 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4208 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4209 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4210 fn drop(&mut self) {
4212 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4213 let _ = unsafe { Box::from_raw(self.contents.result) };
4216 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4217 let _ = unsafe { Box::from_raw(self.contents.err) };
4222 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4223 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4224 let contents = if o.result_ok {
4225 let result = unsafe { o.contents.result };
4226 unsafe { o.contents.result = core::ptr::null_mut() };
4227 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4229 let err = unsafe { o.contents.err };
4230 unsafe { o.contents.err = core::ptr::null_mut(); }
4231 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4235 result_ok: o.result_ok,
4239 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4240 fn clone(&self) -> Self {
4242 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4243 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4246 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4247 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4253 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4254 /// but with all dynamically-allocated buffers duplicated in new buffers.
4255 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4257 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4258 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4259 /// A pointer to the contents in the success state.
4260 /// Reading from this pointer when `result_ok` is not set is undefined.
4261 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4262 /// A pointer to the contents in the error state.
4263 /// Reading from this pointer when `result_ok` is set is undefined.
4264 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4267 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4268 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4270 pub struct CResult_NodeFeaturesDecodeErrorZ {
4271 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4272 /// `err` or `result` depending on the state of `result_ok`.
4273 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4274 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4275 pub result_ok: bool,
4278 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4279 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4280 CResult_NodeFeaturesDecodeErrorZ {
4281 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4282 result: Box::into_raw(Box::new(o)),
4288 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4289 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4290 CResult_NodeFeaturesDecodeErrorZ {
4291 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4292 err: Box::into_raw(Box::new(e)),
4297 /// Checks if the given object is currently in the success state
4299 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4303 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4304 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4305 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4306 fn drop(&mut self) {
4308 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4309 let _ = unsafe { Box::from_raw(self.contents.result) };
4312 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4313 let _ = unsafe { Box::from_raw(self.contents.err) };
4318 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4319 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4320 let contents = if o.result_ok {
4321 let result = unsafe { o.contents.result };
4322 unsafe { o.contents.result = core::ptr::null_mut() };
4323 CResult_NodeFeaturesDecodeErrorZPtr { result }
4325 let err = unsafe { o.contents.err };
4326 unsafe { o.contents.err = core::ptr::null_mut(); }
4327 CResult_NodeFeaturesDecodeErrorZPtr { err }
4331 result_ok: o.result_ok,
4335 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4336 fn clone(&self) -> Self {
4338 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4339 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4342 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4343 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4349 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4350 /// but with all dynamically-allocated buffers duplicated in new buffers.
4351 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4353 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4354 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4355 /// A pointer to the contents in the success state.
4356 /// Reading from this pointer when `result_ok` is not set is undefined.
4357 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4358 /// A pointer to the contents in the error state.
4359 /// Reading from this pointer when `result_ok` is set is undefined.
4360 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4363 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4364 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4366 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4367 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4368 /// `err` or `result` depending on the state of `result_ok`.
4369 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4370 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4371 pub result_ok: bool,
4374 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4375 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4376 CResult_InvoiceFeaturesDecodeErrorZ {
4377 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4378 result: Box::into_raw(Box::new(o)),
4384 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4385 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4386 CResult_InvoiceFeaturesDecodeErrorZ {
4387 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4388 err: Box::into_raw(Box::new(e)),
4393 /// Checks if the given object is currently in the success state
4395 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4399 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4400 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4401 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4402 fn drop(&mut self) {
4404 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4405 let _ = unsafe { Box::from_raw(self.contents.result) };
4408 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4409 let _ = unsafe { Box::from_raw(self.contents.err) };
4414 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4415 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4416 let contents = if o.result_ok {
4417 let result = unsafe { o.contents.result };
4418 unsafe { o.contents.result = core::ptr::null_mut() };
4419 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4421 let err = unsafe { o.contents.err };
4422 unsafe { o.contents.err = core::ptr::null_mut(); }
4423 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4427 result_ok: o.result_ok,
4431 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4432 fn clone(&self) -> Self {
4434 Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4435 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4438 Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4439 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4445 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4446 /// but with all dynamically-allocated buffers duplicated in new buffers.
4447 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4449 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4450 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4451 /// A pointer to the contents in the success state.
4452 /// Reading from this pointer when `result_ok` is not set is undefined.
4453 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4454 /// A pointer to the contents in the error state.
4455 /// Reading from this pointer when `result_ok` is set is undefined.
4456 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4459 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4460 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4462 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4463 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4464 /// `err` or `result` depending on the state of `result_ok`.
4465 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4466 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4467 pub result_ok: bool,
4470 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4471 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4472 CResult_ChannelTypeFeaturesDecodeErrorZ {
4473 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4474 result: Box::into_raw(Box::new(o)),
4480 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4481 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4482 CResult_ChannelTypeFeaturesDecodeErrorZ {
4483 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4484 err: Box::into_raw(Box::new(e)),
4489 /// Checks if the given object is currently in the success state
4491 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4495 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4496 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4497 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4498 fn drop(&mut self) {
4500 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4501 let _ = unsafe { Box::from_raw(self.contents.result) };
4504 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4505 let _ = unsafe { Box::from_raw(self.contents.err) };
4510 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4511 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4512 let contents = if o.result_ok {
4513 let result = unsafe { o.contents.result };
4514 unsafe { o.contents.result = core::ptr::null_mut() };
4515 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4517 let err = unsafe { o.contents.err };
4518 unsafe { o.contents.err = core::ptr::null_mut(); }
4519 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4523 result_ok: o.result_ok,
4527 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4528 fn clone(&self) -> Self {
4530 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4531 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4534 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4535 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4541 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4542 /// but with all dynamically-allocated buffers duplicated in new buffers.
4543 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4545 /// The contents of CResult_NodeIdDecodeErrorZ
4546 pub union CResult_NodeIdDecodeErrorZPtr {
4547 /// A pointer to the contents in the success state.
4548 /// Reading from this pointer when `result_ok` is not set is undefined.
4549 pub result: *mut crate::lightning::routing::gossip::NodeId,
4550 /// A pointer to the contents in the error state.
4551 /// Reading from this pointer when `result_ok` is set is undefined.
4552 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4555 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4556 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4558 pub struct CResult_NodeIdDecodeErrorZ {
4559 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4560 /// `err` or `result` depending on the state of `result_ok`.
4561 pub contents: CResult_NodeIdDecodeErrorZPtr,
4562 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4563 pub result_ok: bool,
4566 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
4567 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
4568 CResult_NodeIdDecodeErrorZ {
4569 contents: CResult_NodeIdDecodeErrorZPtr {
4570 result: Box::into_raw(Box::new(o)),
4576 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
4577 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
4578 CResult_NodeIdDecodeErrorZ {
4579 contents: CResult_NodeIdDecodeErrorZPtr {
4580 err: Box::into_raw(Box::new(e)),
4585 /// Checks if the given object is currently in the success state
4587 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
4591 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
4592 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
4593 impl Drop for CResult_NodeIdDecodeErrorZ {
4594 fn drop(&mut self) {
4596 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4597 let _ = unsafe { Box::from_raw(self.contents.result) };
4600 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4601 let _ = unsafe { Box::from_raw(self.contents.err) };
4606 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
4607 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
4608 let contents = if o.result_ok {
4609 let result = unsafe { o.contents.result };
4610 unsafe { o.contents.result = core::ptr::null_mut() };
4611 CResult_NodeIdDecodeErrorZPtr { result }
4613 let err = unsafe { o.contents.err };
4614 unsafe { o.contents.err = core::ptr::null_mut(); }
4615 CResult_NodeIdDecodeErrorZPtr { err }
4619 result_ok: o.result_ok,
4623 impl Clone for CResult_NodeIdDecodeErrorZ {
4624 fn clone(&self) -> Self {
4626 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
4627 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
4630 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
4631 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4637 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
4638 /// but with all dynamically-allocated buffers duplicated in new buffers.
4639 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
4641 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4642 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4643 /// A pointer to the contents in the success state.
4644 /// Reading from this pointer when `result_ok` is not set is undefined.
4645 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
4646 /// A pointer to the contents in the error state.
4647 /// Reading from this pointer when `result_ok` is set is undefined.
4648 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4651 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
4652 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4653 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4654 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
4655 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
4656 /// `err` or `result` depending on the state of `result_ok`.
4657 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
4658 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
4659 pub result_ok: bool,
4662 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
4663 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4664 CResult_COption_NetworkUpdateZDecodeErrorZ {
4665 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4666 result: Box::into_raw(Box::new(o)),
4672 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
4673 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4674 CResult_COption_NetworkUpdateZDecodeErrorZ {
4675 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4676 err: Box::into_raw(Box::new(e)),
4681 /// Checks if the given object is currently in the success state
4683 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
4687 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
4688 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
4689 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
4690 fn drop(&mut self) {
4692 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4693 let _ = unsafe { Box::from_raw(self.contents.result) };
4696 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4697 let _ = unsafe { Box::from_raw(self.contents.err) };
4702 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
4703 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4704 let contents = if o.result_ok {
4705 let result = unsafe { o.contents.result };
4706 unsafe { o.contents.result = core::ptr::null_mut() };
4707 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
4709 let err = unsafe { o.contents.err };
4710 unsafe { o.contents.err = core::ptr::null_mut(); }
4711 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
4715 result_ok: o.result_ok,
4719 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
4720 fn clone(&self) -> Self {
4722 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4723 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
4726 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4727 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4733 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
4734 /// but with all dynamically-allocated buffers duplicated in new buffers.
4735 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
4737 /// An enum which can either contain a crate::lightning::chain::Access or not
4738 pub enum COption_AccessZ {
4739 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
4740 Some(crate::lightning::chain::Access),
4741 /// When we're in this state, this COption_AccessZ contains nothing
4744 impl COption_AccessZ {
4745 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4746 if let Self::None = self { false } else { true }
4748 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4751 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
4752 if let Self::Some(v) = self { v } else { unreachable!() }
4756 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
4757 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
4758 COption_AccessZ::Some(o)
4761 /// Constructs a new COption_AccessZ containing nothing
4762 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
4763 COption_AccessZ::None
4766 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
4767 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
4769 /// The contents of CResult_boolLightningErrorZ
4770 pub union CResult_boolLightningErrorZPtr {
4771 /// A pointer to the contents in the success state.
4772 /// Reading from this pointer when `result_ok` is not set is undefined.
4773 pub result: *mut bool,
4774 /// A pointer to the contents in the error state.
4775 /// Reading from this pointer when `result_ok` is set is undefined.
4776 pub err: *mut crate::lightning::ln::msgs::LightningError,
4779 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
4780 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4782 pub struct CResult_boolLightningErrorZ {
4783 /// The contents of this CResult_boolLightningErrorZ, accessible via either
4784 /// `err` or `result` depending on the state of `result_ok`.
4785 pub contents: CResult_boolLightningErrorZPtr,
4786 /// Whether this CResult_boolLightningErrorZ represents a success state.
4787 pub result_ok: bool,
4790 /// Creates a new CResult_boolLightningErrorZ in the success state.
4791 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
4792 CResult_boolLightningErrorZ {
4793 contents: CResult_boolLightningErrorZPtr {
4794 result: Box::into_raw(Box::new(o)),
4800 /// Creates a new CResult_boolLightningErrorZ in the error state.
4801 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
4802 CResult_boolLightningErrorZ {
4803 contents: CResult_boolLightningErrorZPtr {
4804 err: Box::into_raw(Box::new(e)),
4809 /// Checks if the given object is currently in the success state
4811 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
4815 /// Frees any resources used by the CResult_boolLightningErrorZ.
4816 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
4817 impl Drop for CResult_boolLightningErrorZ {
4818 fn drop(&mut self) {
4820 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4821 let _ = unsafe { Box::from_raw(self.contents.result) };
4824 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4825 let _ = unsafe { Box::from_raw(self.contents.err) };
4830 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
4831 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
4832 let contents = if o.result_ok {
4833 let result = unsafe { o.contents.result };
4834 unsafe { o.contents.result = core::ptr::null_mut() };
4835 CResult_boolLightningErrorZPtr { result }
4837 let err = unsafe { o.contents.err };
4838 unsafe { o.contents.err = core::ptr::null_mut(); }
4839 CResult_boolLightningErrorZPtr { err }
4843 result_ok: o.result_ok,
4847 impl Clone for CResult_boolLightningErrorZ {
4848 fn clone(&self) -> Self {
4850 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
4851 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4854 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
4855 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4861 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
4862 /// but with all dynamically-allocated buffers duplicated in new buffers.
4863 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
4865 /// A tuple of 3 elements. See the individual fields for the types contained.
4866 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4867 /// The element at position 0
4868 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
4869 /// The element at position 1
4870 pub b: crate::lightning::ln::msgs::ChannelUpdate,
4871 /// The element at position 2
4872 pub c: crate::lightning::ln::msgs::ChannelUpdate,
4874 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4875 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
4883 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4884 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
4885 (self.a, self.b, self.c)
4888 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4889 fn clone(&self) -> Self {
4891 a: Clone::clone(&self.a),
4892 b: Clone::clone(&self.b),
4893 c: Clone::clone(&self.c),
4898 /// Creates a new tuple which has the same data as `orig`
4899 /// but with all dynamically-allocated buffers duplicated in new buffers.
4900 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
4901 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
4903 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 {
4904 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
4908 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
4909 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
4911 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4912 /// This corresponds to std::vector in C++
4913 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4914 /// The elements in the array.
4915 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4916 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
4917 /// The number of elements pointed to by `data`.
4920 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4921 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
4922 if self.datalen == 0 { return Vec::new(); }
4923 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4924 self.data = core::ptr::null_mut();
4928 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
4929 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4932 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4933 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
4934 let datalen = v.len();
4935 let data = Box::into_raw(v.into_boxed_slice());
4936 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4940 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4941 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
4942 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4943 fn drop(&mut self) {
4944 if self.datalen == 0 { return; }
4945 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4948 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4949 fn clone(&self) -> Self {
4950 let mut res = Vec::new();
4951 if self.datalen == 0 { return Self::from(res); }
4952 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4957 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4958 /// This corresponds to std::vector in C++
4959 pub struct CVec_NodeAnnouncementZ {
4960 /// The elements in the array.
4961 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4962 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
4963 /// The number of elements pointed to by `data`.
4966 impl CVec_NodeAnnouncementZ {
4967 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
4968 if self.datalen == 0 { return Vec::new(); }
4969 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4970 self.data = core::ptr::null_mut();
4974 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
4975 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4978 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
4979 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
4980 let datalen = v.len();
4981 let data = Box::into_raw(v.into_boxed_slice());
4982 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4986 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4987 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
4988 impl Drop for CVec_NodeAnnouncementZ {
4989 fn drop(&mut self) {
4990 if self.datalen == 0 { return; }
4991 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4994 impl Clone for CVec_NodeAnnouncementZ {
4995 fn clone(&self) -> Self {
4996 let mut res = Vec::new();
4997 if self.datalen == 0 { return Self::from(res); }
4998 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5003 /// The contents of CResult_NoneLightningErrorZ
5004 pub union CResult_NoneLightningErrorZPtr {
5005 /// Note that this value is always NULL, as there are no contents in the OK variant
5006 pub result: *mut core::ffi::c_void,
5007 /// A pointer to the contents in the error state.
5008 /// Reading from this pointer when `result_ok` is set is undefined.
5009 pub err: *mut crate::lightning::ln::msgs::LightningError,
5012 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5013 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5015 pub struct CResult_NoneLightningErrorZ {
5016 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5017 /// `err` or `result` depending on the state of `result_ok`.
5018 pub contents: CResult_NoneLightningErrorZPtr,
5019 /// Whether this CResult_NoneLightningErrorZ represents a success state.
5020 pub result_ok: bool,
5023 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5024 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5025 CResult_NoneLightningErrorZ {
5026 contents: CResult_NoneLightningErrorZPtr {
5027 result: core::ptr::null_mut(),
5033 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5034 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5035 CResult_NoneLightningErrorZ {
5036 contents: CResult_NoneLightningErrorZPtr {
5037 err: Box::into_raw(Box::new(e)),
5042 /// Checks if the given object is currently in the success state
5044 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5048 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5049 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5050 impl Drop for CResult_NoneLightningErrorZ {
5051 fn drop(&mut self) {
5054 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5055 let _ = unsafe { Box::from_raw(self.contents.err) };
5060 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5061 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5062 let contents = if o.result_ok {
5063 let _ = unsafe { Box::from_raw(o.contents.result) };
5064 o.contents.result = core::ptr::null_mut();
5065 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5067 let err = unsafe { o.contents.err };
5068 unsafe { o.contents.err = core::ptr::null_mut(); }
5069 CResult_NoneLightningErrorZPtr { err }
5073 result_ok: o.result_ok,
5077 impl Clone for CResult_NoneLightningErrorZ {
5078 fn clone(&self) -> Self {
5080 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5081 result: core::ptr::null_mut()
5084 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5085 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5091 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5092 /// but with all dynamically-allocated buffers duplicated in new buffers.
5093 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5095 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5096 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5097 /// A pointer to the contents in the success state.
5098 /// Reading from this pointer when `result_ok` is not set is undefined.
5099 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5100 /// A pointer to the contents in the error state.
5101 /// Reading from this pointer when `result_ok` is set is undefined.
5102 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5105 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5106 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5108 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5109 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5110 /// `err` or `result` depending on the state of `result_ok`.
5111 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5112 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5113 pub result_ok: bool,
5116 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5117 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5118 CResult_ChannelUpdateInfoDecodeErrorZ {
5119 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5120 result: Box::into_raw(Box::new(o)),
5126 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5127 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5128 CResult_ChannelUpdateInfoDecodeErrorZ {
5129 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5130 err: Box::into_raw(Box::new(e)),
5135 /// Checks if the given object is currently in the success state
5137 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5141 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5142 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5143 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5144 fn drop(&mut self) {
5146 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5147 let _ = unsafe { Box::from_raw(self.contents.result) };
5150 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5151 let _ = unsafe { Box::from_raw(self.contents.err) };
5156 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5157 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5158 let contents = if o.result_ok {
5159 let result = unsafe { o.contents.result };
5160 unsafe { o.contents.result = core::ptr::null_mut() };
5161 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5163 let err = unsafe { o.contents.err };
5164 unsafe { o.contents.err = core::ptr::null_mut(); }
5165 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5169 result_ok: o.result_ok,
5173 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5174 fn clone(&self) -> Self {
5176 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5177 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5180 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5181 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5187 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5188 /// but with all dynamically-allocated buffers duplicated in new buffers.
5189 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5191 /// The contents of CResult_ChannelInfoDecodeErrorZ
5192 pub union CResult_ChannelInfoDecodeErrorZPtr {
5193 /// A pointer to the contents in the success state.
5194 /// Reading from this pointer when `result_ok` is not set is undefined.
5195 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5196 /// A pointer to the contents in the error state.
5197 /// Reading from this pointer when `result_ok` is set is undefined.
5198 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5201 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5202 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5204 pub struct CResult_ChannelInfoDecodeErrorZ {
5205 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5206 /// `err` or `result` depending on the state of `result_ok`.
5207 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5208 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5209 pub result_ok: bool,
5212 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5213 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5214 CResult_ChannelInfoDecodeErrorZ {
5215 contents: CResult_ChannelInfoDecodeErrorZPtr {
5216 result: Box::into_raw(Box::new(o)),
5222 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5223 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5224 CResult_ChannelInfoDecodeErrorZ {
5225 contents: CResult_ChannelInfoDecodeErrorZPtr {
5226 err: Box::into_raw(Box::new(e)),
5231 /// Checks if the given object is currently in the success state
5233 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5237 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5238 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5239 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5240 fn drop(&mut self) {
5242 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5243 let _ = unsafe { Box::from_raw(self.contents.result) };
5246 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5247 let _ = unsafe { Box::from_raw(self.contents.err) };
5252 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5253 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5254 let contents = if o.result_ok {
5255 let result = unsafe { o.contents.result };
5256 unsafe { o.contents.result = core::ptr::null_mut() };
5257 CResult_ChannelInfoDecodeErrorZPtr { result }
5259 let err = unsafe { o.contents.err };
5260 unsafe { o.contents.err = core::ptr::null_mut(); }
5261 CResult_ChannelInfoDecodeErrorZPtr { err }
5265 result_ok: o.result_ok,
5269 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5270 fn clone(&self) -> Self {
5272 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5273 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5276 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5277 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5283 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5284 /// but with all dynamically-allocated buffers duplicated in new buffers.
5285 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5287 /// The contents of CResult_RoutingFeesDecodeErrorZ
5288 pub union CResult_RoutingFeesDecodeErrorZPtr {
5289 /// A pointer to the contents in the success state.
5290 /// Reading from this pointer when `result_ok` is not set is undefined.
5291 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5292 /// A pointer to the contents in the error state.
5293 /// Reading from this pointer when `result_ok` is set is undefined.
5294 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5297 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5298 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5299 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5300 pub struct CResult_RoutingFeesDecodeErrorZ {
5301 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5302 /// `err` or `result` depending on the state of `result_ok`.
5303 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5304 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5305 pub result_ok: bool,
5308 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5309 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5310 CResult_RoutingFeesDecodeErrorZ {
5311 contents: CResult_RoutingFeesDecodeErrorZPtr {
5312 result: Box::into_raw(Box::new(o)),
5318 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5319 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5320 CResult_RoutingFeesDecodeErrorZ {
5321 contents: CResult_RoutingFeesDecodeErrorZPtr {
5322 err: Box::into_raw(Box::new(e)),
5327 /// Checks if the given object is currently in the success state
5329 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5333 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5334 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5335 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5336 fn drop(&mut self) {
5338 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5339 let _ = unsafe { Box::from_raw(self.contents.result) };
5342 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5343 let _ = unsafe { Box::from_raw(self.contents.err) };
5348 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5349 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5350 let contents = if o.result_ok {
5351 let result = unsafe { o.contents.result };
5352 unsafe { o.contents.result = core::ptr::null_mut() };
5353 CResult_RoutingFeesDecodeErrorZPtr { result }
5355 let err = unsafe { o.contents.err };
5356 unsafe { o.contents.err = core::ptr::null_mut(); }
5357 CResult_RoutingFeesDecodeErrorZPtr { err }
5361 result_ok: o.result_ok,
5365 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5366 fn clone(&self) -> Self {
5368 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5369 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5372 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5373 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5379 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5380 /// but with all dynamically-allocated buffers duplicated in new buffers.
5381 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5383 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5384 /// This corresponds to std::vector in C++
5385 pub struct CVec_NetAddressZ {
5386 /// The elements in the array.
5387 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5388 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5389 /// The number of elements pointed to by `data`.
5392 impl CVec_NetAddressZ {
5393 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5394 if self.datalen == 0 { return Vec::new(); }
5395 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5396 self.data = core::ptr::null_mut();
5400 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5401 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5404 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5405 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5406 let datalen = v.len();
5407 let data = Box::into_raw(v.into_boxed_slice());
5408 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5412 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5413 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5414 impl Drop for CVec_NetAddressZ {
5415 fn drop(&mut self) {
5416 if self.datalen == 0 { return; }
5417 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5420 impl Clone for CVec_NetAddressZ {
5421 fn clone(&self) -> Self {
5422 let mut res = Vec::new();
5423 if self.datalen == 0 { return Self::from(res); }
5424 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5429 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5430 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5431 /// A pointer to the contents in the success state.
5432 /// Reading from this pointer when `result_ok` is not set is undefined.
5433 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5434 /// A pointer to the contents in the error state.
5435 /// Reading from this pointer when `result_ok` is set is undefined.
5436 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5439 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5440 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5441 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5442 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5443 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5444 /// `err` or `result` depending on the state of `result_ok`.
5445 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5446 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5447 pub result_ok: bool,
5450 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5451 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5452 CResult_NodeAnnouncementInfoDecodeErrorZ {
5453 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5454 result: Box::into_raw(Box::new(o)),
5460 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5461 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5462 CResult_NodeAnnouncementInfoDecodeErrorZ {
5463 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5464 err: Box::into_raw(Box::new(e)),
5469 /// Checks if the given object is currently in the success state
5471 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5475 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5476 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5477 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5478 fn drop(&mut self) {
5480 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5481 let _ = unsafe { Box::from_raw(self.contents.result) };
5484 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5485 let _ = unsafe { Box::from_raw(self.contents.err) };
5490 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5491 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5492 let contents = if o.result_ok {
5493 let result = unsafe { o.contents.result };
5494 unsafe { o.contents.result = core::ptr::null_mut() };
5495 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5497 let err = unsafe { o.contents.err };
5498 unsafe { o.contents.err = core::ptr::null_mut(); }
5499 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5503 result_ok: o.result_ok,
5507 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5508 fn clone(&self) -> Self {
5510 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5511 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5514 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5515 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5521 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5522 /// but with all dynamically-allocated buffers duplicated in new buffers.
5523 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5525 /// A dynamically-allocated array of u64s of arbitrary size.
5526 /// This corresponds to std::vector in C++
5527 pub struct CVec_u64Z {
5528 /// The elements in the array.
5529 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5531 /// The number of elements pointed to by `data`.
5535 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
5536 if self.datalen == 0 { return Vec::new(); }
5537 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5538 self.data = core::ptr::null_mut();
5542 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5543 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5546 impl From<Vec<u64>> for CVec_u64Z {
5547 fn from(v: Vec<u64>) -> Self {
5548 let datalen = v.len();
5549 let data = Box::into_raw(v.into_boxed_slice());
5550 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5554 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5555 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5556 impl Drop for CVec_u64Z {
5557 fn drop(&mut self) {
5558 if self.datalen == 0 { return; }
5559 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5562 impl Clone for CVec_u64Z {
5563 fn clone(&self) -> Self {
5564 let mut res = Vec::new();
5565 if self.datalen == 0 { return Self::from(res); }
5566 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5571 /// The contents of CResult_NodeInfoDecodeErrorZ
5572 pub union CResult_NodeInfoDecodeErrorZPtr {
5573 /// A pointer to the contents in the success state.
5574 /// Reading from this pointer when `result_ok` is not set is undefined.
5575 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
5576 /// A pointer to the contents in the error state.
5577 /// Reading from this pointer when `result_ok` is set is undefined.
5578 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5581 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5582 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5583 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5584 pub struct CResult_NodeInfoDecodeErrorZ {
5585 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5586 /// `err` or `result` depending on the state of `result_ok`.
5587 pub contents: CResult_NodeInfoDecodeErrorZPtr,
5588 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5589 pub result_ok: bool,
5592 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5593 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5594 CResult_NodeInfoDecodeErrorZ {
5595 contents: CResult_NodeInfoDecodeErrorZPtr {
5596 result: Box::into_raw(Box::new(o)),
5602 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5603 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5604 CResult_NodeInfoDecodeErrorZ {
5605 contents: CResult_NodeInfoDecodeErrorZPtr {
5606 err: Box::into_raw(Box::new(e)),
5611 /// Checks if the given object is currently in the success state
5613 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
5617 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5618 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5619 impl Drop for CResult_NodeInfoDecodeErrorZ {
5620 fn drop(&mut self) {
5622 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5623 let _ = unsafe { Box::from_raw(self.contents.result) };
5626 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5627 let _ = unsafe { Box::from_raw(self.contents.err) };
5632 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5633 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5634 let contents = if o.result_ok {
5635 let result = unsafe { o.contents.result };
5636 unsafe { o.contents.result = core::ptr::null_mut() };
5637 CResult_NodeInfoDecodeErrorZPtr { result }
5639 let err = unsafe { o.contents.err };
5640 unsafe { o.contents.err = core::ptr::null_mut(); }
5641 CResult_NodeInfoDecodeErrorZPtr { err }
5645 result_ok: o.result_ok,
5649 impl Clone for CResult_NodeInfoDecodeErrorZ {
5650 fn clone(&self) -> Self {
5652 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5653 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
5656 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5657 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5663 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5664 /// but with all dynamically-allocated buffers duplicated in new buffers.
5665 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
5667 /// The contents of CResult_NetworkGraphDecodeErrorZ
5668 pub union CResult_NetworkGraphDecodeErrorZPtr {
5669 /// A pointer to the contents in the success state.
5670 /// Reading from this pointer when `result_ok` is not set is undefined.
5671 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
5672 /// A pointer to the contents in the error state.
5673 /// Reading from this pointer when `result_ok` is set is undefined.
5674 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5677 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5678 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5680 pub struct CResult_NetworkGraphDecodeErrorZ {
5681 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5682 /// `err` or `result` depending on the state of `result_ok`.
5683 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5684 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5685 pub result_ok: bool,
5688 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5689 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5690 CResult_NetworkGraphDecodeErrorZ {
5691 contents: CResult_NetworkGraphDecodeErrorZPtr {
5692 result: Box::into_raw(Box::new(o)),
5698 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5699 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5700 CResult_NetworkGraphDecodeErrorZ {
5701 contents: CResult_NetworkGraphDecodeErrorZPtr {
5702 err: Box::into_raw(Box::new(e)),
5707 /// Checks if the given object is currently in the success state
5709 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
5713 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
5714 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5715 impl Drop for CResult_NetworkGraphDecodeErrorZ {
5716 fn drop(&mut self) {
5718 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5719 let _ = unsafe { Box::from_raw(self.contents.result) };
5722 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5723 let _ = unsafe { Box::from_raw(self.contents.err) };
5728 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5729 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
5730 let contents = if o.result_ok {
5731 let result = unsafe { o.contents.result };
5732 unsafe { o.contents.result = core::ptr::null_mut() };
5733 CResult_NetworkGraphDecodeErrorZPtr { result }
5735 let err = unsafe { o.contents.err };
5736 unsafe { o.contents.err = core::ptr::null_mut(); }
5737 CResult_NetworkGraphDecodeErrorZPtr { err }
5741 result_ok: o.result_ok,
5747 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
5748 pub enum COption_CVec_NetAddressZZ {
5749 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
5750 Some(crate::c_types::derived::CVec_NetAddressZ),
5751 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
5754 impl COption_CVec_NetAddressZZ {
5755 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5756 if let Self::None = self { false } else { true }
5758 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5761 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
5762 if let Self::Some(v) = self { v } else { unreachable!() }
5766 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
5767 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
5768 COption_CVec_NetAddressZZ::Some(o)
5771 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
5772 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
5773 COption_CVec_NetAddressZZ::None
5776 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
5777 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
5779 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
5780 /// but with all dynamically-allocated buffers duplicated in new buffers.
5781 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
5783 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
5784 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5785 /// A pointer to the contents in the success state.
5786 /// Reading from this pointer when `result_ok` is not set is undefined.
5787 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
5788 /// A pointer to the contents in the error state.
5789 /// Reading from this pointer when `result_ok` is set is undefined.
5790 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5793 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5794 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5795 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5796 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5797 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
5798 /// `err` or `result` depending on the state of `result_ok`.
5799 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
5800 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
5801 pub result_ok: bool,
5804 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
5805 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5806 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5807 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5808 result: Box::into_raw(Box::new(o)),
5814 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
5815 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5816 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5817 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5818 err: Box::into_raw(Box::new(e)),
5823 /// Checks if the given object is currently in the success state
5825 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
5829 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
5830 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
5831 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5832 fn drop(&mut self) {
5834 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5835 let _ = unsafe { Box::from_raw(self.contents.result) };
5838 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5839 let _ = unsafe { Box::from_raw(self.contents.err) };
5844 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5845 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
5846 let contents = if o.result_ok {
5847 let result = unsafe { o.contents.result };
5848 unsafe { o.contents.result = core::ptr::null_mut() };
5849 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
5851 let err = unsafe { o.contents.err };
5852 unsafe { o.contents.err = core::ptr::null_mut(); }
5853 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
5857 result_ok: o.result_ok,
5861 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5862 fn clone(&self) -> Self {
5864 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5865 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
5868 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5869 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5875 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
5876 /// but with all dynamically-allocated buffers duplicated in new buffers.
5877 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
5879 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
5880 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5881 /// A pointer to the contents in the success state.
5882 /// Reading from this pointer when `result_ok` is not set is undefined.
5883 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
5884 /// A pointer to the contents in the error state.
5885 /// Reading from this pointer when `result_ok` is set is undefined.
5886 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5889 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5890 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5891 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5892 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5893 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
5894 /// `err` or `result` depending on the state of `result_ok`.
5895 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
5896 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
5897 pub result_ok: bool,
5900 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
5901 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5902 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5903 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5904 result: Box::into_raw(Box::new(o)),
5910 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
5911 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5912 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5913 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5914 err: Box::into_raw(Box::new(e)),
5919 /// Checks if the given object is currently in the success state
5921 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
5925 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
5926 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
5927 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5928 fn drop(&mut self) {
5930 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5931 let _ = unsafe { Box::from_raw(self.contents.result) };
5934 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5935 let _ = unsafe { Box::from_raw(self.contents.err) };
5940 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5941 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
5942 let contents = if o.result_ok {
5943 let result = unsafe { o.contents.result };
5944 unsafe { o.contents.result = core::ptr::null_mut() };
5945 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
5947 let err = unsafe { o.contents.err };
5948 unsafe { o.contents.err = core::ptr::null_mut(); }
5949 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
5953 result_ok: o.result_ok,
5957 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5958 fn clone(&self) -> Self {
5960 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5961 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
5964 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5965 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5971 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
5972 /// but with all dynamically-allocated buffers duplicated in new buffers.
5973 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
5975 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5976 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
5977 /// A pointer to the contents in the success state.
5978 /// Reading from this pointer when `result_ok` is not set is undefined.
5979 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
5980 /// A pointer to the contents in the error state.
5981 /// Reading from this pointer when `result_ok` is set is undefined.
5982 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5985 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5986 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5988 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
5989 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5990 /// `err` or `result` depending on the state of `result_ok`.
5991 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
5992 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5993 pub result_ok: bool,
5996 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
5997 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
5998 CResult_SpendableOutputDescriptorDecodeErrorZ {
5999 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6000 result: Box::into_raw(Box::new(o)),
6006 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6007 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6008 CResult_SpendableOutputDescriptorDecodeErrorZ {
6009 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6010 err: Box::into_raw(Box::new(e)),
6015 /// Checks if the given object is currently in the success state
6017 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6021 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6022 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6023 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6024 fn drop(&mut self) {
6026 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6027 let _ = unsafe { Box::from_raw(self.contents.result) };
6030 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6031 let _ = unsafe { Box::from_raw(self.contents.err) };
6036 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6037 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6038 let contents = if o.result_ok {
6039 let result = unsafe { o.contents.result };
6040 unsafe { o.contents.result = core::ptr::null_mut() };
6041 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6043 let err = unsafe { o.contents.err };
6044 unsafe { o.contents.err = core::ptr::null_mut(); }
6045 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6049 result_ok: o.result_ok,
6053 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6054 fn clone(&self) -> Self {
6056 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6057 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6060 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6061 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6067 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6068 /// but with all dynamically-allocated buffers duplicated in new buffers.
6069 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6071 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6072 /// This corresponds to std::vector in C++
6073 pub struct CVec_PaymentPreimageZ {
6074 /// The elements in the array.
6075 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6076 pub data: *mut crate::c_types::ThirtyTwoBytes,
6077 /// The number of elements pointed to by `data`.
6080 impl CVec_PaymentPreimageZ {
6081 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6082 if self.datalen == 0 { return Vec::new(); }
6083 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6084 self.data = core::ptr::null_mut();
6088 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6089 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6092 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6093 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6094 let datalen = v.len();
6095 let data = Box::into_raw(v.into_boxed_slice());
6096 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6100 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6101 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6102 impl Drop for CVec_PaymentPreimageZ {
6103 fn drop(&mut self) {
6104 if self.datalen == 0 { return; }
6105 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6108 impl Clone for CVec_PaymentPreimageZ {
6109 fn clone(&self) -> Self {
6110 let mut res = Vec::new();
6111 if self.datalen == 0 { return Self::from(res); }
6112 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6117 /// A tuple of 2 elements. See the individual fields for the types contained.
6118 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6119 /// The element at position 0
6120 pub a: crate::c_types::Signature,
6121 /// The element at position 1
6122 pub b: crate::c_types::derived::CVec_SignatureZ,
6124 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6125 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6132 impl C2Tuple_SignatureCVec_SignatureZZ {
6133 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6137 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6138 fn clone(&self) -> Self {
6140 a: Clone::clone(&self.a),
6141 b: Clone::clone(&self.b),
6146 /// Creates a new tuple which has the same data as `orig`
6147 /// but with all dynamically-allocated buffers duplicated in new buffers.
6148 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6149 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6151 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6152 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6156 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6157 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6159 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6160 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6161 /// A pointer to the contents in the success state.
6162 /// Reading from this pointer when `result_ok` is not set is undefined.
6163 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6164 /// Note that this value is always NULL, as there are no contents in the Err variant
6165 pub err: *mut core::ffi::c_void,
6168 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6169 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6170 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6171 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6172 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6173 /// `err` or `result` depending on the state of `result_ok`.
6174 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6175 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6176 pub result_ok: bool,
6179 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6180 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6181 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6182 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6183 result: Box::into_raw(Box::new(o)),
6189 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6190 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6191 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6192 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6193 err: core::ptr::null_mut(),
6198 /// Checks if the given object is currently in the success state
6200 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6204 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6205 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6206 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6207 fn drop(&mut self) {
6209 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6210 let _ = unsafe { Box::from_raw(self.contents.result) };
6216 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6217 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6218 let contents = if o.result_ok {
6219 let result = unsafe { o.contents.result };
6220 unsafe { o.contents.result = core::ptr::null_mut() };
6221 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6223 let _ = unsafe { Box::from_raw(o.contents.err) };
6224 o.contents.err = core::ptr::null_mut();
6225 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6229 result_ok: o.result_ok,
6233 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6234 fn clone(&self) -> Self {
6236 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6237 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6240 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6241 err: core::ptr::null_mut()
6247 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6248 /// but with all dynamically-allocated buffers duplicated in new buffers.
6249 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6251 /// The contents of CResult_SignatureNoneZ
6252 pub union CResult_SignatureNoneZPtr {
6253 /// A pointer to the contents in the success state.
6254 /// Reading from this pointer when `result_ok` is not set is undefined.
6255 pub result: *mut crate::c_types::Signature,
6256 /// Note that this value is always NULL, as there are no contents in the Err variant
6257 pub err: *mut core::ffi::c_void,
6260 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6261 /// containing a crate::c_types::Signature on success and a () on failure.
6262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6263 pub struct CResult_SignatureNoneZ {
6264 /// The contents of this CResult_SignatureNoneZ, accessible via either
6265 /// `err` or `result` depending on the state of `result_ok`.
6266 pub contents: CResult_SignatureNoneZPtr,
6267 /// Whether this CResult_SignatureNoneZ represents a success state.
6268 pub result_ok: bool,
6271 /// Creates a new CResult_SignatureNoneZ in the success state.
6272 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6273 CResult_SignatureNoneZ {
6274 contents: CResult_SignatureNoneZPtr {
6275 result: Box::into_raw(Box::new(o)),
6281 /// Creates a new CResult_SignatureNoneZ in the error state.
6282 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6283 CResult_SignatureNoneZ {
6284 contents: CResult_SignatureNoneZPtr {
6285 err: core::ptr::null_mut(),
6290 /// Checks if the given object is currently in the success state
6292 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6296 /// Frees any resources used by the CResult_SignatureNoneZ.
6297 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6298 impl Drop for CResult_SignatureNoneZ {
6299 fn drop(&mut self) {
6301 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6302 let _ = unsafe { Box::from_raw(self.contents.result) };
6308 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6309 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6310 let contents = if o.result_ok {
6311 let result = unsafe { o.contents.result };
6312 unsafe { o.contents.result = core::ptr::null_mut() };
6313 CResult_SignatureNoneZPtr { result }
6315 let _ = unsafe { Box::from_raw(o.contents.err) };
6316 o.contents.err = core::ptr::null_mut();
6317 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6321 result_ok: o.result_ok,
6325 impl Clone for CResult_SignatureNoneZ {
6326 fn clone(&self) -> Self {
6328 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6329 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6332 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6333 err: core::ptr::null_mut()
6339 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6340 /// but with all dynamically-allocated buffers duplicated in new buffers.
6341 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6343 /// A tuple of 2 elements. See the individual fields for the types contained.
6344 pub struct C2Tuple_SignatureSignatureZ {
6345 /// The element at position 0
6346 pub a: crate::c_types::Signature,
6347 /// The element at position 1
6348 pub b: crate::c_types::Signature,
6350 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6351 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6358 impl C2Tuple_SignatureSignatureZ {
6359 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6363 impl Clone for C2Tuple_SignatureSignatureZ {
6364 fn clone(&self) -> Self {
6366 a: Clone::clone(&self.a),
6367 b: Clone::clone(&self.b),
6372 /// Creates a new tuple which has the same data as `orig`
6373 /// but with all dynamically-allocated buffers duplicated in new buffers.
6374 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6375 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6377 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6378 C2Tuple_SignatureSignatureZ { a, b, }
6382 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6383 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6385 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6386 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6387 /// A pointer to the contents in the success state.
6388 /// Reading from this pointer when `result_ok` is not set is undefined.
6389 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6390 /// Note that this value is always NULL, as there are no contents in the Err variant
6391 pub err: *mut core::ffi::c_void,
6394 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6395 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6397 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6398 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6399 /// `err` or `result` depending on the state of `result_ok`.
6400 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6401 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6402 pub result_ok: bool,
6405 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6406 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6407 CResult_C2Tuple_SignatureSignatureZNoneZ {
6408 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6409 result: Box::into_raw(Box::new(o)),
6415 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6416 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6417 CResult_C2Tuple_SignatureSignatureZNoneZ {
6418 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6419 err: core::ptr::null_mut(),
6424 /// Checks if the given object is currently in the success state
6426 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6430 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6431 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6432 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
6433 fn drop(&mut self) {
6435 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6436 let _ = unsafe { Box::from_raw(self.contents.result) };
6442 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6443 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
6444 let contents = if o.result_ok {
6445 let result = unsafe { o.contents.result };
6446 unsafe { o.contents.result = core::ptr::null_mut() };
6447 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
6449 let _ = unsafe { Box::from_raw(o.contents.err) };
6450 o.contents.err = core::ptr::null_mut();
6451 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6455 result_ok: o.result_ok,
6459 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6460 fn clone(&self) -> Self {
6462 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6463 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6466 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6467 err: core::ptr::null_mut()
6473 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6474 /// but with all dynamically-allocated buffers duplicated in new buffers.
6475 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6477 /// The contents of CResult_SecretKeyNoneZ
6478 pub union CResult_SecretKeyNoneZPtr {
6479 /// A pointer to the contents in the success state.
6480 /// Reading from this pointer when `result_ok` is not set is undefined.
6481 pub result: *mut crate::c_types::SecretKey,
6482 /// Note that this value is always NULL, as there are no contents in the Err variant
6483 pub err: *mut core::ffi::c_void,
6486 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6487 /// containing a crate::c_types::SecretKey on success and a () on failure.
6488 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6489 pub struct CResult_SecretKeyNoneZ {
6490 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6491 /// `err` or `result` depending on the state of `result_ok`.
6492 pub contents: CResult_SecretKeyNoneZPtr,
6493 /// Whether this CResult_SecretKeyNoneZ represents a success state.
6494 pub result_ok: bool,
6497 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6498 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6499 CResult_SecretKeyNoneZ {
6500 contents: CResult_SecretKeyNoneZPtr {
6501 result: Box::into_raw(Box::new(o)),
6507 /// Creates a new CResult_SecretKeyNoneZ in the error state.
6508 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
6509 CResult_SecretKeyNoneZ {
6510 contents: CResult_SecretKeyNoneZPtr {
6511 err: core::ptr::null_mut(),
6516 /// Checks if the given object is currently in the success state
6518 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
6522 /// Frees any resources used by the CResult_SecretKeyNoneZ.
6523 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
6524 impl Drop for CResult_SecretKeyNoneZ {
6525 fn drop(&mut self) {
6527 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6528 let _ = unsafe { Box::from_raw(self.contents.result) };
6534 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
6535 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
6536 let contents = if o.result_ok {
6537 let result = unsafe { o.contents.result };
6538 unsafe { o.contents.result = core::ptr::null_mut() };
6539 CResult_SecretKeyNoneZPtr { result }
6541 let _ = unsafe { Box::from_raw(o.contents.err) };
6542 o.contents.err = core::ptr::null_mut();
6543 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
6547 result_ok: o.result_ok,
6551 impl Clone for CResult_SecretKeyNoneZ {
6552 fn clone(&self) -> Self {
6554 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
6555 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
6558 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
6559 err: core::ptr::null_mut()
6565 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
6566 /// but with all dynamically-allocated buffers duplicated in new buffers.
6567 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
6569 /// The contents of CResult_SignDecodeErrorZ
6570 pub union CResult_SignDecodeErrorZPtr {
6571 /// A pointer to the contents in the success state.
6572 /// Reading from this pointer when `result_ok` is not set is undefined.
6573 pub result: *mut crate::lightning::chain::keysinterface::Sign,
6574 /// A pointer to the contents in the error state.
6575 /// Reading from this pointer when `result_ok` is set is undefined.
6576 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6579 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6580 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6582 pub struct CResult_SignDecodeErrorZ {
6583 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
6584 /// `err` or `result` depending on the state of `result_ok`.
6585 pub contents: CResult_SignDecodeErrorZPtr,
6586 /// Whether this CResult_SignDecodeErrorZ represents a success state.
6587 pub result_ok: bool,
6590 /// Creates a new CResult_SignDecodeErrorZ in the success state.
6591 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
6592 CResult_SignDecodeErrorZ {
6593 contents: CResult_SignDecodeErrorZPtr {
6594 result: Box::into_raw(Box::new(o)),
6600 /// Creates a new CResult_SignDecodeErrorZ in the error state.
6601 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
6602 CResult_SignDecodeErrorZ {
6603 contents: CResult_SignDecodeErrorZPtr {
6604 err: Box::into_raw(Box::new(e)),
6609 /// Checks if the given object is currently in the success state
6611 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
6615 /// Frees any resources used by the CResult_SignDecodeErrorZ.
6616 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
6617 impl Drop for CResult_SignDecodeErrorZ {
6618 fn drop(&mut self) {
6620 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6621 let _ = unsafe { Box::from_raw(self.contents.result) };
6624 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6625 let _ = unsafe { Box::from_raw(self.contents.err) };
6630 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
6631 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
6632 let contents = if o.result_ok {
6633 let result = unsafe { o.contents.result };
6634 unsafe { o.contents.result = core::ptr::null_mut() };
6635 CResult_SignDecodeErrorZPtr { result }
6637 let err = unsafe { o.contents.err };
6638 unsafe { o.contents.err = core::ptr::null_mut(); }
6639 CResult_SignDecodeErrorZPtr { err }
6643 result_ok: o.result_ok,
6647 impl Clone for CResult_SignDecodeErrorZ {
6648 fn clone(&self) -> Self {
6650 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
6651 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
6654 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
6655 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6661 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
6662 /// but with all dynamically-allocated buffers duplicated in new buffers.
6663 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
6665 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6666 /// This corresponds to std::vector in C++
6667 pub struct CVec_u5Z {
6668 /// The elements in the array.
6669 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6670 pub data: *mut crate::c_types::u5,
6671 /// The number of elements pointed to by `data`.
6675 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
6676 if self.datalen == 0 { return Vec::new(); }
6677 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6678 self.data = core::ptr::null_mut();
6682 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
6683 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6686 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
6687 fn from(v: Vec<crate::c_types::u5>) -> Self {
6688 let datalen = v.len();
6689 let data = Box::into_raw(v.into_boxed_slice());
6690 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6694 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6695 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
6696 impl Drop for CVec_u5Z {
6697 fn drop(&mut self) {
6698 if self.datalen == 0 { return; }
6699 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6702 impl Clone for CVec_u5Z {
6703 fn clone(&self) -> Self {
6704 let mut res = Vec::new();
6705 if self.datalen == 0 { return Self::from(res); }
6706 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6711 /// The contents of CResult_RecoverableSignatureNoneZ
6712 pub union CResult_RecoverableSignatureNoneZPtr {
6713 /// A pointer to the contents in the success state.
6714 /// Reading from this pointer when `result_ok` is not set is undefined.
6715 pub result: *mut crate::c_types::RecoverableSignature,
6716 /// Note that this value is always NULL, as there are no contents in the Err variant
6717 pub err: *mut core::ffi::c_void,
6720 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6721 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
6722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6723 pub struct CResult_RecoverableSignatureNoneZ {
6724 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6725 /// `err` or `result` depending on the state of `result_ok`.
6726 pub contents: CResult_RecoverableSignatureNoneZPtr,
6727 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6728 pub result_ok: bool,
6731 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
6732 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
6733 CResult_RecoverableSignatureNoneZ {
6734 contents: CResult_RecoverableSignatureNoneZPtr {
6735 result: Box::into_raw(Box::new(o)),
6741 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
6742 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
6743 CResult_RecoverableSignatureNoneZ {
6744 contents: CResult_RecoverableSignatureNoneZPtr {
6745 err: core::ptr::null_mut(),
6750 /// Checks if the given object is currently in the success state
6752 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
6756 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
6757 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
6758 impl Drop for CResult_RecoverableSignatureNoneZ {
6759 fn drop(&mut self) {
6761 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6762 let _ = unsafe { Box::from_raw(self.contents.result) };
6768 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
6769 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
6770 let contents = if o.result_ok {
6771 let result = unsafe { o.contents.result };
6772 unsafe { o.contents.result = core::ptr::null_mut() };
6773 CResult_RecoverableSignatureNoneZPtr { result }
6775 let _ = unsafe { Box::from_raw(o.contents.err) };
6776 o.contents.err = core::ptr::null_mut();
6777 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
6781 result_ok: o.result_ok,
6785 impl Clone for CResult_RecoverableSignatureNoneZ {
6786 fn clone(&self) -> Self {
6788 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
6789 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
6792 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
6793 err: core::ptr::null_mut()
6799 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
6800 /// but with all dynamically-allocated buffers duplicated in new buffers.
6801 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
6803 /// A dynamically-allocated array of u8s of arbitrary size.
6804 /// This corresponds to std::vector in C++
6805 pub struct CVec_u8Z {
6806 /// The elements in the array.
6807 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6809 /// The number of elements pointed to by `data`.
6813 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
6814 if self.datalen == 0 { return Vec::new(); }
6815 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6816 self.data = core::ptr::null_mut();
6820 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
6821 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6824 impl From<Vec<u8>> for CVec_u8Z {
6825 fn from(v: Vec<u8>) -> Self {
6826 let datalen = v.len();
6827 let data = Box::into_raw(v.into_boxed_slice());
6828 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6832 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6833 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
6834 impl Drop for CVec_u8Z {
6835 fn drop(&mut self) {
6836 if self.datalen == 0 { return; }
6837 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6840 impl Clone for CVec_u8Z {
6841 fn clone(&self) -> Self {
6842 let mut res = Vec::new();
6843 if self.datalen == 0 { return Self::from(res); }
6844 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6849 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6850 /// This corresponds to std::vector in C++
6851 pub struct CVec_CVec_u8ZZ {
6852 /// The elements in the array.
6853 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6854 pub data: *mut crate::c_types::derived::CVec_u8Z,
6855 /// The number of elements pointed to by `data`.
6858 impl CVec_CVec_u8ZZ {
6859 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
6860 if self.datalen == 0 { return Vec::new(); }
6861 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6862 self.data = core::ptr::null_mut();
6866 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
6867 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6870 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
6871 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
6872 let datalen = v.len();
6873 let data = Box::into_raw(v.into_boxed_slice());
6874 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6878 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6879 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
6880 impl Drop for CVec_CVec_u8ZZ {
6881 fn drop(&mut self) {
6882 if self.datalen == 0 { return; }
6883 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6886 impl Clone for CVec_CVec_u8ZZ {
6887 fn clone(&self) -> Self {
6888 let mut res = Vec::new();
6889 if self.datalen == 0 { return Self::from(res); }
6890 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6895 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
6896 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
6897 /// A pointer to the contents in the success state.
6898 /// Reading from this pointer when `result_ok` is not set is undefined.
6899 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
6900 /// Note that this value is always NULL, as there are no contents in the Err variant
6901 pub err: *mut core::ffi::c_void,
6904 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6905 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6907 pub struct CResult_CVec_CVec_u8ZZNoneZ {
6908 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6909 /// `err` or `result` depending on the state of `result_ok`.
6910 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
6911 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6912 pub result_ok: bool,
6915 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
6916 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
6917 CResult_CVec_CVec_u8ZZNoneZ {
6918 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6919 result: Box::into_raw(Box::new(o)),
6925 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
6926 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
6927 CResult_CVec_CVec_u8ZZNoneZ {
6928 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6929 err: core::ptr::null_mut(),
6934 /// Checks if the given object is currently in the success state
6936 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
6940 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
6941 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
6942 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
6943 fn drop(&mut self) {
6945 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6946 let _ = unsafe { Box::from_raw(self.contents.result) };
6952 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
6953 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
6954 let contents = if o.result_ok {
6955 let result = unsafe { o.contents.result };
6956 unsafe { o.contents.result = core::ptr::null_mut() };
6957 CResult_CVec_CVec_u8ZZNoneZPtr { result }
6959 let _ = unsafe { Box::from_raw(o.contents.err) };
6960 o.contents.err = core::ptr::null_mut();
6961 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
6965 result_ok: o.result_ok,
6969 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
6970 fn clone(&self) -> Self {
6972 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6973 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
6976 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6977 err: core::ptr::null_mut()
6983 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
6984 /// but with all dynamically-allocated buffers duplicated in new buffers.
6985 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
6987 /// The contents of CResult_InMemorySignerDecodeErrorZ
6988 pub union CResult_InMemorySignerDecodeErrorZPtr {
6989 /// A pointer to the contents in the success state.
6990 /// Reading from this pointer when `result_ok` is not set is undefined.
6991 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
6992 /// A pointer to the contents in the error state.
6993 /// Reading from this pointer when `result_ok` is set is undefined.
6994 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6997 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6998 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6999 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7000 pub struct CResult_InMemorySignerDecodeErrorZ {
7001 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7002 /// `err` or `result` depending on the state of `result_ok`.
7003 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7004 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7005 pub result_ok: bool,
7008 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7009 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7010 CResult_InMemorySignerDecodeErrorZ {
7011 contents: CResult_InMemorySignerDecodeErrorZPtr {
7012 result: Box::into_raw(Box::new(o)),
7018 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7019 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7020 CResult_InMemorySignerDecodeErrorZ {
7021 contents: CResult_InMemorySignerDecodeErrorZPtr {
7022 err: Box::into_raw(Box::new(e)),
7027 /// Checks if the given object is currently in the success state
7029 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7033 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7034 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7035 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7036 fn drop(&mut self) {
7038 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7039 let _ = unsafe { Box::from_raw(self.contents.result) };
7042 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7043 let _ = unsafe { Box::from_raw(self.contents.err) };
7048 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7049 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7050 let contents = if o.result_ok {
7051 let result = unsafe { o.contents.result };
7052 unsafe { o.contents.result = core::ptr::null_mut() };
7053 CResult_InMemorySignerDecodeErrorZPtr { result }
7055 let err = unsafe { o.contents.err };
7056 unsafe { o.contents.err = core::ptr::null_mut(); }
7057 CResult_InMemorySignerDecodeErrorZPtr { err }
7061 result_ok: o.result_ok,
7065 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7066 fn clone(&self) -> Self {
7068 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7069 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7072 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7073 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7079 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7080 /// but with all dynamically-allocated buffers duplicated in new buffers.
7081 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7083 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7084 /// This corresponds to std::vector in C++
7085 pub struct CVec_TxOutZ {
7086 /// The elements in the array.
7087 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7088 pub data: *mut crate::c_types::TxOut,
7089 /// The number of elements pointed to by `data`.
7093 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7094 if self.datalen == 0 { return Vec::new(); }
7095 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7096 self.data = core::ptr::null_mut();
7100 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7101 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7104 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7105 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7106 let datalen = v.len();
7107 let data = Box::into_raw(v.into_boxed_slice());
7108 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7112 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7113 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7114 impl Drop for CVec_TxOutZ {
7115 fn drop(&mut self) {
7116 if self.datalen == 0 { return; }
7117 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7120 impl Clone for CVec_TxOutZ {
7121 fn clone(&self) -> Self {
7122 let mut res = Vec::new();
7123 if self.datalen == 0 { return Self::from(res); }
7124 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7129 /// The contents of CResult_TransactionNoneZ
7130 pub union CResult_TransactionNoneZPtr {
7131 /// A pointer to the contents in the success state.
7132 /// Reading from this pointer when `result_ok` is not set is undefined.
7133 pub result: *mut crate::c_types::Transaction,
7134 /// Note that this value is always NULL, as there are no contents in the Err variant
7135 pub err: *mut core::ffi::c_void,
7138 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7139 /// containing a crate::c_types::Transaction on success and a () on failure.
7140 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7141 pub struct CResult_TransactionNoneZ {
7142 /// The contents of this CResult_TransactionNoneZ, accessible via either
7143 /// `err` or `result` depending on the state of `result_ok`.
7144 pub contents: CResult_TransactionNoneZPtr,
7145 /// Whether this CResult_TransactionNoneZ represents a success state.
7146 pub result_ok: bool,
7149 /// Creates a new CResult_TransactionNoneZ in the success state.
7150 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7151 CResult_TransactionNoneZ {
7152 contents: CResult_TransactionNoneZPtr {
7153 result: Box::into_raw(Box::new(o)),
7159 /// Creates a new CResult_TransactionNoneZ in the error state.
7160 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7161 CResult_TransactionNoneZ {
7162 contents: CResult_TransactionNoneZPtr {
7163 err: core::ptr::null_mut(),
7168 /// Checks if the given object is currently in the success state
7170 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7174 /// Frees any resources used by the CResult_TransactionNoneZ.
7175 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7176 impl Drop for CResult_TransactionNoneZ {
7177 fn drop(&mut self) {
7179 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7180 let _ = unsafe { Box::from_raw(self.contents.result) };
7186 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7187 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7188 let contents = if o.result_ok {
7189 let result = unsafe { o.contents.result };
7190 unsafe { o.contents.result = core::ptr::null_mut() };
7191 CResult_TransactionNoneZPtr { result }
7193 let _ = unsafe { Box::from_raw(o.contents.err) };
7194 o.contents.err = core::ptr::null_mut();
7195 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7199 result_ok: o.result_ok,
7203 impl Clone for CResult_TransactionNoneZ {
7204 fn clone(&self) -> Self {
7206 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7207 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7210 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7211 err: core::ptr::null_mut()
7217 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7218 /// but with all dynamically-allocated buffers duplicated in new buffers.
7219 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7221 /// A tuple of 2 elements. See the individual fields for the types contained.
7222 pub struct C2Tuple_BlockHashChannelMonitorZ {
7223 /// The element at position 0
7224 pub a: crate::c_types::ThirtyTwoBytes,
7225 /// The element at position 1
7226 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7228 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7229 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7236 impl C2Tuple_BlockHashChannelMonitorZ {
7237 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
7241 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
7243 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
7244 C2Tuple_BlockHashChannelMonitorZ { a, b, }
7248 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
7249 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
7251 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7252 /// This corresponds to std::vector in C++
7253 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
7254 /// The elements in the array.
7255 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7256 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7257 /// The number of elements pointed to by `data`.
7260 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
7261 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
7262 if self.datalen == 0 { return Vec::new(); }
7263 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7264 self.data = core::ptr::null_mut();
7268 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
7269 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7272 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7273 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
7274 let datalen = v.len();
7275 let data = Box::into_raw(v.into_boxed_slice());
7276 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7280 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7281 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
7282 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7283 fn drop(&mut self) {
7284 if self.datalen == 0 { return; }
7285 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7289 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7290 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7291 /// A pointer to the contents in the success state.
7292 /// Reading from this pointer when `result_ok` is not set is undefined.
7293 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
7294 /// A pointer to the contents in the error state.
7295 /// Reading from this pointer when `result_ok` is set is undefined.
7296 pub err: *mut crate::c_types::IOError,
7299 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7300 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7301 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7302 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7303 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7304 /// `err` or `result` depending on the state of `result_ok`.
7305 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
7306 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7307 pub result_ok: bool,
7310 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
7311 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7312 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7313 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7314 result: Box::into_raw(Box::new(o)),
7320 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
7321 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7322 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7323 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7324 err: Box::into_raw(Box::new(e)),
7329 /// Checks if the given object is currently in the success state
7331 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
7335 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
7336 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
7337 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7338 fn drop(&mut self) {
7340 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7341 let _ = unsafe { Box::from_raw(self.contents.result) };
7344 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7345 let _ = unsafe { Box::from_raw(self.contents.err) };
7350 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7351 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
7352 let contents = if o.result_ok {
7353 let result = unsafe { o.contents.result };
7354 unsafe { o.contents.result = core::ptr::null_mut() };
7355 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
7357 let err = unsafe { o.contents.err };
7358 unsafe { o.contents.err = core::ptr::null_mut(); }
7359 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
7363 result_ok: o.result_ok,
7369 /// An enum which can either contain a u16 or not
7370 pub enum COption_u16Z {
7371 /// When we're in this state, this COption_u16Z contains a u16
7373 /// When we're in this state, this COption_u16Z contains nothing
7377 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7378 if let Self::None = self { false } else { true }
7380 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7383 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
7384 if let Self::Some(v) = self { v } else { unreachable!() }
7388 /// Constructs a new COption_u16Z containing a u16
7389 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
7390 COption_u16Z::Some(o)
7393 /// Constructs a new COption_u16Z containing nothing
7394 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
7398 /// Frees any resources associated with the u16, if we are in the Some state
7399 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
7401 /// Creates a new COption_u16Z which has the same data as `orig`
7402 /// but with all dynamically-allocated buffers duplicated in new buffers.
7403 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
7405 /// The contents of CResult_NoneAPIErrorZ
7406 pub union CResult_NoneAPIErrorZPtr {
7407 /// Note that this value is always NULL, as there are no contents in the OK variant
7408 pub result: *mut core::ffi::c_void,
7409 /// A pointer to the contents in the error state.
7410 /// Reading from this pointer when `result_ok` is set is undefined.
7411 pub err: *mut crate::lightning::util::errors::APIError,
7414 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7415 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
7416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7417 pub struct CResult_NoneAPIErrorZ {
7418 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
7419 /// `err` or `result` depending on the state of `result_ok`.
7420 pub contents: CResult_NoneAPIErrorZPtr,
7421 /// Whether this CResult_NoneAPIErrorZ represents a success state.
7422 pub result_ok: bool,
7425 /// Creates a new CResult_NoneAPIErrorZ in the success state.
7426 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
7427 CResult_NoneAPIErrorZ {
7428 contents: CResult_NoneAPIErrorZPtr {
7429 result: core::ptr::null_mut(),
7435 /// Creates a new CResult_NoneAPIErrorZ in the error state.
7436 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
7437 CResult_NoneAPIErrorZ {
7438 contents: CResult_NoneAPIErrorZPtr {
7439 err: Box::into_raw(Box::new(e)),
7444 /// Checks if the given object is currently in the success state
7446 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
7450 /// Frees any resources used by the CResult_NoneAPIErrorZ.
7451 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
7452 impl Drop for CResult_NoneAPIErrorZ {
7453 fn drop(&mut self) {
7456 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7457 let _ = unsafe { Box::from_raw(self.contents.err) };
7462 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
7463 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
7464 let contents = if o.result_ok {
7465 let _ = unsafe { Box::from_raw(o.contents.result) };
7466 o.contents.result = core::ptr::null_mut();
7467 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
7469 let err = unsafe { o.contents.err };
7470 unsafe { o.contents.err = core::ptr::null_mut(); }
7471 CResult_NoneAPIErrorZPtr { err }
7475 result_ok: o.result_ok,
7479 impl Clone for CResult_NoneAPIErrorZ {
7480 fn clone(&self) -> Self {
7482 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
7483 result: core::ptr::null_mut()
7486 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
7487 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7493 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
7494 /// but with all dynamically-allocated buffers duplicated in new buffers.
7495 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
7497 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7498 /// This corresponds to std::vector in C++
7499 pub struct CVec_CResult_NoneAPIErrorZZ {
7500 /// The elements in the array.
7501 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7502 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
7503 /// The number of elements pointed to by `data`.
7506 impl CVec_CResult_NoneAPIErrorZZ {
7507 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
7508 if self.datalen == 0 { return Vec::new(); }
7509 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7510 self.data = core::ptr::null_mut();
7514 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
7515 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7518 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
7519 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
7520 let datalen = v.len();
7521 let data = Box::into_raw(v.into_boxed_slice());
7522 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7526 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7527 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
7528 impl Drop for CVec_CResult_NoneAPIErrorZZ {
7529 fn drop(&mut self) {
7530 if self.datalen == 0 { return; }
7531 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7534 impl Clone for CVec_CResult_NoneAPIErrorZZ {
7535 fn clone(&self) -> Self {
7536 let mut res = Vec::new();
7537 if self.datalen == 0 { return Self::from(res); }
7538 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7543 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7544 /// This corresponds to std::vector in C++
7545 pub struct CVec_APIErrorZ {
7546 /// The elements in the array.
7547 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7548 pub data: *mut crate::lightning::util::errors::APIError,
7549 /// The number of elements pointed to by `data`.
7552 impl CVec_APIErrorZ {
7553 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
7554 if self.datalen == 0 { return Vec::new(); }
7555 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7556 self.data = core::ptr::null_mut();
7560 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
7561 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7564 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
7565 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
7566 let datalen = v.len();
7567 let data = Box::into_raw(v.into_boxed_slice());
7568 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7572 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7573 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
7574 impl Drop for CVec_APIErrorZ {
7575 fn drop(&mut self) {
7576 if self.datalen == 0 { return; }
7577 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7580 impl Clone for CVec_APIErrorZ {
7581 fn clone(&self) -> Self {
7582 let mut res = Vec::new();
7583 if self.datalen == 0 { return Self::from(res); }
7584 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7589 /// The contents of CResult__u832APIErrorZ
7590 pub union CResult__u832APIErrorZPtr {
7591 /// A pointer to the contents in the success state.
7592 /// Reading from this pointer when `result_ok` is not set is undefined.
7593 pub result: *mut crate::c_types::ThirtyTwoBytes,
7594 /// A pointer to the contents in the error state.
7595 /// Reading from this pointer when `result_ok` is set is undefined.
7596 pub err: *mut crate::lightning::util::errors::APIError,
7599 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
7600 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7602 pub struct CResult__u832APIErrorZ {
7603 /// The contents of this CResult__u832APIErrorZ, accessible via either
7604 /// `err` or `result` depending on the state of `result_ok`.
7605 pub contents: CResult__u832APIErrorZPtr,
7606 /// Whether this CResult__u832APIErrorZ represents a success state.
7607 pub result_ok: bool,
7610 /// Creates a new CResult__u832APIErrorZ in the success state.
7611 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
7612 CResult__u832APIErrorZ {
7613 contents: CResult__u832APIErrorZPtr {
7614 result: Box::into_raw(Box::new(o)),
7620 /// Creates a new CResult__u832APIErrorZ in the error state.
7621 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
7622 CResult__u832APIErrorZ {
7623 contents: CResult__u832APIErrorZPtr {
7624 err: Box::into_raw(Box::new(e)),
7629 /// Checks if the given object is currently in the success state
7631 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
7635 /// Frees any resources used by the CResult__u832APIErrorZ.
7636 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
7637 impl Drop for CResult__u832APIErrorZ {
7638 fn drop(&mut self) {
7640 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7641 let _ = unsafe { Box::from_raw(self.contents.result) };
7644 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7645 let _ = unsafe { Box::from_raw(self.contents.err) };
7650 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
7651 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7652 let contents = if o.result_ok {
7653 let result = unsafe { o.contents.result };
7654 unsafe { o.contents.result = core::ptr::null_mut() };
7655 CResult__u832APIErrorZPtr { result }
7657 let err = unsafe { o.contents.err };
7658 unsafe { o.contents.err = core::ptr::null_mut(); }
7659 CResult__u832APIErrorZPtr { err }
7663 result_ok: o.result_ok,
7667 impl Clone for CResult__u832APIErrorZ {
7668 fn clone(&self) -> Self {
7670 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
7671 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7674 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
7675 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7681 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
7682 /// but with all dynamically-allocated buffers duplicated in new buffers.
7683 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
7685 /// The contents of CResult_PaymentIdPaymentSendFailureZ
7686 pub union CResult_PaymentIdPaymentSendFailureZPtr {
7687 /// A pointer to the contents in the success state.
7688 /// Reading from this pointer when `result_ok` is not set is undefined.
7689 pub result: *mut crate::c_types::ThirtyTwoBytes,
7690 /// A pointer to the contents in the error state.
7691 /// Reading from this pointer when `result_ok` is set is undefined.
7692 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7695 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
7696 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7697 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7698 pub struct CResult_PaymentIdPaymentSendFailureZ {
7699 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
7700 /// `err` or `result` depending on the state of `result_ok`.
7701 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
7702 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
7703 pub result_ok: bool,
7706 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
7707 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
7708 CResult_PaymentIdPaymentSendFailureZ {
7709 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7710 result: Box::into_raw(Box::new(o)),
7716 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
7717 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
7718 CResult_PaymentIdPaymentSendFailureZ {
7719 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7720 err: Box::into_raw(Box::new(e)),
7725 /// Checks if the given object is currently in the success state
7727 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
7731 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
7732 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
7733 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
7734 fn drop(&mut self) {
7736 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7737 let _ = unsafe { Box::from_raw(self.contents.result) };
7740 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7741 let _ = unsafe { Box::from_raw(self.contents.err) };
7746 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
7747 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7748 let contents = if o.result_ok {
7749 let result = unsafe { o.contents.result };
7750 unsafe { o.contents.result = core::ptr::null_mut() };
7751 CResult_PaymentIdPaymentSendFailureZPtr { result }
7753 let err = unsafe { o.contents.err };
7754 unsafe { o.contents.err = core::ptr::null_mut(); }
7755 CResult_PaymentIdPaymentSendFailureZPtr { err }
7759 result_ok: o.result_ok,
7763 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
7764 fn clone(&self) -> Self {
7766 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7767 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7770 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7771 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7777 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
7778 /// but with all dynamically-allocated buffers duplicated in new buffers.
7779 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
7781 /// The contents of CResult_NonePaymentSendFailureZ
7782 pub union CResult_NonePaymentSendFailureZPtr {
7783 /// Note that this value is always NULL, as there are no contents in the OK variant
7784 pub result: *mut core::ffi::c_void,
7785 /// A pointer to the contents in the error state.
7786 /// Reading from this pointer when `result_ok` is set is undefined.
7787 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7790 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7791 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7792 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7793 pub struct CResult_NonePaymentSendFailureZ {
7794 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7795 /// `err` or `result` depending on the state of `result_ok`.
7796 pub contents: CResult_NonePaymentSendFailureZPtr,
7797 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
7798 pub result_ok: bool,
7801 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
7802 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
7803 CResult_NonePaymentSendFailureZ {
7804 contents: CResult_NonePaymentSendFailureZPtr {
7805 result: core::ptr::null_mut(),
7811 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
7812 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
7813 CResult_NonePaymentSendFailureZ {
7814 contents: CResult_NonePaymentSendFailureZPtr {
7815 err: Box::into_raw(Box::new(e)),
7820 /// Checks if the given object is currently in the success state
7822 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
7826 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
7827 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
7828 impl Drop for CResult_NonePaymentSendFailureZ {
7829 fn drop(&mut self) {
7832 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7833 let _ = unsafe { Box::from_raw(self.contents.err) };
7838 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
7839 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7840 let contents = if o.result_ok {
7841 let _ = unsafe { Box::from_raw(o.contents.result) };
7842 o.contents.result = core::ptr::null_mut();
7843 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
7845 let err = unsafe { o.contents.err };
7846 unsafe { o.contents.err = core::ptr::null_mut(); }
7847 CResult_NonePaymentSendFailureZPtr { err }
7851 result_ok: o.result_ok,
7855 impl Clone for CResult_NonePaymentSendFailureZ {
7856 fn clone(&self) -> Self {
7858 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
7859 result: core::ptr::null_mut()
7862 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
7863 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7869 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
7870 /// but with all dynamically-allocated buffers duplicated in new buffers.
7871 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
7873 /// A tuple of 2 elements. See the individual fields for the types contained.
7874 pub struct C2Tuple_PaymentHashPaymentIdZ {
7875 /// The element at position 0
7876 pub a: crate::c_types::ThirtyTwoBytes,
7877 /// The element at position 1
7878 pub b: crate::c_types::ThirtyTwoBytes,
7880 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
7881 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
7888 impl C2Tuple_PaymentHashPaymentIdZ {
7889 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
7893 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
7894 fn clone(&self) -> Self {
7896 a: Clone::clone(&self.a),
7897 b: Clone::clone(&self.b),
7902 /// Creates a new tuple which has the same data as `orig`
7903 /// but with all dynamically-allocated buffers duplicated in new buffers.
7904 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
7905 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
7907 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
7908 C2Tuple_PaymentHashPaymentIdZ { a, b, }
7912 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
7913 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
7915 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
7916 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7917 /// A pointer to the contents in the success state.
7918 /// Reading from this pointer when `result_ok` is not set is undefined.
7919 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
7920 /// A pointer to the contents in the error state.
7921 /// Reading from this pointer when `result_ok` is set is undefined.
7922 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7925 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
7926 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7928 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7929 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
7930 /// `err` or `result` depending on the state of `result_ok`.
7931 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
7932 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
7933 pub result_ok: bool,
7936 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
7937 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7938 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7939 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7940 result: Box::into_raw(Box::new(o)),
7946 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
7947 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7948 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7949 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7950 err: Box::into_raw(Box::new(e)),
7955 /// Checks if the given object is currently in the success state
7957 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
7961 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
7962 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
7963 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7964 fn drop(&mut self) {
7966 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7967 let _ = unsafe { Box::from_raw(self.contents.result) };
7970 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7971 let _ = unsafe { Box::from_raw(self.contents.err) };
7976 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7977 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7978 let contents = if o.result_ok {
7979 let result = unsafe { o.contents.result };
7980 unsafe { o.contents.result = core::ptr::null_mut() };
7981 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
7983 let err = unsafe { o.contents.err };
7984 unsafe { o.contents.err = core::ptr::null_mut(); }
7985 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
7989 result_ok: o.result_ok,
7993 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7994 fn clone(&self) -> Self {
7996 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7997 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8000 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8001 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8007 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8008 /// but with all dynamically-allocated buffers duplicated in new buffers.
8009 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8011 /// A tuple of 2 elements. See the individual fields for the types contained.
8012 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8013 /// The element at position 0
8014 pub a: crate::c_types::ThirtyTwoBytes,
8015 /// The element at position 1
8016 pub b: crate::c_types::ThirtyTwoBytes,
8018 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8019 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8026 impl C2Tuple_PaymentHashPaymentSecretZ {
8027 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8031 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8032 fn clone(&self) -> Self {
8034 a: Clone::clone(&self.a),
8035 b: Clone::clone(&self.b),
8040 /// Creates a new tuple which has the same data as `orig`
8041 /// but with all dynamically-allocated buffers duplicated in new buffers.
8042 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8043 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8045 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8046 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8050 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8051 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8053 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8054 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8055 /// A pointer to the contents in the success state.
8056 /// Reading from this pointer when `result_ok` is not set is undefined.
8057 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8058 /// Note that this value is always NULL, as there are no contents in the Err variant
8059 pub err: *mut core::ffi::c_void,
8062 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8063 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8064 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8065 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8066 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8067 /// `err` or `result` depending on the state of `result_ok`.
8068 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8069 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8070 pub result_ok: bool,
8073 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8074 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8075 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8076 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8077 result: Box::into_raw(Box::new(o)),
8083 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8084 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8085 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8086 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8087 err: core::ptr::null_mut(),
8092 /// Checks if the given object is currently in the success state
8094 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8098 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8099 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8100 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8101 fn drop(&mut self) {
8103 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8104 let _ = unsafe { Box::from_raw(self.contents.result) };
8110 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8111 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8112 let contents = if o.result_ok {
8113 let result = unsafe { o.contents.result };
8114 unsafe { o.contents.result = core::ptr::null_mut() };
8115 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8117 let _ = unsafe { Box::from_raw(o.contents.err) };
8118 o.contents.err = core::ptr::null_mut();
8119 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8123 result_ok: o.result_ok,
8127 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8128 fn clone(&self) -> Self {
8130 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8131 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8134 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8135 err: core::ptr::null_mut()
8141 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8142 /// but with all dynamically-allocated buffers duplicated in new buffers.
8143 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8145 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8146 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8147 /// A pointer to the contents in the success state.
8148 /// Reading from this pointer when `result_ok` is not set is undefined.
8149 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8150 /// A pointer to the contents in the error state.
8151 /// Reading from this pointer when `result_ok` is set is undefined.
8152 pub err: *mut crate::lightning::util::errors::APIError,
8155 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8156 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8158 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8159 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8160 /// `err` or `result` depending on the state of `result_ok`.
8161 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8162 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8163 pub result_ok: bool,
8166 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8167 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8168 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8169 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8170 result: Box::into_raw(Box::new(o)),
8176 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8177 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8178 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8179 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8180 err: Box::into_raw(Box::new(e)),
8185 /// Checks if the given object is currently in the success state
8187 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
8191 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
8192 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
8193 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8194 fn drop(&mut self) {
8196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8197 let _ = unsafe { Box::from_raw(self.contents.result) };
8200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8201 let _ = unsafe { Box::from_raw(self.contents.err) };
8206 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8207 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
8208 let contents = if o.result_ok {
8209 let result = unsafe { o.contents.result };
8210 unsafe { o.contents.result = core::ptr::null_mut() };
8211 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
8213 let err = unsafe { o.contents.err };
8214 unsafe { o.contents.err = core::ptr::null_mut(); }
8215 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
8219 result_ok: o.result_ok,
8223 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8224 fn clone(&self) -> Self {
8226 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8227 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8230 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8231 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8237 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
8238 /// but with all dynamically-allocated buffers duplicated in new buffers.
8239 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
8241 /// The contents of CResult_PaymentSecretNoneZ
8242 pub union CResult_PaymentSecretNoneZPtr {
8243 /// A pointer to the contents in the success state.
8244 /// Reading from this pointer when `result_ok` is not set is undefined.
8245 pub result: *mut crate::c_types::ThirtyTwoBytes,
8246 /// Note that this value is always NULL, as there are no contents in the Err variant
8247 pub err: *mut core::ffi::c_void,
8250 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8251 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8253 pub struct CResult_PaymentSecretNoneZ {
8254 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8255 /// `err` or `result` depending on the state of `result_ok`.
8256 pub contents: CResult_PaymentSecretNoneZPtr,
8257 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8258 pub result_ok: bool,
8261 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8262 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8263 CResult_PaymentSecretNoneZ {
8264 contents: CResult_PaymentSecretNoneZPtr {
8265 result: Box::into_raw(Box::new(o)),
8271 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8272 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8273 CResult_PaymentSecretNoneZ {
8274 contents: CResult_PaymentSecretNoneZPtr {
8275 err: core::ptr::null_mut(),
8280 /// Checks if the given object is currently in the success state
8282 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8286 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8287 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8288 impl Drop for CResult_PaymentSecretNoneZ {
8289 fn drop(&mut self) {
8291 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8292 let _ = unsafe { Box::from_raw(self.contents.result) };
8298 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8299 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8300 let contents = if o.result_ok {
8301 let result = unsafe { o.contents.result };
8302 unsafe { o.contents.result = core::ptr::null_mut() };
8303 CResult_PaymentSecretNoneZPtr { result }
8305 let _ = unsafe { Box::from_raw(o.contents.err) };
8306 o.contents.err = core::ptr::null_mut();
8307 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8311 result_ok: o.result_ok,
8315 impl Clone for CResult_PaymentSecretNoneZ {
8316 fn clone(&self) -> Self {
8318 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8319 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8322 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8323 err: core::ptr::null_mut()
8329 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8330 /// but with all dynamically-allocated buffers duplicated in new buffers.
8331 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
8333 /// The contents of CResult_PaymentSecretAPIErrorZ
8334 pub union CResult_PaymentSecretAPIErrorZPtr {
8335 /// A pointer to the contents in the success state.
8336 /// Reading from this pointer when `result_ok` is not set is undefined.
8337 pub result: *mut crate::c_types::ThirtyTwoBytes,
8338 /// A pointer to the contents in the error state.
8339 /// Reading from this pointer when `result_ok` is set is undefined.
8340 pub err: *mut crate::lightning::util::errors::APIError,
8343 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8344 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8346 pub struct CResult_PaymentSecretAPIErrorZ {
8347 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8348 /// `err` or `result` depending on the state of `result_ok`.
8349 pub contents: CResult_PaymentSecretAPIErrorZPtr,
8350 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8351 pub result_ok: bool,
8354 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
8355 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
8356 CResult_PaymentSecretAPIErrorZ {
8357 contents: CResult_PaymentSecretAPIErrorZPtr {
8358 result: Box::into_raw(Box::new(o)),
8364 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
8365 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
8366 CResult_PaymentSecretAPIErrorZ {
8367 contents: CResult_PaymentSecretAPIErrorZPtr {
8368 err: Box::into_raw(Box::new(e)),
8373 /// Checks if the given object is currently in the success state
8375 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
8379 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
8380 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
8381 impl Drop for CResult_PaymentSecretAPIErrorZ {
8382 fn drop(&mut self) {
8384 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8385 let _ = unsafe { Box::from_raw(self.contents.result) };
8388 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8389 let _ = unsafe { Box::from_raw(self.contents.err) };
8394 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
8395 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8396 let contents = if o.result_ok {
8397 let result = unsafe { o.contents.result };
8398 unsafe { o.contents.result = core::ptr::null_mut() };
8399 CResult_PaymentSecretAPIErrorZPtr { result }
8401 let err = unsafe { o.contents.err };
8402 unsafe { o.contents.err = core::ptr::null_mut(); }
8403 CResult_PaymentSecretAPIErrorZPtr { err }
8407 result_ok: o.result_ok,
8411 impl Clone for CResult_PaymentSecretAPIErrorZ {
8412 fn clone(&self) -> Self {
8414 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
8415 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8418 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
8419 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8425 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
8426 /// but with all dynamically-allocated buffers duplicated in new buffers.
8427 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
8429 /// The contents of CResult_PaymentPreimageAPIErrorZ
8430 pub union CResult_PaymentPreimageAPIErrorZPtr {
8431 /// A pointer to the contents in the success state.
8432 /// Reading from this pointer when `result_ok` is not set is undefined.
8433 pub result: *mut crate::c_types::ThirtyTwoBytes,
8434 /// A pointer to the contents in the error state.
8435 /// Reading from this pointer when `result_ok` is set is undefined.
8436 pub err: *mut crate::lightning::util::errors::APIError,
8439 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8440 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8441 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8442 pub struct CResult_PaymentPreimageAPIErrorZ {
8443 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8444 /// `err` or `result` depending on the state of `result_ok`.
8445 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
8446 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8447 pub result_ok: bool,
8450 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
8451 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
8452 CResult_PaymentPreimageAPIErrorZ {
8453 contents: CResult_PaymentPreimageAPIErrorZPtr {
8454 result: Box::into_raw(Box::new(o)),
8460 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
8461 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
8462 CResult_PaymentPreimageAPIErrorZ {
8463 contents: CResult_PaymentPreimageAPIErrorZPtr {
8464 err: Box::into_raw(Box::new(e)),
8469 /// Checks if the given object is currently in the success state
8471 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
8475 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
8476 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
8477 impl Drop for CResult_PaymentPreimageAPIErrorZ {
8478 fn drop(&mut self) {
8480 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8481 let _ = unsafe { Box::from_raw(self.contents.result) };
8484 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8485 let _ = unsafe { Box::from_raw(self.contents.err) };
8490 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
8491 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8492 let contents = if o.result_ok {
8493 let result = unsafe { o.contents.result };
8494 unsafe { o.contents.result = core::ptr::null_mut() };
8495 CResult_PaymentPreimageAPIErrorZPtr { result }
8497 let err = unsafe { o.contents.err };
8498 unsafe { o.contents.err = core::ptr::null_mut(); }
8499 CResult_PaymentPreimageAPIErrorZPtr { err }
8503 result_ok: o.result_ok,
8507 impl Clone for CResult_PaymentPreimageAPIErrorZ {
8508 fn clone(&self) -> Self {
8510 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
8511 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8514 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
8515 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8521 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
8522 /// but with all dynamically-allocated buffers duplicated in new buffers.
8523 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
8525 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8526 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8527 /// A pointer to the contents in the success state.
8528 /// Reading from this pointer when `result_ok` is not set is undefined.
8529 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
8530 /// A pointer to the contents in the error state.
8531 /// Reading from this pointer when `result_ok` is set is undefined.
8532 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8535 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8536 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8537 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8538 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
8539 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8540 /// `err` or `result` depending on the state of `result_ok`.
8541 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
8542 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8543 pub result_ok: bool,
8546 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
8547 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8548 CResult_CounterpartyForwardingInfoDecodeErrorZ {
8549 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8550 result: Box::into_raw(Box::new(o)),
8556 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
8557 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8558 CResult_CounterpartyForwardingInfoDecodeErrorZ {
8559 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8560 err: Box::into_raw(Box::new(e)),
8565 /// Checks if the given object is currently in the success state
8567 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
8571 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
8572 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
8573 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8574 fn drop(&mut self) {
8576 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8577 let _ = unsafe { Box::from_raw(self.contents.result) };
8580 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8581 let _ = unsafe { Box::from_raw(self.contents.err) };
8586 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8587 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8588 let contents = if o.result_ok {
8589 let result = unsafe { o.contents.result };
8590 unsafe { o.contents.result = core::ptr::null_mut() };
8591 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
8593 let err = unsafe { o.contents.err };
8594 unsafe { o.contents.err = core::ptr::null_mut(); }
8595 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
8599 result_ok: o.result_ok,
8603 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8604 fn clone(&self) -> Self {
8606 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8607 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
8610 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8611 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8617 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
8618 /// but with all dynamically-allocated buffers duplicated in new buffers.
8619 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
8621 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
8622 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
8623 /// A pointer to the contents in the success state.
8624 /// Reading from this pointer when `result_ok` is not set is undefined.
8625 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
8626 /// A pointer to the contents in the error state.
8627 /// Reading from this pointer when `result_ok` is set is undefined.
8628 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8631 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8632 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8633 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8634 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
8635 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8636 /// `err` or `result` depending on the state of `result_ok`.
8637 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
8638 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8639 pub result_ok: bool,
8642 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
8643 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
8644 CResult_ChannelCounterpartyDecodeErrorZ {
8645 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8646 result: Box::into_raw(Box::new(o)),
8652 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
8653 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
8654 CResult_ChannelCounterpartyDecodeErrorZ {
8655 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8656 err: Box::into_raw(Box::new(e)),
8661 /// Checks if the given object is currently in the success state
8663 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
8667 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
8668 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
8669 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
8670 fn drop(&mut self) {
8672 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8673 let _ = unsafe { Box::from_raw(self.contents.result) };
8676 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8677 let _ = unsafe { Box::from_raw(self.contents.err) };
8682 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
8683 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
8684 let contents = if o.result_ok {
8685 let result = unsafe { o.contents.result };
8686 unsafe { o.contents.result = core::ptr::null_mut() };
8687 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
8689 let err = unsafe { o.contents.err };
8690 unsafe { o.contents.err = core::ptr::null_mut(); }
8691 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
8695 result_ok: o.result_ok,
8699 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
8700 fn clone(&self) -> Self {
8702 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8703 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
8706 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8707 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8713 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
8714 /// but with all dynamically-allocated buffers duplicated in new buffers.
8715 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
8717 /// The contents of CResult_ChannelDetailsDecodeErrorZ
8718 pub union CResult_ChannelDetailsDecodeErrorZPtr {
8719 /// A pointer to the contents in the success state.
8720 /// Reading from this pointer when `result_ok` is not set is undefined.
8721 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
8722 /// A pointer to the contents in the error state.
8723 /// Reading from this pointer when `result_ok` is set is undefined.
8724 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8727 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
8728 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
8729 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8730 pub struct CResult_ChannelDetailsDecodeErrorZ {
8731 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
8732 /// `err` or `result` depending on the state of `result_ok`.
8733 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
8734 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
8735 pub result_ok: bool,
8738 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
8739 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
8740 CResult_ChannelDetailsDecodeErrorZ {
8741 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8742 result: Box::into_raw(Box::new(o)),
8748 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
8749 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
8750 CResult_ChannelDetailsDecodeErrorZ {
8751 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8752 err: Box::into_raw(Box::new(e)),
8757 /// Checks if the given object is currently in the success state
8759 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
8763 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
8764 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
8765 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
8766 fn drop(&mut self) {
8768 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8769 let _ = unsafe { Box::from_raw(self.contents.result) };
8772 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8773 let _ = unsafe { Box::from_raw(self.contents.err) };
8778 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
8779 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
8780 let contents = if o.result_ok {
8781 let result = unsafe { o.contents.result };
8782 unsafe { o.contents.result = core::ptr::null_mut() };
8783 CResult_ChannelDetailsDecodeErrorZPtr { result }
8785 let err = unsafe { o.contents.err };
8786 unsafe { o.contents.err = core::ptr::null_mut(); }
8787 CResult_ChannelDetailsDecodeErrorZPtr { err }
8791 result_ok: o.result_ok,
8795 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
8796 fn clone(&self) -> Self {
8798 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
8799 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
8802 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
8803 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8809 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
8810 /// but with all dynamically-allocated buffers duplicated in new buffers.
8811 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
8813 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
8814 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
8815 /// A pointer to the contents in the success state.
8816 /// Reading from this pointer when `result_ok` is not set is undefined.
8817 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
8818 /// A pointer to the contents in the error state.
8819 /// Reading from this pointer when `result_ok` is set is undefined.
8820 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8823 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
8824 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
8825 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8826 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
8827 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
8828 /// `err` or `result` depending on the state of `result_ok`.
8829 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
8830 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
8831 pub result_ok: bool,
8834 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
8835 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
8836 CResult_PhantomRouteHintsDecodeErrorZ {
8837 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8838 result: Box::into_raw(Box::new(o)),
8844 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
8845 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
8846 CResult_PhantomRouteHintsDecodeErrorZ {
8847 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8848 err: Box::into_raw(Box::new(e)),
8853 /// Checks if the given object is currently in the success state
8855 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
8859 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
8860 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
8861 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
8862 fn drop(&mut self) {
8864 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8865 let _ = unsafe { Box::from_raw(self.contents.result) };
8868 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8869 let _ = unsafe { Box::from_raw(self.contents.err) };
8874 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
8875 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
8876 let contents = if o.result_ok {
8877 let result = unsafe { o.contents.result };
8878 unsafe { o.contents.result = core::ptr::null_mut() };
8879 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
8881 let err = unsafe { o.contents.err };
8882 unsafe { o.contents.err = core::ptr::null_mut(); }
8883 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
8887 result_ok: o.result_ok,
8891 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
8892 fn clone(&self) -> Self {
8894 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8895 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
8898 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8899 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8905 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
8906 /// but with all dynamically-allocated buffers duplicated in new buffers.
8907 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
8909 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
8910 /// This corresponds to std::vector in C++
8911 pub struct CVec_ChannelMonitorZ {
8912 /// The elements in the array.
8913 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8914 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
8915 /// The number of elements pointed to by `data`.
8918 impl CVec_ChannelMonitorZ {
8919 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
8920 if self.datalen == 0 { return Vec::new(); }
8921 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8922 self.data = core::ptr::null_mut();
8926 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
8927 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8930 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
8931 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
8932 let datalen = v.len();
8933 let data = Box::into_raw(v.into_boxed_slice());
8934 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8938 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8939 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
8940 impl Drop for CVec_ChannelMonitorZ {
8941 fn drop(&mut self) {
8942 if self.datalen == 0 { return; }
8943 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8947 /// A tuple of 2 elements. See the individual fields for the types contained.
8948 pub struct C2Tuple_BlockHashChannelManagerZ {
8949 /// The element at position 0
8950 pub a: crate::c_types::ThirtyTwoBytes,
8951 /// The element at position 1
8952 pub b: crate::lightning::ln::channelmanager::ChannelManager,
8954 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
8955 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
8962 impl C2Tuple_BlockHashChannelManagerZ {
8963 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
8967 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
8969 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
8970 C2Tuple_BlockHashChannelManagerZ { a, b, }
8974 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
8975 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
8977 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
8978 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8979 /// A pointer to the contents in the success state.
8980 /// Reading from this pointer when `result_ok` is not set is undefined.
8981 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
8982 /// A pointer to the contents in the error state.
8983 /// Reading from this pointer when `result_ok` is set is undefined.
8984 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8987 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
8988 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8990 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8991 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
8992 /// `err` or `result` depending on the state of `result_ok`.
8993 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
8994 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
8995 pub result_ok: bool,
8998 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
8999 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9000 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9001 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9002 result: Box::into_raw(Box::new(o)),
9008 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9009 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9010 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9011 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9012 err: Box::into_raw(Box::new(e)),
9017 /// Checks if the given object is currently in the success state
9019 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9023 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9024 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9025 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9026 fn drop(&mut self) {
9028 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9029 let _ = unsafe { Box::from_raw(self.contents.result) };
9032 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9033 let _ = unsafe { Box::from_raw(self.contents.err) };
9038 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9039 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9040 let contents = if o.result_ok {
9041 let result = unsafe { o.contents.result };
9042 unsafe { o.contents.result = core::ptr::null_mut() };
9043 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9045 let err = unsafe { o.contents.err };
9046 unsafe { o.contents.err = core::ptr::null_mut(); }
9047 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9051 result_ok: o.result_ok,
9056 /// The contents of CResult_ChannelConfigDecodeErrorZ
9057 pub union CResult_ChannelConfigDecodeErrorZPtr {
9058 /// A pointer to the contents in the success state.
9059 /// Reading from this pointer when `result_ok` is not set is undefined.
9060 pub result: *mut crate::lightning::util::config::ChannelConfig,
9061 /// A pointer to the contents in the error state.
9062 /// Reading from this pointer when `result_ok` is set is undefined.
9063 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9066 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9067 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9069 pub struct CResult_ChannelConfigDecodeErrorZ {
9070 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9071 /// `err` or `result` depending on the state of `result_ok`.
9072 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9073 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9074 pub result_ok: bool,
9077 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9078 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9079 CResult_ChannelConfigDecodeErrorZ {
9080 contents: CResult_ChannelConfigDecodeErrorZPtr {
9081 result: Box::into_raw(Box::new(o)),
9087 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9088 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9089 CResult_ChannelConfigDecodeErrorZ {
9090 contents: CResult_ChannelConfigDecodeErrorZPtr {
9091 err: Box::into_raw(Box::new(e)),
9096 /// Checks if the given object is currently in the success state
9098 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9102 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9103 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9104 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9105 fn drop(&mut self) {
9107 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9108 let _ = unsafe { Box::from_raw(self.contents.result) };
9111 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9112 let _ = unsafe { Box::from_raw(self.contents.err) };
9117 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9118 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9119 let contents = if o.result_ok {
9120 let result = unsafe { o.contents.result };
9121 unsafe { o.contents.result = core::ptr::null_mut() };
9122 CResult_ChannelConfigDecodeErrorZPtr { result }
9124 let err = unsafe { o.contents.err };
9125 unsafe { o.contents.err = core::ptr::null_mut(); }
9126 CResult_ChannelConfigDecodeErrorZPtr { err }
9130 result_ok: o.result_ok,
9134 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9135 fn clone(&self) -> Self {
9137 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9138 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9141 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9142 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9148 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9149 /// but with all dynamically-allocated buffers duplicated in new buffers.
9150 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9152 /// The contents of CResult_OutPointDecodeErrorZ
9153 pub union CResult_OutPointDecodeErrorZPtr {
9154 /// A pointer to the contents in the success state.
9155 /// Reading from this pointer when `result_ok` is not set is undefined.
9156 pub result: *mut crate::lightning::chain::transaction::OutPoint,
9157 /// A pointer to the contents in the error state.
9158 /// Reading from this pointer when `result_ok` is set is undefined.
9159 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9162 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9163 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9164 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9165 pub struct CResult_OutPointDecodeErrorZ {
9166 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9167 /// `err` or `result` depending on the state of `result_ok`.
9168 pub contents: CResult_OutPointDecodeErrorZPtr,
9169 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9170 pub result_ok: bool,
9173 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9174 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9175 CResult_OutPointDecodeErrorZ {
9176 contents: CResult_OutPointDecodeErrorZPtr {
9177 result: Box::into_raw(Box::new(o)),
9183 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9184 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9185 CResult_OutPointDecodeErrorZ {
9186 contents: CResult_OutPointDecodeErrorZPtr {
9187 err: Box::into_raw(Box::new(e)),
9192 /// Checks if the given object is currently in the success state
9194 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
9198 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
9199 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
9200 impl Drop for CResult_OutPointDecodeErrorZ {
9201 fn drop(&mut self) {
9203 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9204 let _ = unsafe { Box::from_raw(self.contents.result) };
9207 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9208 let _ = unsafe { Box::from_raw(self.contents.err) };
9213 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
9214 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
9215 let contents = if o.result_ok {
9216 let result = unsafe { o.contents.result };
9217 unsafe { o.contents.result = core::ptr::null_mut() };
9218 CResult_OutPointDecodeErrorZPtr { result }
9220 let err = unsafe { o.contents.err };
9221 unsafe { o.contents.err = core::ptr::null_mut(); }
9222 CResult_OutPointDecodeErrorZPtr { err }
9226 result_ok: o.result_ok,
9230 impl Clone for CResult_OutPointDecodeErrorZ {
9231 fn clone(&self) -> Self {
9233 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
9234 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
9237 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
9238 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9244 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9245 /// but with all dynamically-allocated buffers duplicated in new buffers.
9246 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
9248 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
9249 pub enum COption_TypeZ {
9250 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9251 Some(crate::lightning::ln::wire::Type),
9252 /// When we're in this state, this COption_TypeZ contains nothing
9255 impl COption_TypeZ {
9256 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9257 if let Self::None = self { false } else { true }
9259 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9262 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
9263 if let Self::Some(v) = self { v } else { unreachable!() }
9267 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
9268 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
9269 COption_TypeZ::Some(o)
9272 /// Constructs a new COption_TypeZ containing nothing
9273 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
9277 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
9278 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
9280 /// The contents of CResult_COption_TypeZDecodeErrorZ
9281 pub union CResult_COption_TypeZDecodeErrorZPtr {
9282 /// A pointer to the contents in the success state.
9283 /// Reading from this pointer when `result_ok` is not set is undefined.
9284 pub result: *mut crate::c_types::derived::COption_TypeZ,
9285 /// A pointer to the contents in the error state.
9286 /// Reading from this pointer when `result_ok` is set is undefined.
9287 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9290 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9291 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9292 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9293 pub struct CResult_COption_TypeZDecodeErrorZ {
9294 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9295 /// `err` or `result` depending on the state of `result_ok`.
9296 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
9297 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9298 pub result_ok: bool,
9301 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
9302 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
9303 CResult_COption_TypeZDecodeErrorZ {
9304 contents: CResult_COption_TypeZDecodeErrorZPtr {
9305 result: Box::into_raw(Box::new(o)),
9311 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
9312 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
9313 CResult_COption_TypeZDecodeErrorZ {
9314 contents: CResult_COption_TypeZDecodeErrorZPtr {
9315 err: Box::into_raw(Box::new(e)),
9320 /// Checks if the given object is currently in the success state
9322 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
9326 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
9327 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
9328 impl Drop for CResult_COption_TypeZDecodeErrorZ {
9329 fn drop(&mut self) {
9331 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9332 let _ = unsafe { Box::from_raw(self.contents.result) };
9335 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9336 let _ = unsafe { Box::from_raw(self.contents.err) };
9341 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
9342 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9343 let contents = if o.result_ok {
9344 let result = unsafe { o.contents.result };
9345 unsafe { o.contents.result = core::ptr::null_mut() };
9346 CResult_COption_TypeZDecodeErrorZPtr { result }
9348 let err = unsafe { o.contents.err };
9349 unsafe { o.contents.err = core::ptr::null_mut(); }
9350 CResult_COption_TypeZDecodeErrorZPtr { err }
9354 result_ok: o.result_ok,
9359 /// The contents of CResult_PaymentIdPaymentErrorZ
9360 pub union CResult_PaymentIdPaymentErrorZPtr {
9361 /// A pointer to the contents in the success state.
9362 /// Reading from this pointer when `result_ok` is not set is undefined.
9363 pub result: *mut crate::c_types::ThirtyTwoBytes,
9364 /// A pointer to the contents in the error state.
9365 /// Reading from this pointer when `result_ok` is set is undefined.
9366 pub err: *mut crate::lightning_invoice::payment::PaymentError,
9369 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
9370 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
9371 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9372 pub struct CResult_PaymentIdPaymentErrorZ {
9373 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
9374 /// `err` or `result` depending on the state of `result_ok`.
9375 pub contents: CResult_PaymentIdPaymentErrorZPtr,
9376 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
9377 pub result_ok: bool,
9380 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
9381 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
9382 CResult_PaymentIdPaymentErrorZ {
9383 contents: CResult_PaymentIdPaymentErrorZPtr {
9384 result: Box::into_raw(Box::new(o)),
9390 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
9391 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
9392 CResult_PaymentIdPaymentErrorZ {
9393 contents: CResult_PaymentIdPaymentErrorZPtr {
9394 err: Box::into_raw(Box::new(e)),
9399 /// Checks if the given object is currently in the success state
9401 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
9405 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
9406 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
9407 impl Drop for CResult_PaymentIdPaymentErrorZ {
9408 fn drop(&mut self) {
9410 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9411 let _ = unsafe { Box::from_raw(self.contents.result) };
9414 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9415 let _ = unsafe { Box::from_raw(self.contents.err) };
9420 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
9421 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
9422 let contents = if o.result_ok {
9423 let result = unsafe { o.contents.result };
9424 unsafe { o.contents.result = core::ptr::null_mut() };
9425 CResult_PaymentIdPaymentErrorZPtr { result }
9427 let err = unsafe { o.contents.err };
9428 unsafe { o.contents.err = core::ptr::null_mut(); }
9429 CResult_PaymentIdPaymentErrorZPtr { err }
9433 result_ok: o.result_ok,
9437 impl Clone for CResult_PaymentIdPaymentErrorZ {
9438 fn clone(&self) -> Self {
9440 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
9441 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9444 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
9445 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
9451 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
9452 /// but with all dynamically-allocated buffers duplicated in new buffers.
9453 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
9455 /// The contents of CResult_SiPrefixParseErrorZ
9456 pub union CResult_SiPrefixParseErrorZPtr {
9457 /// A pointer to the contents in the success state.
9458 /// Reading from this pointer when `result_ok` is not set is undefined.
9459 pub result: *mut crate::lightning_invoice::SiPrefix,
9460 /// A pointer to the contents in the error state.
9461 /// Reading from this pointer when `result_ok` is set is undefined.
9462 pub err: *mut crate::lightning_invoice::ParseError,
9465 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
9466 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
9467 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9468 pub struct CResult_SiPrefixParseErrorZ {
9469 /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
9470 /// `err` or `result` depending on the state of `result_ok`.
9471 pub contents: CResult_SiPrefixParseErrorZPtr,
9472 /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
9473 pub result_ok: bool,
9476 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
9477 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
9478 CResult_SiPrefixParseErrorZ {
9479 contents: CResult_SiPrefixParseErrorZPtr {
9480 result: Box::into_raw(Box::new(o)),
9486 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
9487 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
9488 CResult_SiPrefixParseErrorZ {
9489 contents: CResult_SiPrefixParseErrorZPtr {
9490 err: Box::into_raw(Box::new(e)),
9495 /// Checks if the given object is currently in the success state
9497 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
9501 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
9502 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
9503 impl Drop for CResult_SiPrefixParseErrorZ {
9504 fn drop(&mut self) {
9506 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9507 let _ = unsafe { Box::from_raw(self.contents.result) };
9510 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9511 let _ = unsafe { Box::from_raw(self.contents.err) };
9516 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
9517 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
9518 let contents = if o.result_ok {
9519 let result = unsafe { o.contents.result };
9520 unsafe { o.contents.result = core::ptr::null_mut() };
9521 CResult_SiPrefixParseErrorZPtr { result }
9523 let err = unsafe { o.contents.err };
9524 unsafe { o.contents.err = core::ptr::null_mut(); }
9525 CResult_SiPrefixParseErrorZPtr { err }
9529 result_ok: o.result_ok,
9533 impl Clone for CResult_SiPrefixParseErrorZ {
9534 fn clone(&self) -> Self {
9536 Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
9537 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
9540 Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
9541 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9547 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
9548 /// but with all dynamically-allocated buffers duplicated in new buffers.
9549 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
9551 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
9552 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
9553 /// A pointer to the contents in the success state.
9554 /// Reading from this pointer when `result_ok` is not set is undefined.
9555 pub result: *mut crate::lightning_invoice::Invoice,
9556 /// A pointer to the contents in the error state.
9557 /// Reading from this pointer when `result_ok` is set is undefined.
9558 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
9561 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
9562 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
9563 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9564 pub struct CResult_InvoiceParseOrSemanticErrorZ {
9565 /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
9566 /// `err` or `result` depending on the state of `result_ok`.
9567 pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
9568 /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
9569 pub result_ok: bool,
9572 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
9573 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
9574 CResult_InvoiceParseOrSemanticErrorZ {
9575 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9576 result: Box::into_raw(Box::new(o)),
9582 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
9583 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
9584 CResult_InvoiceParseOrSemanticErrorZ {
9585 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9586 err: Box::into_raw(Box::new(e)),
9591 /// Checks if the given object is currently in the success state
9593 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
9597 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
9598 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
9599 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
9600 fn drop(&mut self) {
9602 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9603 let _ = unsafe { Box::from_raw(self.contents.result) };
9606 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9607 let _ = unsafe { Box::from_raw(self.contents.err) };
9612 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
9613 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
9614 let contents = if o.result_ok {
9615 let result = unsafe { o.contents.result };
9616 unsafe { o.contents.result = core::ptr::null_mut() };
9617 CResult_InvoiceParseOrSemanticErrorZPtr { result }
9619 let err = unsafe { o.contents.err };
9620 unsafe { o.contents.err = core::ptr::null_mut(); }
9621 CResult_InvoiceParseOrSemanticErrorZPtr { err }
9625 result_ok: o.result_ok,
9629 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
9630 fn clone(&self) -> Self {
9632 Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9633 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
9636 Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9637 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
9643 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
9644 /// but with all dynamically-allocated buffers duplicated in new buffers.
9645 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
9647 /// The contents of CResult_SignedRawInvoiceParseErrorZ
9648 pub union CResult_SignedRawInvoiceParseErrorZPtr {
9649 /// A pointer to the contents in the success state.
9650 /// Reading from this pointer when `result_ok` is not set is undefined.
9651 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
9652 /// A pointer to the contents in the error state.
9653 /// Reading from this pointer when `result_ok` is set is undefined.
9654 pub err: *mut crate::lightning_invoice::ParseError,
9657 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
9658 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
9659 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9660 pub struct CResult_SignedRawInvoiceParseErrorZ {
9661 /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
9662 /// `err` or `result` depending on the state of `result_ok`.
9663 pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
9664 /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
9665 pub result_ok: bool,
9668 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
9669 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
9670 CResult_SignedRawInvoiceParseErrorZ {
9671 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9672 result: Box::into_raw(Box::new(o)),
9678 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
9679 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
9680 CResult_SignedRawInvoiceParseErrorZ {
9681 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9682 err: Box::into_raw(Box::new(e)),
9687 /// Checks if the given object is currently in the success state
9689 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
9693 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
9694 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
9695 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
9696 fn drop(&mut self) {
9698 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9699 let _ = unsafe { Box::from_raw(self.contents.result) };
9702 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9703 let _ = unsafe { Box::from_raw(self.contents.err) };
9708 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
9709 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
9710 let contents = if o.result_ok {
9711 let result = unsafe { o.contents.result };
9712 unsafe { o.contents.result = core::ptr::null_mut() };
9713 CResult_SignedRawInvoiceParseErrorZPtr { result }
9715 let err = unsafe { o.contents.err };
9716 unsafe { o.contents.err = core::ptr::null_mut(); }
9717 CResult_SignedRawInvoiceParseErrorZPtr { err }
9721 result_ok: o.result_ok,
9725 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
9726 fn clone(&self) -> Self {
9728 Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9729 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
9732 Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9733 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9739 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
9740 /// but with all dynamically-allocated buffers duplicated in new buffers.
9741 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
9743 /// A tuple of 3 elements. See the individual fields for the types contained.
9744 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9745 /// The element at position 0
9746 pub a: crate::lightning_invoice::RawInvoice,
9747 /// The element at position 1
9748 pub b: crate::c_types::ThirtyTwoBytes,
9749 /// The element at position 2
9750 pub c: crate::lightning_invoice::InvoiceSignature,
9752 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9753 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
9761 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9762 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
9763 (self.a, self.b, self.c)
9766 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9767 fn clone(&self) -> Self {
9769 a: Clone::clone(&self.a),
9770 b: Clone::clone(&self.b),
9771 c: Clone::clone(&self.c),
9776 /// Creates a new tuple which has the same data as `orig`
9777 /// but with all dynamically-allocated buffers duplicated in new buffers.
9778 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
9779 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
9781 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 {
9782 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
9786 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
9787 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
9789 /// The contents of CResult_PayeePubKeyErrorZ
9790 pub union CResult_PayeePubKeyErrorZPtr {
9791 /// A pointer to the contents in the success state.
9792 /// Reading from this pointer when `result_ok` is not set is undefined.
9793 pub result: *mut crate::lightning_invoice::PayeePubKey,
9794 /// A pointer to the contents in the error state.
9795 /// Reading from this pointer when `result_ok` is set is undefined.
9796 pub err: *mut crate::c_types::Secp256k1Error,
9799 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
9800 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
9801 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9802 pub struct CResult_PayeePubKeyErrorZ {
9803 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
9804 /// `err` or `result` depending on the state of `result_ok`.
9805 pub contents: CResult_PayeePubKeyErrorZPtr,
9806 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
9807 pub result_ok: bool,
9810 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
9811 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
9812 CResult_PayeePubKeyErrorZ {
9813 contents: CResult_PayeePubKeyErrorZPtr {
9814 result: Box::into_raw(Box::new(o)),
9820 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
9821 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
9822 CResult_PayeePubKeyErrorZ {
9823 contents: CResult_PayeePubKeyErrorZPtr {
9824 err: Box::into_raw(Box::new(e)),
9829 /// Checks if the given object is currently in the success state
9831 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
9835 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
9836 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
9837 impl Drop for CResult_PayeePubKeyErrorZ {
9838 fn drop(&mut self) {
9840 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9841 let _ = unsafe { Box::from_raw(self.contents.result) };
9844 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9845 let _ = unsafe { Box::from_raw(self.contents.err) };
9850 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
9851 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
9852 let contents = if o.result_ok {
9853 let result = unsafe { o.contents.result };
9854 unsafe { o.contents.result = core::ptr::null_mut() };
9855 CResult_PayeePubKeyErrorZPtr { result }
9857 let err = unsafe { o.contents.err };
9858 unsafe { o.contents.err = core::ptr::null_mut(); }
9859 CResult_PayeePubKeyErrorZPtr { err }
9863 result_ok: o.result_ok,
9867 impl Clone for CResult_PayeePubKeyErrorZ {
9868 fn clone(&self) -> Self {
9870 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
9871 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
9874 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
9875 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
9881 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
9882 /// but with all dynamically-allocated buffers duplicated in new buffers.
9883 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
9885 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
9886 /// This corresponds to std::vector in C++
9887 pub struct CVec_PrivateRouteZ {
9888 /// The elements in the array.
9889 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9890 pub data: *mut crate::lightning_invoice::PrivateRoute,
9891 /// The number of elements pointed to by `data`.
9894 impl CVec_PrivateRouteZ {
9895 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
9896 if self.datalen == 0 { return Vec::new(); }
9897 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9898 self.data = core::ptr::null_mut();
9902 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
9903 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9906 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
9907 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
9908 let datalen = v.len();
9909 let data = Box::into_raw(v.into_boxed_slice());
9910 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9914 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9915 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
9916 impl Drop for CVec_PrivateRouteZ {
9917 fn drop(&mut self) {
9918 if self.datalen == 0 { return; }
9919 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9922 impl Clone for CVec_PrivateRouteZ {
9923 fn clone(&self) -> Self {
9924 let mut res = Vec::new();
9925 if self.datalen == 0 { return Self::from(res); }
9926 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9931 /// The contents of CResult_PositiveTimestampCreationErrorZ
9932 pub union CResult_PositiveTimestampCreationErrorZPtr {
9933 /// A pointer to the contents in the success state.
9934 /// Reading from this pointer when `result_ok` is not set is undefined.
9935 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
9936 /// A pointer to the contents in the error state.
9937 /// Reading from this pointer when `result_ok` is set is undefined.
9938 pub err: *mut crate::lightning_invoice::CreationError,
9941 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
9942 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
9943 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9944 pub struct CResult_PositiveTimestampCreationErrorZ {
9945 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
9946 /// `err` or `result` depending on the state of `result_ok`.
9947 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
9948 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
9949 pub result_ok: bool,
9952 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
9953 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
9954 CResult_PositiveTimestampCreationErrorZ {
9955 contents: CResult_PositiveTimestampCreationErrorZPtr {
9956 result: Box::into_raw(Box::new(o)),
9962 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
9963 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
9964 CResult_PositiveTimestampCreationErrorZ {
9965 contents: CResult_PositiveTimestampCreationErrorZPtr {
9966 err: Box::into_raw(Box::new(e)),
9971 /// Checks if the given object is currently in the success state
9973 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
9977 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
9978 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
9979 impl Drop for CResult_PositiveTimestampCreationErrorZ {
9980 fn drop(&mut self) {
9982 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9983 let _ = unsafe { Box::from_raw(self.contents.result) };
9986 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9987 let _ = unsafe { Box::from_raw(self.contents.err) };
9992 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
9993 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
9994 let contents = if o.result_ok {
9995 let result = unsafe { o.contents.result };
9996 unsafe { o.contents.result = core::ptr::null_mut() };
9997 CResult_PositiveTimestampCreationErrorZPtr { result }
9999 let err = unsafe { o.contents.err };
10000 unsafe { o.contents.err = core::ptr::null_mut(); }
10001 CResult_PositiveTimestampCreationErrorZPtr { err }
10005 result_ok: o.result_ok,
10009 impl Clone for CResult_PositiveTimestampCreationErrorZ {
10010 fn clone(&self) -> Self {
10011 if self.result_ok {
10012 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
10013 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
10016 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
10017 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10023 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10024 /// but with all dynamically-allocated buffers duplicated in new buffers.
10025 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
10027 /// The contents of CResult_NoneSemanticErrorZ
10028 pub union CResult_NoneSemanticErrorZPtr {
10029 /// Note that this value is always NULL, as there are no contents in the OK variant
10030 pub result: *mut core::ffi::c_void,
10031 /// A pointer to the contents in the error state.
10032 /// Reading from this pointer when `result_ok` is set is undefined.
10033 pub err: *mut crate::lightning_invoice::SemanticError,
10036 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10037 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10038 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10039 pub struct CResult_NoneSemanticErrorZ {
10040 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
10041 /// `err` or `result` depending on the state of `result_ok`.
10042 pub contents: CResult_NoneSemanticErrorZPtr,
10043 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
10044 pub result_ok: bool,
10047 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
10048 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
10049 CResult_NoneSemanticErrorZ {
10050 contents: CResult_NoneSemanticErrorZPtr {
10051 result: core::ptr::null_mut(),
10057 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
10058 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
10059 CResult_NoneSemanticErrorZ {
10060 contents: CResult_NoneSemanticErrorZPtr {
10061 err: Box::into_raw(Box::new(e)),
10066 /// Checks if the given object is currently in the success state
10068 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
10072 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
10073 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
10074 impl Drop for CResult_NoneSemanticErrorZ {
10075 fn drop(&mut self) {
10076 if self.result_ok {
10078 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10079 let _ = unsafe { Box::from_raw(self.contents.err) };
10084 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
10085 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
10086 let contents = if o.result_ok {
10087 let _ = unsafe { Box::from_raw(o.contents.result) };
10088 o.contents.result = core::ptr::null_mut();
10089 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
10091 let err = unsafe { o.contents.err };
10092 unsafe { o.contents.err = core::ptr::null_mut(); }
10093 CResult_NoneSemanticErrorZPtr { err }
10097 result_ok: o.result_ok,
10101 impl Clone for CResult_NoneSemanticErrorZ {
10102 fn clone(&self) -> Self {
10103 if self.result_ok {
10104 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
10105 result: core::ptr::null_mut()
10108 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
10109 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10115 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10116 /// but with all dynamically-allocated buffers duplicated in new buffers.
10117 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
10119 /// The contents of CResult_InvoiceSemanticErrorZ
10120 pub union CResult_InvoiceSemanticErrorZPtr {
10121 /// A pointer to the contents in the success state.
10122 /// Reading from this pointer when `result_ok` is not set is undefined.
10123 pub result: *mut crate::lightning_invoice::Invoice,
10124 /// A pointer to the contents in the error state.
10125 /// Reading from this pointer when `result_ok` is set is undefined.
10126 pub err: *mut crate::lightning_invoice::SemanticError,
10129 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10130 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10132 pub struct CResult_InvoiceSemanticErrorZ {
10133 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10134 /// `err` or `result` depending on the state of `result_ok`.
10135 pub contents: CResult_InvoiceSemanticErrorZPtr,
10136 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10137 pub result_ok: bool,
10140 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10141 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
10142 CResult_InvoiceSemanticErrorZ {
10143 contents: CResult_InvoiceSemanticErrorZPtr {
10144 result: Box::into_raw(Box::new(o)),
10150 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10151 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
10152 CResult_InvoiceSemanticErrorZ {
10153 contents: CResult_InvoiceSemanticErrorZPtr {
10154 err: Box::into_raw(Box::new(e)),
10159 /// Checks if the given object is currently in the success state
10161 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
10165 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10166 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
10167 impl Drop for CResult_InvoiceSemanticErrorZ {
10168 fn drop(&mut self) {
10169 if self.result_ok {
10170 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10171 let _ = unsafe { Box::from_raw(self.contents.result) };
10174 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10175 let _ = unsafe { Box::from_raw(self.contents.err) };
10180 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
10181 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
10182 let contents = if o.result_ok {
10183 let result = unsafe { o.contents.result };
10184 unsafe { o.contents.result = core::ptr::null_mut() };
10185 CResult_InvoiceSemanticErrorZPtr { result }
10187 let err = unsafe { o.contents.err };
10188 unsafe { o.contents.err = core::ptr::null_mut(); }
10189 CResult_InvoiceSemanticErrorZPtr { err }
10193 result_ok: o.result_ok,
10197 impl Clone for CResult_InvoiceSemanticErrorZ {
10198 fn clone(&self) -> Self {
10199 if self.result_ok {
10200 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
10201 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10204 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
10205 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10211 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10212 /// but with all dynamically-allocated buffers duplicated in new buffers.
10213 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
10215 /// The contents of CResult_DescriptionCreationErrorZ
10216 pub union CResult_DescriptionCreationErrorZPtr {
10217 /// A pointer to the contents in the success state.
10218 /// Reading from this pointer when `result_ok` is not set is undefined.
10219 pub result: *mut crate::lightning_invoice::Description,
10220 /// A pointer to the contents in the error state.
10221 /// Reading from this pointer when `result_ok` is set is undefined.
10222 pub err: *mut crate::lightning_invoice::CreationError,
10225 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10226 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10228 pub struct CResult_DescriptionCreationErrorZ {
10229 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10230 /// `err` or `result` depending on the state of `result_ok`.
10231 pub contents: CResult_DescriptionCreationErrorZPtr,
10232 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
10233 pub result_ok: bool,
10236 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
10237 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
10238 CResult_DescriptionCreationErrorZ {
10239 contents: CResult_DescriptionCreationErrorZPtr {
10240 result: Box::into_raw(Box::new(o)),
10246 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
10247 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
10248 CResult_DescriptionCreationErrorZ {
10249 contents: CResult_DescriptionCreationErrorZPtr {
10250 err: Box::into_raw(Box::new(e)),
10255 /// Checks if the given object is currently in the success state
10257 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
10261 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
10262 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
10263 impl Drop for CResult_DescriptionCreationErrorZ {
10264 fn drop(&mut self) {
10265 if self.result_ok {
10266 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10267 let _ = unsafe { Box::from_raw(self.contents.result) };
10270 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10271 let _ = unsafe { Box::from_raw(self.contents.err) };
10276 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
10277 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
10278 let contents = if o.result_ok {
10279 let result = unsafe { o.contents.result };
10280 unsafe { o.contents.result = core::ptr::null_mut() };
10281 CResult_DescriptionCreationErrorZPtr { result }
10283 let err = unsafe { o.contents.err };
10284 unsafe { o.contents.err = core::ptr::null_mut(); }
10285 CResult_DescriptionCreationErrorZPtr { err }
10289 result_ok: o.result_ok,
10293 impl Clone for CResult_DescriptionCreationErrorZ {
10294 fn clone(&self) -> Self {
10295 if self.result_ok {
10296 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
10297 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
10300 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
10301 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10307 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10308 /// but with all dynamically-allocated buffers duplicated in new buffers.
10309 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
10311 /// The contents of CResult_PrivateRouteCreationErrorZ
10312 pub union CResult_PrivateRouteCreationErrorZPtr {
10313 /// A pointer to the contents in the success state.
10314 /// Reading from this pointer when `result_ok` is not set is undefined.
10315 pub result: *mut crate::lightning_invoice::PrivateRoute,
10316 /// A pointer to the contents in the error state.
10317 /// Reading from this pointer when `result_ok` is set is undefined.
10318 pub err: *mut crate::lightning_invoice::CreationError,
10321 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
10322 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
10323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10324 pub struct CResult_PrivateRouteCreationErrorZ {
10325 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
10326 /// `err` or `result` depending on the state of `result_ok`.
10327 pub contents: CResult_PrivateRouteCreationErrorZPtr,
10328 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
10329 pub result_ok: bool,
10332 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10333 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
10334 CResult_PrivateRouteCreationErrorZ {
10335 contents: CResult_PrivateRouteCreationErrorZPtr {
10336 result: Box::into_raw(Box::new(o)),
10342 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10343 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
10344 CResult_PrivateRouteCreationErrorZ {
10345 contents: CResult_PrivateRouteCreationErrorZPtr {
10346 err: Box::into_raw(Box::new(e)),
10351 /// Checks if the given object is currently in the success state
10353 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
10357 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10358 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
10359 impl Drop for CResult_PrivateRouteCreationErrorZ {
10360 fn drop(&mut self) {
10361 if self.result_ok {
10362 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10363 let _ = unsafe { Box::from_raw(self.contents.result) };
10366 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10367 let _ = unsafe { Box::from_raw(self.contents.err) };
10372 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
10373 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
10374 let contents = if o.result_ok {
10375 let result = unsafe { o.contents.result };
10376 unsafe { o.contents.result = core::ptr::null_mut() };
10377 CResult_PrivateRouteCreationErrorZPtr { result }
10379 let err = unsafe { o.contents.err };
10380 unsafe { o.contents.err = core::ptr::null_mut(); }
10381 CResult_PrivateRouteCreationErrorZPtr { err }
10385 result_ok: o.result_ok,
10389 impl Clone for CResult_PrivateRouteCreationErrorZ {
10390 fn clone(&self) -> Self {
10391 if self.result_ok {
10392 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
10393 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
10396 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
10397 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10403 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10404 /// but with all dynamically-allocated buffers duplicated in new buffers.
10405 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
10407 /// The contents of CResult_StringErrorZ
10408 pub union CResult_StringErrorZPtr {
10409 /// A pointer to the contents in the success state.
10410 /// Reading from this pointer when `result_ok` is not set is undefined.
10411 pub result: *mut crate::c_types::Str,
10412 /// A pointer to the contents in the error state.
10413 /// Reading from this pointer when `result_ok` is set is undefined.
10414 pub err: *mut crate::c_types::Secp256k1Error,
10417 /// A CResult_StringErrorZ represents the result of a fallible operation,
10418 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10419 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10420 pub struct CResult_StringErrorZ {
10421 /// The contents of this CResult_StringErrorZ, accessible via either
10422 /// `err` or `result` depending on the state of `result_ok`.
10423 pub contents: CResult_StringErrorZPtr,
10424 /// Whether this CResult_StringErrorZ represents a success state.
10425 pub result_ok: bool,
10428 /// Creates a new CResult_StringErrorZ in the success state.
10429 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10430 CResult_StringErrorZ {
10431 contents: CResult_StringErrorZPtr {
10432 result: Box::into_raw(Box::new(o)),
10438 /// Creates a new CResult_StringErrorZ in the error state.
10439 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10440 CResult_StringErrorZ {
10441 contents: CResult_StringErrorZPtr {
10442 err: Box::into_raw(Box::new(e)),
10447 /// Checks if the given object is currently in the success state
10449 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10453 /// Frees any resources used by the CResult_StringErrorZ.
10454 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10455 impl Drop for CResult_StringErrorZ {
10456 fn drop(&mut self) {
10457 if self.result_ok {
10458 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10459 let _ = unsafe { Box::from_raw(self.contents.result) };
10462 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10463 let _ = unsafe { Box::from_raw(self.contents.err) };
10468 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10469 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10470 let contents = if o.result_ok {
10471 let result = unsafe { o.contents.result };
10472 unsafe { o.contents.result = core::ptr::null_mut() };
10473 CResult_StringErrorZPtr { result }
10475 let err = unsafe { o.contents.err };
10476 unsafe { o.contents.err = core::ptr::null_mut(); }
10477 CResult_StringErrorZPtr { err }
10481 result_ok: o.result_ok,
10485 impl Clone for CResult_StringErrorZ {
10486 fn clone(&self) -> Self {
10487 if self.result_ok {
10488 Self { result_ok: true, contents: CResult_StringErrorZPtr {
10489 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10492 Self { result_ok: false, contents: CResult_StringErrorZPtr {
10493 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10499 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10500 /// but with all dynamically-allocated buffers duplicated in new buffers.
10501 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10503 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10504 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10505 /// A pointer to the contents in the success state.
10506 /// Reading from this pointer when `result_ok` is not set is undefined.
10507 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10508 /// A pointer to the contents in the error state.
10509 /// Reading from this pointer when `result_ok` is set is undefined.
10510 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10513 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10514 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10515 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10516 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10517 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10518 /// `err` or `result` depending on the state of `result_ok`.
10519 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10520 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10521 pub result_ok: bool,
10524 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10525 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10526 CResult_ChannelMonitorUpdateDecodeErrorZ {
10527 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10528 result: Box::into_raw(Box::new(o)),
10534 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10535 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10536 CResult_ChannelMonitorUpdateDecodeErrorZ {
10537 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10538 err: Box::into_raw(Box::new(e)),
10543 /// Checks if the given object is currently in the success state
10545 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10549 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10550 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10551 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10552 fn drop(&mut self) {
10553 if self.result_ok {
10554 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10555 let _ = unsafe { Box::from_raw(self.contents.result) };
10558 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10559 let _ = unsafe { Box::from_raw(self.contents.err) };
10564 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10565 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10566 let contents = if o.result_ok {
10567 let result = unsafe { o.contents.result };
10568 unsafe { o.contents.result = core::ptr::null_mut() };
10569 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10571 let err = unsafe { o.contents.err };
10572 unsafe { o.contents.err = core::ptr::null_mut(); }
10573 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10577 result_ok: o.result_ok,
10581 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10582 fn clone(&self) -> Self {
10583 if self.result_ok {
10584 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10585 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10588 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10589 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10595 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10596 /// but with all dynamically-allocated buffers duplicated in new buffers.
10597 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10600 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10601 pub enum COption_MonitorEventZ {
10602 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10603 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10604 /// When we're in this state, this COption_MonitorEventZ contains nothing
10607 impl COption_MonitorEventZ {
10608 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10609 if let Self::None = self { false } else { true }
10611 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10614 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10615 if let Self::Some(v) = self { v } else { unreachable!() }
10619 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10620 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10621 COption_MonitorEventZ::Some(o)
10624 /// Constructs a new COption_MonitorEventZ containing nothing
10625 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10626 COption_MonitorEventZ::None
10629 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10630 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10632 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10633 /// but with all dynamically-allocated buffers duplicated in new buffers.
10634 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10636 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10637 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10638 /// A pointer to the contents in the success state.
10639 /// Reading from this pointer when `result_ok` is not set is undefined.
10640 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10641 /// A pointer to the contents in the error state.
10642 /// Reading from this pointer when `result_ok` is set is undefined.
10643 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10646 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10647 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10648 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10649 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10650 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10651 /// `err` or `result` depending on the state of `result_ok`.
10652 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10653 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10654 pub result_ok: bool,
10657 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10658 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10659 CResult_COption_MonitorEventZDecodeErrorZ {
10660 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10661 result: Box::into_raw(Box::new(o)),
10667 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10668 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10669 CResult_COption_MonitorEventZDecodeErrorZ {
10670 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10671 err: Box::into_raw(Box::new(e)),
10676 /// Checks if the given object is currently in the success state
10678 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10682 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10683 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10684 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10685 fn drop(&mut self) {
10686 if self.result_ok {
10687 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10688 let _ = unsafe { Box::from_raw(self.contents.result) };
10691 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10692 let _ = unsafe { Box::from_raw(self.contents.err) };
10697 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10698 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10699 let contents = if o.result_ok {
10700 let result = unsafe { o.contents.result };
10701 unsafe { o.contents.result = core::ptr::null_mut() };
10702 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10704 let err = unsafe { o.contents.err };
10705 unsafe { o.contents.err = core::ptr::null_mut(); }
10706 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10710 result_ok: o.result_ok,
10714 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10715 fn clone(&self) -> Self {
10716 if self.result_ok {
10717 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10718 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10721 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10722 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10728 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10729 /// but with all dynamically-allocated buffers duplicated in new buffers.
10730 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10732 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10733 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10734 /// A pointer to the contents in the success state.
10735 /// Reading from this pointer when `result_ok` is not set is undefined.
10736 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10737 /// A pointer to the contents in the error state.
10738 /// Reading from this pointer when `result_ok` is set is undefined.
10739 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10742 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10743 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10745 pub struct CResult_HTLCUpdateDecodeErrorZ {
10746 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10747 /// `err` or `result` depending on the state of `result_ok`.
10748 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10749 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10750 pub result_ok: bool,
10753 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10754 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10755 CResult_HTLCUpdateDecodeErrorZ {
10756 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10757 result: Box::into_raw(Box::new(o)),
10763 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10764 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10765 CResult_HTLCUpdateDecodeErrorZ {
10766 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10767 err: Box::into_raw(Box::new(e)),
10772 /// Checks if the given object is currently in the success state
10774 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10778 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10779 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10780 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10781 fn drop(&mut self) {
10782 if self.result_ok {
10783 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10784 let _ = unsafe { Box::from_raw(self.contents.result) };
10787 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10788 let _ = unsafe { Box::from_raw(self.contents.err) };
10793 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10794 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10795 let contents = if o.result_ok {
10796 let result = unsafe { o.contents.result };
10797 unsafe { o.contents.result = core::ptr::null_mut() };
10798 CResult_HTLCUpdateDecodeErrorZPtr { result }
10800 let err = unsafe { o.contents.err };
10801 unsafe { o.contents.err = core::ptr::null_mut(); }
10802 CResult_HTLCUpdateDecodeErrorZPtr { err }
10806 result_ok: o.result_ok,
10810 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10811 fn clone(&self) -> Self {
10812 if self.result_ok {
10813 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10814 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10817 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10818 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10824 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10825 /// but with all dynamically-allocated buffers duplicated in new buffers.
10826 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10828 /// A tuple of 2 elements. See the individual fields for the types contained.
10829 pub struct C2Tuple_OutPointScriptZ {
10830 /// The element at position 0
10831 pub a: crate::lightning::chain::transaction::OutPoint,
10832 /// The element at position 1
10833 pub b: crate::c_types::derived::CVec_u8Z,
10835 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
10836 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10843 impl C2Tuple_OutPointScriptZ {
10844 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10848 impl Clone for C2Tuple_OutPointScriptZ {
10849 fn clone(&self) -> Self {
10851 a: Clone::clone(&self.a),
10852 b: Clone::clone(&self.b),
10857 /// Creates a new tuple which has the same data as `orig`
10858 /// but with all dynamically-allocated buffers duplicated in new buffers.
10859 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
10860 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10862 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
10863 C2Tuple_OutPointScriptZ { a, b, }
10867 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
10868 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
10870 /// A tuple of 2 elements. See the individual fields for the types contained.
10871 pub struct C2Tuple_u32ScriptZ {
10872 /// The element at position 0
10874 /// The element at position 1
10875 pub b: crate::c_types::derived::CVec_u8Z,
10877 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
10878 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10885 impl C2Tuple_u32ScriptZ {
10886 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10890 impl Clone for C2Tuple_u32ScriptZ {
10891 fn clone(&self) -> Self {
10893 a: Clone::clone(&self.a),
10894 b: Clone::clone(&self.b),
10899 /// Creates a new tuple which has the same data as `orig`
10900 /// but with all dynamically-allocated buffers duplicated in new buffers.
10901 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
10902 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
10904 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
10905 C2Tuple_u32ScriptZ { a, b, }
10909 /// Frees any resources used by the C2Tuple_u32ScriptZ.
10910 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
10912 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
10913 /// This corresponds to std::vector in C++
10914 pub struct CVec_C2Tuple_u32ScriptZZ {
10915 /// The elements in the array.
10916 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10917 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
10918 /// The number of elements pointed to by `data`.
10921 impl CVec_C2Tuple_u32ScriptZZ {
10922 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
10923 if self.datalen == 0 { return Vec::new(); }
10924 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10925 self.data = core::ptr::null_mut();
10929 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
10930 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10933 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
10934 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
10935 let datalen = v.len();
10936 let data = Box::into_raw(v.into_boxed_slice());
10937 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10941 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10942 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
10943 impl Drop for CVec_C2Tuple_u32ScriptZZ {
10944 fn drop(&mut self) {
10945 if self.datalen == 0 { return; }
10946 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10949 impl Clone for CVec_C2Tuple_u32ScriptZZ {
10950 fn clone(&self) -> Self {
10951 let mut res = Vec::new();
10952 if self.datalen == 0 { return Self::from(res); }
10953 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10958 /// A tuple of 2 elements. See the individual fields for the types contained.
10959 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10960 /// The element at position 0
10961 pub a: crate::c_types::ThirtyTwoBytes,
10962 /// The element at position 1
10963 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
10965 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10966 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
10973 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10974 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
10978 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10979 fn clone(&self) -> Self {
10981 a: Clone::clone(&self.a),
10982 b: Clone::clone(&self.b),
10987 /// Creates a new tuple which has the same data as `orig`
10988 /// but with all dynamically-allocated buffers duplicated in new buffers.
10989 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
10990 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10992 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 {
10993 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
10997 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10998 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11000 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11001 /// This corresponds to std::vector in C++
11002 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11003 /// The elements in the array.
11004 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11005 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11006 /// The number of elements pointed to by `data`.
11009 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11010 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11011 if self.datalen == 0 { return Vec::new(); }
11012 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11013 self.data = core::ptr::null_mut();
11017 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11018 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11021 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11022 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11023 let datalen = v.len();
11024 let data = Box::into_raw(v.into_boxed_slice());
11025 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11029 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11030 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11031 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11032 fn drop(&mut self) {
11033 if self.datalen == 0 { return; }
11034 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11037 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11038 fn clone(&self) -> Self {
11039 let mut res = Vec::new();
11040 if self.datalen == 0 { return Self::from(res); }
11041 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11046 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11047 /// This corresponds to std::vector in C++
11048 pub struct CVec_EventZ {
11049 /// The elements in the array.
11050 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11051 pub data: *mut crate::lightning::util::events::Event,
11052 /// The number of elements pointed to by `data`.
11056 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11057 if self.datalen == 0 { return Vec::new(); }
11058 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11059 self.data = core::ptr::null_mut();
11063 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11064 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11067 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11068 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11069 let datalen = v.len();
11070 let data = Box::into_raw(v.into_boxed_slice());
11071 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11075 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11076 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11077 impl Drop for CVec_EventZ {
11078 fn drop(&mut self) {
11079 if self.datalen == 0 { return; }
11080 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11083 impl Clone for CVec_EventZ {
11084 fn clone(&self) -> Self {
11085 let mut res = Vec::new();
11086 if self.datalen == 0 { return Self::from(res); }
11087 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11092 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11093 /// This corresponds to std::vector in C++
11094 pub struct CVec_TransactionZ {
11095 /// The elements in the array.
11096 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11097 pub data: *mut crate::c_types::Transaction,
11098 /// The number of elements pointed to by `data`.
11101 impl CVec_TransactionZ {
11102 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11103 if self.datalen == 0 { return Vec::new(); }
11104 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11105 self.data = core::ptr::null_mut();
11109 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11110 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11113 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11114 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11115 let datalen = v.len();
11116 let data = Box::into_raw(v.into_boxed_slice());
11117 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11121 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11122 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11123 impl Drop for CVec_TransactionZ {
11124 fn drop(&mut self) {
11125 if self.datalen == 0 { return; }
11126 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11129 impl Clone for CVec_TransactionZ {
11130 fn clone(&self) -> Self {
11131 let mut res = Vec::new();
11132 if self.datalen == 0 { return Self::from(res); }
11133 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11138 /// A tuple of 2 elements. See the individual fields for the types contained.
11139 pub struct C2Tuple_u32TxOutZ {
11140 /// The element at position 0
11142 /// The element at position 1
11143 pub b: crate::c_types::TxOut,
11145 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11146 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11153 impl C2Tuple_u32TxOutZ {
11154 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11158 impl Clone for C2Tuple_u32TxOutZ {
11159 fn clone(&self) -> Self {
11161 a: Clone::clone(&self.a),
11162 b: Clone::clone(&self.b),
11167 /// Creates a new tuple which has the same data as `orig`
11168 /// but with all dynamically-allocated buffers duplicated in new buffers.
11169 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11170 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11172 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11173 C2Tuple_u32TxOutZ { a, b, }
11177 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11178 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11180 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11181 /// This corresponds to std::vector in C++
11182 pub struct CVec_C2Tuple_u32TxOutZZ {
11183 /// The elements in the array.
11184 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11185 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11186 /// The number of elements pointed to by `data`.
11189 impl CVec_C2Tuple_u32TxOutZZ {
11190 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11191 if self.datalen == 0 { return Vec::new(); }
11192 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11193 self.data = core::ptr::null_mut();
11197 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11198 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11201 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11202 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11203 let datalen = v.len();
11204 let data = Box::into_raw(v.into_boxed_slice());
11205 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11209 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11210 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11211 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11212 fn drop(&mut self) {
11213 if self.datalen == 0 { return; }
11214 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11217 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11218 fn clone(&self) -> Self {
11219 let mut res = Vec::new();
11220 if self.datalen == 0 { return Self::from(res); }
11221 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11226 /// A tuple of 2 elements. See the individual fields for the types contained.
11227 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11228 /// The element at position 0
11229 pub a: crate::c_types::ThirtyTwoBytes,
11230 /// The element at position 1
11231 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11233 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11234 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11241 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11242 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11246 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11247 fn clone(&self) -> Self {
11249 a: Clone::clone(&self.a),
11250 b: Clone::clone(&self.b),
11255 /// Creates a new tuple which has the same data as `orig`
11256 /// but with all dynamically-allocated buffers duplicated in new buffers.
11257 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11258 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11260 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 {
11261 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11265 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11266 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11268 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11269 /// This corresponds to std::vector in C++
11270 pub struct CVec_TransactionOutputsZ {
11271 /// The elements in the array.
11272 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11273 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11274 /// The number of elements pointed to by `data`.
11277 impl CVec_TransactionOutputsZ {
11278 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11279 if self.datalen == 0 { return Vec::new(); }
11280 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11281 self.data = core::ptr::null_mut();
11285 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11286 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11289 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11290 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11291 let datalen = v.len();
11292 let data = Box::into_raw(v.into_boxed_slice());
11293 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11297 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11298 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11299 impl Drop for CVec_TransactionOutputsZ {
11300 fn drop(&mut self) {
11301 if self.datalen == 0 { return; }
11302 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11305 impl Clone for CVec_TransactionOutputsZ {
11306 fn clone(&self) -> Self {
11307 let mut res = Vec::new();
11308 if self.datalen == 0 { return Self::from(res); }
11309 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11314 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11315 /// This corresponds to std::vector in C++
11316 pub struct CVec_BalanceZ {
11317 /// The elements in the array.
11318 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11319 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11320 /// The number of elements pointed to by `data`.
11323 impl CVec_BalanceZ {
11324 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11325 if self.datalen == 0 { return Vec::new(); }
11326 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11327 self.data = core::ptr::null_mut();
11331 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11332 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11335 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11336 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11337 let datalen = v.len();
11338 let data = Box::into_raw(v.into_boxed_slice());
11339 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11343 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11344 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11345 impl Drop for CVec_BalanceZ {
11346 fn drop(&mut self) {
11347 if self.datalen == 0 { return; }
11348 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11351 impl Clone for CVec_BalanceZ {
11352 fn clone(&self) -> Self {
11353 let mut res = Vec::new();
11354 if self.datalen == 0 { return Self::from(res); }
11355 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11360 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11361 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11362 /// A pointer to the contents in the success state.
11363 /// Reading from this pointer when `result_ok` is not set is undefined.
11364 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11365 /// A pointer to the contents in the error state.
11366 /// Reading from this pointer when `result_ok` is set is undefined.
11367 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11370 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11371 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11372 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11373 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11374 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11375 /// `err` or `result` depending on the state of `result_ok`.
11376 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11377 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11378 pub result_ok: bool,
11381 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11382 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11383 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11384 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11385 result: Box::into_raw(Box::new(o)),
11391 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11392 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11393 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11394 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11395 err: Box::into_raw(Box::new(e)),
11400 /// Checks if the given object is currently in the success state
11402 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11406 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11407 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11408 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11409 fn drop(&mut self) {
11410 if self.result_ok {
11411 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11412 let _ = unsafe { Box::from_raw(self.contents.result) };
11415 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11416 let _ = unsafe { Box::from_raw(self.contents.err) };
11421 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11422 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11423 let contents = if o.result_ok {
11424 let result = unsafe { o.contents.result };
11425 unsafe { o.contents.result = core::ptr::null_mut() };
11426 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11428 let err = unsafe { o.contents.err };
11429 unsafe { o.contents.err = core::ptr::null_mut(); }
11430 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11434 result_ok: o.result_ok,
11439 /// A tuple of 2 elements. See the individual fields for the types contained.
11440 pub struct C2Tuple_PublicKeyTypeZ {
11441 /// The element at position 0
11442 pub a: crate::c_types::PublicKey,
11443 /// The element at position 1
11444 pub b: crate::lightning::ln::wire::Type,
11446 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11447 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11454 impl C2Tuple_PublicKeyTypeZ {
11455 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11459 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11461 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11462 C2Tuple_PublicKeyTypeZ { a, b, }
11466 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11467 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11469 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11470 /// This corresponds to std::vector in C++
11471 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11472 /// The elements in the array.
11473 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11474 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11475 /// The number of elements pointed to by `data`.
11478 impl CVec_C2Tuple_PublicKeyTypeZZ {
11479 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11480 if self.datalen == 0 { return Vec::new(); }
11481 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11482 self.data = core::ptr::null_mut();
11486 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11487 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11490 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11491 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11492 let datalen = v.len();
11493 let data = Box::into_raw(v.into_boxed_slice());
11494 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11498 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11499 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11500 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11501 fn drop(&mut self) {
11502 if self.datalen == 0 { return; }
11503 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11508 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11509 pub enum COption_NetAddressZ {
11510 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11511 Some(crate::lightning::ln::msgs::NetAddress),
11512 /// When we're in this state, this COption_NetAddressZ contains nothing
11515 impl COption_NetAddressZ {
11516 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11517 if let Self::None = self { false } else { true }
11519 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11522 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11523 if let Self::Some(v) = self { v } else { unreachable!() }
11527 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11528 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11529 COption_NetAddressZ::Some(o)
11532 /// Constructs a new COption_NetAddressZ containing nothing
11533 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11534 COption_NetAddressZ::None
11537 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11538 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11540 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11541 /// but with all dynamically-allocated buffers duplicated in new buffers.
11542 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11544 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11545 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11546 /// A pointer to the contents in the success state.
11547 /// Reading from this pointer when `result_ok` is not set is undefined.
11548 pub result: *mut crate::c_types::derived::CVec_u8Z,
11549 /// A pointer to the contents in the error state.
11550 /// Reading from this pointer when `result_ok` is set is undefined.
11551 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11554 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11555 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11557 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11558 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11559 /// `err` or `result` depending on the state of `result_ok`.
11560 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11561 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11562 pub result_ok: bool,
11565 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11566 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11567 CResult_CVec_u8ZPeerHandleErrorZ {
11568 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11569 result: Box::into_raw(Box::new(o)),
11575 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11576 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11577 CResult_CVec_u8ZPeerHandleErrorZ {
11578 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11579 err: Box::into_raw(Box::new(e)),
11584 /// Checks if the given object is currently in the success state
11586 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11590 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11591 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11592 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11593 fn drop(&mut self) {
11594 if self.result_ok {
11595 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11596 let _ = unsafe { Box::from_raw(self.contents.result) };
11599 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11600 let _ = unsafe { Box::from_raw(self.contents.err) };
11605 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11606 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11607 let contents = if o.result_ok {
11608 let result = unsafe { o.contents.result };
11609 unsafe { o.contents.result = core::ptr::null_mut() };
11610 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11612 let err = unsafe { o.contents.err };
11613 unsafe { o.contents.err = core::ptr::null_mut(); }
11614 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11618 result_ok: o.result_ok,
11622 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11623 fn clone(&self) -> Self {
11624 if self.result_ok {
11625 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11626 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11629 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11630 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11636 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11637 /// but with all dynamically-allocated buffers duplicated in new buffers.
11638 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11640 /// The contents of CResult_NonePeerHandleErrorZ
11641 pub union CResult_NonePeerHandleErrorZPtr {
11642 /// Note that this value is always NULL, as there are no contents in the OK variant
11643 pub result: *mut core::ffi::c_void,
11644 /// A pointer to the contents in the error state.
11645 /// Reading from this pointer when `result_ok` is set is undefined.
11646 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11649 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11650 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11652 pub struct CResult_NonePeerHandleErrorZ {
11653 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11654 /// `err` or `result` depending on the state of `result_ok`.
11655 pub contents: CResult_NonePeerHandleErrorZPtr,
11656 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11657 pub result_ok: bool,
11660 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11661 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11662 CResult_NonePeerHandleErrorZ {
11663 contents: CResult_NonePeerHandleErrorZPtr {
11664 result: core::ptr::null_mut(),
11670 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11671 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11672 CResult_NonePeerHandleErrorZ {
11673 contents: CResult_NonePeerHandleErrorZPtr {
11674 err: Box::into_raw(Box::new(e)),
11679 /// Checks if the given object is currently in the success state
11681 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11685 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11686 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11687 impl Drop for CResult_NonePeerHandleErrorZ {
11688 fn drop(&mut self) {
11689 if self.result_ok {
11691 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11692 let _ = unsafe { Box::from_raw(self.contents.err) };
11697 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11698 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11699 let contents = if o.result_ok {
11700 let _ = unsafe { Box::from_raw(o.contents.result) };
11701 o.contents.result = core::ptr::null_mut();
11702 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11704 let err = unsafe { o.contents.err };
11705 unsafe { o.contents.err = core::ptr::null_mut(); }
11706 CResult_NonePeerHandleErrorZPtr { err }
11710 result_ok: o.result_ok,
11714 impl Clone for CResult_NonePeerHandleErrorZ {
11715 fn clone(&self) -> Self {
11716 if self.result_ok {
11717 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11718 result: core::ptr::null_mut()
11721 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11722 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11728 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11729 /// but with all dynamically-allocated buffers duplicated in new buffers.
11730 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11732 /// The contents of CResult_boolPeerHandleErrorZ
11733 pub union CResult_boolPeerHandleErrorZPtr {
11734 /// A pointer to the contents in the success state.
11735 /// Reading from this pointer when `result_ok` is not set is undefined.
11736 pub result: *mut bool,
11737 /// A pointer to the contents in the error state.
11738 /// Reading from this pointer when `result_ok` is set is undefined.
11739 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11742 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11743 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11745 pub struct CResult_boolPeerHandleErrorZ {
11746 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11747 /// `err` or `result` depending on the state of `result_ok`.
11748 pub contents: CResult_boolPeerHandleErrorZPtr,
11749 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11750 pub result_ok: bool,
11753 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11754 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11755 CResult_boolPeerHandleErrorZ {
11756 contents: CResult_boolPeerHandleErrorZPtr {
11757 result: Box::into_raw(Box::new(o)),
11763 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11764 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
11765 CResult_boolPeerHandleErrorZ {
11766 contents: CResult_boolPeerHandleErrorZPtr {
11767 err: Box::into_raw(Box::new(e)),
11772 /// Checks if the given object is currently in the success state
11774 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
11778 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
11779 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
11780 impl Drop for CResult_boolPeerHandleErrorZ {
11781 fn drop(&mut self) {
11782 if self.result_ok {
11783 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11784 let _ = unsafe { Box::from_raw(self.contents.result) };
11787 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11788 let _ = unsafe { Box::from_raw(self.contents.err) };
11793 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
11794 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11795 let contents = if o.result_ok {
11796 let result = unsafe { o.contents.result };
11797 unsafe { o.contents.result = core::ptr::null_mut() };
11798 CResult_boolPeerHandleErrorZPtr { result }
11800 let err = unsafe { o.contents.err };
11801 unsafe { o.contents.err = core::ptr::null_mut(); }
11802 CResult_boolPeerHandleErrorZPtr { err }
11806 result_ok: o.result_ok,
11810 impl Clone for CResult_boolPeerHandleErrorZ {
11811 fn clone(&self) -> Self {
11812 if self.result_ok {
11813 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
11814 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
11817 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
11818 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11824 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
11825 /// but with all dynamically-allocated buffers duplicated in new buffers.
11826 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
11828 /// The contents of CResult_u32GraphSyncErrorZ
11829 pub union CResult_u32GraphSyncErrorZPtr {
11830 /// A pointer to the contents in the success state.
11831 /// Reading from this pointer when `result_ok` is not set is undefined.
11832 pub result: *mut u32,
11833 /// A pointer to the contents in the error state.
11834 /// Reading from this pointer when `result_ok` is set is undefined.
11835 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
11838 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
11839 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
11840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11841 pub struct CResult_u32GraphSyncErrorZ {
11842 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
11843 /// `err` or `result` depending on the state of `result_ok`.
11844 pub contents: CResult_u32GraphSyncErrorZPtr,
11845 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
11846 pub result_ok: bool,
11849 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
11850 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
11851 CResult_u32GraphSyncErrorZ {
11852 contents: CResult_u32GraphSyncErrorZPtr {
11853 result: Box::into_raw(Box::new(o)),
11859 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
11860 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
11861 CResult_u32GraphSyncErrorZ {
11862 contents: CResult_u32GraphSyncErrorZPtr {
11863 err: Box::into_raw(Box::new(e)),
11868 /// Checks if the given object is currently in the success state
11870 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
11874 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
11875 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
11876 impl Drop for CResult_u32GraphSyncErrorZ {
11877 fn drop(&mut self) {
11878 if self.result_ok {
11879 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11880 let _ = unsafe { Box::from_raw(self.contents.result) };
11883 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11884 let _ = unsafe { Box::from_raw(self.contents.err) };
11889 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
11890 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
11891 let contents = if o.result_ok {
11892 let result = unsafe { o.contents.result };
11893 unsafe { o.contents.result = core::ptr::null_mut() };
11894 CResult_u32GraphSyncErrorZPtr { result }
11896 let err = unsafe { o.contents.err };
11897 unsafe { o.contents.err = core::ptr::null_mut(); }
11898 CResult_u32GraphSyncErrorZPtr { err }
11902 result_ok: o.result_ok,
11907 /// The contents of CResult_NetAddressDecodeErrorZ
11908 pub union CResult_NetAddressDecodeErrorZPtr {
11909 /// A pointer to the contents in the success state.
11910 /// Reading from this pointer when `result_ok` is not set is undefined.
11911 pub result: *mut crate::lightning::ln::msgs::NetAddress,
11912 /// A pointer to the contents in the error state.
11913 /// Reading from this pointer when `result_ok` is set is undefined.
11914 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11917 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11918 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11919 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11920 pub struct CResult_NetAddressDecodeErrorZ {
11921 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11922 /// `err` or `result` depending on the state of `result_ok`.
11923 pub contents: CResult_NetAddressDecodeErrorZPtr,
11924 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11925 pub result_ok: bool,
11928 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11929 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11930 CResult_NetAddressDecodeErrorZ {
11931 contents: CResult_NetAddressDecodeErrorZPtr {
11932 result: Box::into_raw(Box::new(o)),
11938 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11939 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11940 CResult_NetAddressDecodeErrorZ {
11941 contents: CResult_NetAddressDecodeErrorZPtr {
11942 err: Box::into_raw(Box::new(e)),
11947 /// Checks if the given object is currently in the success state
11949 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11953 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11954 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11955 impl Drop for CResult_NetAddressDecodeErrorZ {
11956 fn drop(&mut self) {
11957 if self.result_ok {
11958 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11959 let _ = unsafe { Box::from_raw(self.contents.result) };
11962 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11963 let _ = unsafe { Box::from_raw(self.contents.err) };
11968 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11969 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11970 let contents = if o.result_ok {
11971 let result = unsafe { o.contents.result };
11972 unsafe { o.contents.result = core::ptr::null_mut() };
11973 CResult_NetAddressDecodeErrorZPtr { result }
11975 let err = unsafe { o.contents.err };
11976 unsafe { o.contents.err = core::ptr::null_mut(); }
11977 CResult_NetAddressDecodeErrorZPtr { err }
11981 result_ok: o.result_ok,
11985 impl Clone for CResult_NetAddressDecodeErrorZ {
11986 fn clone(&self) -> Self {
11987 if self.result_ok {
11988 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11989 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11992 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11993 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11999 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12000 /// but with all dynamically-allocated buffers duplicated in new buffers.
12001 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
12003 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
12004 /// This corresponds to std::vector in C++
12005 pub struct CVec_UpdateAddHTLCZ {
12006 /// The elements in the array.
12007 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12008 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12009 /// The number of elements pointed to by `data`.
12012 impl CVec_UpdateAddHTLCZ {
12013 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
12014 if self.datalen == 0 { return Vec::new(); }
12015 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12016 self.data = core::ptr::null_mut();
12020 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
12021 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12024 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
12025 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
12026 let datalen = v.len();
12027 let data = Box::into_raw(v.into_boxed_slice());
12028 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12032 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12033 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12034 impl Drop for CVec_UpdateAddHTLCZ {
12035 fn drop(&mut self) {
12036 if self.datalen == 0 { return; }
12037 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12040 impl Clone for CVec_UpdateAddHTLCZ {
12041 fn clone(&self) -> Self {
12042 let mut res = Vec::new();
12043 if self.datalen == 0 { return Self::from(res); }
12044 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12049 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12050 /// This corresponds to std::vector in C++
12051 pub struct CVec_UpdateFulfillHTLCZ {
12052 /// The elements in the array.
12053 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12054 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12055 /// The number of elements pointed to by `data`.
12058 impl CVec_UpdateFulfillHTLCZ {
12059 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12060 if self.datalen == 0 { return Vec::new(); }
12061 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12062 self.data = core::ptr::null_mut();
12066 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12067 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12070 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12071 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12072 let datalen = v.len();
12073 let data = Box::into_raw(v.into_boxed_slice());
12074 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12078 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12079 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12080 impl Drop for CVec_UpdateFulfillHTLCZ {
12081 fn drop(&mut self) {
12082 if self.datalen == 0 { return; }
12083 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12086 impl Clone for CVec_UpdateFulfillHTLCZ {
12087 fn clone(&self) -> Self {
12088 let mut res = Vec::new();
12089 if self.datalen == 0 { return Self::from(res); }
12090 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12095 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12096 /// This corresponds to std::vector in C++
12097 pub struct CVec_UpdateFailHTLCZ {
12098 /// The elements in the array.
12099 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12100 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12101 /// The number of elements pointed to by `data`.
12104 impl CVec_UpdateFailHTLCZ {
12105 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12106 if self.datalen == 0 { return Vec::new(); }
12107 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12108 self.data = core::ptr::null_mut();
12112 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12113 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12116 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12117 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12118 let datalen = v.len();
12119 let data = Box::into_raw(v.into_boxed_slice());
12120 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12124 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12125 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12126 impl Drop for CVec_UpdateFailHTLCZ {
12127 fn drop(&mut self) {
12128 if self.datalen == 0 { return; }
12129 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12132 impl Clone for CVec_UpdateFailHTLCZ {
12133 fn clone(&self) -> Self {
12134 let mut res = Vec::new();
12135 if self.datalen == 0 { return Self::from(res); }
12136 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12141 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12142 /// This corresponds to std::vector in C++
12143 pub struct CVec_UpdateFailMalformedHTLCZ {
12144 /// The elements in the array.
12145 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12146 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12147 /// The number of elements pointed to by `data`.
12150 impl CVec_UpdateFailMalformedHTLCZ {
12151 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12152 if self.datalen == 0 { return Vec::new(); }
12153 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12154 self.data = core::ptr::null_mut();
12158 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12159 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12162 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12163 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12164 let datalen = v.len();
12165 let data = Box::into_raw(v.into_boxed_slice());
12166 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12170 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12171 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12172 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12173 fn drop(&mut self) {
12174 if self.datalen == 0 { return; }
12175 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12178 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12179 fn clone(&self) -> Self {
12180 let mut res = Vec::new();
12181 if self.datalen == 0 { return Self::from(res); }
12182 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12187 /// The contents of CResult_AcceptChannelDecodeErrorZ
12188 pub union CResult_AcceptChannelDecodeErrorZPtr {
12189 /// A pointer to the contents in the success state.
12190 /// Reading from this pointer when `result_ok` is not set is undefined.
12191 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12192 /// A pointer to the contents in the error state.
12193 /// Reading from this pointer when `result_ok` is set is undefined.
12194 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12197 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12198 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12199 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12200 pub struct CResult_AcceptChannelDecodeErrorZ {
12201 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12202 /// `err` or `result` depending on the state of `result_ok`.
12203 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12204 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12205 pub result_ok: bool,
12208 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12209 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12210 CResult_AcceptChannelDecodeErrorZ {
12211 contents: CResult_AcceptChannelDecodeErrorZPtr {
12212 result: Box::into_raw(Box::new(o)),
12218 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12219 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12220 CResult_AcceptChannelDecodeErrorZ {
12221 contents: CResult_AcceptChannelDecodeErrorZPtr {
12222 err: Box::into_raw(Box::new(e)),
12227 /// Checks if the given object is currently in the success state
12229 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12233 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12234 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12235 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12236 fn drop(&mut self) {
12237 if self.result_ok {
12238 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12239 let _ = unsafe { Box::from_raw(self.contents.result) };
12242 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12243 let _ = unsafe { Box::from_raw(self.contents.err) };
12248 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12249 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12250 let contents = if o.result_ok {
12251 let result = unsafe { o.contents.result };
12252 unsafe { o.contents.result = core::ptr::null_mut() };
12253 CResult_AcceptChannelDecodeErrorZPtr { result }
12255 let err = unsafe { o.contents.err };
12256 unsafe { o.contents.err = core::ptr::null_mut(); }
12257 CResult_AcceptChannelDecodeErrorZPtr { err }
12261 result_ok: o.result_ok,
12265 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12266 fn clone(&self) -> Self {
12267 if self.result_ok {
12268 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12269 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12272 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12273 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12279 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12280 /// but with all dynamically-allocated buffers duplicated in new buffers.
12281 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12283 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12284 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12285 /// A pointer to the contents in the success state.
12286 /// Reading from this pointer when `result_ok` is not set is undefined.
12287 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12288 /// A pointer to the contents in the error state.
12289 /// Reading from this pointer when `result_ok` is set is undefined.
12290 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12293 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12294 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12295 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12296 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12297 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12298 /// `err` or `result` depending on the state of `result_ok`.
12299 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12300 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12301 pub result_ok: bool,
12304 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12305 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12306 CResult_AnnouncementSignaturesDecodeErrorZ {
12307 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12308 result: Box::into_raw(Box::new(o)),
12314 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12315 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12316 CResult_AnnouncementSignaturesDecodeErrorZ {
12317 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12318 err: Box::into_raw(Box::new(e)),
12323 /// Checks if the given object is currently in the success state
12325 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12329 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12330 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12331 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12332 fn drop(&mut self) {
12333 if self.result_ok {
12334 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12335 let _ = unsafe { Box::from_raw(self.contents.result) };
12338 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12339 let _ = unsafe { Box::from_raw(self.contents.err) };
12344 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12345 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12346 let contents = if o.result_ok {
12347 let result = unsafe { o.contents.result };
12348 unsafe { o.contents.result = core::ptr::null_mut() };
12349 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12351 let err = unsafe { o.contents.err };
12352 unsafe { o.contents.err = core::ptr::null_mut(); }
12353 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12357 result_ok: o.result_ok,
12361 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12362 fn clone(&self) -> Self {
12363 if self.result_ok {
12364 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12365 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12368 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12369 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12375 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12376 /// but with all dynamically-allocated buffers duplicated in new buffers.
12377 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12379 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12380 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12381 /// A pointer to the contents in the success state.
12382 /// Reading from this pointer when `result_ok` is not set is undefined.
12383 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12384 /// A pointer to the contents in the error state.
12385 /// Reading from this pointer when `result_ok` is set is undefined.
12386 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12389 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12390 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12391 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12392 pub struct CResult_ChannelReestablishDecodeErrorZ {
12393 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12394 /// `err` or `result` depending on the state of `result_ok`.
12395 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12396 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12397 pub result_ok: bool,
12400 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12401 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12402 CResult_ChannelReestablishDecodeErrorZ {
12403 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12404 result: Box::into_raw(Box::new(o)),
12410 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12411 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12412 CResult_ChannelReestablishDecodeErrorZ {
12413 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12414 err: Box::into_raw(Box::new(e)),
12419 /// Checks if the given object is currently in the success state
12421 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12425 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12426 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12427 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12428 fn drop(&mut self) {
12429 if self.result_ok {
12430 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12431 let _ = unsafe { Box::from_raw(self.contents.result) };
12434 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12435 let _ = unsafe { Box::from_raw(self.contents.err) };
12440 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12441 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12442 let contents = if o.result_ok {
12443 let result = unsafe { o.contents.result };
12444 unsafe { o.contents.result = core::ptr::null_mut() };
12445 CResult_ChannelReestablishDecodeErrorZPtr { result }
12447 let err = unsafe { o.contents.err };
12448 unsafe { o.contents.err = core::ptr::null_mut(); }
12449 CResult_ChannelReestablishDecodeErrorZPtr { err }
12453 result_ok: o.result_ok,
12457 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12458 fn clone(&self) -> Self {
12459 if self.result_ok {
12460 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12461 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12464 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12465 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12471 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12472 /// but with all dynamically-allocated buffers duplicated in new buffers.
12473 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12475 /// The contents of CResult_ClosingSignedDecodeErrorZ
12476 pub union CResult_ClosingSignedDecodeErrorZPtr {
12477 /// A pointer to the contents in the success state.
12478 /// Reading from this pointer when `result_ok` is not set is undefined.
12479 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12480 /// A pointer to the contents in the error state.
12481 /// Reading from this pointer when `result_ok` is set is undefined.
12482 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12485 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12486 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12487 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12488 pub struct CResult_ClosingSignedDecodeErrorZ {
12489 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12490 /// `err` or `result` depending on the state of `result_ok`.
12491 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12492 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12493 pub result_ok: bool,
12496 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12497 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12498 CResult_ClosingSignedDecodeErrorZ {
12499 contents: CResult_ClosingSignedDecodeErrorZPtr {
12500 result: Box::into_raw(Box::new(o)),
12506 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12507 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12508 CResult_ClosingSignedDecodeErrorZ {
12509 contents: CResult_ClosingSignedDecodeErrorZPtr {
12510 err: Box::into_raw(Box::new(e)),
12515 /// Checks if the given object is currently in the success state
12517 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12521 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12522 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12523 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12524 fn drop(&mut self) {
12525 if self.result_ok {
12526 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12527 let _ = unsafe { Box::from_raw(self.contents.result) };
12530 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12531 let _ = unsafe { Box::from_raw(self.contents.err) };
12536 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12537 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12538 let contents = if o.result_ok {
12539 let result = unsafe { o.contents.result };
12540 unsafe { o.contents.result = core::ptr::null_mut() };
12541 CResult_ClosingSignedDecodeErrorZPtr { result }
12543 let err = unsafe { o.contents.err };
12544 unsafe { o.contents.err = core::ptr::null_mut(); }
12545 CResult_ClosingSignedDecodeErrorZPtr { err }
12549 result_ok: o.result_ok,
12553 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12554 fn clone(&self) -> Self {
12555 if self.result_ok {
12556 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12557 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12560 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12561 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12567 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12568 /// but with all dynamically-allocated buffers duplicated in new buffers.
12569 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12571 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12572 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12573 /// A pointer to the contents in the success state.
12574 /// Reading from this pointer when `result_ok` is not set is undefined.
12575 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12576 /// A pointer to the contents in the error state.
12577 /// Reading from this pointer when `result_ok` is set is undefined.
12578 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12581 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12582 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12583 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12584 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12585 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12586 /// `err` or `result` depending on the state of `result_ok`.
12587 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12588 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12589 pub result_ok: bool,
12592 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12593 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12594 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12595 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12596 result: Box::into_raw(Box::new(o)),
12602 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12603 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12604 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12605 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12606 err: Box::into_raw(Box::new(e)),
12611 /// Checks if the given object is currently in the success state
12613 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12617 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12618 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12619 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12620 fn drop(&mut self) {
12621 if self.result_ok {
12622 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12623 let _ = unsafe { Box::from_raw(self.contents.result) };
12626 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12627 let _ = unsafe { Box::from_raw(self.contents.err) };
12632 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12633 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12634 let contents = if o.result_ok {
12635 let result = unsafe { o.contents.result };
12636 unsafe { o.contents.result = core::ptr::null_mut() };
12637 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12639 let err = unsafe { o.contents.err };
12640 unsafe { o.contents.err = core::ptr::null_mut(); }
12641 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12645 result_ok: o.result_ok,
12649 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12650 fn clone(&self) -> Self {
12651 if self.result_ok {
12652 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12653 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12656 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12657 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12663 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12664 /// but with all dynamically-allocated buffers duplicated in new buffers.
12665 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12667 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12668 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12669 /// A pointer to the contents in the success state.
12670 /// Reading from this pointer when `result_ok` is not set is undefined.
12671 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12672 /// A pointer to the contents in the error state.
12673 /// Reading from this pointer when `result_ok` is set is undefined.
12674 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12677 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12678 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12680 pub struct CResult_CommitmentSignedDecodeErrorZ {
12681 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12682 /// `err` or `result` depending on the state of `result_ok`.
12683 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12684 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12685 pub result_ok: bool,
12688 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12689 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12690 CResult_CommitmentSignedDecodeErrorZ {
12691 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12692 result: Box::into_raw(Box::new(o)),
12698 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12699 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12700 CResult_CommitmentSignedDecodeErrorZ {
12701 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12702 err: Box::into_raw(Box::new(e)),
12707 /// Checks if the given object is currently in the success state
12709 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12713 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12714 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12715 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12716 fn drop(&mut self) {
12717 if self.result_ok {
12718 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12719 let _ = unsafe { Box::from_raw(self.contents.result) };
12722 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12723 let _ = unsafe { Box::from_raw(self.contents.err) };
12728 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12729 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12730 let contents = if o.result_ok {
12731 let result = unsafe { o.contents.result };
12732 unsafe { o.contents.result = core::ptr::null_mut() };
12733 CResult_CommitmentSignedDecodeErrorZPtr { result }
12735 let err = unsafe { o.contents.err };
12736 unsafe { o.contents.err = core::ptr::null_mut(); }
12737 CResult_CommitmentSignedDecodeErrorZPtr { err }
12741 result_ok: o.result_ok,
12745 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12746 fn clone(&self) -> Self {
12747 if self.result_ok {
12748 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12749 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12752 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12753 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12759 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12760 /// but with all dynamically-allocated buffers duplicated in new buffers.
12761 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12763 /// The contents of CResult_FundingCreatedDecodeErrorZ
12764 pub union CResult_FundingCreatedDecodeErrorZPtr {
12765 /// A pointer to the contents in the success state.
12766 /// Reading from this pointer when `result_ok` is not set is undefined.
12767 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12768 /// A pointer to the contents in the error state.
12769 /// Reading from this pointer when `result_ok` is set is undefined.
12770 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12773 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12774 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12775 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12776 pub struct CResult_FundingCreatedDecodeErrorZ {
12777 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12778 /// `err` or `result` depending on the state of `result_ok`.
12779 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12780 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12781 pub result_ok: bool,
12784 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12785 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12786 CResult_FundingCreatedDecodeErrorZ {
12787 contents: CResult_FundingCreatedDecodeErrorZPtr {
12788 result: Box::into_raw(Box::new(o)),
12794 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12795 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12796 CResult_FundingCreatedDecodeErrorZ {
12797 contents: CResult_FundingCreatedDecodeErrorZPtr {
12798 err: Box::into_raw(Box::new(e)),
12803 /// Checks if the given object is currently in the success state
12805 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12809 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12810 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12811 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12812 fn drop(&mut self) {
12813 if self.result_ok {
12814 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12815 let _ = unsafe { Box::from_raw(self.contents.result) };
12818 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12819 let _ = unsafe { Box::from_raw(self.contents.err) };
12824 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12825 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12826 let contents = if o.result_ok {
12827 let result = unsafe { o.contents.result };
12828 unsafe { o.contents.result = core::ptr::null_mut() };
12829 CResult_FundingCreatedDecodeErrorZPtr { result }
12831 let err = unsafe { o.contents.err };
12832 unsafe { o.contents.err = core::ptr::null_mut(); }
12833 CResult_FundingCreatedDecodeErrorZPtr { err }
12837 result_ok: o.result_ok,
12841 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12842 fn clone(&self) -> Self {
12843 if self.result_ok {
12844 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12845 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12848 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12849 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12855 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12856 /// but with all dynamically-allocated buffers duplicated in new buffers.
12857 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12859 /// The contents of CResult_FundingSignedDecodeErrorZ
12860 pub union CResult_FundingSignedDecodeErrorZPtr {
12861 /// A pointer to the contents in the success state.
12862 /// Reading from this pointer when `result_ok` is not set is undefined.
12863 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12864 /// A pointer to the contents in the error state.
12865 /// Reading from this pointer when `result_ok` is set is undefined.
12866 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12869 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12870 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12871 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12872 pub struct CResult_FundingSignedDecodeErrorZ {
12873 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12874 /// `err` or `result` depending on the state of `result_ok`.
12875 pub contents: CResult_FundingSignedDecodeErrorZPtr,
12876 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12877 pub result_ok: bool,
12880 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12881 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12882 CResult_FundingSignedDecodeErrorZ {
12883 contents: CResult_FundingSignedDecodeErrorZPtr {
12884 result: Box::into_raw(Box::new(o)),
12890 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12891 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12892 CResult_FundingSignedDecodeErrorZ {
12893 contents: CResult_FundingSignedDecodeErrorZPtr {
12894 err: Box::into_raw(Box::new(e)),
12899 /// Checks if the given object is currently in the success state
12901 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12905 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12906 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12907 impl Drop for CResult_FundingSignedDecodeErrorZ {
12908 fn drop(&mut self) {
12909 if self.result_ok {
12910 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12911 let _ = unsafe { Box::from_raw(self.contents.result) };
12914 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12915 let _ = unsafe { Box::from_raw(self.contents.err) };
12920 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12921 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12922 let contents = if o.result_ok {
12923 let result = unsafe { o.contents.result };
12924 unsafe { o.contents.result = core::ptr::null_mut() };
12925 CResult_FundingSignedDecodeErrorZPtr { result }
12927 let err = unsafe { o.contents.err };
12928 unsafe { o.contents.err = core::ptr::null_mut(); }
12929 CResult_FundingSignedDecodeErrorZPtr { err }
12933 result_ok: o.result_ok,
12937 impl Clone for CResult_FundingSignedDecodeErrorZ {
12938 fn clone(&self) -> Self {
12939 if self.result_ok {
12940 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12941 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12944 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12945 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12951 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12952 /// but with all dynamically-allocated buffers duplicated in new buffers.
12953 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12955 /// The contents of CResult_ChannelReadyDecodeErrorZ
12956 pub union CResult_ChannelReadyDecodeErrorZPtr {
12957 /// A pointer to the contents in the success state.
12958 /// Reading from this pointer when `result_ok` is not set is undefined.
12959 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
12960 /// A pointer to the contents in the error state.
12961 /// Reading from this pointer when `result_ok` is set is undefined.
12962 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12965 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
12966 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
12967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12968 pub struct CResult_ChannelReadyDecodeErrorZ {
12969 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
12970 /// `err` or `result` depending on the state of `result_ok`.
12971 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
12972 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
12973 pub result_ok: bool,
12976 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
12977 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
12978 CResult_ChannelReadyDecodeErrorZ {
12979 contents: CResult_ChannelReadyDecodeErrorZPtr {
12980 result: Box::into_raw(Box::new(o)),
12986 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
12987 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
12988 CResult_ChannelReadyDecodeErrorZ {
12989 contents: CResult_ChannelReadyDecodeErrorZPtr {
12990 err: Box::into_raw(Box::new(e)),
12995 /// Checks if the given object is currently in the success state
12997 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13001 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13002 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13003 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13004 fn drop(&mut self) {
13005 if self.result_ok {
13006 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13007 let _ = unsafe { Box::from_raw(self.contents.result) };
13010 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13011 let _ = unsafe { Box::from_raw(self.contents.err) };
13016 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13017 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13018 let contents = if o.result_ok {
13019 let result = unsafe { o.contents.result };
13020 unsafe { o.contents.result = core::ptr::null_mut() };
13021 CResult_ChannelReadyDecodeErrorZPtr { result }
13023 let err = unsafe { o.contents.err };
13024 unsafe { o.contents.err = core::ptr::null_mut(); }
13025 CResult_ChannelReadyDecodeErrorZPtr { err }
13029 result_ok: o.result_ok,
13033 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13034 fn clone(&self) -> Self {
13035 if self.result_ok {
13036 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13037 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13040 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13041 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13047 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13048 /// but with all dynamically-allocated buffers duplicated in new buffers.
13049 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13051 /// The contents of CResult_InitDecodeErrorZ
13052 pub union CResult_InitDecodeErrorZPtr {
13053 /// A pointer to the contents in the success state.
13054 /// Reading from this pointer when `result_ok` is not set is undefined.
13055 pub result: *mut crate::lightning::ln::msgs::Init,
13056 /// A pointer to the contents in the error state.
13057 /// Reading from this pointer when `result_ok` is set is undefined.
13058 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13061 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13062 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13063 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13064 pub struct CResult_InitDecodeErrorZ {
13065 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13066 /// `err` or `result` depending on the state of `result_ok`.
13067 pub contents: CResult_InitDecodeErrorZPtr,
13068 /// Whether this CResult_InitDecodeErrorZ represents a success state.
13069 pub result_ok: bool,
13072 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13073 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13074 CResult_InitDecodeErrorZ {
13075 contents: CResult_InitDecodeErrorZPtr {
13076 result: Box::into_raw(Box::new(o)),
13082 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13083 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13084 CResult_InitDecodeErrorZ {
13085 contents: CResult_InitDecodeErrorZPtr {
13086 err: Box::into_raw(Box::new(e)),
13091 /// Checks if the given object is currently in the success state
13093 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13097 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13098 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13099 impl Drop for CResult_InitDecodeErrorZ {
13100 fn drop(&mut self) {
13101 if self.result_ok {
13102 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13103 let _ = unsafe { Box::from_raw(self.contents.result) };
13106 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13107 let _ = unsafe { Box::from_raw(self.contents.err) };
13112 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
13113 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
13114 let contents = if o.result_ok {
13115 let result = unsafe { o.contents.result };
13116 unsafe { o.contents.result = core::ptr::null_mut() };
13117 CResult_InitDecodeErrorZPtr { result }
13119 let err = unsafe { o.contents.err };
13120 unsafe { o.contents.err = core::ptr::null_mut(); }
13121 CResult_InitDecodeErrorZPtr { err }
13125 result_ok: o.result_ok,
13129 impl Clone for CResult_InitDecodeErrorZ {
13130 fn clone(&self) -> Self {
13131 if self.result_ok {
13132 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
13133 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
13136 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
13137 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13143 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13144 /// but with all dynamically-allocated buffers duplicated in new buffers.
13145 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
13147 /// The contents of CResult_OpenChannelDecodeErrorZ
13148 pub union CResult_OpenChannelDecodeErrorZPtr {
13149 /// A pointer to the contents in the success state.
13150 /// Reading from this pointer when `result_ok` is not set is undefined.
13151 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
13152 /// A pointer to the contents in the error state.
13153 /// Reading from this pointer when `result_ok` is set is undefined.
13154 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13157 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
13158 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13160 pub struct CResult_OpenChannelDecodeErrorZ {
13161 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
13162 /// `err` or `result` depending on the state of `result_ok`.
13163 pub contents: CResult_OpenChannelDecodeErrorZPtr,
13164 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
13165 pub result_ok: bool,
13168 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13169 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13170 CResult_OpenChannelDecodeErrorZ {
13171 contents: CResult_OpenChannelDecodeErrorZPtr {
13172 result: Box::into_raw(Box::new(o)),
13178 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13179 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13180 CResult_OpenChannelDecodeErrorZ {
13181 contents: CResult_OpenChannelDecodeErrorZPtr {
13182 err: Box::into_raw(Box::new(e)),
13187 /// Checks if the given object is currently in the success state
13189 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13193 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13194 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13195 impl Drop for CResult_OpenChannelDecodeErrorZ {
13196 fn drop(&mut self) {
13197 if self.result_ok {
13198 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13199 let _ = unsafe { Box::from_raw(self.contents.result) };
13202 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13203 let _ = unsafe { Box::from_raw(self.contents.err) };
13208 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13209 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13210 let contents = if o.result_ok {
13211 let result = unsafe { o.contents.result };
13212 unsafe { o.contents.result = core::ptr::null_mut() };
13213 CResult_OpenChannelDecodeErrorZPtr { result }
13215 let err = unsafe { o.contents.err };
13216 unsafe { o.contents.err = core::ptr::null_mut(); }
13217 CResult_OpenChannelDecodeErrorZPtr { err }
13221 result_ok: o.result_ok,
13225 impl Clone for CResult_OpenChannelDecodeErrorZ {
13226 fn clone(&self) -> Self {
13227 if self.result_ok {
13228 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13229 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13232 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13233 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13239 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13240 /// but with all dynamically-allocated buffers duplicated in new buffers.
13241 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13243 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13244 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13245 /// A pointer to the contents in the success state.
13246 /// Reading from this pointer when `result_ok` is not set is undefined.
13247 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13248 /// A pointer to the contents in the error state.
13249 /// Reading from this pointer when `result_ok` is set is undefined.
13250 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13253 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13254 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13256 pub struct CResult_RevokeAndACKDecodeErrorZ {
13257 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13258 /// `err` or `result` depending on the state of `result_ok`.
13259 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13260 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13261 pub result_ok: bool,
13264 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13265 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13266 CResult_RevokeAndACKDecodeErrorZ {
13267 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13268 result: Box::into_raw(Box::new(o)),
13274 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13275 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13276 CResult_RevokeAndACKDecodeErrorZ {
13277 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13278 err: Box::into_raw(Box::new(e)),
13283 /// Checks if the given object is currently in the success state
13285 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13289 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13290 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13291 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13292 fn drop(&mut self) {
13293 if self.result_ok {
13294 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13295 let _ = unsafe { Box::from_raw(self.contents.result) };
13298 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13299 let _ = unsafe { Box::from_raw(self.contents.err) };
13304 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13305 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13306 let contents = if o.result_ok {
13307 let result = unsafe { o.contents.result };
13308 unsafe { o.contents.result = core::ptr::null_mut() };
13309 CResult_RevokeAndACKDecodeErrorZPtr { result }
13311 let err = unsafe { o.contents.err };
13312 unsafe { o.contents.err = core::ptr::null_mut(); }
13313 CResult_RevokeAndACKDecodeErrorZPtr { err }
13317 result_ok: o.result_ok,
13321 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13322 fn clone(&self) -> Self {
13323 if self.result_ok {
13324 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13325 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13328 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13329 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13335 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13336 /// but with all dynamically-allocated buffers duplicated in new buffers.
13337 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13339 /// The contents of CResult_ShutdownDecodeErrorZ
13340 pub union CResult_ShutdownDecodeErrorZPtr {
13341 /// A pointer to the contents in the success state.
13342 /// Reading from this pointer when `result_ok` is not set is undefined.
13343 pub result: *mut crate::lightning::ln::msgs::Shutdown,
13344 /// A pointer to the contents in the error state.
13345 /// Reading from this pointer when `result_ok` is set is undefined.
13346 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13349 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13350 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13352 pub struct CResult_ShutdownDecodeErrorZ {
13353 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13354 /// `err` or `result` depending on the state of `result_ok`.
13355 pub contents: CResult_ShutdownDecodeErrorZPtr,
13356 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13357 pub result_ok: bool,
13360 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13361 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13362 CResult_ShutdownDecodeErrorZ {
13363 contents: CResult_ShutdownDecodeErrorZPtr {
13364 result: Box::into_raw(Box::new(o)),
13370 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13371 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13372 CResult_ShutdownDecodeErrorZ {
13373 contents: CResult_ShutdownDecodeErrorZPtr {
13374 err: Box::into_raw(Box::new(e)),
13379 /// Checks if the given object is currently in the success state
13381 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13385 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13386 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13387 impl Drop for CResult_ShutdownDecodeErrorZ {
13388 fn drop(&mut self) {
13389 if self.result_ok {
13390 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13391 let _ = unsafe { Box::from_raw(self.contents.result) };
13394 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13395 let _ = unsafe { Box::from_raw(self.contents.err) };
13400 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13401 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13402 let contents = if o.result_ok {
13403 let result = unsafe { o.contents.result };
13404 unsafe { o.contents.result = core::ptr::null_mut() };
13405 CResult_ShutdownDecodeErrorZPtr { result }
13407 let err = unsafe { o.contents.err };
13408 unsafe { o.contents.err = core::ptr::null_mut(); }
13409 CResult_ShutdownDecodeErrorZPtr { err }
13413 result_ok: o.result_ok,
13417 impl Clone for CResult_ShutdownDecodeErrorZ {
13418 fn clone(&self) -> Self {
13419 if self.result_ok {
13420 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13421 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13424 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13425 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13431 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13432 /// but with all dynamically-allocated buffers duplicated in new buffers.
13433 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13435 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13436 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13437 /// A pointer to the contents in the success state.
13438 /// Reading from this pointer when `result_ok` is not set is undefined.
13439 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13440 /// A pointer to the contents in the error state.
13441 /// Reading from this pointer when `result_ok` is set is undefined.
13442 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13445 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13446 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13448 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13449 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13450 /// `err` or `result` depending on the state of `result_ok`.
13451 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13452 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13453 pub result_ok: bool,
13456 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13457 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13458 CResult_UpdateFailHTLCDecodeErrorZ {
13459 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13460 result: Box::into_raw(Box::new(o)),
13466 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13467 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13468 CResult_UpdateFailHTLCDecodeErrorZ {
13469 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13470 err: Box::into_raw(Box::new(e)),
13475 /// Checks if the given object is currently in the success state
13477 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13481 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13482 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13483 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13484 fn drop(&mut self) {
13485 if self.result_ok {
13486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13487 let _ = unsafe { Box::from_raw(self.contents.result) };
13490 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13491 let _ = unsafe { Box::from_raw(self.contents.err) };
13496 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13497 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13498 let contents = if o.result_ok {
13499 let result = unsafe { o.contents.result };
13500 unsafe { o.contents.result = core::ptr::null_mut() };
13501 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13503 let err = unsafe { o.contents.err };
13504 unsafe { o.contents.err = core::ptr::null_mut(); }
13505 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13509 result_ok: o.result_ok,
13513 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13514 fn clone(&self) -> Self {
13515 if self.result_ok {
13516 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13517 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13520 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13521 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13527 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13528 /// but with all dynamically-allocated buffers duplicated in new buffers.
13529 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13531 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13532 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13533 /// A pointer to the contents in the success state.
13534 /// Reading from this pointer when `result_ok` is not set is undefined.
13535 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13536 /// A pointer to the contents in the error state.
13537 /// Reading from this pointer when `result_ok` is set is undefined.
13538 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13541 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13542 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13544 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13545 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13546 /// `err` or `result` depending on the state of `result_ok`.
13547 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13548 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13549 pub result_ok: bool,
13552 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13553 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13554 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13555 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13556 result: Box::into_raw(Box::new(o)),
13562 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13563 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13564 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13565 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13566 err: Box::into_raw(Box::new(e)),
13571 /// Checks if the given object is currently in the success state
13573 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13577 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13578 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13579 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13580 fn drop(&mut self) {
13581 if self.result_ok {
13582 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13583 let _ = unsafe { Box::from_raw(self.contents.result) };
13586 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13587 let _ = unsafe { Box::from_raw(self.contents.err) };
13592 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13593 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13594 let contents = if o.result_ok {
13595 let result = unsafe { o.contents.result };
13596 unsafe { o.contents.result = core::ptr::null_mut() };
13597 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13599 let err = unsafe { o.contents.err };
13600 unsafe { o.contents.err = core::ptr::null_mut(); }
13601 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13605 result_ok: o.result_ok,
13609 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13610 fn clone(&self) -> Self {
13611 if self.result_ok {
13612 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13613 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13616 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13617 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13623 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13624 /// but with all dynamically-allocated buffers duplicated in new buffers.
13625 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13627 /// The contents of CResult_UpdateFeeDecodeErrorZ
13628 pub union CResult_UpdateFeeDecodeErrorZPtr {
13629 /// A pointer to the contents in the success state.
13630 /// Reading from this pointer when `result_ok` is not set is undefined.
13631 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13632 /// A pointer to the contents in the error state.
13633 /// Reading from this pointer when `result_ok` is set is undefined.
13634 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13637 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13638 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13640 pub struct CResult_UpdateFeeDecodeErrorZ {
13641 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13642 /// `err` or `result` depending on the state of `result_ok`.
13643 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13644 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13645 pub result_ok: bool,
13648 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13649 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13650 CResult_UpdateFeeDecodeErrorZ {
13651 contents: CResult_UpdateFeeDecodeErrorZPtr {
13652 result: Box::into_raw(Box::new(o)),
13658 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13659 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13660 CResult_UpdateFeeDecodeErrorZ {
13661 contents: CResult_UpdateFeeDecodeErrorZPtr {
13662 err: Box::into_raw(Box::new(e)),
13667 /// Checks if the given object is currently in the success state
13669 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13673 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13674 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13675 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13676 fn drop(&mut self) {
13677 if self.result_ok {
13678 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13679 let _ = unsafe { Box::from_raw(self.contents.result) };
13682 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13683 let _ = unsafe { Box::from_raw(self.contents.err) };
13688 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13689 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13690 let contents = if o.result_ok {
13691 let result = unsafe { o.contents.result };
13692 unsafe { o.contents.result = core::ptr::null_mut() };
13693 CResult_UpdateFeeDecodeErrorZPtr { result }
13695 let err = unsafe { o.contents.err };
13696 unsafe { o.contents.err = core::ptr::null_mut(); }
13697 CResult_UpdateFeeDecodeErrorZPtr { err }
13701 result_ok: o.result_ok,
13705 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13706 fn clone(&self) -> Self {
13707 if self.result_ok {
13708 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13709 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13712 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13713 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13719 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13720 /// but with all dynamically-allocated buffers duplicated in new buffers.
13721 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13723 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13724 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13725 /// A pointer to the contents in the success state.
13726 /// Reading from this pointer when `result_ok` is not set is undefined.
13727 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13728 /// A pointer to the contents in the error state.
13729 /// Reading from this pointer when `result_ok` is set is undefined.
13730 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13733 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13734 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13736 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13737 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13738 /// `err` or `result` depending on the state of `result_ok`.
13739 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13740 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13741 pub result_ok: bool,
13744 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13745 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13746 CResult_UpdateFulfillHTLCDecodeErrorZ {
13747 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13748 result: Box::into_raw(Box::new(o)),
13754 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13755 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13756 CResult_UpdateFulfillHTLCDecodeErrorZ {
13757 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13758 err: Box::into_raw(Box::new(e)),
13763 /// Checks if the given object is currently in the success state
13765 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13769 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13770 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13771 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13772 fn drop(&mut self) {
13773 if self.result_ok {
13774 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13775 let _ = unsafe { Box::from_raw(self.contents.result) };
13778 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13779 let _ = unsafe { Box::from_raw(self.contents.err) };
13784 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13785 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13786 let contents = if o.result_ok {
13787 let result = unsafe { o.contents.result };
13788 unsafe { o.contents.result = core::ptr::null_mut() };
13789 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13791 let err = unsafe { o.contents.err };
13792 unsafe { o.contents.err = core::ptr::null_mut(); }
13793 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13797 result_ok: o.result_ok,
13801 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13802 fn clone(&self) -> Self {
13803 if self.result_ok {
13804 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13805 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13808 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13809 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13815 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13816 /// but with all dynamically-allocated buffers duplicated in new buffers.
13817 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13819 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13820 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13821 /// A pointer to the contents in the success state.
13822 /// Reading from this pointer when `result_ok` is not set is undefined.
13823 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13824 /// A pointer to the contents in the error state.
13825 /// Reading from this pointer when `result_ok` is set is undefined.
13826 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13829 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13830 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13832 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13833 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13834 /// `err` or `result` depending on the state of `result_ok`.
13835 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13836 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13837 pub result_ok: bool,
13840 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13841 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13842 CResult_UpdateAddHTLCDecodeErrorZ {
13843 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13844 result: Box::into_raw(Box::new(o)),
13850 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13851 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13852 CResult_UpdateAddHTLCDecodeErrorZ {
13853 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13854 err: Box::into_raw(Box::new(e)),
13859 /// Checks if the given object is currently in the success state
13861 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13865 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13866 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13867 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13868 fn drop(&mut self) {
13869 if self.result_ok {
13870 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13871 let _ = unsafe { Box::from_raw(self.contents.result) };
13874 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13875 let _ = unsafe { Box::from_raw(self.contents.err) };
13880 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13881 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13882 let contents = if o.result_ok {
13883 let result = unsafe { o.contents.result };
13884 unsafe { o.contents.result = core::ptr::null_mut() };
13885 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13887 let err = unsafe { o.contents.err };
13888 unsafe { o.contents.err = core::ptr::null_mut(); }
13889 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13893 result_ok: o.result_ok,
13897 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13898 fn clone(&self) -> Self {
13899 if self.result_ok {
13900 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13901 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13904 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13905 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13911 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13912 /// but with all dynamically-allocated buffers duplicated in new buffers.
13913 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13915 /// The contents of CResult_PingDecodeErrorZ
13916 pub union CResult_PingDecodeErrorZPtr {
13917 /// A pointer to the contents in the success state.
13918 /// Reading from this pointer when `result_ok` is not set is undefined.
13919 pub result: *mut crate::lightning::ln::msgs::Ping,
13920 /// A pointer to the contents in the error state.
13921 /// Reading from this pointer when `result_ok` is set is undefined.
13922 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13925 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13926 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13928 pub struct CResult_PingDecodeErrorZ {
13929 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13930 /// `err` or `result` depending on the state of `result_ok`.
13931 pub contents: CResult_PingDecodeErrorZPtr,
13932 /// Whether this CResult_PingDecodeErrorZ represents a success state.
13933 pub result_ok: bool,
13936 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13937 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13938 CResult_PingDecodeErrorZ {
13939 contents: CResult_PingDecodeErrorZPtr {
13940 result: Box::into_raw(Box::new(o)),
13946 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13947 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13948 CResult_PingDecodeErrorZ {
13949 contents: CResult_PingDecodeErrorZPtr {
13950 err: Box::into_raw(Box::new(e)),
13955 /// Checks if the given object is currently in the success state
13957 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13961 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13962 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13963 impl Drop for CResult_PingDecodeErrorZ {
13964 fn drop(&mut self) {
13965 if self.result_ok {
13966 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13967 let _ = unsafe { Box::from_raw(self.contents.result) };
13970 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13971 let _ = unsafe { Box::from_raw(self.contents.err) };
13976 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13977 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13978 let contents = if o.result_ok {
13979 let result = unsafe { o.contents.result };
13980 unsafe { o.contents.result = core::ptr::null_mut() };
13981 CResult_PingDecodeErrorZPtr { result }
13983 let err = unsafe { o.contents.err };
13984 unsafe { o.contents.err = core::ptr::null_mut(); }
13985 CResult_PingDecodeErrorZPtr { err }
13989 result_ok: o.result_ok,
13993 impl Clone for CResult_PingDecodeErrorZ {
13994 fn clone(&self) -> Self {
13995 if self.result_ok {
13996 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13997 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
14000 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
14001 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14007 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
14008 /// but with all dynamically-allocated buffers duplicated in new buffers.
14009 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
14011 /// The contents of CResult_PongDecodeErrorZ
14012 pub union CResult_PongDecodeErrorZPtr {
14013 /// A pointer to the contents in the success state.
14014 /// Reading from this pointer when `result_ok` is not set is undefined.
14015 pub result: *mut crate::lightning::ln::msgs::Pong,
14016 /// A pointer to the contents in the error state.
14017 /// Reading from this pointer when `result_ok` is set is undefined.
14018 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14021 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
14022 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
14023 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14024 pub struct CResult_PongDecodeErrorZ {
14025 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
14026 /// `err` or `result` depending on the state of `result_ok`.
14027 pub contents: CResult_PongDecodeErrorZPtr,
14028 /// Whether this CResult_PongDecodeErrorZ represents a success state.
14029 pub result_ok: bool,
14032 /// Creates a new CResult_PongDecodeErrorZ in the success state.
14033 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
14034 CResult_PongDecodeErrorZ {
14035 contents: CResult_PongDecodeErrorZPtr {
14036 result: Box::into_raw(Box::new(o)),
14042 /// Creates a new CResult_PongDecodeErrorZ in the error state.
14043 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
14044 CResult_PongDecodeErrorZ {
14045 contents: CResult_PongDecodeErrorZPtr {
14046 err: Box::into_raw(Box::new(e)),
14051 /// Checks if the given object is currently in the success state
14053 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
14057 /// Frees any resources used by the CResult_PongDecodeErrorZ.
14058 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
14059 impl Drop for CResult_PongDecodeErrorZ {
14060 fn drop(&mut self) {
14061 if self.result_ok {
14062 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14063 let _ = unsafe { Box::from_raw(self.contents.result) };
14066 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14067 let _ = unsafe { Box::from_raw(self.contents.err) };
14072 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
14073 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
14074 let contents = if o.result_ok {
14075 let result = unsafe { o.contents.result };
14076 unsafe { o.contents.result = core::ptr::null_mut() };
14077 CResult_PongDecodeErrorZPtr { result }
14079 let err = unsafe { o.contents.err };
14080 unsafe { o.contents.err = core::ptr::null_mut(); }
14081 CResult_PongDecodeErrorZPtr { err }
14085 result_ok: o.result_ok,
14089 impl Clone for CResult_PongDecodeErrorZ {
14090 fn clone(&self) -> Self {
14091 if self.result_ok {
14092 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
14093 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
14096 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
14097 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14103 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
14104 /// but with all dynamically-allocated buffers duplicated in new buffers.
14105 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
14107 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
14108 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14109 /// A pointer to the contents in the success state.
14110 /// Reading from this pointer when `result_ok` is not set is undefined.
14111 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
14112 /// A pointer to the contents in the error state.
14113 /// Reading from this pointer when `result_ok` is set is undefined.
14114 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14117 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14118 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14119 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14120 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14121 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
14122 /// `err` or `result` depending on the state of `result_ok`.
14123 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
14124 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
14125 pub result_ok: bool,
14128 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
14129 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14130 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14131 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14132 result: Box::into_raw(Box::new(o)),
14138 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
14139 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14140 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14141 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14142 err: Box::into_raw(Box::new(e)),
14147 /// Checks if the given object is currently in the success state
14149 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
14153 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
14154 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
14155 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14156 fn drop(&mut self) {
14157 if self.result_ok {
14158 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14159 let _ = unsafe { Box::from_raw(self.contents.result) };
14162 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14163 let _ = unsafe { Box::from_raw(self.contents.err) };
14168 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14169 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14170 let contents = if o.result_ok {
14171 let result = unsafe { o.contents.result };
14172 unsafe { o.contents.result = core::ptr::null_mut() };
14173 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
14175 let err = unsafe { o.contents.err };
14176 unsafe { o.contents.err = core::ptr::null_mut(); }
14177 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14181 result_ok: o.result_ok,
14185 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14186 fn clone(&self) -> Self {
14187 if self.result_ok {
14188 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14189 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14192 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14193 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14199 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14200 /// but with all dynamically-allocated buffers duplicated in new buffers.
14201 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14203 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14204 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14205 /// A pointer to the contents in the success state.
14206 /// Reading from this pointer when `result_ok` is not set is undefined.
14207 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14208 /// A pointer to the contents in the error state.
14209 /// Reading from this pointer when `result_ok` is set is undefined.
14210 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14213 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14214 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14215 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14216 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14217 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14218 /// `err` or `result` depending on the state of `result_ok`.
14219 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14220 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14221 pub result_ok: bool,
14224 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14225 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14226 CResult_ChannelAnnouncementDecodeErrorZ {
14227 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14228 result: Box::into_raw(Box::new(o)),
14234 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14235 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14236 CResult_ChannelAnnouncementDecodeErrorZ {
14237 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14238 err: Box::into_raw(Box::new(e)),
14243 /// Checks if the given object is currently in the success state
14245 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14249 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14250 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14251 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14252 fn drop(&mut self) {
14253 if self.result_ok {
14254 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14255 let _ = unsafe { Box::from_raw(self.contents.result) };
14258 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14259 let _ = unsafe { Box::from_raw(self.contents.err) };
14264 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14265 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14266 let contents = if o.result_ok {
14267 let result = unsafe { o.contents.result };
14268 unsafe { o.contents.result = core::ptr::null_mut() };
14269 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14271 let err = unsafe { o.contents.err };
14272 unsafe { o.contents.err = core::ptr::null_mut(); }
14273 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14277 result_ok: o.result_ok,
14281 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14282 fn clone(&self) -> Self {
14283 if self.result_ok {
14284 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14285 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14288 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14289 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14295 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14296 /// but with all dynamically-allocated buffers duplicated in new buffers.
14297 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14299 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14300 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14301 /// A pointer to the contents in the success state.
14302 /// Reading from this pointer when `result_ok` is not set is undefined.
14303 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14304 /// A pointer to the contents in the error state.
14305 /// Reading from this pointer when `result_ok` is set is undefined.
14306 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14309 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14310 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14311 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14312 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14313 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14314 /// `err` or `result` depending on the state of `result_ok`.
14315 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14316 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14317 pub result_ok: bool,
14320 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14321 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14322 CResult_UnsignedChannelUpdateDecodeErrorZ {
14323 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14324 result: Box::into_raw(Box::new(o)),
14330 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14331 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14332 CResult_UnsignedChannelUpdateDecodeErrorZ {
14333 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14334 err: Box::into_raw(Box::new(e)),
14339 /// Checks if the given object is currently in the success state
14341 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14345 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14346 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14347 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14348 fn drop(&mut self) {
14349 if self.result_ok {
14350 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14351 let _ = unsafe { Box::from_raw(self.contents.result) };
14354 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14355 let _ = unsafe { Box::from_raw(self.contents.err) };
14360 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14361 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14362 let contents = if o.result_ok {
14363 let result = unsafe { o.contents.result };
14364 unsafe { o.contents.result = core::ptr::null_mut() };
14365 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14367 let err = unsafe { o.contents.err };
14368 unsafe { o.contents.err = core::ptr::null_mut(); }
14369 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14373 result_ok: o.result_ok,
14377 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14378 fn clone(&self) -> Self {
14379 if self.result_ok {
14380 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14381 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14384 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14385 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14391 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14392 /// but with all dynamically-allocated buffers duplicated in new buffers.
14393 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14395 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14396 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14397 /// A pointer to the contents in the success state.
14398 /// Reading from this pointer when `result_ok` is not set is undefined.
14399 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14400 /// A pointer to the contents in the error state.
14401 /// Reading from this pointer when `result_ok` is set is undefined.
14402 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14405 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14406 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14408 pub struct CResult_ChannelUpdateDecodeErrorZ {
14409 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14410 /// `err` or `result` depending on the state of `result_ok`.
14411 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14412 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14413 pub result_ok: bool,
14416 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14417 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14418 CResult_ChannelUpdateDecodeErrorZ {
14419 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14420 result: Box::into_raw(Box::new(o)),
14426 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14427 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14428 CResult_ChannelUpdateDecodeErrorZ {
14429 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14430 err: Box::into_raw(Box::new(e)),
14435 /// Checks if the given object is currently in the success state
14437 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14441 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14442 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14443 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14444 fn drop(&mut self) {
14445 if self.result_ok {
14446 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14447 let _ = unsafe { Box::from_raw(self.contents.result) };
14450 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14451 let _ = unsafe { Box::from_raw(self.contents.err) };
14456 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14457 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14458 let contents = if o.result_ok {
14459 let result = unsafe { o.contents.result };
14460 unsafe { o.contents.result = core::ptr::null_mut() };
14461 CResult_ChannelUpdateDecodeErrorZPtr { result }
14463 let err = unsafe { o.contents.err };
14464 unsafe { o.contents.err = core::ptr::null_mut(); }
14465 CResult_ChannelUpdateDecodeErrorZPtr { err }
14469 result_ok: o.result_ok,
14473 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14474 fn clone(&self) -> Self {
14475 if self.result_ok {
14476 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14477 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14480 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14481 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14487 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14488 /// but with all dynamically-allocated buffers duplicated in new buffers.
14489 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14491 /// The contents of CResult_ErrorMessageDecodeErrorZ
14492 pub union CResult_ErrorMessageDecodeErrorZPtr {
14493 /// A pointer to the contents in the success state.
14494 /// Reading from this pointer when `result_ok` is not set is undefined.
14495 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14496 /// A pointer to the contents in the error state.
14497 /// Reading from this pointer when `result_ok` is set is undefined.
14498 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14501 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14502 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14504 pub struct CResult_ErrorMessageDecodeErrorZ {
14505 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14506 /// `err` or `result` depending on the state of `result_ok`.
14507 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14508 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14509 pub result_ok: bool,
14512 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14513 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14514 CResult_ErrorMessageDecodeErrorZ {
14515 contents: CResult_ErrorMessageDecodeErrorZPtr {
14516 result: Box::into_raw(Box::new(o)),
14522 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14523 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14524 CResult_ErrorMessageDecodeErrorZ {
14525 contents: CResult_ErrorMessageDecodeErrorZPtr {
14526 err: Box::into_raw(Box::new(e)),
14531 /// Checks if the given object is currently in the success state
14533 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14537 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14538 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14539 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14540 fn drop(&mut self) {
14541 if self.result_ok {
14542 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14543 let _ = unsafe { Box::from_raw(self.contents.result) };
14546 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14547 let _ = unsafe { Box::from_raw(self.contents.err) };
14552 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14553 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14554 let contents = if o.result_ok {
14555 let result = unsafe { o.contents.result };
14556 unsafe { o.contents.result = core::ptr::null_mut() };
14557 CResult_ErrorMessageDecodeErrorZPtr { result }
14559 let err = unsafe { o.contents.err };
14560 unsafe { o.contents.err = core::ptr::null_mut(); }
14561 CResult_ErrorMessageDecodeErrorZPtr { err }
14565 result_ok: o.result_ok,
14569 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14570 fn clone(&self) -> Self {
14571 if self.result_ok {
14572 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14573 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14576 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14577 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14583 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14584 /// but with all dynamically-allocated buffers duplicated in new buffers.
14585 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14587 /// The contents of CResult_WarningMessageDecodeErrorZ
14588 pub union CResult_WarningMessageDecodeErrorZPtr {
14589 /// A pointer to the contents in the success state.
14590 /// Reading from this pointer when `result_ok` is not set is undefined.
14591 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14592 /// A pointer to the contents in the error state.
14593 /// Reading from this pointer when `result_ok` is set is undefined.
14594 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14597 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14598 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14600 pub struct CResult_WarningMessageDecodeErrorZ {
14601 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14602 /// `err` or `result` depending on the state of `result_ok`.
14603 pub contents: CResult_WarningMessageDecodeErrorZPtr,
14604 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14605 pub result_ok: bool,
14608 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14609 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14610 CResult_WarningMessageDecodeErrorZ {
14611 contents: CResult_WarningMessageDecodeErrorZPtr {
14612 result: Box::into_raw(Box::new(o)),
14618 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14619 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14620 CResult_WarningMessageDecodeErrorZ {
14621 contents: CResult_WarningMessageDecodeErrorZPtr {
14622 err: Box::into_raw(Box::new(e)),
14627 /// Checks if the given object is currently in the success state
14629 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14633 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14634 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14635 impl Drop for CResult_WarningMessageDecodeErrorZ {
14636 fn drop(&mut self) {
14637 if self.result_ok {
14638 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14639 let _ = unsafe { Box::from_raw(self.contents.result) };
14642 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14643 let _ = unsafe { Box::from_raw(self.contents.err) };
14648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14649 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14650 let contents = if o.result_ok {
14651 let result = unsafe { o.contents.result };
14652 unsafe { o.contents.result = core::ptr::null_mut() };
14653 CResult_WarningMessageDecodeErrorZPtr { result }
14655 let err = unsafe { o.contents.err };
14656 unsafe { o.contents.err = core::ptr::null_mut(); }
14657 CResult_WarningMessageDecodeErrorZPtr { err }
14661 result_ok: o.result_ok,
14665 impl Clone for CResult_WarningMessageDecodeErrorZ {
14666 fn clone(&self) -> Self {
14667 if self.result_ok {
14668 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14669 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14672 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14673 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14679 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14680 /// but with all dynamically-allocated buffers duplicated in new buffers.
14681 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14683 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14684 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14685 /// A pointer to the contents in the success state.
14686 /// Reading from this pointer when `result_ok` is not set is undefined.
14687 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14688 /// A pointer to the contents in the error state.
14689 /// Reading from this pointer when `result_ok` is set is undefined.
14690 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14693 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14694 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14696 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14697 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14698 /// `err` or `result` depending on the state of `result_ok`.
14699 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14700 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14701 pub result_ok: bool,
14704 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14705 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14706 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14707 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14708 result: Box::into_raw(Box::new(o)),
14714 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14715 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14716 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14717 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14718 err: Box::into_raw(Box::new(e)),
14723 /// Checks if the given object is currently in the success state
14725 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14729 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14730 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14731 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14732 fn drop(&mut self) {
14733 if self.result_ok {
14734 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14735 let _ = unsafe { Box::from_raw(self.contents.result) };
14738 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14739 let _ = unsafe { Box::from_raw(self.contents.err) };
14744 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14745 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14746 let contents = if o.result_ok {
14747 let result = unsafe { o.contents.result };
14748 unsafe { o.contents.result = core::ptr::null_mut() };
14749 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14751 let err = unsafe { o.contents.err };
14752 unsafe { o.contents.err = core::ptr::null_mut(); }
14753 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14757 result_ok: o.result_ok,
14761 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14762 fn clone(&self) -> Self {
14763 if self.result_ok {
14764 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14765 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14768 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14769 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14775 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14776 /// but with all dynamically-allocated buffers duplicated in new buffers.
14777 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14779 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14780 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14781 /// A pointer to the contents in the success state.
14782 /// Reading from this pointer when `result_ok` is not set is undefined.
14783 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14784 /// A pointer to the contents in the error state.
14785 /// Reading from this pointer when `result_ok` is set is undefined.
14786 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14789 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14790 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14792 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14793 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14794 /// `err` or `result` depending on the state of `result_ok`.
14795 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14796 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14797 pub result_ok: bool,
14800 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14801 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14802 CResult_NodeAnnouncementDecodeErrorZ {
14803 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14804 result: Box::into_raw(Box::new(o)),
14810 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14811 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14812 CResult_NodeAnnouncementDecodeErrorZ {
14813 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14814 err: Box::into_raw(Box::new(e)),
14819 /// Checks if the given object is currently in the success state
14821 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14825 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14826 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14827 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14828 fn drop(&mut self) {
14829 if self.result_ok {
14830 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14831 let _ = unsafe { Box::from_raw(self.contents.result) };
14834 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14835 let _ = unsafe { Box::from_raw(self.contents.err) };
14840 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14841 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14842 let contents = if o.result_ok {
14843 let result = unsafe { o.contents.result };
14844 unsafe { o.contents.result = core::ptr::null_mut() };
14845 CResult_NodeAnnouncementDecodeErrorZPtr { result }
14847 let err = unsafe { o.contents.err };
14848 unsafe { o.contents.err = core::ptr::null_mut(); }
14849 CResult_NodeAnnouncementDecodeErrorZPtr { err }
14853 result_ok: o.result_ok,
14857 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14858 fn clone(&self) -> Self {
14859 if self.result_ok {
14860 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14861 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14864 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14865 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14871 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14872 /// but with all dynamically-allocated buffers duplicated in new buffers.
14873 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14875 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14876 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14877 /// A pointer to the contents in the success state.
14878 /// Reading from this pointer when `result_ok` is not set is undefined.
14879 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14880 /// A pointer to the contents in the error state.
14881 /// Reading from this pointer when `result_ok` is set is undefined.
14882 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14885 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14886 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14888 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14889 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14890 /// `err` or `result` depending on the state of `result_ok`.
14891 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14892 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14893 pub result_ok: bool,
14896 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14897 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14898 CResult_QueryShortChannelIdsDecodeErrorZ {
14899 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14900 result: Box::into_raw(Box::new(o)),
14906 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14907 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14908 CResult_QueryShortChannelIdsDecodeErrorZ {
14909 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14910 err: Box::into_raw(Box::new(e)),
14915 /// Checks if the given object is currently in the success state
14917 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14921 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14922 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14923 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14924 fn drop(&mut self) {
14925 if self.result_ok {
14926 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14927 let _ = unsafe { Box::from_raw(self.contents.result) };
14930 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14931 let _ = unsafe { Box::from_raw(self.contents.err) };
14936 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14937 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14938 let contents = if o.result_ok {
14939 let result = unsafe { o.contents.result };
14940 unsafe { o.contents.result = core::ptr::null_mut() };
14941 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14943 let err = unsafe { o.contents.err };
14944 unsafe { o.contents.err = core::ptr::null_mut(); }
14945 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14949 result_ok: o.result_ok,
14953 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14954 fn clone(&self) -> Self {
14955 if self.result_ok {
14956 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14957 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14960 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14961 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14967 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14968 /// but with all dynamically-allocated buffers duplicated in new buffers.
14969 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14971 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14972 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14973 /// A pointer to the contents in the success state.
14974 /// Reading from this pointer when `result_ok` is not set is undefined.
14975 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14976 /// A pointer to the contents in the error state.
14977 /// Reading from this pointer when `result_ok` is set is undefined.
14978 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14981 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14982 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14984 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14985 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14986 /// `err` or `result` depending on the state of `result_ok`.
14987 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14988 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14989 pub result_ok: bool,
14992 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14993 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14994 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14995 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14996 result: Box::into_raw(Box::new(o)),
15002 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
15003 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15004 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15005 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15006 err: Box::into_raw(Box::new(e)),
15011 /// Checks if the given object is currently in the success state
15013 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
15017 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
15018 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
15019 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15020 fn drop(&mut self) {
15021 if self.result_ok {
15022 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15023 let _ = unsafe { Box::from_raw(self.contents.result) };
15026 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15027 let _ = unsafe { Box::from_raw(self.contents.err) };
15032 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15033 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
15034 let contents = if o.result_ok {
15035 let result = unsafe { o.contents.result };
15036 unsafe { o.contents.result = core::ptr::null_mut() };
15037 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
15039 let err = unsafe { o.contents.err };
15040 unsafe { o.contents.err = core::ptr::null_mut(); }
15041 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
15045 result_ok: o.result_ok,
15049 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15050 fn clone(&self) -> Self {
15051 if self.result_ok {
15052 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15053 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
15056 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15057 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15063 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15064 /// but with all dynamically-allocated buffers duplicated in new buffers.
15065 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
15067 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
15068 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
15069 /// A pointer to the contents in the success state.
15070 /// Reading from this pointer when `result_ok` is not set is undefined.
15071 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
15072 /// A pointer to the contents in the error state.
15073 /// Reading from this pointer when `result_ok` is set is undefined.
15074 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15077 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
15078 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15079 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15080 pub struct CResult_QueryChannelRangeDecodeErrorZ {
15081 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
15082 /// `err` or `result` depending on the state of `result_ok`.
15083 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
15084 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
15085 pub result_ok: bool,
15088 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
15089 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
15090 CResult_QueryChannelRangeDecodeErrorZ {
15091 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15092 result: Box::into_raw(Box::new(o)),
15098 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
15099 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
15100 CResult_QueryChannelRangeDecodeErrorZ {
15101 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15102 err: Box::into_raw(Box::new(e)),
15107 /// Checks if the given object is currently in the success state
15109 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
15113 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
15114 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
15115 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
15116 fn drop(&mut self) {
15117 if self.result_ok {
15118 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15119 let _ = unsafe { Box::from_raw(self.contents.result) };
15122 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15123 let _ = unsafe { Box::from_raw(self.contents.err) };
15128 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
15129 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15130 let contents = if o.result_ok {
15131 let result = unsafe { o.contents.result };
15132 unsafe { o.contents.result = core::ptr::null_mut() };
15133 CResult_QueryChannelRangeDecodeErrorZPtr { result }
15135 let err = unsafe { o.contents.err };
15136 unsafe { o.contents.err = core::ptr::null_mut(); }
15137 CResult_QueryChannelRangeDecodeErrorZPtr { err }
15141 result_ok: o.result_ok,
15145 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
15146 fn clone(&self) -> Self {
15147 if self.result_ok {
15148 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15149 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
15152 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15153 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15159 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
15160 /// but with all dynamically-allocated buffers duplicated in new buffers.
15161 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15163 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
15164 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
15165 /// A pointer to the contents in the success state.
15166 /// Reading from this pointer when `result_ok` is not set is undefined.
15167 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
15168 /// A pointer to the contents in the error state.
15169 /// Reading from this pointer when `result_ok` is set is undefined.
15170 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15173 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
15174 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15175 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15176 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
15177 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
15178 /// `err` or `result` depending on the state of `result_ok`.
15179 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15180 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15181 pub result_ok: bool,
15184 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15185 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15186 CResult_ReplyChannelRangeDecodeErrorZ {
15187 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15188 result: Box::into_raw(Box::new(o)),
15194 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15195 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15196 CResult_ReplyChannelRangeDecodeErrorZ {
15197 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15198 err: Box::into_raw(Box::new(e)),
15203 /// Checks if the given object is currently in the success state
15205 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15209 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15210 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15211 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15212 fn drop(&mut self) {
15213 if self.result_ok {
15214 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15215 let _ = unsafe { Box::from_raw(self.contents.result) };
15218 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15219 let _ = unsafe { Box::from_raw(self.contents.err) };
15224 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15225 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15226 let contents = if o.result_ok {
15227 let result = unsafe { o.contents.result };
15228 unsafe { o.contents.result = core::ptr::null_mut() };
15229 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15231 let err = unsafe { o.contents.err };
15232 unsafe { o.contents.err = core::ptr::null_mut(); }
15233 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15237 result_ok: o.result_ok,
15241 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15242 fn clone(&self) -> Self {
15243 if self.result_ok {
15244 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15245 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15248 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15249 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15255 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15256 /// but with all dynamically-allocated buffers duplicated in new buffers.
15257 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15259 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15260 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15261 /// A pointer to the contents in the success state.
15262 /// Reading from this pointer when `result_ok` is not set is undefined.
15263 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15264 /// A pointer to the contents in the error state.
15265 /// Reading from this pointer when `result_ok` is set is undefined.
15266 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15269 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15270 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15271 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15272 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15273 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15274 /// `err` or `result` depending on the state of `result_ok`.
15275 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15276 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15277 pub result_ok: bool,
15280 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15281 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15282 CResult_GossipTimestampFilterDecodeErrorZ {
15283 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15284 result: Box::into_raw(Box::new(o)),
15290 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15291 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15292 CResult_GossipTimestampFilterDecodeErrorZ {
15293 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15294 err: Box::into_raw(Box::new(e)),
15299 /// Checks if the given object is currently in the success state
15301 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15305 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15306 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15307 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15308 fn drop(&mut self) {
15309 if self.result_ok {
15310 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15311 let _ = unsafe { Box::from_raw(self.contents.result) };
15314 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15315 let _ = unsafe { Box::from_raw(self.contents.err) };
15320 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15321 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15322 let contents = if o.result_ok {
15323 let result = unsafe { o.contents.result };
15324 unsafe { o.contents.result = core::ptr::null_mut() };
15325 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15327 let err = unsafe { o.contents.err };
15328 unsafe { o.contents.err = core::ptr::null_mut(); }
15329 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15333 result_ok: o.result_ok,
15337 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15338 fn clone(&self) -> Self {
15339 if self.result_ok {
15340 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15341 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15344 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15345 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15351 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15352 /// but with all dynamically-allocated buffers duplicated in new buffers.
15353 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15355 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15356 /// This corresponds to std::vector in C++
15357 pub struct CVec_PhantomRouteHintsZ {
15358 /// The elements in the array.
15359 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15360 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15361 /// The number of elements pointed to by `data`.
15364 impl CVec_PhantomRouteHintsZ {
15365 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15366 if self.datalen == 0 { return Vec::new(); }
15367 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15368 self.data = core::ptr::null_mut();
15372 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15373 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15376 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15377 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15378 let datalen = v.len();
15379 let data = Box::into_raw(v.into_boxed_slice());
15380 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15384 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15385 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15386 impl Drop for CVec_PhantomRouteHintsZ {
15387 fn drop(&mut self) {
15388 if self.datalen == 0 { return; }
15389 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15392 impl Clone for CVec_PhantomRouteHintsZ {
15393 fn clone(&self) -> Self {
15394 let mut res = Vec::new();
15395 if self.datalen == 0 { return Self::from(res); }
15396 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15401 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15402 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15403 /// A pointer to the contents in the success state.
15404 /// Reading from this pointer when `result_ok` is not set is undefined.
15405 pub result: *mut crate::lightning_invoice::Invoice,
15406 /// A pointer to the contents in the error state.
15407 /// Reading from this pointer when `result_ok` is set is undefined.
15408 pub err: *mut crate::lightning_invoice::SignOrCreationError,
15411 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15412 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15414 pub struct CResult_InvoiceSignOrCreationErrorZ {
15415 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15416 /// `err` or `result` depending on the state of `result_ok`.
15417 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15418 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15419 pub result_ok: bool,
15422 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15423 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15424 CResult_InvoiceSignOrCreationErrorZ {
15425 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15426 result: Box::into_raw(Box::new(o)),
15432 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15433 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15434 CResult_InvoiceSignOrCreationErrorZ {
15435 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15436 err: Box::into_raw(Box::new(e)),
15441 /// Checks if the given object is currently in the success state
15443 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15447 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15448 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15449 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15450 fn drop(&mut self) {
15451 if self.result_ok {
15452 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15453 let _ = unsafe { Box::from_raw(self.contents.result) };
15456 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15457 let _ = unsafe { Box::from_raw(self.contents.err) };
15462 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15463 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15464 let contents = if o.result_ok {
15465 let result = unsafe { o.contents.result };
15466 unsafe { o.contents.result = core::ptr::null_mut() };
15467 CResult_InvoiceSignOrCreationErrorZPtr { result }
15469 let err = unsafe { o.contents.err };
15470 unsafe { o.contents.err = core::ptr::null_mut(); }
15471 CResult_InvoiceSignOrCreationErrorZPtr { err }
15475 result_ok: o.result_ok,
15479 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15480 fn clone(&self) -> Self {
15481 if self.result_ok {
15482 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15483 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15486 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15487 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15493 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15494 /// but with all dynamically-allocated buffers duplicated in new buffers.
15495 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15497 /// An enum which can either contain a crate::lightning::chain::Filter or not
15498 pub enum COption_FilterZ {
15499 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15500 Some(crate::lightning::chain::Filter),
15501 /// When we're in this state, this COption_FilterZ contains nothing
15504 impl COption_FilterZ {
15505 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15506 if let Self::None = self { false } else { true }
15508 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15511 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15512 if let Self::Some(v) = self { v } else { unreachable!() }
15516 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15517 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15518 COption_FilterZ::Some(o)
15521 /// Constructs a new COption_FilterZ containing nothing
15522 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15523 COption_FilterZ::None
15526 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15527 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15529 /// The contents of CResult_LockedChannelMonitorNoneZ
15530 pub union CResult_LockedChannelMonitorNoneZPtr {
15531 /// A pointer to the contents in the success state.
15532 /// Reading from this pointer when `result_ok` is not set is undefined.
15533 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15534 /// Note that this value is always NULL, as there are no contents in the Err variant
15535 pub err: *mut core::ffi::c_void,
15538 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15539 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15540 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15541 pub struct CResult_LockedChannelMonitorNoneZ {
15542 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15543 /// `err` or `result` depending on the state of `result_ok`.
15544 pub contents: CResult_LockedChannelMonitorNoneZPtr,
15545 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15546 pub result_ok: bool,
15549 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15550 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15551 CResult_LockedChannelMonitorNoneZ {
15552 contents: CResult_LockedChannelMonitorNoneZPtr {
15553 result: Box::into_raw(Box::new(o)),
15559 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15560 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15561 CResult_LockedChannelMonitorNoneZ {
15562 contents: CResult_LockedChannelMonitorNoneZPtr {
15563 err: core::ptr::null_mut(),
15568 /// Checks if the given object is currently in the success state
15570 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15574 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15575 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15576 impl Drop for CResult_LockedChannelMonitorNoneZ {
15577 fn drop(&mut self) {
15578 if self.result_ok {
15579 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15580 let _ = unsafe { Box::from_raw(self.contents.result) };
15586 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15587 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15588 let contents = if o.result_ok {
15589 let result = unsafe { o.contents.result };
15590 unsafe { o.contents.result = core::ptr::null_mut() };
15591 CResult_LockedChannelMonitorNoneZPtr { result }
15593 let _ = unsafe { Box::from_raw(o.contents.err) };
15594 o.contents.err = core::ptr::null_mut();
15595 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15599 result_ok: o.result_ok,
15604 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15605 /// This corresponds to std::vector in C++
15606 pub struct CVec_OutPointZ {
15607 /// The elements in the array.
15608 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15609 pub data: *mut crate::lightning::chain::transaction::OutPoint,
15610 /// The number of elements pointed to by `data`.
15613 impl CVec_OutPointZ {
15614 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15615 if self.datalen == 0 { return Vec::new(); }
15616 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15617 self.data = core::ptr::null_mut();
15621 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15622 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15625 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15626 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15627 let datalen = v.len();
15628 let data = Box::into_raw(v.into_boxed_slice());
15629 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15633 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15634 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15635 impl Drop for CVec_OutPointZ {
15636 fn drop(&mut self) {
15637 if self.datalen == 0 { return; }
15638 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15641 impl Clone for CVec_OutPointZ {
15642 fn clone(&self) -> Self {
15643 let mut res = Vec::new();
15644 if self.datalen == 0 { return Self::from(res); }
15645 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });