2 use alloc::str::FromStr;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
11 /// The contents of CResult_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13 /// Note that this value is always NULL, as there are no contents in the OK variant
14 pub result: *mut core::ffi::c_void,
15 /// Note that this value is always NULL, as there are no contents in the Err variant
16 pub err: *mut core::ffi::c_void,
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23 /// The contents of this CResult_NoneNoneZ, accessible via either
24 /// `err` or `result` depending on the state of `result_ok`.
25 pub contents: CResult_NoneNoneZPtr,
26 /// Whether this CResult_NoneNoneZ represents a success state.
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
33 contents: CResult_NoneNoneZPtr {
34 result: core::ptr::null_mut(),
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
43 contents: CResult_NoneNoneZPtr {
44 err: core::ptr::null_mut(),
49 /// Checks if the given object is currently in the success state
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65 fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66 let contents = if o.result_ok {
67 let _ = unsafe { Box::from_raw(o.contents.result) };
68 o.contents.result = core::ptr::null_mut();
69 CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
71 let _ = unsafe { Box::from_raw(o.contents.err) };
72 o.contents.err = core::ptr::null_mut();
73 CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
77 result_ok: o.result_ok,
81 impl Clone for CResult_NoneNoneZ {
82 fn clone(&self) -> Self {
84 Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85 result: core::ptr::null_mut()
88 Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89 err: core::ptr::null_mut()
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101 /// A pointer to the contents in the success state.
102 /// Reading from this pointer when `result_ok` is not set is undefined.
103 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104 /// A pointer to the contents in the error state.
105 /// Reading from this pointer when `result_ok` is set is undefined.
106 pub err: *mut crate::lightning::ln::msgs::DecodeError,
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113 /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114 /// `err` or `result` depending on the state of `result_ok`.
115 pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116 /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124 result: Box::into_raw(Box::new(o)),
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132 CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134 err: Box::into_raw(Box::new(e)),
139 /// Checks if the given object is currently in the success state
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
150 if unsafe { !(self.contents.result as *mut ()).is_null() } {
151 let _ = unsafe { Box::from_raw(self.contents.result) };
154 if unsafe { !(self.contents.err as *mut ()).is_null() } {
155 let _ = unsafe { Box::from_raw(self.contents.err) };
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162 let contents = if o.result_ok {
163 let result = unsafe { o.contents.result };
164 unsafe { o.contents.result = core::ptr::null_mut() };
165 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
167 let err = unsafe { o.contents.err };
168 unsafe { o.contents.err = core::ptr::null_mut(); }
169 CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
173 result_ok: o.result_ok,
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178 fn clone(&self) -> Self {
180 Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
184 Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197 /// A pointer to the contents in the success state.
198 /// Reading from this pointer when `result_ok` is not set is undefined.
199 pub result: *mut crate::c_types::SecretKey,
200 /// A pointer to the contents in the error state.
201 /// Reading from this pointer when `result_ok` is set is undefined.
202 pub err: *mut crate::c_types::Secp256k1Error,
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210 /// `err` or `result` depending on the state of `result_ok`.
211 pub contents: CResult_SecretKeyErrorZPtr,
212 /// Whether this CResult_SecretKeyErrorZ represents a success state.
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218 CResult_SecretKeyErrorZ {
219 contents: CResult_SecretKeyErrorZPtr {
220 result: Box::into_raw(Box::new(o)),
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228 CResult_SecretKeyErrorZ {
229 contents: CResult_SecretKeyErrorZPtr {
230 err: Box::into_raw(Box::new(e)),
235 /// Checks if the given object is currently in the success state
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
247 let _ = unsafe { Box::from_raw(self.contents.result) };
250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
251 let _ = unsafe { Box::from_raw(self.contents.err) };
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258 let contents = if o.result_ok {
259 let result = unsafe { o.contents.result };
260 unsafe { o.contents.result = core::ptr::null_mut() };
261 CResult_SecretKeyErrorZPtr { result }
263 let err = unsafe { o.contents.err };
264 unsafe { o.contents.err = core::ptr::null_mut(); }
265 CResult_SecretKeyErrorZPtr { err }
269 result_ok: o.result_ok,
273 impl Clone for CResult_SecretKeyErrorZ {
274 fn clone(&self) -> Self {
276 Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
280 Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293 /// A pointer to the contents in the success state.
294 /// Reading from this pointer when `result_ok` is not set is undefined.
295 pub result: *mut crate::c_types::PublicKey,
296 /// A pointer to the contents in the error state.
297 /// Reading from this pointer when `result_ok` is set is undefined.
298 pub err: *mut crate::c_types::Secp256k1Error,
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306 /// `err` or `result` depending on the state of `result_ok`.
307 pub contents: CResult_PublicKeyErrorZPtr,
308 /// Whether this CResult_PublicKeyErrorZ represents a success state.
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314 CResult_PublicKeyErrorZ {
315 contents: CResult_PublicKeyErrorZPtr {
316 result: Box::into_raw(Box::new(o)),
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324 CResult_PublicKeyErrorZ {
325 contents: CResult_PublicKeyErrorZPtr {
326 err: Box::into_raw(Box::new(e)),
331 /// Checks if the given object is currently in the success state
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
342 if unsafe { !(self.contents.result as *mut ()).is_null() } {
343 let _ = unsafe { Box::from_raw(self.contents.result) };
346 if unsafe { !(self.contents.err as *mut ()).is_null() } {
347 let _ = unsafe { Box::from_raw(self.contents.err) };
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354 let contents = if o.result_ok {
355 let result = unsafe { o.contents.result };
356 unsafe { o.contents.result = core::ptr::null_mut() };
357 CResult_PublicKeyErrorZPtr { result }
359 let err = unsafe { o.contents.err };
360 unsafe { o.contents.err = core::ptr::null_mut(); }
361 CResult_PublicKeyErrorZPtr { err }
365 result_ok: o.result_ok,
369 impl Clone for CResult_PublicKeyErrorZ {
370 fn clone(&self) -> Self {
372 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
376 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389 /// A pointer to the contents in the success state.
390 /// Reading from this pointer when `result_ok` is not set is undefined.
391 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392 /// A pointer to the contents in the error state.
393 /// Reading from this pointer when `result_ok` is set is undefined.
394 pub err: *mut crate::lightning::ln::msgs::DecodeError,
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402 /// `err` or `result` depending on the state of `result_ok`.
403 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410 CResult_TxCreationKeysDecodeErrorZ {
411 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412 result: Box::into_raw(Box::new(o)),
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420 CResult_TxCreationKeysDecodeErrorZ {
421 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422 err: Box::into_raw(Box::new(e)),
427 /// Checks if the given object is currently in the success state
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
438 if unsafe { !(self.contents.result as *mut ()).is_null() } {
439 let _ = unsafe { Box::from_raw(self.contents.result) };
442 if unsafe { !(self.contents.err as *mut ()).is_null() } {
443 let _ = unsafe { Box::from_raw(self.contents.err) };
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450 let contents = if o.result_ok {
451 let result = unsafe { o.contents.result };
452 unsafe { o.contents.result = core::ptr::null_mut() };
453 CResult_TxCreationKeysDecodeErrorZPtr { result }
455 let err = unsafe { o.contents.err };
456 unsafe { o.contents.err = core::ptr::null_mut(); }
457 CResult_TxCreationKeysDecodeErrorZPtr { err }
461 result_ok: o.result_ok,
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466 fn clone(&self) -> Self {
468 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
472 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485 /// A pointer to the contents in the success state.
486 /// Reading from this pointer when `result_ok` is not set is undefined.
487 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488 /// A pointer to the contents in the error state.
489 /// Reading from this pointer when `result_ok` is set is undefined.
490 pub err: *mut crate::lightning::ln::msgs::DecodeError,
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498 /// `err` or `result` depending on the state of `result_ok`.
499 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506 CResult_ChannelPublicKeysDecodeErrorZ {
507 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508 result: Box::into_raw(Box::new(o)),
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516 CResult_ChannelPublicKeysDecodeErrorZ {
517 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518 err: Box::into_raw(Box::new(e)),
523 /// Checks if the given object is currently in the success state
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
534 if unsafe { !(self.contents.result as *mut ()).is_null() } {
535 let _ = unsafe { Box::from_raw(self.contents.result) };
538 if unsafe { !(self.contents.err as *mut ()).is_null() } {
539 let _ = unsafe { Box::from_raw(self.contents.err) };
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546 let contents = if o.result_ok {
547 let result = unsafe { o.contents.result };
548 unsafe { o.contents.result = core::ptr::null_mut() };
549 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
551 let err = unsafe { o.contents.err };
552 unsafe { o.contents.err = core::ptr::null_mut(); }
553 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
557 result_ok: o.result_ok,
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562 fn clone(&self) -> Self {
564 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
568 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581 /// A pointer to the contents in the success state.
582 /// Reading from this pointer when `result_ok` is not set is undefined.
583 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584 /// A pointer to the contents in the error state.
585 /// Reading from this pointer when `result_ok` is set is undefined.
586 pub err: *mut crate::c_types::Secp256k1Error,
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594 /// `err` or `result` depending on the state of `result_ok`.
595 pub contents: CResult_TxCreationKeysErrorZPtr,
596 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602 CResult_TxCreationKeysErrorZ {
603 contents: CResult_TxCreationKeysErrorZPtr {
604 result: Box::into_raw(Box::new(o)),
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612 CResult_TxCreationKeysErrorZ {
613 contents: CResult_TxCreationKeysErrorZPtr {
614 err: Box::into_raw(Box::new(e)),
619 /// Checks if the given object is currently in the success state
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
630 if unsafe { !(self.contents.result as *mut ()).is_null() } {
631 let _ = unsafe { Box::from_raw(self.contents.result) };
634 if unsafe { !(self.contents.err as *mut ()).is_null() } {
635 let _ = unsafe { Box::from_raw(self.contents.err) };
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642 let contents = if o.result_ok {
643 let result = unsafe { o.contents.result };
644 unsafe { o.contents.result = core::ptr::null_mut() };
645 CResult_TxCreationKeysErrorZPtr { result }
647 let err = unsafe { o.contents.err };
648 unsafe { o.contents.err = core::ptr::null_mut(); }
649 CResult_TxCreationKeysErrorZPtr { err }
653 result_ok: o.result_ok,
657 impl Clone for CResult_TxCreationKeysErrorZ {
658 fn clone(&self) -> Self {
660 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
664 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678 /// When we're in this state, this COption_u32Z contains a u32
680 /// When we're in this state, this COption_u32Z contains nothing
684 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685 if let Self::None = self { false } else { true }
687 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
690 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691 if let Self::Some(v) = self { v } else { unreachable!() }
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697 COption_u32Z::Some(o)
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714 /// A pointer to the contents in the success state.
715 /// Reading from this pointer when `result_ok` is not set is undefined.
716 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717 /// A pointer to the contents in the error state.
718 /// Reading from this pointer when `result_ok` is set is undefined.
719 pub err: *mut crate::lightning::ln::msgs::DecodeError,
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727 /// `err` or `result` depending on the state of `result_ok`.
728 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735 CResult_HTLCOutputInCommitmentDecodeErrorZ {
736 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737 result: Box::into_raw(Box::new(o)),
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745 CResult_HTLCOutputInCommitmentDecodeErrorZ {
746 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747 err: Box::into_raw(Box::new(e)),
752 /// Checks if the given object is currently in the success state
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
763 if unsafe { !(self.contents.result as *mut ()).is_null() } {
764 let _ = unsafe { Box::from_raw(self.contents.result) };
767 if unsafe { !(self.contents.err as *mut ()).is_null() } {
768 let _ = unsafe { Box::from_raw(self.contents.err) };
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775 let contents = if o.result_ok {
776 let result = unsafe { o.contents.result };
777 unsafe { o.contents.result = core::ptr::null_mut() };
778 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
780 let err = unsafe { o.contents.err };
781 unsafe { o.contents.err = core::ptr::null_mut(); }
782 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
786 result_ok: o.result_ok,
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791 fn clone(&self) -> Self {
793 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
797 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
808 /// An enum which can either contain a or not
809 pub enum COption_NoneZ {
810 /// When we're in this state, this COption_NoneZ contains a
812 /// When we're in this state, this COption_NoneZ contains nothing
816 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817 if let Self::None = self { false } else { true }
819 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
824 /// Constructs a new COption_NoneZ containing a
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839 /// A pointer to the contents in the success state.
840 /// Reading from this pointer when `result_ok` is not set is undefined.
841 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842 /// A pointer to the contents in the error state.
843 /// Reading from this pointer when `result_ok` is set is undefined.
844 pub err: *mut crate::lightning::ln::msgs::DecodeError,
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852 /// `err` or `result` depending on the state of `result_ok`.
853 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862 result: Box::into_raw(Box::new(o)),
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872 err: Box::into_raw(Box::new(e)),
877 /// Checks if the given object is currently in the success state
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
888 if unsafe { !(self.contents.result as *mut ()).is_null() } {
889 let _ = unsafe { Box::from_raw(self.contents.result) };
892 if unsafe { !(self.contents.err as *mut ()).is_null() } {
893 let _ = unsafe { Box::from_raw(self.contents.err) };
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900 let contents = if o.result_ok {
901 let result = unsafe { o.contents.result };
902 unsafe { o.contents.result = core::ptr::null_mut() };
903 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
905 let err = unsafe { o.contents.err };
906 unsafe { o.contents.err = core::ptr::null_mut(); }
907 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
911 result_ok: o.result_ok,
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916 fn clone(&self) -> Self {
918 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
922 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935 /// A pointer to the contents in the success state.
936 /// Reading from this pointer when `result_ok` is not set is undefined.
937 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938 /// A pointer to the contents in the error state.
939 /// Reading from this pointer when `result_ok` is set is undefined.
940 pub err: *mut crate::lightning::ln::msgs::DecodeError,
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948 /// `err` or `result` depending on the state of `result_ok`.
949 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956 CResult_ChannelTransactionParametersDecodeErrorZ {
957 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958 result: Box::into_raw(Box::new(o)),
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966 CResult_ChannelTransactionParametersDecodeErrorZ {
967 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968 err: Box::into_raw(Box::new(e)),
973 /// Checks if the given object is currently in the success state
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
984 if unsafe { !(self.contents.result as *mut ()).is_null() } {
985 let _ = unsafe { Box::from_raw(self.contents.result) };
988 if unsafe { !(self.contents.err as *mut ()).is_null() } {
989 let _ = unsafe { Box::from_raw(self.contents.err) };
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996 let contents = if o.result_ok {
997 let result = unsafe { o.contents.result };
998 unsafe { o.contents.result = core::ptr::null_mut() };
999 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1001 let err = unsafe { o.contents.err };
1002 unsafe { o.contents.err = core::ptr::null_mut(); }
1003 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1007 result_ok: o.result_ok,
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012 fn clone(&self) -> Self {
1014 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1018 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032 /// The elements in the array.
1033 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034 pub data: *mut crate::c_types::Signature,
1035 /// The number of elements pointed to by `data`.
1038 impl CVec_SignatureZ {
1039 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040 if self.datalen == 0 { return Vec::new(); }
1041 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042 self.data = core::ptr::null_mut();
1046 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051 fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052 let datalen = v.len();
1053 let data = Box::into_raw(v.into_boxed_slice());
1054 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061 fn drop(&mut self) {
1062 if self.datalen == 0 { return; }
1063 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1066 impl Clone for CVec_SignatureZ {
1067 fn clone(&self) -> Self {
1068 let mut res = Vec::new();
1069 if self.datalen == 0 { return Self::from(res); }
1070 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077 /// A pointer to the contents in the success state.
1078 /// Reading from this pointer when `result_ok` is not set is undefined.
1079 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080 /// A pointer to the contents in the error state.
1081 /// Reading from this pointer when `result_ok` is set is undefined.
1082 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090 /// `err` or `result` depending on the state of `result_ok`.
1091 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093 pub result_ok: bool,
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098 CResult_HolderCommitmentTransactionDecodeErrorZ {
1099 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100 result: Box::into_raw(Box::new(o)),
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108 CResult_HolderCommitmentTransactionDecodeErrorZ {
1109 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110 err: Box::into_raw(Box::new(e)),
1115 /// Checks if the given object is currently in the success state
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124 fn drop(&mut self) {
1126 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127 let _ = unsafe { Box::from_raw(self.contents.result) };
1130 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131 let _ = unsafe { Box::from_raw(self.contents.err) };
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138 let contents = if o.result_ok {
1139 let result = unsafe { o.contents.result };
1140 unsafe { o.contents.result = core::ptr::null_mut() };
1141 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1143 let err = unsafe { o.contents.err };
1144 unsafe { o.contents.err = core::ptr::null_mut(); }
1145 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1149 result_ok: o.result_ok,
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154 fn clone(&self) -> Self {
1156 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1160 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173 /// A pointer to the contents in the success state.
1174 /// Reading from this pointer when `result_ok` is not set is undefined.
1175 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176 /// A pointer to the contents in the error state.
1177 /// Reading from this pointer when `result_ok` is set is undefined.
1178 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186 /// `err` or `result` depending on the state of `result_ok`.
1187 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189 pub result_ok: bool,
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196 result: Box::into_raw(Box::new(o)),
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206 err: Box::into_raw(Box::new(e)),
1211 /// Checks if the given object is currently in the success state
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220 fn drop(&mut self) {
1222 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223 let _ = unsafe { Box::from_raw(self.contents.result) };
1226 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227 let _ = unsafe { Box::from_raw(self.contents.err) };
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234 let contents = if o.result_ok {
1235 let result = unsafe { o.contents.result };
1236 unsafe { o.contents.result = core::ptr::null_mut() };
1237 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1239 let err = unsafe { o.contents.err };
1240 unsafe { o.contents.err = core::ptr::null_mut(); }
1241 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1245 result_ok: o.result_ok,
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250 fn clone(&self) -> Self {
1252 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1256 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269 /// A pointer to the contents in the success state.
1270 /// Reading from this pointer when `result_ok` is not set is undefined.
1271 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272 /// Note that this value is always NULL, as there are no contents in the Err variant
1273 pub err: *mut core::ffi::c_void,
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281 /// `err` or `result` depending on the state of `result_ok`.
1282 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284 pub result_ok: bool,
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289 CResult_TrustedClosingTransactionNoneZ {
1290 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291 result: Box::into_raw(Box::new(o)),
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299 CResult_TrustedClosingTransactionNoneZ {
1300 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301 err: core::ptr::null_mut(),
1306 /// Checks if the given object is currently in the success state
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315 fn drop(&mut self) {
1317 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318 let _ = unsafe { Box::from_raw(self.contents.result) };
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326 let contents = if o.result_ok {
1327 let result = unsafe { o.contents.result };
1328 unsafe { o.contents.result = core::ptr::null_mut() };
1329 CResult_TrustedClosingTransactionNoneZPtr { result }
1331 let _ = unsafe { Box::from_raw(o.contents.err) };
1332 o.contents.err = core::ptr::null_mut();
1333 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1337 result_ok: o.result_ok,
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344 /// A pointer to the contents in the success state.
1345 /// Reading from this pointer when `result_ok` is not set is undefined.
1346 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347 /// A pointer to the contents in the error state.
1348 /// Reading from this pointer when `result_ok` is set is undefined.
1349 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357 /// `err` or `result` depending on the state of `result_ok`.
1358 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360 pub result_ok: bool,
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365 CResult_CommitmentTransactionDecodeErrorZ {
1366 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367 result: Box::into_raw(Box::new(o)),
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375 CResult_CommitmentTransactionDecodeErrorZ {
1376 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377 err: Box::into_raw(Box::new(e)),
1382 /// Checks if the given object is currently in the success state
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391 fn drop(&mut self) {
1393 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394 let _ = unsafe { Box::from_raw(self.contents.result) };
1397 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398 let _ = unsafe { Box::from_raw(self.contents.err) };
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405 let contents = if o.result_ok {
1406 let result = unsafe { o.contents.result };
1407 unsafe { o.contents.result = core::ptr::null_mut() };
1408 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1410 let err = unsafe { o.contents.err };
1411 unsafe { o.contents.err = core::ptr::null_mut(); }
1412 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1416 result_ok: o.result_ok,
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421 fn clone(&self) -> Self {
1423 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1427 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440 /// A pointer to the contents in the success state.
1441 /// Reading from this pointer when `result_ok` is not set is undefined.
1442 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443 /// Note that this value is always NULL, as there are no contents in the Err variant
1444 pub err: *mut core::ffi::c_void,
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452 /// `err` or `result` depending on the state of `result_ok`.
1453 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455 pub result_ok: bool,
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460 CResult_TrustedCommitmentTransactionNoneZ {
1461 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462 result: Box::into_raw(Box::new(o)),
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470 CResult_TrustedCommitmentTransactionNoneZ {
1471 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472 err: core::ptr::null_mut(),
1477 /// Checks if the given object is currently in the success state
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486 fn drop(&mut self) {
1488 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489 let _ = unsafe { Box::from_raw(self.contents.result) };
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497 let contents = if o.result_ok {
1498 let result = unsafe { o.contents.result };
1499 unsafe { o.contents.result = core::ptr::null_mut() };
1500 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1502 let _ = unsafe { Box::from_raw(o.contents.err) };
1503 o.contents.err = core::ptr::null_mut();
1504 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1508 result_ok: o.result_ok,
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515 /// A pointer to the contents in the success state.
1516 /// Reading from this pointer when `result_ok` is not set is undefined.
1517 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518 /// Note that this value is always NULL, as there are no contents in the Err variant
1519 pub err: *mut core::ffi::c_void,
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527 /// `err` or `result` depending on the state of `result_ok`.
1528 pub contents: CResult_CVec_SignatureZNoneZPtr,
1529 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530 pub result_ok: bool,
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535 CResult_CVec_SignatureZNoneZ {
1536 contents: CResult_CVec_SignatureZNoneZPtr {
1537 result: Box::into_raw(Box::new(o)),
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545 CResult_CVec_SignatureZNoneZ {
1546 contents: CResult_CVec_SignatureZNoneZPtr {
1547 err: core::ptr::null_mut(),
1552 /// Checks if the given object is currently in the success state
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561 fn drop(&mut self) {
1563 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564 let _ = unsafe { Box::from_raw(self.contents.result) };
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572 let contents = if o.result_ok {
1573 let result = unsafe { o.contents.result };
1574 unsafe { o.contents.result = core::ptr::null_mut() };
1575 CResult_CVec_SignatureZNoneZPtr { result }
1577 let _ = unsafe { Box::from_raw(o.contents.err) };
1578 o.contents.err = core::ptr::null_mut();
1579 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1583 result_ok: o.result_ok,
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588 fn clone(&self) -> Self {
1590 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1594 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595 err: core::ptr::null_mut()
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607 /// A pointer to the contents in the success state.
1608 /// Reading from this pointer when `result_ok` is not set is undefined.
1609 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610 /// A pointer to the contents in the error state.
1611 /// Reading from this pointer when `result_ok` is set is undefined.
1612 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620 /// `err` or `result` depending on the state of `result_ok`.
1621 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623 pub result_ok: bool,
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628 CResult_ShutdownScriptDecodeErrorZ {
1629 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630 result: Box::into_raw(Box::new(o)),
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638 CResult_ShutdownScriptDecodeErrorZ {
1639 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640 err: Box::into_raw(Box::new(e)),
1645 /// Checks if the given object is currently in the success state
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654 fn drop(&mut self) {
1656 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657 let _ = unsafe { Box::from_raw(self.contents.result) };
1660 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661 let _ = unsafe { Box::from_raw(self.contents.err) };
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668 let contents = if o.result_ok {
1669 let result = unsafe { o.contents.result };
1670 unsafe { o.contents.result = core::ptr::null_mut() };
1671 CResult_ShutdownScriptDecodeErrorZPtr { result }
1673 let err = unsafe { o.contents.err };
1674 unsafe { o.contents.err = core::ptr::null_mut(); }
1675 CResult_ShutdownScriptDecodeErrorZPtr { err }
1679 result_ok: o.result_ok,
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684 fn clone(&self) -> Self {
1686 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1690 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703 /// A pointer to the contents in the success state.
1704 /// Reading from this pointer when `result_ok` is not set is undefined.
1705 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706 /// A pointer to the contents in the error state.
1707 /// Reading from this pointer when `result_ok` is set is undefined.
1708 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716 /// `err` or `result` depending on the state of `result_ok`.
1717 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719 pub result_ok: bool,
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724 CResult_ShutdownScriptInvalidShutdownScriptZ {
1725 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726 result: Box::into_raw(Box::new(o)),
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734 CResult_ShutdownScriptInvalidShutdownScriptZ {
1735 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736 err: Box::into_raw(Box::new(e)),
1741 /// Checks if the given object is currently in the success state
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750 fn drop(&mut self) {
1752 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753 let _ = unsafe { Box::from_raw(self.contents.result) };
1756 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757 let _ = unsafe { Box::from_raw(self.contents.err) };
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764 let contents = if o.result_ok {
1765 let result = unsafe { o.contents.result };
1766 unsafe { o.contents.result = core::ptr::null_mut() };
1767 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1769 let err = unsafe { o.contents.err };
1770 unsafe { o.contents.err = core::ptr::null_mut(); }
1771 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1775 result_ok: o.result_ok,
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780 fn clone(&self) -> Self {
1782 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1786 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799 /// Note that this value is always NULL, as there are no contents in the OK variant
1800 pub result: *mut core::ffi::c_void,
1801 /// A pointer to the contents in the error state.
1802 /// Reading from this pointer when `result_ok` is set is undefined.
1803 pub err: *mut crate::c_types::IOError,
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810 /// The contents of this CResult_NoneErrorZ, accessible via either
1811 /// `err` or `result` depending on the state of `result_ok`.
1812 pub contents: CResult_NoneErrorZPtr,
1813 /// Whether this CResult_NoneErrorZ represents a success state.
1814 pub result_ok: bool,
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819 CResult_NoneErrorZ {
1820 contents: CResult_NoneErrorZPtr {
1821 result: core::ptr::null_mut(),
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829 CResult_NoneErrorZ {
1830 contents: CResult_NoneErrorZPtr {
1831 err: Box::into_raw(Box::new(e)),
1836 /// Checks if the given object is currently in the success state
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845 fn drop(&mut self) {
1848 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849 let _ = unsafe { Box::from_raw(self.contents.err) };
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856 let contents = if o.result_ok {
1857 let _ = unsafe { Box::from_raw(o.contents.result) };
1858 o.contents.result = core::ptr::null_mut();
1859 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1861 let err = unsafe { o.contents.err };
1862 unsafe { o.contents.err = core::ptr::null_mut(); }
1863 CResult_NoneErrorZPtr { err }
1867 result_ok: o.result_ok,
1871 impl Clone for CResult_NoneErrorZ {
1872 fn clone(&self) -> Self {
1874 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875 result: core::ptr::null_mut()
1878 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891 /// A pointer to the contents in the success state.
1892 /// Reading from this pointer when `result_ok` is not set is undefined.
1893 pub result: *mut crate::lightning::routing::router::RouteHop,
1894 /// A pointer to the contents in the error state.
1895 /// Reading from this pointer when `result_ok` is set is undefined.
1896 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904 /// `err` or `result` depending on the state of `result_ok`.
1905 pub contents: CResult_RouteHopDecodeErrorZPtr,
1906 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907 pub result_ok: bool,
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912 CResult_RouteHopDecodeErrorZ {
1913 contents: CResult_RouteHopDecodeErrorZPtr {
1914 result: Box::into_raw(Box::new(o)),
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922 CResult_RouteHopDecodeErrorZ {
1923 contents: CResult_RouteHopDecodeErrorZPtr {
1924 err: Box::into_raw(Box::new(e)),
1929 /// Checks if the given object is currently in the success state
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938 fn drop(&mut self) {
1940 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941 let _ = unsafe { Box::from_raw(self.contents.result) };
1944 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945 let _ = unsafe { Box::from_raw(self.contents.err) };
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952 let contents = if o.result_ok {
1953 let result = unsafe { o.contents.result };
1954 unsafe { o.contents.result = core::ptr::null_mut() };
1955 CResult_RouteHopDecodeErrorZPtr { result }
1957 let err = unsafe { o.contents.err };
1958 unsafe { o.contents.err = core::ptr::null_mut(); }
1959 CResult_RouteHopDecodeErrorZPtr { err }
1963 result_ok: o.result_ok,
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968 fn clone(&self) -> Self {
1970 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1974 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988 /// The elements in the array.
1989 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990 pub data: *mut crate::lightning::routing::router::RouteHop,
1991 /// The number of elements pointed to by `data`.
1994 impl CVec_RouteHopZ {
1995 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996 if self.datalen == 0 { return Vec::new(); }
1997 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998 self.data = core::ptr::null_mut();
2002 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008 let datalen = v.len();
2009 let data = Box::into_raw(v.into_boxed_slice());
2010 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017 fn drop(&mut self) {
2018 if self.datalen == 0 { return; }
2019 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2022 impl Clone for CVec_RouteHopZ {
2023 fn clone(&self) -> Self {
2024 let mut res = Vec::new();
2025 if self.datalen == 0 { return Self::from(res); }
2026 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034 /// The elements in the array.
2035 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037 /// The number of elements pointed to by `data`.
2040 impl CVec_CVec_RouteHopZZ {
2041 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042 if self.datalen == 0 { return Vec::new(); }
2043 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044 self.data = core::ptr::null_mut();
2048 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054 let datalen = v.len();
2055 let data = Box::into_raw(v.into_boxed_slice());
2056 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063 fn drop(&mut self) {
2064 if self.datalen == 0 { return; }
2065 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069 fn clone(&self) -> Self {
2070 let mut res = Vec::new();
2071 if self.datalen == 0 { return Self::from(res); }
2072 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079 /// A pointer to the contents in the success state.
2080 /// Reading from this pointer when `result_ok` is not set is undefined.
2081 pub result: *mut crate::lightning::routing::router::Route,
2082 /// A pointer to the contents in the error state.
2083 /// Reading from this pointer when `result_ok` is set is undefined.
2084 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092 /// `err` or `result` depending on the state of `result_ok`.
2093 pub contents: CResult_RouteDecodeErrorZPtr,
2094 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095 pub result_ok: bool,
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100 CResult_RouteDecodeErrorZ {
2101 contents: CResult_RouteDecodeErrorZPtr {
2102 result: Box::into_raw(Box::new(o)),
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110 CResult_RouteDecodeErrorZ {
2111 contents: CResult_RouteDecodeErrorZPtr {
2112 err: Box::into_raw(Box::new(e)),
2117 /// Checks if the given object is currently in the success state
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126 fn drop(&mut self) {
2128 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129 let _ = unsafe { Box::from_raw(self.contents.result) };
2132 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133 let _ = unsafe { Box::from_raw(self.contents.err) };
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140 let contents = if o.result_ok {
2141 let result = unsafe { o.contents.result };
2142 unsafe { o.contents.result = core::ptr::null_mut() };
2143 CResult_RouteDecodeErrorZPtr { result }
2145 let err = unsafe { o.contents.err };
2146 unsafe { o.contents.err = core::ptr::null_mut(); }
2147 CResult_RouteDecodeErrorZPtr { err }
2151 result_ok: o.result_ok,
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156 fn clone(&self) -> Self {
2158 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2162 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175 /// A pointer to the contents in the success state.
2176 /// Reading from this pointer when `result_ok` is not set is undefined.
2177 pub result: *mut crate::lightning::routing::router::RouteParameters,
2178 /// A pointer to the contents in the error state.
2179 /// Reading from this pointer when `result_ok` is set is undefined.
2180 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188 /// `err` or `result` depending on the state of `result_ok`.
2189 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191 pub result_ok: bool,
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196 CResult_RouteParametersDecodeErrorZ {
2197 contents: CResult_RouteParametersDecodeErrorZPtr {
2198 result: Box::into_raw(Box::new(o)),
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206 CResult_RouteParametersDecodeErrorZ {
2207 contents: CResult_RouteParametersDecodeErrorZPtr {
2208 err: Box::into_raw(Box::new(e)),
2213 /// Checks if the given object is currently in the success state
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222 fn drop(&mut self) {
2224 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225 let _ = unsafe { Box::from_raw(self.contents.result) };
2228 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229 let _ = unsafe { Box::from_raw(self.contents.err) };
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236 let contents = if o.result_ok {
2237 let result = unsafe { o.contents.result };
2238 unsafe { o.contents.result = core::ptr::null_mut() };
2239 CResult_RouteParametersDecodeErrorZPtr { result }
2241 let err = unsafe { o.contents.err };
2242 unsafe { o.contents.err = core::ptr::null_mut(); }
2243 CResult_RouteParametersDecodeErrorZPtr { err }
2247 result_ok: o.result_ok,
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252 fn clone(&self) -> Self {
2254 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2258 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272 /// The elements in the array.
2273 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274 pub data: *mut crate::lightning::routing::router::RouteHint,
2275 /// The number of elements pointed to by `data`.
2278 impl CVec_RouteHintZ {
2279 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280 if self.datalen == 0 { return Vec::new(); }
2281 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282 self.data = core::ptr::null_mut();
2286 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292 let datalen = v.len();
2293 let data = Box::into_raw(v.into_boxed_slice());
2294 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301 fn drop(&mut self) {
2302 if self.datalen == 0 { return; }
2303 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2306 impl Clone for CVec_RouteHintZ {
2307 fn clone(&self) -> Self {
2308 let mut res = Vec::new();
2309 if self.datalen == 0 { return Self::from(res); }
2310 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318 /// When we're in this state, this COption_u64Z contains a u64
2320 /// When we're in this state, this COption_u64Z contains nothing
2324 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325 if let Self::None = self { false } else { true }
2327 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2330 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331 if let Self::Some(v) = self { v } else { unreachable!() }
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337 COption_u64Z::Some(o)
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354 /// A pointer to the contents in the success state.
2355 /// Reading from this pointer when `result_ok` is not set is undefined.
2356 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357 /// A pointer to the contents in the error state.
2358 /// Reading from this pointer when `result_ok` is set is undefined.
2359 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367 /// `err` or `result` depending on the state of `result_ok`.
2368 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370 pub result_ok: bool,
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375 CResult_PaymentParametersDecodeErrorZ {
2376 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377 result: Box::into_raw(Box::new(o)),
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385 CResult_PaymentParametersDecodeErrorZ {
2386 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387 err: Box::into_raw(Box::new(e)),
2392 /// Checks if the given object is currently in the success state
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401 fn drop(&mut self) {
2403 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404 let _ = unsafe { Box::from_raw(self.contents.result) };
2407 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408 let _ = unsafe { Box::from_raw(self.contents.err) };
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415 let contents = if o.result_ok {
2416 let result = unsafe { o.contents.result };
2417 unsafe { o.contents.result = core::ptr::null_mut() };
2418 CResult_PaymentParametersDecodeErrorZPtr { result }
2420 let err = unsafe { o.contents.err };
2421 unsafe { o.contents.err = core::ptr::null_mut(); }
2422 CResult_PaymentParametersDecodeErrorZPtr { err }
2426 result_ok: o.result_ok,
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431 fn clone(&self) -> Self {
2433 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2437 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451 /// The elements in the array.
2452 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454 /// The number of elements pointed to by `data`.
2457 impl CVec_RouteHintHopZ {
2458 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459 if self.datalen == 0 { return Vec::new(); }
2460 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461 self.data = core::ptr::null_mut();
2465 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471 let datalen = v.len();
2472 let data = Box::into_raw(v.into_boxed_slice());
2473 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480 fn drop(&mut self) {
2481 if self.datalen == 0 { return; }
2482 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2485 impl Clone for CVec_RouteHintHopZ {
2486 fn clone(&self) -> Self {
2487 let mut res = Vec::new();
2488 if self.datalen == 0 { return Self::from(res); }
2489 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496 /// A pointer to the contents in the success state.
2497 /// Reading from this pointer when `result_ok` is not set is undefined.
2498 pub result: *mut crate::lightning::routing::router::RouteHint,
2499 /// A pointer to the contents in the error state.
2500 /// Reading from this pointer when `result_ok` is set is undefined.
2501 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509 /// `err` or `result` depending on the state of `result_ok`.
2510 pub contents: CResult_RouteHintDecodeErrorZPtr,
2511 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512 pub result_ok: bool,
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517 CResult_RouteHintDecodeErrorZ {
2518 contents: CResult_RouteHintDecodeErrorZPtr {
2519 result: Box::into_raw(Box::new(o)),
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527 CResult_RouteHintDecodeErrorZ {
2528 contents: CResult_RouteHintDecodeErrorZPtr {
2529 err: Box::into_raw(Box::new(e)),
2534 /// Checks if the given object is currently in the success state
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543 fn drop(&mut self) {
2545 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546 let _ = unsafe { Box::from_raw(self.contents.result) };
2549 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550 let _ = unsafe { Box::from_raw(self.contents.err) };
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557 let contents = if o.result_ok {
2558 let result = unsafe { o.contents.result };
2559 unsafe { o.contents.result = core::ptr::null_mut() };
2560 CResult_RouteHintDecodeErrorZPtr { result }
2562 let err = unsafe { o.contents.err };
2563 unsafe { o.contents.err = core::ptr::null_mut(); }
2564 CResult_RouteHintDecodeErrorZPtr { err }
2568 result_ok: o.result_ok,
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573 fn clone(&self) -> Self {
2575 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2579 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592 /// A pointer to the contents in the success state.
2593 /// Reading from this pointer when `result_ok` is not set is undefined.
2594 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595 /// A pointer to the contents in the error state.
2596 /// Reading from this pointer when `result_ok` is set is undefined.
2597 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605 /// `err` or `result` depending on the state of `result_ok`.
2606 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608 pub result_ok: bool,
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613 CResult_RouteHintHopDecodeErrorZ {
2614 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615 result: Box::into_raw(Box::new(o)),
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623 CResult_RouteHintHopDecodeErrorZ {
2624 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625 err: Box::into_raw(Box::new(e)),
2630 /// Checks if the given object is currently in the success state
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639 fn drop(&mut self) {
2641 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642 let _ = unsafe { Box::from_raw(self.contents.result) };
2645 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646 let _ = unsafe { Box::from_raw(self.contents.err) };
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653 let contents = if o.result_ok {
2654 let result = unsafe { o.contents.result };
2655 unsafe { o.contents.result = core::ptr::null_mut() };
2656 CResult_RouteHintHopDecodeErrorZPtr { result }
2658 let err = unsafe { o.contents.err };
2659 unsafe { o.contents.err = core::ptr::null_mut(); }
2660 CResult_RouteHintHopDecodeErrorZPtr { err }
2664 result_ok: o.result_ok,
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669 fn clone(&self) -> Self {
2671 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2675 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689 /// The elements in the array.
2690 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692 /// The number of elements pointed to by `data`.
2695 impl CVec_ChannelDetailsZ {
2696 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697 if self.datalen == 0 { return Vec::new(); }
2698 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699 self.data = core::ptr::null_mut();
2703 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709 let datalen = v.len();
2710 let data = Box::into_raw(v.into_boxed_slice());
2711 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718 fn drop(&mut self) {
2719 if self.datalen == 0 { return; }
2720 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2723 impl Clone for CVec_ChannelDetailsZ {
2724 fn clone(&self) -> Self {
2725 let mut res = Vec::new();
2726 if self.datalen == 0 { return Self::from(res); }
2727 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734 /// A pointer to the contents in the success state.
2735 /// Reading from this pointer when `result_ok` is not set is undefined.
2736 pub result: *mut crate::lightning::routing::router::Route,
2737 /// A pointer to the contents in the error state.
2738 /// Reading from this pointer when `result_ok` is set is undefined.
2739 pub err: *mut crate::lightning::ln::msgs::LightningError,
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747 /// `err` or `result` depending on the state of `result_ok`.
2748 pub contents: CResult_RouteLightningErrorZPtr,
2749 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750 pub result_ok: bool,
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755 CResult_RouteLightningErrorZ {
2756 contents: CResult_RouteLightningErrorZPtr {
2757 result: Box::into_raw(Box::new(o)),
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765 CResult_RouteLightningErrorZ {
2766 contents: CResult_RouteLightningErrorZPtr {
2767 err: Box::into_raw(Box::new(e)),
2772 /// Checks if the given object is currently in the success state
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781 fn drop(&mut self) {
2783 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784 let _ = unsafe { Box::from_raw(self.contents.result) };
2787 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788 let _ = unsafe { Box::from_raw(self.contents.err) };
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795 let contents = if o.result_ok {
2796 let result = unsafe { o.contents.result };
2797 unsafe { o.contents.result = core::ptr::null_mut() };
2798 CResult_RouteLightningErrorZPtr { result }
2800 let err = unsafe { o.contents.err };
2801 unsafe { o.contents.err = core::ptr::null_mut(); }
2802 CResult_RouteLightningErrorZPtr { err }
2806 result_ok: o.result_ok,
2810 impl Clone for CResult_RouteLightningErrorZ {
2811 fn clone(&self) -> Self {
2813 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2817 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2828 /// The contents of CResult_TxOutAccessErrorZ
2829 pub union CResult_TxOutAccessErrorZPtr {
2830 /// A pointer to the contents in the success state.
2831 /// Reading from this pointer when `result_ok` is not set is undefined.
2832 pub result: *mut crate::c_types::TxOut,
2833 /// A pointer to the contents in the error state.
2834 /// Reading from this pointer when `result_ok` is set is undefined.
2835 pub err: *mut crate::lightning::chain::AccessError,
2838 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2839 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2841 pub struct CResult_TxOutAccessErrorZ {
2842 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2843 /// `err` or `result` depending on the state of `result_ok`.
2844 pub contents: CResult_TxOutAccessErrorZPtr,
2845 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2846 pub result_ok: bool,
2849 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2850 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2851 CResult_TxOutAccessErrorZ {
2852 contents: CResult_TxOutAccessErrorZPtr {
2853 result: Box::into_raw(Box::new(o)),
2859 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2860 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2861 CResult_TxOutAccessErrorZ {
2862 contents: CResult_TxOutAccessErrorZPtr {
2863 err: Box::into_raw(Box::new(e)),
2868 /// Checks if the given object is currently in the success state
2870 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2874 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2875 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2876 impl Drop for CResult_TxOutAccessErrorZ {
2877 fn drop(&mut self) {
2879 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2880 let _ = unsafe { Box::from_raw(self.contents.result) };
2883 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2884 let _ = unsafe { Box::from_raw(self.contents.err) };
2889 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2890 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2891 let contents = if o.result_ok {
2892 let result = unsafe { o.contents.result };
2893 unsafe { o.contents.result = core::ptr::null_mut() };
2894 CResult_TxOutAccessErrorZPtr { result }
2896 let err = unsafe { o.contents.err };
2897 unsafe { o.contents.err = core::ptr::null_mut(); }
2898 CResult_TxOutAccessErrorZPtr { err }
2902 result_ok: o.result_ok,
2906 impl Clone for CResult_TxOutAccessErrorZ {
2907 fn clone(&self) -> Self {
2909 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2910 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2913 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2914 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2920 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2921 /// but with all dynamically-allocated buffers duplicated in new buffers.
2922 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2924 /// A tuple of 2 elements. See the individual fields for the types contained.
2925 pub struct C2Tuple_usizeTransactionZ {
2926 /// The element at position 0
2928 /// The element at position 1
2929 pub b: crate::c_types::Transaction,
2931 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2932 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2939 impl C2Tuple_usizeTransactionZ {
2940 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2944 impl Clone for C2Tuple_usizeTransactionZ {
2945 fn clone(&self) -> Self {
2947 a: Clone::clone(&self.a),
2948 b: Clone::clone(&self.b),
2953 /// Creates a new tuple which has the same data as `orig`
2954 /// but with all dynamically-allocated buffers duplicated in new buffers.
2955 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2956 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2958 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2959 C2Tuple_usizeTransactionZ { a, b, }
2963 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2964 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2967 /// This corresponds to std::vector in C++
2968 pub struct CVec_C2Tuple_usizeTransactionZZ {
2969 /// The elements in the array.
2970 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2971 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2972 /// The number of elements pointed to by `data`.
2975 impl CVec_C2Tuple_usizeTransactionZZ {
2976 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2977 if self.datalen == 0 { return Vec::new(); }
2978 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2979 self.data = core::ptr::null_mut();
2983 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2984 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2987 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2988 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2989 let datalen = v.len();
2990 let data = Box::into_raw(v.into_boxed_slice());
2991 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2996 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2997 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2998 fn drop(&mut self) {
2999 if self.datalen == 0 { return; }
3000 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3003 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3004 fn clone(&self) -> Self {
3005 let mut res = Vec::new();
3006 if self.datalen == 0 { return Self::from(res); }
3007 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3012 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3013 /// This corresponds to std::vector in C++
3014 pub struct CVec_TxidZ {
3015 /// The elements in the array.
3016 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3017 pub data: *mut crate::c_types::ThirtyTwoBytes,
3018 /// The number of elements pointed to by `data`.
3022 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3023 if self.datalen == 0 { return Vec::new(); }
3024 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3025 self.data = core::ptr::null_mut();
3029 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3030 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3033 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3034 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3035 let datalen = v.len();
3036 let data = Box::into_raw(v.into_boxed_slice());
3037 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3042 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3043 impl Drop for CVec_TxidZ {
3044 fn drop(&mut self) {
3045 if self.datalen == 0 { return; }
3046 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3049 impl Clone for CVec_TxidZ {
3050 fn clone(&self) -> Self {
3051 let mut res = Vec::new();
3052 if self.datalen == 0 { return Self::from(res); }
3053 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3058 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3059 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3060 /// Note that this value is always NULL, as there are no contents in the OK variant
3061 pub result: *mut core::ffi::c_void,
3062 /// A pointer to the contents in the error state.
3063 /// Reading from this pointer when `result_ok` is set is undefined.
3064 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3067 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3068 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3070 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3071 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3072 /// `err` or `result` depending on the state of `result_ok`.
3073 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3074 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3075 pub result_ok: bool,
3078 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3079 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3080 CResult_NoneChannelMonitorUpdateErrZ {
3081 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3082 result: core::ptr::null_mut(),
3088 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3089 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3090 CResult_NoneChannelMonitorUpdateErrZ {
3091 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3092 err: Box::into_raw(Box::new(e)),
3097 /// Checks if the given object is currently in the success state
3099 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3103 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3104 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3105 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3106 fn drop(&mut self) {
3109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3110 let _ = unsafe { Box::from_raw(self.contents.err) };
3115 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3116 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3117 let contents = if o.result_ok {
3118 let _ = unsafe { Box::from_raw(o.contents.result) };
3119 o.contents.result = core::ptr::null_mut();
3120 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3122 let err = unsafe { o.contents.err };
3123 unsafe { o.contents.err = core::ptr::null_mut(); }
3124 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3128 result_ok: o.result_ok,
3132 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3133 fn clone(&self) -> Self {
3135 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3136 result: core::ptr::null_mut()
3139 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3140 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3146 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3147 /// but with all dynamically-allocated buffers duplicated in new buffers.
3148 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3150 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3151 /// This corresponds to std::vector in C++
3152 pub struct CVec_MonitorEventZ {
3153 /// The elements in the array.
3154 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3155 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3156 /// The number of elements pointed to by `data`.
3159 impl CVec_MonitorEventZ {
3160 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3161 if self.datalen == 0 { return Vec::new(); }
3162 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3163 self.data = core::ptr::null_mut();
3167 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3168 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3171 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3172 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3173 let datalen = v.len();
3174 let data = Box::into_raw(v.into_boxed_slice());
3175 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3180 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3181 impl Drop for CVec_MonitorEventZ {
3182 fn drop(&mut self) {
3183 if self.datalen == 0 { return; }
3184 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3187 impl Clone for CVec_MonitorEventZ {
3188 fn clone(&self) -> Self {
3189 let mut res = Vec::new();
3190 if self.datalen == 0 { return Self::from(res); }
3191 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3197 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3198 pub enum COption_C2Tuple_usizeTransactionZZ {
3199 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3201 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3204 impl COption_C2Tuple_usizeTransactionZZ {
3205 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3206 if let Self::None = self { false } else { true }
3208 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3211 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3212 if let Self::Some(v) = self { v } else { unreachable!() }
3216 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3217 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3218 COption_C2Tuple_usizeTransactionZZ::Some(o)
3221 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3222 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3223 COption_C2Tuple_usizeTransactionZZ::None
3226 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3227 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3229 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3230 /// but with all dynamically-allocated buffers duplicated in new buffers.
3231 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3234 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3235 pub enum COption_ClosureReasonZ {
3236 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3237 Some(crate::lightning::util::events::ClosureReason),
3238 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3241 impl COption_ClosureReasonZ {
3242 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243 if let Self::None = self { false } else { true }
3245 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3248 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3249 if let Self::Some(v) = self { v } else { unreachable!() }
3253 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3254 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3255 COption_ClosureReasonZ::Some(o)
3258 /// Constructs a new COption_ClosureReasonZ containing nothing
3259 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3260 COption_ClosureReasonZ::None
3263 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3264 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3266 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3267 /// but with all dynamically-allocated buffers duplicated in new buffers.
3268 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3270 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3271 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3272 /// A pointer to the contents in the success state.
3273 /// Reading from this pointer when `result_ok` is not set is undefined.
3274 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3275 /// A pointer to the contents in the error state.
3276 /// Reading from this pointer when `result_ok` is set is undefined.
3277 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3280 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3281 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3283 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3284 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3285 /// `err` or `result` depending on the state of `result_ok`.
3286 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3287 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3288 pub result_ok: bool,
3291 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3292 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3293 CResult_COption_ClosureReasonZDecodeErrorZ {
3294 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295 result: Box::into_raw(Box::new(o)),
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3302 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3303 CResult_COption_ClosureReasonZDecodeErrorZ {
3304 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3305 err: Box::into_raw(Box::new(e)),
3310 /// Checks if the given object is currently in the success state
3312 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3316 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3317 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3318 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3319 fn drop(&mut self) {
3321 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3322 let _ = unsafe { Box::from_raw(self.contents.result) };
3325 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3326 let _ = unsafe { Box::from_raw(self.contents.err) };
3331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3332 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3333 let contents = if o.result_ok {
3334 let result = unsafe { o.contents.result };
3335 unsafe { o.contents.result = core::ptr::null_mut() };
3336 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3338 let err = unsafe { o.contents.err };
3339 unsafe { o.contents.err = core::ptr::null_mut(); }
3340 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3344 result_ok: o.result_ok,
3348 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3349 fn clone(&self) -> Self {
3351 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3352 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3355 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3356 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3362 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3363 /// but with all dynamically-allocated buffers duplicated in new buffers.
3364 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3367 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3368 pub enum COption_NetworkUpdateZ {
3369 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3370 Some(crate::lightning::routing::network_graph::NetworkUpdate),
3371 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3374 impl COption_NetworkUpdateZ {
3375 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376 if let Self::None = self { false } else { true }
3378 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3381 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3382 if let Self::Some(v) = self { v } else { unreachable!() }
3386 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3387 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3388 COption_NetworkUpdateZ::Some(o)
3391 /// Constructs a new COption_NetworkUpdateZ containing nothing
3392 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3393 COption_NetworkUpdateZ::None
3396 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3397 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3399 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3403 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_SpendableOutputDescriptorZ {
3406 /// The elements in the array.
3407 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3409 /// The number of elements pointed to by `data`.
3412 impl CVec_SpendableOutputDescriptorZ {
3413 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3414 if self.datalen == 0 { return Vec::new(); }
3415 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416 self.data = core::ptr::null_mut();
3420 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3421 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3424 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3425 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3426 let datalen = v.len();
3427 let data = Box::into_raw(v.into_boxed_slice());
3428 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3434 impl Drop for CVec_SpendableOutputDescriptorZ {
3435 fn drop(&mut self) {
3436 if self.datalen == 0 { return; }
3437 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3440 impl Clone for CVec_SpendableOutputDescriptorZ {
3441 fn clone(&self) -> Self {
3442 let mut res = Vec::new();
3443 if self.datalen == 0 { return Self::from(res); }
3444 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3450 /// An enum which can either contain a crate::lightning::util::events::Event or not
3451 pub enum COption_EventZ {
3452 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3453 Some(crate::lightning::util::events::Event),
3454 /// When we're in this state, this COption_EventZ contains nothing
3457 impl COption_EventZ {
3458 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3459 if let Self::None = self { false } else { true }
3461 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3464 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3465 if let Self::Some(v) = self { v } else { unreachable!() }
3469 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3470 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3471 COption_EventZ::Some(o)
3474 /// Constructs a new COption_EventZ containing nothing
3475 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3476 COption_EventZ::None
3479 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3480 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3482 /// Creates a new COption_EventZ which has the same data as `orig`
3483 /// but with all dynamically-allocated buffers duplicated in new buffers.
3484 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3486 /// The contents of CResult_COption_EventZDecodeErrorZ
3487 pub union CResult_COption_EventZDecodeErrorZPtr {
3488 /// A pointer to the contents in the success state.
3489 /// Reading from this pointer when `result_ok` is not set is undefined.
3490 pub result: *mut crate::c_types::derived::COption_EventZ,
3491 /// A pointer to the contents in the error state.
3492 /// Reading from this pointer when `result_ok` is set is undefined.
3493 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3496 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3497 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3499 pub struct CResult_COption_EventZDecodeErrorZ {
3500 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3501 /// `err` or `result` depending on the state of `result_ok`.
3502 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3503 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3504 pub result_ok: bool,
3507 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3508 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3509 CResult_COption_EventZDecodeErrorZ {
3510 contents: CResult_COption_EventZDecodeErrorZPtr {
3511 result: Box::into_raw(Box::new(o)),
3517 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3518 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3519 CResult_COption_EventZDecodeErrorZ {
3520 contents: CResult_COption_EventZDecodeErrorZPtr {
3521 err: Box::into_raw(Box::new(e)),
3526 /// Checks if the given object is currently in the success state
3528 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3532 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3533 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3534 impl Drop for CResult_COption_EventZDecodeErrorZ {
3535 fn drop(&mut self) {
3537 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3538 let _ = unsafe { Box::from_raw(self.contents.result) };
3541 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3542 let _ = unsafe { Box::from_raw(self.contents.err) };
3547 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3548 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3549 let contents = if o.result_ok {
3550 let result = unsafe { o.contents.result };
3551 unsafe { o.contents.result = core::ptr::null_mut() };
3552 CResult_COption_EventZDecodeErrorZPtr { result }
3554 let err = unsafe { o.contents.err };
3555 unsafe { o.contents.err = core::ptr::null_mut(); }
3556 CResult_COption_EventZDecodeErrorZPtr { err }
3560 result_ok: o.result_ok,
3564 impl Clone for CResult_COption_EventZDecodeErrorZ {
3565 fn clone(&self) -> Self {
3567 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3568 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3571 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3572 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3578 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3579 /// but with all dynamically-allocated buffers duplicated in new buffers.
3580 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3582 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3583 /// This corresponds to std::vector in C++
3584 pub struct CVec_MessageSendEventZ {
3585 /// The elements in the array.
3586 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3587 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3588 /// The number of elements pointed to by `data`.
3591 impl CVec_MessageSendEventZ {
3592 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3593 if self.datalen == 0 { return Vec::new(); }
3594 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3595 self.data = core::ptr::null_mut();
3599 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3600 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3603 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3604 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3605 let datalen = v.len();
3606 let data = Box::into_raw(v.into_boxed_slice());
3607 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3612 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3613 impl Drop for CVec_MessageSendEventZ {
3614 fn drop(&mut self) {
3615 if self.datalen == 0 { return; }
3616 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3619 impl Clone for CVec_MessageSendEventZ {
3620 fn clone(&self) -> Self {
3621 let mut res = Vec::new();
3622 if self.datalen == 0 { return Self::from(res); }
3623 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3628 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3629 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3630 /// A pointer to the contents in the success state.
3631 /// Reading from this pointer when `result_ok` is not set is undefined.
3632 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3633 /// A pointer to the contents in the error state.
3634 /// Reading from this pointer when `result_ok` is set is undefined.
3635 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3638 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3639 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3640 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3641 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3642 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3643 /// `err` or `result` depending on the state of `result_ok`.
3644 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3645 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3646 pub result_ok: bool,
3649 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3650 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3651 CResult_FixedPenaltyScorerDecodeErrorZ {
3652 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3653 result: Box::into_raw(Box::new(o)),
3659 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3660 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3661 CResult_FixedPenaltyScorerDecodeErrorZ {
3662 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3663 err: Box::into_raw(Box::new(e)),
3668 /// Checks if the given object is currently in the success state
3670 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3674 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3675 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3676 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3677 fn drop(&mut self) {
3679 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3680 let _ = unsafe { Box::from_raw(self.contents.result) };
3683 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3684 let _ = unsafe { Box::from_raw(self.contents.err) };
3689 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3690 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3691 let contents = if o.result_ok {
3692 let result = unsafe { o.contents.result };
3693 unsafe { o.contents.result = core::ptr::null_mut() };
3694 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3696 let err = unsafe { o.contents.err };
3697 unsafe { o.contents.err = core::ptr::null_mut(); }
3698 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3702 result_ok: o.result_ok,
3706 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3707 fn clone(&self) -> Self {
3709 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3710 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3713 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3714 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3720 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3721 /// but with all dynamically-allocated buffers duplicated in new buffers.
3722 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3724 /// The contents of CResult_ScoringParametersDecodeErrorZ
3725 pub union CResult_ScoringParametersDecodeErrorZPtr {
3726 /// A pointer to the contents in the success state.
3727 /// Reading from this pointer when `result_ok` is not set is undefined.
3728 pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3729 /// A pointer to the contents in the error state.
3730 /// Reading from this pointer when `result_ok` is set is undefined.
3731 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3734 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3735 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3736 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3737 pub struct CResult_ScoringParametersDecodeErrorZ {
3738 /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3739 /// `err` or `result` depending on the state of `result_ok`.
3740 pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3741 /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3742 pub result_ok: bool,
3745 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3746 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3747 CResult_ScoringParametersDecodeErrorZ {
3748 contents: CResult_ScoringParametersDecodeErrorZPtr {
3749 result: Box::into_raw(Box::new(o)),
3755 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3756 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3757 CResult_ScoringParametersDecodeErrorZ {
3758 contents: CResult_ScoringParametersDecodeErrorZPtr {
3759 err: Box::into_raw(Box::new(e)),
3764 /// Checks if the given object is currently in the success state
3766 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3770 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3771 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3772 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3773 fn drop(&mut self) {
3775 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3776 let _ = unsafe { Box::from_raw(self.contents.result) };
3779 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3780 let _ = unsafe { Box::from_raw(self.contents.err) };
3785 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3786 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3787 let contents = if o.result_ok {
3788 let result = unsafe { o.contents.result };
3789 unsafe { o.contents.result = core::ptr::null_mut() };
3790 CResult_ScoringParametersDecodeErrorZPtr { result }
3792 let err = unsafe { o.contents.err };
3793 unsafe { o.contents.err = core::ptr::null_mut(); }
3794 CResult_ScoringParametersDecodeErrorZPtr { err }
3798 result_ok: o.result_ok,
3802 impl Clone for CResult_ScoringParametersDecodeErrorZ {
3803 fn clone(&self) -> Self {
3805 Self { result_ok: true, contents: CResult_ScoringParametersDecodeErrorZPtr {
3806 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ScoringParameters>::clone(unsafe { &*self.contents.result })))
3809 Self { result_ok: false, contents: CResult_ScoringParametersDecodeErrorZPtr {
3810 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3816 /// Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig`
3817 /// but with all dynamically-allocated buffers duplicated in new buffers.
3818 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_clone(orig: &CResult_ScoringParametersDecodeErrorZ) -> CResult_ScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3820 /// The contents of CResult_ScorerDecodeErrorZ
3821 pub union CResult_ScorerDecodeErrorZPtr {
3822 /// A pointer to the contents in the success state.
3823 /// Reading from this pointer when `result_ok` is not set is undefined.
3824 pub result: *mut crate::lightning::routing::scoring::Scorer,
3825 /// A pointer to the contents in the error state.
3826 /// Reading from this pointer when `result_ok` is set is undefined.
3827 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3830 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3831 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3833 pub struct CResult_ScorerDecodeErrorZ {
3834 /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3835 /// `err` or `result` depending on the state of `result_ok`.
3836 pub contents: CResult_ScorerDecodeErrorZPtr,
3837 /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3838 pub result_ok: bool,
3841 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3842 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3843 CResult_ScorerDecodeErrorZ {
3844 contents: CResult_ScorerDecodeErrorZPtr {
3845 result: Box::into_raw(Box::new(o)),
3851 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3852 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3853 CResult_ScorerDecodeErrorZ {
3854 contents: CResult_ScorerDecodeErrorZPtr {
3855 err: Box::into_raw(Box::new(e)),
3860 /// Checks if the given object is currently in the success state
3862 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3866 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3867 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3868 impl Drop for CResult_ScorerDecodeErrorZ {
3869 fn drop(&mut self) {
3871 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3872 let _ = unsafe { Box::from_raw(self.contents.result) };
3875 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3876 let _ = unsafe { Box::from_raw(self.contents.err) };
3881 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3882 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3883 let contents = if o.result_ok {
3884 let result = unsafe { o.contents.result };
3885 unsafe { o.contents.result = core::ptr::null_mut() };
3886 CResult_ScorerDecodeErrorZPtr { result }
3888 let err = unsafe { o.contents.err };
3889 unsafe { o.contents.err = core::ptr::null_mut(); }
3890 CResult_ScorerDecodeErrorZPtr { err }
3894 result_ok: o.result_ok,
3899 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3900 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3901 /// A pointer to the contents in the success state.
3902 /// Reading from this pointer when `result_ok` is not set is undefined.
3903 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3904 /// A pointer to the contents in the error state.
3905 /// Reading from this pointer when `result_ok` is set is undefined.
3906 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3909 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3910 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3912 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
3913 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
3914 /// `err` or `result` depending on the state of `result_ok`.
3915 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
3916 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
3917 pub result_ok: bool,
3920 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
3921 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
3922 CResult_ProbabilisticScorerDecodeErrorZ {
3923 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3924 result: Box::into_raw(Box::new(o)),
3930 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
3931 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
3932 CResult_ProbabilisticScorerDecodeErrorZ {
3933 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3934 err: Box::into_raw(Box::new(e)),
3939 /// Checks if the given object is currently in the success state
3941 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
3945 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
3946 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
3947 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
3948 fn drop(&mut self) {
3950 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3951 let _ = unsafe { Box::from_raw(self.contents.result) };
3954 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3955 let _ = unsafe { Box::from_raw(self.contents.err) };
3960 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
3961 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3962 let contents = if o.result_ok {
3963 let result = unsafe { o.contents.result };
3964 unsafe { o.contents.result = core::ptr::null_mut() };
3965 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
3967 let err = unsafe { o.contents.err };
3968 unsafe { o.contents.err = core::ptr::null_mut(); }
3969 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
3973 result_ok: o.result_ok,
3978 /// The contents of CResult_InitFeaturesDecodeErrorZ
3979 pub union CResult_InitFeaturesDecodeErrorZPtr {
3980 /// A pointer to the contents in the success state.
3981 /// Reading from this pointer when `result_ok` is not set is undefined.
3982 pub result: *mut crate::lightning::ln::features::InitFeatures,
3983 /// A pointer to the contents in the error state.
3984 /// Reading from this pointer when `result_ok` is set is undefined.
3985 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3988 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3989 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3991 pub struct CResult_InitFeaturesDecodeErrorZ {
3992 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3993 /// `err` or `result` depending on the state of `result_ok`.
3994 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3995 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3996 pub result_ok: bool,
3999 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4000 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4001 CResult_InitFeaturesDecodeErrorZ {
4002 contents: CResult_InitFeaturesDecodeErrorZPtr {
4003 result: Box::into_raw(Box::new(o)),
4009 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4010 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4011 CResult_InitFeaturesDecodeErrorZ {
4012 contents: CResult_InitFeaturesDecodeErrorZPtr {
4013 err: Box::into_raw(Box::new(e)),
4018 /// Checks if the given object is currently in the success state
4020 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4024 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4025 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4026 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4027 fn drop(&mut self) {
4029 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4030 let _ = unsafe { Box::from_raw(self.contents.result) };
4033 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4034 let _ = unsafe { Box::from_raw(self.contents.err) };
4039 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4040 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4041 let contents = if o.result_ok {
4042 let result = unsafe { o.contents.result };
4043 unsafe { o.contents.result = core::ptr::null_mut() };
4044 CResult_InitFeaturesDecodeErrorZPtr { result }
4046 let err = unsafe { o.contents.err };
4047 unsafe { o.contents.err = core::ptr::null_mut(); }
4048 CResult_InitFeaturesDecodeErrorZPtr { err }
4052 result_ok: o.result_ok,
4057 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4058 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4059 /// A pointer to the contents in the success state.
4060 /// Reading from this pointer when `result_ok` is not set is undefined.
4061 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4062 /// A pointer to the contents in the error state.
4063 /// Reading from this pointer when `result_ok` is set is undefined.
4064 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4067 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4068 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4070 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4071 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4072 /// `err` or `result` depending on the state of `result_ok`.
4073 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4074 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4075 pub result_ok: bool,
4078 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4079 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4080 CResult_ChannelFeaturesDecodeErrorZ {
4081 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4082 result: Box::into_raw(Box::new(o)),
4088 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4089 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4090 CResult_ChannelFeaturesDecodeErrorZ {
4091 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4092 err: Box::into_raw(Box::new(e)),
4097 /// Checks if the given object is currently in the success state
4099 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4103 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4104 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4105 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4106 fn drop(&mut self) {
4108 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4109 let _ = unsafe { Box::from_raw(self.contents.result) };
4112 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4113 let _ = unsafe { Box::from_raw(self.contents.err) };
4118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4119 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4120 let contents = if o.result_ok {
4121 let result = unsafe { o.contents.result };
4122 unsafe { o.contents.result = core::ptr::null_mut() };
4123 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4125 let err = unsafe { o.contents.err };
4126 unsafe { o.contents.err = core::ptr::null_mut(); }
4127 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4131 result_ok: o.result_ok,
4136 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4137 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4138 /// A pointer to the contents in the success state.
4139 /// Reading from this pointer when `result_ok` is not set is undefined.
4140 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4141 /// A pointer to the contents in the error state.
4142 /// Reading from this pointer when `result_ok` is set is undefined.
4143 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4146 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4147 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4148 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4149 pub struct CResult_NodeFeaturesDecodeErrorZ {
4150 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4151 /// `err` or `result` depending on the state of `result_ok`.
4152 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4153 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4154 pub result_ok: bool,
4157 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4158 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4159 CResult_NodeFeaturesDecodeErrorZ {
4160 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4161 result: Box::into_raw(Box::new(o)),
4167 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4168 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4169 CResult_NodeFeaturesDecodeErrorZ {
4170 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4171 err: Box::into_raw(Box::new(e)),
4176 /// Checks if the given object is currently in the success state
4178 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4182 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4183 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4184 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4185 fn drop(&mut self) {
4187 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4188 let _ = unsafe { Box::from_raw(self.contents.result) };
4191 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4192 let _ = unsafe { Box::from_raw(self.contents.err) };
4197 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4198 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4199 let contents = if o.result_ok {
4200 let result = unsafe { o.contents.result };
4201 unsafe { o.contents.result = core::ptr::null_mut() };
4202 CResult_NodeFeaturesDecodeErrorZPtr { result }
4204 let err = unsafe { o.contents.err };
4205 unsafe { o.contents.err = core::ptr::null_mut(); }
4206 CResult_NodeFeaturesDecodeErrorZPtr { err }
4210 result_ok: o.result_ok,
4215 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4216 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4217 /// A pointer to the contents in the success state.
4218 /// Reading from this pointer when `result_ok` is not set is undefined.
4219 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4220 /// A pointer to the contents in the error state.
4221 /// Reading from this pointer when `result_ok` is set is undefined.
4222 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4225 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4226 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4228 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4229 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4230 /// `err` or `result` depending on the state of `result_ok`.
4231 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4232 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4233 pub result_ok: bool,
4236 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4237 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4238 CResult_InvoiceFeaturesDecodeErrorZ {
4239 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4240 result: Box::into_raw(Box::new(o)),
4246 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4247 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4248 CResult_InvoiceFeaturesDecodeErrorZ {
4249 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4250 err: Box::into_raw(Box::new(e)),
4255 /// Checks if the given object is currently in the success state
4257 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4261 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4262 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4263 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4264 fn drop(&mut self) {
4266 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4267 let _ = unsafe { Box::from_raw(self.contents.result) };
4270 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4271 let _ = unsafe { Box::from_raw(self.contents.err) };
4276 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4277 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4278 let contents = if o.result_ok {
4279 let result = unsafe { o.contents.result };
4280 unsafe { o.contents.result = core::ptr::null_mut() };
4281 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4283 let err = unsafe { o.contents.err };
4284 unsafe { o.contents.err = core::ptr::null_mut(); }
4285 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4289 result_ok: o.result_ok,
4294 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4295 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4296 /// A pointer to the contents in the success state.
4297 /// Reading from this pointer when `result_ok` is not set is undefined.
4298 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4299 /// A pointer to the contents in the error state.
4300 /// Reading from this pointer when `result_ok` is set is undefined.
4301 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4304 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4305 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4306 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4307 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4308 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4309 /// `err` or `result` depending on the state of `result_ok`.
4310 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4311 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4312 pub result_ok: bool,
4315 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4316 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4317 CResult_ChannelTypeFeaturesDecodeErrorZ {
4318 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4319 result: Box::into_raw(Box::new(o)),
4325 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4326 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4327 CResult_ChannelTypeFeaturesDecodeErrorZ {
4328 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4329 err: Box::into_raw(Box::new(e)),
4334 /// Checks if the given object is currently in the success state
4336 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4340 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4341 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4342 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4343 fn drop(&mut self) {
4345 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4346 let _ = unsafe { Box::from_raw(self.contents.result) };
4349 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4350 let _ = unsafe { Box::from_raw(self.contents.err) };
4355 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4356 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4357 let contents = if o.result_ok {
4358 let result = unsafe { o.contents.result };
4359 unsafe { o.contents.result = core::ptr::null_mut() };
4360 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4362 let err = unsafe { o.contents.err };
4363 unsafe { o.contents.err = core::ptr::null_mut(); }
4364 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4368 result_ok: o.result_ok,
4373 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4374 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4375 /// A pointer to the contents in the success state.
4376 /// Reading from this pointer when `result_ok` is not set is undefined.
4377 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4378 /// A pointer to the contents in the error state.
4379 /// Reading from this pointer when `result_ok` is set is undefined.
4380 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4383 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4384 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4385 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4386 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4387 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4388 /// `err` or `result` depending on the state of `result_ok`.
4389 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4390 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4391 pub result_ok: bool,
4394 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4395 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4396 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4397 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4398 result: Box::into_raw(Box::new(o)),
4404 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4405 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4406 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4407 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4408 err: Box::into_raw(Box::new(e)),
4413 /// Checks if the given object is currently in the success state
4415 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4419 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4420 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4421 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4422 fn drop(&mut self) {
4424 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4425 let _ = unsafe { Box::from_raw(self.contents.result) };
4428 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4429 let _ = unsafe { Box::from_raw(self.contents.err) };
4434 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4435 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4436 let contents = if o.result_ok {
4437 let result = unsafe { o.contents.result };
4438 unsafe { o.contents.result = core::ptr::null_mut() };
4439 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4441 let err = unsafe { o.contents.err };
4442 unsafe { o.contents.err = core::ptr::null_mut(); }
4443 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4447 result_ok: o.result_ok,
4451 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4452 fn clone(&self) -> Self {
4454 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4455 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4458 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4459 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4465 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4466 /// but with all dynamically-allocated buffers duplicated in new buffers.
4467 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4469 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4470 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4471 /// A pointer to the contents in the success state.
4472 /// Reading from this pointer when `result_ok` is not set is undefined.
4473 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4474 /// A pointer to the contents in the error state.
4475 /// Reading from this pointer when `result_ok` is set is undefined.
4476 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4479 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4480 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4481 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4482 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4483 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4484 /// `err` or `result` depending on the state of `result_ok`.
4485 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4486 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4487 pub result_ok: bool,
4490 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4491 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4492 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4493 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4494 result: Box::into_raw(Box::new(o)),
4500 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4501 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4502 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4503 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4504 err: Box::into_raw(Box::new(e)),
4509 /// Checks if the given object is currently in the success state
4511 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4515 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4516 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4517 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4518 fn drop(&mut self) {
4520 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4521 let _ = unsafe { Box::from_raw(self.contents.result) };
4524 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4525 let _ = unsafe { Box::from_raw(self.contents.err) };
4530 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4531 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4532 let contents = if o.result_ok {
4533 let result = unsafe { o.contents.result };
4534 unsafe { o.contents.result = core::ptr::null_mut() };
4535 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4537 let err = unsafe { o.contents.err };
4538 unsafe { o.contents.err = core::ptr::null_mut(); }
4539 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4543 result_ok: o.result_ok,
4547 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4548 fn clone(&self) -> Self {
4550 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4551 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4554 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4555 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4561 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4562 /// but with all dynamically-allocated buffers duplicated in new buffers.
4563 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4565 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4566 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4567 /// A pointer to the contents in the success state.
4568 /// Reading from this pointer when `result_ok` is not set is undefined.
4569 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4570 /// A pointer to the contents in the error state.
4571 /// Reading from this pointer when `result_ok` is set is undefined.
4572 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4575 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4576 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4578 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4579 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4580 /// `err` or `result` depending on the state of `result_ok`.
4581 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4582 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4583 pub result_ok: bool,
4586 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4587 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4588 CResult_SpendableOutputDescriptorDecodeErrorZ {
4589 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4590 result: Box::into_raw(Box::new(o)),
4596 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4597 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4598 CResult_SpendableOutputDescriptorDecodeErrorZ {
4599 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4600 err: Box::into_raw(Box::new(e)),
4605 /// Checks if the given object is currently in the success state
4607 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4611 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4612 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4613 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4614 fn drop(&mut self) {
4616 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4617 let _ = unsafe { Box::from_raw(self.contents.result) };
4620 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4621 let _ = unsafe { Box::from_raw(self.contents.err) };
4626 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4627 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4628 let contents = if o.result_ok {
4629 let result = unsafe { o.contents.result };
4630 unsafe { o.contents.result = core::ptr::null_mut() };
4631 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4633 let err = unsafe { o.contents.err };
4634 unsafe { o.contents.err = core::ptr::null_mut(); }
4635 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4639 result_ok: o.result_ok,
4643 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4644 fn clone(&self) -> Self {
4646 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4647 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4650 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4651 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4657 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4658 /// but with all dynamically-allocated buffers duplicated in new buffers.
4659 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4661 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4662 /// This corresponds to std::vector in C++
4663 pub struct CVec_PaymentPreimageZ {
4664 /// The elements in the array.
4665 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4666 pub data: *mut crate::c_types::ThirtyTwoBytes,
4667 /// The number of elements pointed to by `data`.
4670 impl CVec_PaymentPreimageZ {
4671 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4672 if self.datalen == 0 { return Vec::new(); }
4673 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4674 self.data = core::ptr::null_mut();
4678 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4679 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4682 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4683 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4684 let datalen = v.len();
4685 let data = Box::into_raw(v.into_boxed_slice());
4686 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4690 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4691 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4692 impl Drop for CVec_PaymentPreimageZ {
4693 fn drop(&mut self) {
4694 if self.datalen == 0 { return; }
4695 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4698 impl Clone for CVec_PaymentPreimageZ {
4699 fn clone(&self) -> Self {
4700 let mut res = Vec::new();
4701 if self.datalen == 0 { return Self::from(res); }
4702 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4707 /// A tuple of 2 elements. See the individual fields for the types contained.
4708 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4709 /// The element at position 0
4710 pub a: crate::c_types::Signature,
4711 /// The element at position 1
4712 pub b: crate::c_types::derived::CVec_SignatureZ,
4714 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4715 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4722 impl C2Tuple_SignatureCVec_SignatureZZ {
4723 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4727 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4728 fn clone(&self) -> Self {
4730 a: Clone::clone(&self.a),
4731 b: Clone::clone(&self.b),
4736 /// Creates a new tuple which has the same data as `orig`
4737 /// but with all dynamically-allocated buffers duplicated in new buffers.
4738 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4739 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4741 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4742 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4746 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4747 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4749 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4750 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4751 /// A pointer to the contents in the success state.
4752 /// Reading from this pointer when `result_ok` is not set is undefined.
4753 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4754 /// Note that this value is always NULL, as there are no contents in the Err variant
4755 pub err: *mut core::ffi::c_void,
4758 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4759 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4761 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4762 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4763 /// `err` or `result` depending on the state of `result_ok`.
4764 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4765 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4766 pub result_ok: bool,
4769 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4770 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4771 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4772 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4773 result: Box::into_raw(Box::new(o)),
4779 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4780 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4781 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4782 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4783 err: core::ptr::null_mut(),
4788 /// Checks if the given object is currently in the success state
4790 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4794 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4795 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4796 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4797 fn drop(&mut self) {
4799 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4800 let _ = unsafe { Box::from_raw(self.contents.result) };
4806 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4807 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4808 let contents = if o.result_ok {
4809 let result = unsafe { o.contents.result };
4810 unsafe { o.contents.result = core::ptr::null_mut() };
4811 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4813 let _ = unsafe { Box::from_raw(o.contents.err) };
4814 o.contents.err = core::ptr::null_mut();
4815 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4819 result_ok: o.result_ok,
4823 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4824 fn clone(&self) -> Self {
4826 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4827 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4830 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4831 err: core::ptr::null_mut()
4837 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4838 /// but with all dynamically-allocated buffers duplicated in new buffers.
4839 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4841 /// The contents of CResult_SignatureNoneZ
4842 pub union CResult_SignatureNoneZPtr {
4843 /// A pointer to the contents in the success state.
4844 /// Reading from this pointer when `result_ok` is not set is undefined.
4845 pub result: *mut crate::c_types::Signature,
4846 /// Note that this value is always NULL, as there are no contents in the Err variant
4847 pub err: *mut core::ffi::c_void,
4850 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4851 /// containing a crate::c_types::Signature on success and a () on failure.
4852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4853 pub struct CResult_SignatureNoneZ {
4854 /// The contents of this CResult_SignatureNoneZ, accessible via either
4855 /// `err` or `result` depending on the state of `result_ok`.
4856 pub contents: CResult_SignatureNoneZPtr,
4857 /// Whether this CResult_SignatureNoneZ represents a success state.
4858 pub result_ok: bool,
4861 /// Creates a new CResult_SignatureNoneZ in the success state.
4862 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4863 CResult_SignatureNoneZ {
4864 contents: CResult_SignatureNoneZPtr {
4865 result: Box::into_raw(Box::new(o)),
4871 /// Creates a new CResult_SignatureNoneZ in the error state.
4872 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4873 CResult_SignatureNoneZ {
4874 contents: CResult_SignatureNoneZPtr {
4875 err: core::ptr::null_mut(),
4880 /// Checks if the given object is currently in the success state
4882 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4886 /// Frees any resources used by the CResult_SignatureNoneZ.
4887 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4888 impl Drop for CResult_SignatureNoneZ {
4889 fn drop(&mut self) {
4891 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4892 let _ = unsafe { Box::from_raw(self.contents.result) };
4898 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4899 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4900 let contents = if o.result_ok {
4901 let result = unsafe { o.contents.result };
4902 unsafe { o.contents.result = core::ptr::null_mut() };
4903 CResult_SignatureNoneZPtr { result }
4905 let _ = unsafe { Box::from_raw(o.contents.err) };
4906 o.contents.err = core::ptr::null_mut();
4907 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
4911 result_ok: o.result_ok,
4915 impl Clone for CResult_SignatureNoneZ {
4916 fn clone(&self) -> Self {
4918 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4919 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4922 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4923 err: core::ptr::null_mut()
4929 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4930 /// but with all dynamically-allocated buffers duplicated in new buffers.
4931 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4933 /// A tuple of 2 elements. See the individual fields for the types contained.
4934 pub struct C2Tuple_SignatureSignatureZ {
4935 /// The element at position 0
4936 pub a: crate::c_types::Signature,
4937 /// The element at position 1
4938 pub b: crate::c_types::Signature,
4940 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
4941 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
4948 impl C2Tuple_SignatureSignatureZ {
4949 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
4953 impl Clone for C2Tuple_SignatureSignatureZ {
4954 fn clone(&self) -> Self {
4956 a: Clone::clone(&self.a),
4957 b: Clone::clone(&self.b),
4962 /// Creates a new tuple which has the same data as `orig`
4963 /// but with all dynamically-allocated buffers duplicated in new buffers.
4964 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
4965 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
4967 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
4968 C2Tuple_SignatureSignatureZ { a, b, }
4972 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
4973 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
4975 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
4976 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4977 /// A pointer to the contents in the success state.
4978 /// Reading from this pointer when `result_ok` is not set is undefined.
4979 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
4980 /// Note that this value is always NULL, as there are no contents in the Err variant
4981 pub err: *mut core::ffi::c_void,
4984 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
4985 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
4986 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4987 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
4988 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
4989 /// `err` or `result` depending on the state of `result_ok`.
4990 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
4991 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
4992 pub result_ok: bool,
4995 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
4996 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
4997 CResult_C2Tuple_SignatureSignatureZNoneZ {
4998 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4999 result: Box::into_raw(Box::new(o)),
5005 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
5006 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5007 CResult_C2Tuple_SignatureSignatureZNoneZ {
5008 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5009 err: core::ptr::null_mut(),
5014 /// Checks if the given object is currently in the success state
5016 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
5020 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
5021 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
5022 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
5023 fn drop(&mut self) {
5025 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5026 let _ = unsafe { Box::from_raw(self.contents.result) };
5032 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
5033 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5034 let contents = if o.result_ok {
5035 let result = unsafe { o.contents.result };
5036 unsafe { o.contents.result = core::ptr::null_mut() };
5037 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5039 let _ = unsafe { Box::from_raw(o.contents.err) };
5040 o.contents.err = core::ptr::null_mut();
5041 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5045 result_ok: o.result_ok,
5049 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5050 fn clone(&self) -> Self {
5052 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5053 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5056 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5057 err: core::ptr::null_mut()
5063 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5064 /// but with all dynamically-allocated buffers duplicated in new buffers.
5065 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5067 /// The contents of CResult_SecretKeyNoneZ
5068 pub union CResult_SecretKeyNoneZPtr {
5069 /// A pointer to the contents in the success state.
5070 /// Reading from this pointer when `result_ok` is not set is undefined.
5071 pub result: *mut crate::c_types::SecretKey,
5072 /// Note that this value is always NULL, as there are no contents in the Err variant
5073 pub err: *mut core::ffi::c_void,
5076 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5077 /// containing a crate::c_types::SecretKey on success and a () on failure.
5078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5079 pub struct CResult_SecretKeyNoneZ {
5080 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5081 /// `err` or `result` depending on the state of `result_ok`.
5082 pub contents: CResult_SecretKeyNoneZPtr,
5083 /// Whether this CResult_SecretKeyNoneZ represents a success state.
5084 pub result_ok: bool,
5087 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5088 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5089 CResult_SecretKeyNoneZ {
5090 contents: CResult_SecretKeyNoneZPtr {
5091 result: Box::into_raw(Box::new(o)),
5097 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5098 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5099 CResult_SecretKeyNoneZ {
5100 contents: CResult_SecretKeyNoneZPtr {
5101 err: core::ptr::null_mut(),
5106 /// Checks if the given object is currently in the success state
5108 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5112 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5113 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5114 impl Drop for CResult_SecretKeyNoneZ {
5115 fn drop(&mut self) {
5117 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5118 let _ = unsafe { Box::from_raw(self.contents.result) };
5124 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5125 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5126 let contents = if o.result_ok {
5127 let result = unsafe { o.contents.result };
5128 unsafe { o.contents.result = core::ptr::null_mut() };
5129 CResult_SecretKeyNoneZPtr { result }
5131 let _ = unsafe { Box::from_raw(o.contents.err) };
5132 o.contents.err = core::ptr::null_mut();
5133 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5137 result_ok: o.result_ok,
5141 impl Clone for CResult_SecretKeyNoneZ {
5142 fn clone(&self) -> Self {
5144 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
5145 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
5148 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
5149 err: core::ptr::null_mut()
5155 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
5156 /// but with all dynamically-allocated buffers duplicated in new buffers.
5157 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
5159 /// The contents of CResult_SignDecodeErrorZ
5160 pub union CResult_SignDecodeErrorZPtr {
5161 /// A pointer to the contents in the success state.
5162 /// Reading from this pointer when `result_ok` is not set is undefined.
5163 pub result: *mut crate::lightning::chain::keysinterface::Sign,
5164 /// A pointer to the contents in the error state.
5165 /// Reading from this pointer when `result_ok` is set is undefined.
5166 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5169 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5170 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172 pub struct CResult_SignDecodeErrorZ {
5173 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5174 /// `err` or `result` depending on the state of `result_ok`.
5175 pub contents: CResult_SignDecodeErrorZPtr,
5176 /// Whether this CResult_SignDecodeErrorZ represents a success state.
5177 pub result_ok: bool,
5180 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5181 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5182 CResult_SignDecodeErrorZ {
5183 contents: CResult_SignDecodeErrorZPtr {
5184 result: Box::into_raw(Box::new(o)),
5190 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5191 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5192 CResult_SignDecodeErrorZ {
5193 contents: CResult_SignDecodeErrorZPtr {
5194 err: Box::into_raw(Box::new(e)),
5199 /// Checks if the given object is currently in the success state
5201 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5205 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5206 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5207 impl Drop for CResult_SignDecodeErrorZ {
5208 fn drop(&mut self) {
5210 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5211 let _ = unsafe { Box::from_raw(self.contents.result) };
5214 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5215 let _ = unsafe { Box::from_raw(self.contents.err) };
5220 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5221 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5222 let contents = if o.result_ok {
5223 let result = unsafe { o.contents.result };
5224 unsafe { o.contents.result = core::ptr::null_mut() };
5225 CResult_SignDecodeErrorZPtr { result }
5227 let err = unsafe { o.contents.err };
5228 unsafe { o.contents.err = core::ptr::null_mut(); }
5229 CResult_SignDecodeErrorZPtr { err }
5233 result_ok: o.result_ok,
5237 impl Clone for CResult_SignDecodeErrorZ {
5238 fn clone(&self) -> Self {
5240 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5241 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5244 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5245 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5251 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5252 /// but with all dynamically-allocated buffers duplicated in new buffers.
5253 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5255 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5256 /// This corresponds to std::vector in C++
5257 pub struct CVec_u5Z {
5258 /// The elements in the array.
5259 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5260 pub data: *mut crate::c_types::u5,
5261 /// The number of elements pointed to by `data`.
5265 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5266 if self.datalen == 0 { return Vec::new(); }
5267 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5268 self.data = core::ptr::null_mut();
5272 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5273 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5276 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5277 fn from(v: Vec<crate::c_types::u5>) -> Self {
5278 let datalen = v.len();
5279 let data = Box::into_raw(v.into_boxed_slice());
5280 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5284 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5285 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5286 impl Drop for CVec_u5Z {
5287 fn drop(&mut self) {
5288 if self.datalen == 0 { return; }
5289 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5292 impl Clone for CVec_u5Z {
5293 fn clone(&self) -> Self {
5294 let mut res = Vec::new();
5295 if self.datalen == 0 { return Self::from(res); }
5296 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5301 /// The contents of CResult_RecoverableSignatureNoneZ
5302 pub union CResult_RecoverableSignatureNoneZPtr {
5303 /// A pointer to the contents in the success state.
5304 /// Reading from this pointer when `result_ok` is not set is undefined.
5305 pub result: *mut crate::c_types::RecoverableSignature,
5306 /// Note that this value is always NULL, as there are no contents in the Err variant
5307 pub err: *mut core::ffi::c_void,
5310 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5311 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5312 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5313 pub struct CResult_RecoverableSignatureNoneZ {
5314 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5315 /// `err` or `result` depending on the state of `result_ok`.
5316 pub contents: CResult_RecoverableSignatureNoneZPtr,
5317 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5318 pub result_ok: bool,
5321 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5322 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5323 CResult_RecoverableSignatureNoneZ {
5324 contents: CResult_RecoverableSignatureNoneZPtr {
5325 result: Box::into_raw(Box::new(o)),
5331 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5332 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5333 CResult_RecoverableSignatureNoneZ {
5334 contents: CResult_RecoverableSignatureNoneZPtr {
5335 err: core::ptr::null_mut(),
5340 /// Checks if the given object is currently in the success state
5342 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5346 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5347 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5348 impl Drop for CResult_RecoverableSignatureNoneZ {
5349 fn drop(&mut self) {
5351 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5352 let _ = unsafe { Box::from_raw(self.contents.result) };
5358 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5359 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5360 let contents = if o.result_ok {
5361 let result = unsafe { o.contents.result };
5362 unsafe { o.contents.result = core::ptr::null_mut() };
5363 CResult_RecoverableSignatureNoneZPtr { result }
5365 let _ = unsafe { Box::from_raw(o.contents.err) };
5366 o.contents.err = core::ptr::null_mut();
5367 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5371 result_ok: o.result_ok,
5375 impl Clone for CResult_RecoverableSignatureNoneZ {
5376 fn clone(&self) -> Self {
5378 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5379 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5382 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5383 err: core::ptr::null_mut()
5389 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5390 /// but with all dynamically-allocated buffers duplicated in new buffers.
5391 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5393 /// A dynamically-allocated array of u8s of arbitrary size.
5394 /// This corresponds to std::vector in C++
5395 pub struct CVec_u8Z {
5396 /// The elements in the array.
5397 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5399 /// The number of elements pointed to by `data`.
5403 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5404 if self.datalen == 0 { return Vec::new(); }
5405 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5406 self.data = core::ptr::null_mut();
5410 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5411 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5414 impl From<Vec<u8>> for CVec_u8Z {
5415 fn from(v: Vec<u8>) -> Self {
5416 let datalen = v.len();
5417 let data = Box::into_raw(v.into_boxed_slice());
5418 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5422 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5423 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5424 impl Drop for CVec_u8Z {
5425 fn drop(&mut self) {
5426 if self.datalen == 0 { return; }
5427 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5430 impl Clone for CVec_u8Z {
5431 fn clone(&self) -> Self {
5432 let mut res = Vec::new();
5433 if self.datalen == 0 { return Self::from(res); }
5434 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5439 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5440 /// This corresponds to std::vector in C++
5441 pub struct CVec_CVec_u8ZZ {
5442 /// The elements in the array.
5443 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5444 pub data: *mut crate::c_types::derived::CVec_u8Z,
5445 /// The number of elements pointed to by `data`.
5448 impl CVec_CVec_u8ZZ {
5449 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5450 if self.datalen == 0 { return Vec::new(); }
5451 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5452 self.data = core::ptr::null_mut();
5456 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5457 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5460 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5461 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5462 let datalen = v.len();
5463 let data = Box::into_raw(v.into_boxed_slice());
5464 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5468 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5469 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5470 impl Drop for CVec_CVec_u8ZZ {
5471 fn drop(&mut self) {
5472 if self.datalen == 0 { return; }
5473 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5476 impl Clone for CVec_CVec_u8ZZ {
5477 fn clone(&self) -> Self {
5478 let mut res = Vec::new();
5479 if self.datalen == 0 { return Self::from(res); }
5480 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5485 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5486 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5487 /// A pointer to the contents in the success state.
5488 /// Reading from this pointer when `result_ok` is not set is undefined.
5489 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5490 /// Note that this value is always NULL, as there are no contents in the Err variant
5491 pub err: *mut core::ffi::c_void,
5494 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5495 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5497 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5498 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5499 /// `err` or `result` depending on the state of `result_ok`.
5500 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5501 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5502 pub result_ok: bool,
5505 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5506 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5507 CResult_CVec_CVec_u8ZZNoneZ {
5508 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5509 result: Box::into_raw(Box::new(o)),
5515 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5516 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5517 CResult_CVec_CVec_u8ZZNoneZ {
5518 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5519 err: core::ptr::null_mut(),
5524 /// Checks if the given object is currently in the success state
5526 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5530 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5531 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5532 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5533 fn drop(&mut self) {
5535 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5536 let _ = unsafe { Box::from_raw(self.contents.result) };
5542 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5543 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5544 let contents = if o.result_ok {
5545 let result = unsafe { o.contents.result };
5546 unsafe { o.contents.result = core::ptr::null_mut() };
5547 CResult_CVec_CVec_u8ZZNoneZPtr { result }
5549 let _ = unsafe { Box::from_raw(o.contents.err) };
5550 o.contents.err = core::ptr::null_mut();
5551 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5555 result_ok: o.result_ok,
5559 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5560 fn clone(&self) -> Self {
5562 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5563 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5566 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5567 err: core::ptr::null_mut()
5573 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5574 /// but with all dynamically-allocated buffers duplicated in new buffers.
5575 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5577 /// The contents of CResult_InMemorySignerDecodeErrorZ
5578 pub union CResult_InMemorySignerDecodeErrorZPtr {
5579 /// A pointer to the contents in the success state.
5580 /// Reading from this pointer when `result_ok` is not set is undefined.
5581 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5582 /// A pointer to the contents in the error state.
5583 /// Reading from this pointer when `result_ok` is set is undefined.
5584 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5587 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5588 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5589 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5590 pub struct CResult_InMemorySignerDecodeErrorZ {
5591 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5592 /// `err` or `result` depending on the state of `result_ok`.
5593 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5594 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5595 pub result_ok: bool,
5598 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5599 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5600 CResult_InMemorySignerDecodeErrorZ {
5601 contents: CResult_InMemorySignerDecodeErrorZPtr {
5602 result: Box::into_raw(Box::new(o)),
5608 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5609 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5610 CResult_InMemorySignerDecodeErrorZ {
5611 contents: CResult_InMemorySignerDecodeErrorZPtr {
5612 err: Box::into_raw(Box::new(e)),
5617 /// Checks if the given object is currently in the success state
5619 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5623 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5624 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5625 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5626 fn drop(&mut self) {
5628 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5629 let _ = unsafe { Box::from_raw(self.contents.result) };
5632 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5633 let _ = unsafe { Box::from_raw(self.contents.err) };
5638 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5639 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5640 let contents = if o.result_ok {
5641 let result = unsafe { o.contents.result };
5642 unsafe { o.contents.result = core::ptr::null_mut() };
5643 CResult_InMemorySignerDecodeErrorZPtr { result }
5645 let err = unsafe { o.contents.err };
5646 unsafe { o.contents.err = core::ptr::null_mut(); }
5647 CResult_InMemorySignerDecodeErrorZPtr { err }
5651 result_ok: o.result_ok,
5655 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5656 fn clone(&self) -> Self {
5658 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5659 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5662 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5663 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5669 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5670 /// but with all dynamically-allocated buffers duplicated in new buffers.
5671 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5673 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5674 /// This corresponds to std::vector in C++
5675 pub struct CVec_TxOutZ {
5676 /// The elements in the array.
5677 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5678 pub data: *mut crate::c_types::TxOut,
5679 /// The number of elements pointed to by `data`.
5683 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5684 if self.datalen == 0 { return Vec::new(); }
5685 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5686 self.data = core::ptr::null_mut();
5690 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5691 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5694 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5695 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5696 let datalen = v.len();
5697 let data = Box::into_raw(v.into_boxed_slice());
5698 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5702 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5703 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5704 impl Drop for CVec_TxOutZ {
5705 fn drop(&mut self) {
5706 if self.datalen == 0 { return; }
5707 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5710 impl Clone for CVec_TxOutZ {
5711 fn clone(&self) -> Self {
5712 let mut res = Vec::new();
5713 if self.datalen == 0 { return Self::from(res); }
5714 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5719 /// The contents of CResult_TransactionNoneZ
5720 pub union CResult_TransactionNoneZPtr {
5721 /// A pointer to the contents in the success state.
5722 /// Reading from this pointer when `result_ok` is not set is undefined.
5723 pub result: *mut crate::c_types::Transaction,
5724 /// Note that this value is always NULL, as there are no contents in the Err variant
5725 pub err: *mut core::ffi::c_void,
5728 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5729 /// containing a crate::c_types::Transaction on success and a () on failure.
5730 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5731 pub struct CResult_TransactionNoneZ {
5732 /// The contents of this CResult_TransactionNoneZ, accessible via either
5733 /// `err` or `result` depending on the state of `result_ok`.
5734 pub contents: CResult_TransactionNoneZPtr,
5735 /// Whether this CResult_TransactionNoneZ represents a success state.
5736 pub result_ok: bool,
5739 /// Creates a new CResult_TransactionNoneZ in the success state.
5740 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5741 CResult_TransactionNoneZ {
5742 contents: CResult_TransactionNoneZPtr {
5743 result: Box::into_raw(Box::new(o)),
5749 /// Creates a new CResult_TransactionNoneZ in the error state.
5750 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5751 CResult_TransactionNoneZ {
5752 contents: CResult_TransactionNoneZPtr {
5753 err: core::ptr::null_mut(),
5758 /// Checks if the given object is currently in the success state
5760 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5764 /// Frees any resources used by the CResult_TransactionNoneZ.
5765 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5766 impl Drop for CResult_TransactionNoneZ {
5767 fn drop(&mut self) {
5769 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5770 let _ = unsafe { Box::from_raw(self.contents.result) };
5776 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5777 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5778 let contents = if o.result_ok {
5779 let result = unsafe { o.contents.result };
5780 unsafe { o.contents.result = core::ptr::null_mut() };
5781 CResult_TransactionNoneZPtr { result }
5783 let _ = unsafe { Box::from_raw(o.contents.err) };
5784 o.contents.err = core::ptr::null_mut();
5785 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5789 result_ok: o.result_ok,
5793 impl Clone for CResult_TransactionNoneZ {
5794 fn clone(&self) -> Self {
5796 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5797 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5800 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5801 err: core::ptr::null_mut()
5807 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5808 /// but with all dynamically-allocated buffers duplicated in new buffers.
5809 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5811 /// A tuple of 2 elements. See the individual fields for the types contained.
5812 pub struct C2Tuple_BlockHashChannelMonitorZ {
5813 /// The element at position 0
5814 pub a: crate::c_types::ThirtyTwoBytes,
5815 /// The element at position 1
5816 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5818 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5819 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5826 impl C2Tuple_BlockHashChannelMonitorZ {
5827 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5831 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5833 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5834 C2Tuple_BlockHashChannelMonitorZ { a, b, }
5838 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5839 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5841 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5842 /// This corresponds to std::vector in C++
5843 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5844 /// The elements in the array.
5845 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5846 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5847 /// The number of elements pointed to by `data`.
5850 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5851 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5852 if self.datalen == 0 { return Vec::new(); }
5853 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5854 self.data = core::ptr::null_mut();
5858 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5859 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5862 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5863 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5864 let datalen = v.len();
5865 let data = Box::into_raw(v.into_boxed_slice());
5866 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5870 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5871 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5872 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5873 fn drop(&mut self) {
5874 if self.datalen == 0 { return; }
5875 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5879 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5880 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
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::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
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::c_types::IOError,
5889 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5890 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5891 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5892 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5893 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5894 /// `err` or `result` depending on the state of `result_ok`.
5895 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5896 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5897 pub result_ok: bool,
5900 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5901 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5902 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5903 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5904 result: Box::into_raw(Box::new(o)),
5910 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5911 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5912 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5913 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
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_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5925 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5926 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5927 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
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::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5941 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> 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_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5947 let err = unsafe { o.contents.err };
5948 unsafe { o.contents.err = core::ptr::null_mut(); }
5949 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5953 result_ok: o.result_ok,
5959 /// An enum which can either contain a u16 or not
5960 pub enum COption_u16Z {
5961 /// When we're in this state, this COption_u16Z contains a u16
5963 /// When we're in this state, this COption_u16Z contains nothing
5967 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5968 if let Self::None = self { false } else { true }
5970 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5973 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5974 if let Self::Some(v) = self { v } else { unreachable!() }
5978 /// Constructs a new COption_u16Z containing a u16
5979 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5980 COption_u16Z::Some(o)
5983 /// Constructs a new COption_u16Z containing nothing
5984 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5988 /// Frees any resources associated with the u16, if we are in the Some state
5989 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5991 /// Creates a new COption_u16Z which has the same data as `orig`
5992 /// but with all dynamically-allocated buffers duplicated in new buffers.
5993 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5995 /// The contents of CResult_NoneAPIErrorZ
5996 pub union CResult_NoneAPIErrorZPtr {
5997 /// Note that this value is always NULL, as there are no contents in the OK variant
5998 pub result: *mut core::ffi::c_void,
5999 /// A pointer to the contents in the error state.
6000 /// Reading from this pointer when `result_ok` is set is undefined.
6001 pub err: *mut crate::lightning::util::errors::APIError,
6004 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6005 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
6006 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6007 pub struct CResult_NoneAPIErrorZ {
6008 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
6009 /// `err` or `result` depending on the state of `result_ok`.
6010 pub contents: CResult_NoneAPIErrorZPtr,
6011 /// Whether this CResult_NoneAPIErrorZ represents a success state.
6012 pub result_ok: bool,
6015 /// Creates a new CResult_NoneAPIErrorZ in the success state.
6016 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
6017 CResult_NoneAPIErrorZ {
6018 contents: CResult_NoneAPIErrorZPtr {
6019 result: core::ptr::null_mut(),
6025 /// Creates a new CResult_NoneAPIErrorZ in the error state.
6026 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
6027 CResult_NoneAPIErrorZ {
6028 contents: CResult_NoneAPIErrorZPtr {
6029 err: Box::into_raw(Box::new(e)),
6034 /// Checks if the given object is currently in the success state
6036 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
6040 /// Frees any resources used by the CResult_NoneAPIErrorZ.
6041 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
6042 impl Drop for CResult_NoneAPIErrorZ {
6043 fn drop(&mut self) {
6046 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6047 let _ = unsafe { Box::from_raw(self.contents.err) };
6052 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6053 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6054 let contents = if o.result_ok {
6055 let _ = unsafe { Box::from_raw(o.contents.result) };
6056 o.contents.result = core::ptr::null_mut();
6057 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6059 let err = unsafe { o.contents.err };
6060 unsafe { o.contents.err = core::ptr::null_mut(); }
6061 CResult_NoneAPIErrorZPtr { err }
6065 result_ok: o.result_ok,
6069 impl Clone for CResult_NoneAPIErrorZ {
6070 fn clone(&self) -> Self {
6072 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6073 result: core::ptr::null_mut()
6076 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6077 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6083 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6084 /// but with all dynamically-allocated buffers duplicated in new buffers.
6085 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6087 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6088 /// This corresponds to std::vector in C++
6089 pub struct CVec_CResult_NoneAPIErrorZZ {
6090 /// The elements in the array.
6091 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6092 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6093 /// The number of elements pointed to by `data`.
6096 impl CVec_CResult_NoneAPIErrorZZ {
6097 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6098 if self.datalen == 0 { return Vec::new(); }
6099 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6100 self.data = core::ptr::null_mut();
6104 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6105 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6108 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6109 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6110 let datalen = v.len();
6111 let data = Box::into_raw(v.into_boxed_slice());
6112 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6116 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6117 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6118 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6119 fn drop(&mut self) {
6120 if self.datalen == 0 { return; }
6121 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6124 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6125 fn clone(&self) -> Self {
6126 let mut res = Vec::new();
6127 if self.datalen == 0 { return Self::from(res); }
6128 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6133 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6134 /// This corresponds to std::vector in C++
6135 pub struct CVec_APIErrorZ {
6136 /// The elements in the array.
6137 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6138 pub data: *mut crate::lightning::util::errors::APIError,
6139 /// The number of elements pointed to by `data`.
6142 impl CVec_APIErrorZ {
6143 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6144 if self.datalen == 0 { return Vec::new(); }
6145 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6146 self.data = core::ptr::null_mut();
6150 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6151 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6154 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6155 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6156 let datalen = v.len();
6157 let data = Box::into_raw(v.into_boxed_slice());
6158 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6162 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6163 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6164 impl Drop for CVec_APIErrorZ {
6165 fn drop(&mut self) {
6166 if self.datalen == 0 { return; }
6167 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6170 impl Clone for CVec_APIErrorZ {
6171 fn clone(&self) -> Self {
6172 let mut res = Vec::new();
6173 if self.datalen == 0 { return Self::from(res); }
6174 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6179 /// The contents of CResult__u832APIErrorZ
6180 pub union CResult__u832APIErrorZPtr {
6181 /// A pointer to the contents in the success state.
6182 /// Reading from this pointer when `result_ok` is not set is undefined.
6183 pub result: *mut crate::c_types::ThirtyTwoBytes,
6184 /// A pointer to the contents in the error state.
6185 /// Reading from this pointer when `result_ok` is set is undefined.
6186 pub err: *mut crate::lightning::util::errors::APIError,
6189 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6190 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6191 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6192 pub struct CResult__u832APIErrorZ {
6193 /// The contents of this CResult__u832APIErrorZ, accessible via either
6194 /// `err` or `result` depending on the state of `result_ok`.
6195 pub contents: CResult__u832APIErrorZPtr,
6196 /// Whether this CResult__u832APIErrorZ represents a success state.
6197 pub result_ok: bool,
6200 /// Creates a new CResult__u832APIErrorZ in the success state.
6201 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6202 CResult__u832APIErrorZ {
6203 contents: CResult__u832APIErrorZPtr {
6204 result: Box::into_raw(Box::new(o)),
6210 /// Creates a new CResult__u832APIErrorZ in the error state.
6211 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6212 CResult__u832APIErrorZ {
6213 contents: CResult__u832APIErrorZPtr {
6214 err: Box::into_raw(Box::new(e)),
6219 /// Checks if the given object is currently in the success state
6221 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6225 /// Frees any resources used by the CResult__u832APIErrorZ.
6226 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6227 impl Drop for CResult__u832APIErrorZ {
6228 fn drop(&mut self) {
6230 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6231 let _ = unsafe { Box::from_raw(self.contents.result) };
6234 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6235 let _ = unsafe { Box::from_raw(self.contents.err) };
6240 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6241 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6242 let contents = if o.result_ok {
6243 let result = unsafe { o.contents.result };
6244 unsafe { o.contents.result = core::ptr::null_mut() };
6245 CResult__u832APIErrorZPtr { result }
6247 let err = unsafe { o.contents.err };
6248 unsafe { o.contents.err = core::ptr::null_mut(); }
6249 CResult__u832APIErrorZPtr { err }
6253 result_ok: o.result_ok,
6257 impl Clone for CResult__u832APIErrorZ {
6258 fn clone(&self) -> Self {
6260 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6261 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6264 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6265 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6271 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6272 /// but with all dynamically-allocated buffers duplicated in new buffers.
6273 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6275 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6276 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6277 /// A pointer to the contents in the success state.
6278 /// Reading from this pointer when `result_ok` is not set is undefined.
6279 pub result: *mut crate::c_types::ThirtyTwoBytes,
6280 /// A pointer to the contents in the error state.
6281 /// Reading from this pointer when `result_ok` is set is undefined.
6282 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6285 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6286 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6288 pub struct CResult_PaymentIdPaymentSendFailureZ {
6289 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6290 /// `err` or `result` depending on the state of `result_ok`.
6291 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6292 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6293 pub result_ok: bool,
6296 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6297 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6298 CResult_PaymentIdPaymentSendFailureZ {
6299 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6300 result: Box::into_raw(Box::new(o)),
6306 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6307 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6308 CResult_PaymentIdPaymentSendFailureZ {
6309 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6310 err: Box::into_raw(Box::new(e)),
6315 /// Checks if the given object is currently in the success state
6317 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6321 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6322 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6323 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6324 fn drop(&mut self) {
6326 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6327 let _ = unsafe { Box::from_raw(self.contents.result) };
6330 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6331 let _ = unsafe { Box::from_raw(self.contents.err) };
6336 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6337 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6338 let contents = if o.result_ok {
6339 let result = unsafe { o.contents.result };
6340 unsafe { o.contents.result = core::ptr::null_mut() };
6341 CResult_PaymentIdPaymentSendFailureZPtr { result }
6343 let err = unsafe { o.contents.err };
6344 unsafe { o.contents.err = core::ptr::null_mut(); }
6345 CResult_PaymentIdPaymentSendFailureZPtr { err }
6349 result_ok: o.result_ok,
6353 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6354 fn clone(&self) -> Self {
6356 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6357 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6360 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6361 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6367 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6368 /// but with all dynamically-allocated buffers duplicated in new buffers.
6369 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6371 /// The contents of CResult_NonePaymentSendFailureZ
6372 pub union CResult_NonePaymentSendFailureZPtr {
6373 /// Note that this value is always NULL, as there are no contents in the OK variant
6374 pub result: *mut core::ffi::c_void,
6375 /// A pointer to the contents in the error state.
6376 /// Reading from this pointer when `result_ok` is set is undefined.
6377 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6380 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6381 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6383 pub struct CResult_NonePaymentSendFailureZ {
6384 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6385 /// `err` or `result` depending on the state of `result_ok`.
6386 pub contents: CResult_NonePaymentSendFailureZPtr,
6387 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6388 pub result_ok: bool,
6391 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6392 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6393 CResult_NonePaymentSendFailureZ {
6394 contents: CResult_NonePaymentSendFailureZPtr {
6395 result: core::ptr::null_mut(),
6401 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6402 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6403 CResult_NonePaymentSendFailureZ {
6404 contents: CResult_NonePaymentSendFailureZPtr {
6405 err: Box::into_raw(Box::new(e)),
6410 /// Checks if the given object is currently in the success state
6412 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6416 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6417 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6418 impl Drop for CResult_NonePaymentSendFailureZ {
6419 fn drop(&mut self) {
6422 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6423 let _ = unsafe { Box::from_raw(self.contents.err) };
6428 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6429 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6430 let contents = if o.result_ok {
6431 let _ = unsafe { Box::from_raw(o.contents.result) };
6432 o.contents.result = core::ptr::null_mut();
6433 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6435 let err = unsafe { o.contents.err };
6436 unsafe { o.contents.err = core::ptr::null_mut(); }
6437 CResult_NonePaymentSendFailureZPtr { err }
6441 result_ok: o.result_ok,
6445 impl Clone for CResult_NonePaymentSendFailureZ {
6446 fn clone(&self) -> Self {
6448 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6449 result: core::ptr::null_mut()
6452 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6453 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6459 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6460 /// but with all dynamically-allocated buffers duplicated in new buffers.
6461 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6463 /// A tuple of 2 elements. See the individual fields for the types contained.
6464 pub struct C2Tuple_PaymentHashPaymentIdZ {
6465 /// The element at position 0
6466 pub a: crate::c_types::ThirtyTwoBytes,
6467 /// The element at position 1
6468 pub b: crate::c_types::ThirtyTwoBytes,
6470 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6471 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6478 impl C2Tuple_PaymentHashPaymentIdZ {
6479 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6483 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6484 fn clone(&self) -> Self {
6486 a: Clone::clone(&self.a),
6487 b: Clone::clone(&self.b),
6492 /// Creates a new tuple which has the same data as `orig`
6493 /// but with all dynamically-allocated buffers duplicated in new buffers.
6494 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6495 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6497 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6498 C2Tuple_PaymentHashPaymentIdZ { a, b, }
6502 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6503 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6505 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6506 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6507 /// A pointer to the contents in the success state.
6508 /// Reading from this pointer when `result_ok` is not set is undefined.
6509 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6510 /// A pointer to the contents in the error state.
6511 /// Reading from this pointer when `result_ok` is set is undefined.
6512 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6515 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6516 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6518 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6519 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6520 /// `err` or `result` depending on the state of `result_ok`.
6521 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6522 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6523 pub result_ok: bool,
6526 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6527 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6528 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6529 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6530 result: Box::into_raw(Box::new(o)),
6536 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6537 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6538 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6539 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6540 err: Box::into_raw(Box::new(e)),
6545 /// Checks if the given object is currently in the success state
6547 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6551 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6552 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6553 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6554 fn drop(&mut self) {
6556 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6557 let _ = unsafe { Box::from_raw(self.contents.result) };
6560 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6561 let _ = unsafe { Box::from_raw(self.contents.err) };
6566 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6567 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6568 let contents = if o.result_ok {
6569 let result = unsafe { o.contents.result };
6570 unsafe { o.contents.result = core::ptr::null_mut() };
6571 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6573 let err = unsafe { o.contents.err };
6574 unsafe { o.contents.err = core::ptr::null_mut(); }
6575 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6579 result_ok: o.result_ok,
6583 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6584 fn clone(&self) -> Self {
6586 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6587 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6590 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6591 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6597 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6598 /// but with all dynamically-allocated buffers duplicated in new buffers.
6599 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6601 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6602 /// This corresponds to std::vector in C++
6603 pub struct CVec_NetAddressZ {
6604 /// The elements in the array.
6605 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6606 pub data: *mut crate::lightning::ln::msgs::NetAddress,
6607 /// The number of elements pointed to by `data`.
6610 impl CVec_NetAddressZ {
6611 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6612 if self.datalen == 0 { return Vec::new(); }
6613 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6614 self.data = core::ptr::null_mut();
6618 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6619 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6622 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6623 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6624 let datalen = v.len();
6625 let data = Box::into_raw(v.into_boxed_slice());
6626 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6630 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6631 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6632 impl Drop for CVec_NetAddressZ {
6633 fn drop(&mut self) {
6634 if self.datalen == 0 { return; }
6635 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6638 impl Clone for CVec_NetAddressZ {
6639 fn clone(&self) -> Self {
6640 let mut res = Vec::new();
6641 if self.datalen == 0 { return Self::from(res); }
6642 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6647 /// A tuple of 2 elements. See the individual fields for the types contained.
6648 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6649 /// The element at position 0
6650 pub a: crate::c_types::ThirtyTwoBytes,
6651 /// The element at position 1
6652 pub b: crate::c_types::ThirtyTwoBytes,
6654 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6655 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6662 impl C2Tuple_PaymentHashPaymentSecretZ {
6663 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6667 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6668 fn clone(&self) -> Self {
6670 a: Clone::clone(&self.a),
6671 b: Clone::clone(&self.b),
6676 /// Creates a new tuple which has the same data as `orig`
6677 /// but with all dynamically-allocated buffers duplicated in new buffers.
6678 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6679 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6681 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6682 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6686 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6687 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6689 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6690 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6691 /// A pointer to the contents in the success state.
6692 /// Reading from this pointer when `result_ok` is not set is undefined.
6693 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6694 /// Note that this value is always NULL, as there are no contents in the Err variant
6695 pub err: *mut core::ffi::c_void,
6698 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6699 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6701 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6702 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6703 /// `err` or `result` depending on the state of `result_ok`.
6704 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6705 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6706 pub result_ok: bool,
6709 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6710 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6711 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6712 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6713 result: Box::into_raw(Box::new(o)),
6719 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6720 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6721 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6722 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6723 err: core::ptr::null_mut(),
6728 /// Checks if the given object is currently in the success state
6730 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6734 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6735 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6736 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6737 fn drop(&mut self) {
6739 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6740 let _ = unsafe { Box::from_raw(self.contents.result) };
6746 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6747 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6748 let contents = if o.result_ok {
6749 let result = unsafe { o.contents.result };
6750 unsafe { o.contents.result = core::ptr::null_mut() };
6751 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6753 let _ = unsafe { Box::from_raw(o.contents.err) };
6754 o.contents.err = core::ptr::null_mut();
6755 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6759 result_ok: o.result_ok,
6763 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6764 fn clone(&self) -> Self {
6766 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6767 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6770 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6771 err: core::ptr::null_mut()
6777 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6778 /// but with all dynamically-allocated buffers duplicated in new buffers.
6779 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6781 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6782 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6783 /// A pointer to the contents in the success state.
6784 /// Reading from this pointer when `result_ok` is not set is undefined.
6785 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6786 /// A pointer to the contents in the error state.
6787 /// Reading from this pointer when `result_ok` is set is undefined.
6788 pub err: *mut crate::lightning::util::errors::APIError,
6791 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6792 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6794 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6795 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6796 /// `err` or `result` depending on the state of `result_ok`.
6797 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6798 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6799 pub result_ok: bool,
6802 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6803 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6804 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6805 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6806 result: Box::into_raw(Box::new(o)),
6812 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6813 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6814 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6815 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6816 err: Box::into_raw(Box::new(e)),
6821 /// Checks if the given object is currently in the success state
6823 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6827 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6828 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6829 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6830 fn drop(&mut self) {
6832 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6833 let _ = unsafe { Box::from_raw(self.contents.result) };
6836 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6837 let _ = unsafe { Box::from_raw(self.contents.err) };
6842 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6843 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6844 let contents = if o.result_ok {
6845 let result = unsafe { o.contents.result };
6846 unsafe { o.contents.result = core::ptr::null_mut() };
6847 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6849 let err = unsafe { o.contents.err };
6850 unsafe { o.contents.err = core::ptr::null_mut(); }
6851 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6855 result_ok: o.result_ok,
6859 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6860 fn clone(&self) -> Self {
6862 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6863 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6866 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6867 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6873 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6874 /// but with all dynamically-allocated buffers duplicated in new buffers.
6875 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6877 /// The contents of CResult_PaymentSecretNoneZ
6878 pub union CResult_PaymentSecretNoneZPtr {
6879 /// A pointer to the contents in the success state.
6880 /// Reading from this pointer when `result_ok` is not set is undefined.
6881 pub result: *mut crate::c_types::ThirtyTwoBytes,
6882 /// Note that this value is always NULL, as there are no contents in the Err variant
6883 pub err: *mut core::ffi::c_void,
6886 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6887 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6889 pub struct CResult_PaymentSecretNoneZ {
6890 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6891 /// `err` or `result` depending on the state of `result_ok`.
6892 pub contents: CResult_PaymentSecretNoneZPtr,
6893 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6894 pub result_ok: bool,
6897 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6898 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6899 CResult_PaymentSecretNoneZ {
6900 contents: CResult_PaymentSecretNoneZPtr {
6901 result: Box::into_raw(Box::new(o)),
6907 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6908 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6909 CResult_PaymentSecretNoneZ {
6910 contents: CResult_PaymentSecretNoneZPtr {
6911 err: core::ptr::null_mut(),
6916 /// Checks if the given object is currently in the success state
6918 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6922 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6923 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6924 impl Drop for CResult_PaymentSecretNoneZ {
6925 fn drop(&mut self) {
6927 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6928 let _ = unsafe { Box::from_raw(self.contents.result) };
6934 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6935 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6936 let contents = if o.result_ok {
6937 let result = unsafe { o.contents.result };
6938 unsafe { o.contents.result = core::ptr::null_mut() };
6939 CResult_PaymentSecretNoneZPtr { result }
6941 let _ = unsafe { Box::from_raw(o.contents.err) };
6942 o.contents.err = core::ptr::null_mut();
6943 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
6947 result_ok: o.result_ok,
6951 impl Clone for CResult_PaymentSecretNoneZ {
6952 fn clone(&self) -> Self {
6954 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
6955 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6958 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
6959 err: core::ptr::null_mut()
6965 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
6966 /// but with all dynamically-allocated buffers duplicated in new buffers.
6967 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
6969 /// The contents of CResult_PaymentSecretAPIErrorZ
6970 pub union CResult_PaymentSecretAPIErrorZPtr {
6971 /// A pointer to the contents in the success state.
6972 /// Reading from this pointer when `result_ok` is not set is undefined.
6973 pub result: *mut crate::c_types::ThirtyTwoBytes,
6974 /// A pointer to the contents in the error state.
6975 /// Reading from this pointer when `result_ok` is set is undefined.
6976 pub err: *mut crate::lightning::util::errors::APIError,
6979 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6980 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6982 pub struct CResult_PaymentSecretAPIErrorZ {
6983 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6984 /// `err` or `result` depending on the state of `result_ok`.
6985 pub contents: CResult_PaymentSecretAPIErrorZPtr,
6986 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6987 pub result_ok: bool,
6990 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
6991 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
6992 CResult_PaymentSecretAPIErrorZ {
6993 contents: CResult_PaymentSecretAPIErrorZPtr {
6994 result: Box::into_raw(Box::new(o)),
7000 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
7001 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
7002 CResult_PaymentSecretAPIErrorZ {
7003 contents: CResult_PaymentSecretAPIErrorZPtr {
7004 err: Box::into_raw(Box::new(e)),
7009 /// Checks if the given object is currently in the success state
7011 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
7015 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
7016 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
7017 impl Drop for CResult_PaymentSecretAPIErrorZ {
7018 fn drop(&mut self) {
7020 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7021 let _ = unsafe { Box::from_raw(self.contents.result) };
7024 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7025 let _ = unsafe { Box::from_raw(self.contents.err) };
7030 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
7031 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7032 let contents = if o.result_ok {
7033 let result = unsafe { o.contents.result };
7034 unsafe { o.contents.result = core::ptr::null_mut() };
7035 CResult_PaymentSecretAPIErrorZPtr { result }
7037 let err = unsafe { o.contents.err };
7038 unsafe { o.contents.err = core::ptr::null_mut(); }
7039 CResult_PaymentSecretAPIErrorZPtr { err }
7043 result_ok: o.result_ok,
7047 impl Clone for CResult_PaymentSecretAPIErrorZ {
7048 fn clone(&self) -> Self {
7050 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7051 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7054 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7055 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7061 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7062 /// but with all dynamically-allocated buffers duplicated in new buffers.
7063 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7065 /// The contents of CResult_PaymentPreimageAPIErrorZ
7066 pub union CResult_PaymentPreimageAPIErrorZPtr {
7067 /// A pointer to the contents in the success state.
7068 /// Reading from this pointer when `result_ok` is not set is undefined.
7069 pub result: *mut crate::c_types::ThirtyTwoBytes,
7070 /// A pointer to the contents in the error state.
7071 /// Reading from this pointer when `result_ok` is set is undefined.
7072 pub err: *mut crate::lightning::util::errors::APIError,
7075 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7076 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7078 pub struct CResult_PaymentPreimageAPIErrorZ {
7079 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7080 /// `err` or `result` depending on the state of `result_ok`.
7081 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7082 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7083 pub result_ok: bool,
7086 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7087 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7088 CResult_PaymentPreimageAPIErrorZ {
7089 contents: CResult_PaymentPreimageAPIErrorZPtr {
7090 result: Box::into_raw(Box::new(o)),
7096 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7097 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7098 CResult_PaymentPreimageAPIErrorZ {
7099 contents: CResult_PaymentPreimageAPIErrorZPtr {
7100 err: Box::into_raw(Box::new(e)),
7105 /// Checks if the given object is currently in the success state
7107 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7111 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7112 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7113 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7114 fn drop(&mut self) {
7116 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7117 let _ = unsafe { Box::from_raw(self.contents.result) };
7120 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7121 let _ = unsafe { Box::from_raw(self.contents.err) };
7126 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7127 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7128 let contents = if o.result_ok {
7129 let result = unsafe { o.contents.result };
7130 unsafe { o.contents.result = core::ptr::null_mut() };
7131 CResult_PaymentPreimageAPIErrorZPtr { result }
7133 let err = unsafe { o.contents.err };
7134 unsafe { o.contents.err = core::ptr::null_mut(); }
7135 CResult_PaymentPreimageAPIErrorZPtr { err }
7139 result_ok: o.result_ok,
7143 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7144 fn clone(&self) -> Self {
7146 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7147 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7150 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7151 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7157 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7158 /// but with all dynamically-allocated buffers duplicated in new buffers.
7159 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7161 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7162 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7163 /// A pointer to the contents in the success state.
7164 /// Reading from this pointer when `result_ok` is not set is undefined.
7165 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7166 /// A pointer to the contents in the error state.
7167 /// Reading from this pointer when `result_ok` is set is undefined.
7168 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7171 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7172 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7174 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7175 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7176 /// `err` or `result` depending on the state of `result_ok`.
7177 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7178 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7179 pub result_ok: bool,
7182 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7183 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7184 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7185 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7186 result: Box::into_raw(Box::new(o)),
7192 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7193 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7194 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7195 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7196 err: Box::into_raw(Box::new(e)),
7201 /// Checks if the given object is currently in the success state
7203 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7207 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7208 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7209 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7210 fn drop(&mut self) {
7212 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7213 let _ = unsafe { Box::from_raw(self.contents.result) };
7216 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7217 let _ = unsafe { Box::from_raw(self.contents.err) };
7222 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7223 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7224 let contents = if o.result_ok {
7225 let result = unsafe { o.contents.result };
7226 unsafe { o.contents.result = core::ptr::null_mut() };
7227 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7229 let err = unsafe { o.contents.err };
7230 unsafe { o.contents.err = core::ptr::null_mut(); }
7231 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7235 result_ok: o.result_ok,
7239 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7240 fn clone(&self) -> Self {
7242 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7243 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7246 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7247 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7253 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7254 /// but with all dynamically-allocated buffers duplicated in new buffers.
7255 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7257 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7258 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7259 /// A pointer to the contents in the success state.
7260 /// Reading from this pointer when `result_ok` is not set is undefined.
7261 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7262 /// A pointer to the contents in the error state.
7263 /// Reading from this pointer when `result_ok` is set is undefined.
7264 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7267 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7268 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7270 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7271 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7272 /// `err` or `result` depending on the state of `result_ok`.
7273 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7274 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7275 pub result_ok: bool,
7278 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7279 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7280 CResult_ChannelCounterpartyDecodeErrorZ {
7281 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7282 result: Box::into_raw(Box::new(o)),
7288 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7289 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7290 CResult_ChannelCounterpartyDecodeErrorZ {
7291 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7292 err: Box::into_raw(Box::new(e)),
7297 /// Checks if the given object is currently in the success state
7299 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7303 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7304 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7305 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7306 fn drop(&mut self) {
7308 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7309 let _ = unsafe { Box::from_raw(self.contents.result) };
7312 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7313 let _ = unsafe { Box::from_raw(self.contents.err) };
7318 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7319 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7320 let contents = if o.result_ok {
7321 let result = unsafe { o.contents.result };
7322 unsafe { o.contents.result = core::ptr::null_mut() };
7323 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7325 let err = unsafe { o.contents.err };
7326 unsafe { o.contents.err = core::ptr::null_mut(); }
7327 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7331 result_ok: o.result_ok,
7335 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7336 fn clone(&self) -> Self {
7338 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7339 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7342 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7343 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7349 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7350 /// but with all dynamically-allocated buffers duplicated in new buffers.
7351 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7353 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7354 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7355 /// A pointer to the contents in the success state.
7356 /// Reading from this pointer when `result_ok` is not set is undefined.
7357 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7358 /// A pointer to the contents in the error state.
7359 /// Reading from this pointer when `result_ok` is set is undefined.
7360 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7363 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7364 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7366 pub struct CResult_ChannelDetailsDecodeErrorZ {
7367 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7368 /// `err` or `result` depending on the state of `result_ok`.
7369 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7370 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7371 pub result_ok: bool,
7374 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7375 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7376 CResult_ChannelDetailsDecodeErrorZ {
7377 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7378 result: Box::into_raw(Box::new(o)),
7384 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7385 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7386 CResult_ChannelDetailsDecodeErrorZ {
7387 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7388 err: Box::into_raw(Box::new(e)),
7393 /// Checks if the given object is currently in the success state
7395 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7399 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7400 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7401 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7402 fn drop(&mut self) {
7404 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7405 let _ = unsafe { Box::from_raw(self.contents.result) };
7408 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7409 let _ = unsafe { Box::from_raw(self.contents.err) };
7414 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7415 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7416 let contents = if o.result_ok {
7417 let result = unsafe { o.contents.result };
7418 unsafe { o.contents.result = core::ptr::null_mut() };
7419 CResult_ChannelDetailsDecodeErrorZPtr { result }
7421 let err = unsafe { o.contents.err };
7422 unsafe { o.contents.err = core::ptr::null_mut(); }
7423 CResult_ChannelDetailsDecodeErrorZPtr { err }
7427 result_ok: o.result_ok,
7431 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7432 fn clone(&self) -> Self {
7434 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7435 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7438 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7439 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7445 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7446 /// but with all dynamically-allocated buffers duplicated in new buffers.
7447 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7449 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7450 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7451 /// A pointer to the contents in the success state.
7452 /// Reading from this pointer when `result_ok` is not set is undefined.
7453 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7454 /// A pointer to the contents in the error state.
7455 /// Reading from this pointer when `result_ok` is set is undefined.
7456 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7459 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7460 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7462 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7463 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7464 /// `err` or `result` depending on the state of `result_ok`.
7465 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7466 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7467 pub result_ok: bool,
7470 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7471 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7472 CResult_PhantomRouteHintsDecodeErrorZ {
7473 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7474 result: Box::into_raw(Box::new(o)),
7480 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7481 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7482 CResult_PhantomRouteHintsDecodeErrorZ {
7483 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7484 err: Box::into_raw(Box::new(e)),
7489 /// Checks if the given object is currently in the success state
7491 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7495 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7496 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7497 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7498 fn drop(&mut self) {
7500 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7501 let _ = unsafe { Box::from_raw(self.contents.result) };
7504 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7505 let _ = unsafe { Box::from_raw(self.contents.err) };
7510 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7511 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7512 let contents = if o.result_ok {
7513 let result = unsafe { o.contents.result };
7514 unsafe { o.contents.result = core::ptr::null_mut() };
7515 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7517 let err = unsafe { o.contents.err };
7518 unsafe { o.contents.err = core::ptr::null_mut(); }
7519 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7523 result_ok: o.result_ok,
7527 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
7528 fn clone(&self) -> Self {
7530 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7531 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
7534 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7535 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7541 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
7542 /// but with all dynamically-allocated buffers duplicated in new buffers.
7543 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
7545 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7546 /// This corresponds to std::vector in C++
7547 pub struct CVec_ChannelMonitorZ {
7548 /// The elements in the array.
7549 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7550 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7551 /// The number of elements pointed to by `data`.
7554 impl CVec_ChannelMonitorZ {
7555 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7556 if self.datalen == 0 { return Vec::new(); }
7557 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7558 self.data = core::ptr::null_mut();
7562 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7563 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7566 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7567 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7568 let datalen = v.len();
7569 let data = Box::into_raw(v.into_boxed_slice());
7570 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7574 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7575 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7576 impl Drop for CVec_ChannelMonitorZ {
7577 fn drop(&mut self) {
7578 if self.datalen == 0 { return; }
7579 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7583 /// A tuple of 2 elements. See the individual fields for the types contained.
7584 pub struct C2Tuple_BlockHashChannelManagerZ {
7585 /// The element at position 0
7586 pub a: crate::c_types::ThirtyTwoBytes,
7587 /// The element at position 1
7588 pub b: crate::lightning::ln::channelmanager::ChannelManager,
7590 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7591 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7598 impl C2Tuple_BlockHashChannelManagerZ {
7599 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7603 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7605 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7606 C2Tuple_BlockHashChannelManagerZ { a, b, }
7610 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7611 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7613 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7614 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7615 /// A pointer to the contents in the success state.
7616 /// Reading from this pointer when `result_ok` is not set is undefined.
7617 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7618 /// A pointer to the contents in the error state.
7619 /// Reading from this pointer when `result_ok` is set is undefined.
7620 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7623 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7624 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7625 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7626 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7627 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7628 /// `err` or `result` depending on the state of `result_ok`.
7629 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7630 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7631 pub result_ok: bool,
7634 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7635 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7636 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7637 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7638 result: Box::into_raw(Box::new(o)),
7644 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7645 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7646 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7647 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7648 err: Box::into_raw(Box::new(e)),
7653 /// Checks if the given object is currently in the success state
7655 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7659 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7660 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7661 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7662 fn drop(&mut self) {
7664 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7665 let _ = unsafe { Box::from_raw(self.contents.result) };
7668 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7669 let _ = unsafe { Box::from_raw(self.contents.err) };
7674 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7675 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7676 let contents = if o.result_ok {
7677 let result = unsafe { o.contents.result };
7678 unsafe { o.contents.result = core::ptr::null_mut() };
7679 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7681 let err = unsafe { o.contents.err };
7682 unsafe { o.contents.err = core::ptr::null_mut(); }
7683 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7687 result_ok: o.result_ok,
7692 /// The contents of CResult_ChannelConfigDecodeErrorZ
7693 pub union CResult_ChannelConfigDecodeErrorZPtr {
7694 /// A pointer to the contents in the success state.
7695 /// Reading from this pointer when `result_ok` is not set is undefined.
7696 pub result: *mut crate::lightning::util::config::ChannelConfig,
7697 /// A pointer to the contents in the error state.
7698 /// Reading from this pointer when `result_ok` is set is undefined.
7699 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7702 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7703 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7704 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7705 pub struct CResult_ChannelConfigDecodeErrorZ {
7706 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7707 /// `err` or `result` depending on the state of `result_ok`.
7708 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7709 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7710 pub result_ok: bool,
7713 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7714 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7715 CResult_ChannelConfigDecodeErrorZ {
7716 contents: CResult_ChannelConfigDecodeErrorZPtr {
7717 result: Box::into_raw(Box::new(o)),
7723 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7724 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7725 CResult_ChannelConfigDecodeErrorZ {
7726 contents: CResult_ChannelConfigDecodeErrorZPtr {
7727 err: Box::into_raw(Box::new(e)),
7732 /// Checks if the given object is currently in the success state
7734 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7738 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7739 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7740 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7741 fn drop(&mut self) {
7743 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7744 let _ = unsafe { Box::from_raw(self.contents.result) };
7747 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7748 let _ = unsafe { Box::from_raw(self.contents.err) };
7753 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7754 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7755 let contents = if o.result_ok {
7756 let result = unsafe { o.contents.result };
7757 unsafe { o.contents.result = core::ptr::null_mut() };
7758 CResult_ChannelConfigDecodeErrorZPtr { result }
7760 let err = unsafe { o.contents.err };
7761 unsafe { o.contents.err = core::ptr::null_mut(); }
7762 CResult_ChannelConfigDecodeErrorZPtr { err }
7766 result_ok: o.result_ok,
7770 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7771 fn clone(&self) -> Self {
7773 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7774 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7777 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7778 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7784 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7785 /// but with all dynamically-allocated buffers duplicated in new buffers.
7786 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7788 /// The contents of CResult_OutPointDecodeErrorZ
7789 pub union CResult_OutPointDecodeErrorZPtr {
7790 /// A pointer to the contents in the success state.
7791 /// Reading from this pointer when `result_ok` is not set is undefined.
7792 pub result: *mut crate::lightning::chain::transaction::OutPoint,
7793 /// A pointer to the contents in the error state.
7794 /// Reading from this pointer when `result_ok` is set is undefined.
7795 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7798 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7799 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7801 pub struct CResult_OutPointDecodeErrorZ {
7802 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7803 /// `err` or `result` depending on the state of `result_ok`.
7804 pub contents: CResult_OutPointDecodeErrorZPtr,
7805 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7806 pub result_ok: bool,
7809 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7810 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7811 CResult_OutPointDecodeErrorZ {
7812 contents: CResult_OutPointDecodeErrorZPtr {
7813 result: Box::into_raw(Box::new(o)),
7819 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7820 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7821 CResult_OutPointDecodeErrorZ {
7822 contents: CResult_OutPointDecodeErrorZPtr {
7823 err: Box::into_raw(Box::new(e)),
7828 /// Checks if the given object is currently in the success state
7830 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7834 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7835 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7836 impl Drop for CResult_OutPointDecodeErrorZ {
7837 fn drop(&mut self) {
7839 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7840 let _ = unsafe { Box::from_raw(self.contents.result) };
7843 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7844 let _ = unsafe { Box::from_raw(self.contents.err) };
7849 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7850 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7851 let contents = if o.result_ok {
7852 let result = unsafe { o.contents.result };
7853 unsafe { o.contents.result = core::ptr::null_mut() };
7854 CResult_OutPointDecodeErrorZPtr { result }
7856 let err = unsafe { o.contents.err };
7857 unsafe { o.contents.err = core::ptr::null_mut(); }
7858 CResult_OutPointDecodeErrorZPtr { err }
7862 result_ok: o.result_ok,
7866 impl Clone for CResult_OutPointDecodeErrorZ {
7867 fn clone(&self) -> Self {
7869 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7870 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7873 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7874 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7880 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7881 /// but with all dynamically-allocated buffers duplicated in new buffers.
7882 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7884 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7885 pub enum COption_TypeZ {
7886 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7887 Some(crate::lightning::ln::wire::Type),
7888 /// When we're in this state, this COption_TypeZ contains nothing
7891 impl COption_TypeZ {
7892 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7893 if let Self::None = self { false } else { true }
7895 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7898 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7899 if let Self::Some(v) = self { v } else { unreachable!() }
7903 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7904 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7905 COption_TypeZ::Some(o)
7908 /// Constructs a new COption_TypeZ containing nothing
7909 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7913 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
7914 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
7916 /// The contents of CResult_COption_TypeZDecodeErrorZ
7917 pub union CResult_COption_TypeZDecodeErrorZPtr {
7918 /// A pointer to the contents in the success state.
7919 /// Reading from this pointer when `result_ok` is not set is undefined.
7920 pub result: *mut crate::c_types::derived::COption_TypeZ,
7921 /// A pointer to the contents in the error state.
7922 /// Reading from this pointer when `result_ok` is set is undefined.
7923 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7926 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7927 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7929 pub struct CResult_COption_TypeZDecodeErrorZ {
7930 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7931 /// `err` or `result` depending on the state of `result_ok`.
7932 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
7933 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7934 pub result_ok: bool,
7937 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
7938 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
7939 CResult_COption_TypeZDecodeErrorZ {
7940 contents: CResult_COption_TypeZDecodeErrorZPtr {
7941 result: Box::into_raw(Box::new(o)),
7947 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
7948 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
7949 CResult_COption_TypeZDecodeErrorZ {
7950 contents: CResult_COption_TypeZDecodeErrorZPtr {
7951 err: Box::into_raw(Box::new(e)),
7956 /// Checks if the given object is currently in the success state
7958 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
7962 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
7963 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
7964 impl Drop for CResult_COption_TypeZDecodeErrorZ {
7965 fn drop(&mut self) {
7967 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7968 let _ = unsafe { Box::from_raw(self.contents.result) };
7971 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7972 let _ = unsafe { Box::from_raw(self.contents.err) };
7977 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
7978 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7979 let contents = if o.result_ok {
7980 let result = unsafe { o.contents.result };
7981 unsafe { o.contents.result = core::ptr::null_mut() };
7982 CResult_COption_TypeZDecodeErrorZPtr { result }
7984 let err = unsafe { o.contents.err };
7985 unsafe { o.contents.err = core::ptr::null_mut(); }
7986 CResult_COption_TypeZDecodeErrorZPtr { err }
7990 result_ok: o.result_ok,
7995 /// The contents of CResult_PaymentIdPaymentErrorZ
7996 pub union CResult_PaymentIdPaymentErrorZPtr {
7997 /// A pointer to the contents in the success state.
7998 /// Reading from this pointer when `result_ok` is not set is undefined.
7999 pub result: *mut crate::c_types::ThirtyTwoBytes,
8000 /// A pointer to the contents in the error state.
8001 /// Reading from this pointer when `result_ok` is set is undefined.
8002 pub err: *mut crate::lightning_invoice::payment::PaymentError,
8005 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8006 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8007 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8008 pub struct CResult_PaymentIdPaymentErrorZ {
8009 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8010 /// `err` or `result` depending on the state of `result_ok`.
8011 pub contents: CResult_PaymentIdPaymentErrorZPtr,
8012 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8013 pub result_ok: bool,
8016 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
8017 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
8018 CResult_PaymentIdPaymentErrorZ {
8019 contents: CResult_PaymentIdPaymentErrorZPtr {
8020 result: Box::into_raw(Box::new(o)),
8026 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
8027 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
8028 CResult_PaymentIdPaymentErrorZ {
8029 contents: CResult_PaymentIdPaymentErrorZPtr {
8030 err: Box::into_raw(Box::new(e)),
8035 /// Checks if the given object is currently in the success state
8037 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
8041 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
8042 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
8043 impl Drop for CResult_PaymentIdPaymentErrorZ {
8044 fn drop(&mut self) {
8046 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8047 let _ = unsafe { Box::from_raw(self.contents.result) };
8050 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8051 let _ = unsafe { Box::from_raw(self.contents.err) };
8056 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
8057 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
8058 let contents = if o.result_ok {
8059 let result = unsafe { o.contents.result };
8060 unsafe { o.contents.result = core::ptr::null_mut() };
8061 CResult_PaymentIdPaymentErrorZPtr { result }
8063 let err = unsafe { o.contents.err };
8064 unsafe { o.contents.err = core::ptr::null_mut(); }
8065 CResult_PaymentIdPaymentErrorZPtr { err }
8069 result_ok: o.result_ok,
8073 impl Clone for CResult_PaymentIdPaymentErrorZ {
8074 fn clone(&self) -> Self {
8076 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8077 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8080 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8081 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8087 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8088 /// but with all dynamically-allocated buffers duplicated in new buffers.
8089 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8091 /// The contents of CResult_SiPrefixNoneZ
8092 pub union CResult_SiPrefixNoneZPtr {
8093 /// A pointer to the contents in the success state.
8094 /// Reading from this pointer when `result_ok` is not set is undefined.
8095 pub result: *mut crate::lightning_invoice::SiPrefix,
8096 /// Note that this value is always NULL, as there are no contents in the Err variant
8097 pub err: *mut core::ffi::c_void,
8100 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
8101 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
8102 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8103 pub struct CResult_SiPrefixNoneZ {
8104 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
8105 /// `err` or `result` depending on the state of `result_ok`.
8106 pub contents: CResult_SiPrefixNoneZPtr,
8107 /// Whether this CResult_SiPrefixNoneZ represents a success state.
8108 pub result_ok: bool,
8111 /// Creates a new CResult_SiPrefixNoneZ in the success state.
8112 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
8113 CResult_SiPrefixNoneZ {
8114 contents: CResult_SiPrefixNoneZPtr {
8115 result: Box::into_raw(Box::new(o)),
8121 /// Creates a new CResult_SiPrefixNoneZ in the error state.
8122 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
8123 CResult_SiPrefixNoneZ {
8124 contents: CResult_SiPrefixNoneZPtr {
8125 err: core::ptr::null_mut(),
8130 /// Checks if the given object is currently in the success state
8132 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
8136 /// Frees any resources used by the CResult_SiPrefixNoneZ.
8137 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
8138 impl Drop for CResult_SiPrefixNoneZ {
8139 fn drop(&mut self) {
8141 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8142 let _ = unsafe { Box::from_raw(self.contents.result) };
8148 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
8149 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
8150 let contents = if o.result_ok {
8151 let result = unsafe { o.contents.result };
8152 unsafe { o.contents.result = core::ptr::null_mut() };
8153 CResult_SiPrefixNoneZPtr { result }
8155 let _ = unsafe { Box::from_raw(o.contents.err) };
8156 o.contents.err = core::ptr::null_mut();
8157 CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
8161 result_ok: o.result_ok,
8165 impl Clone for CResult_SiPrefixNoneZ {
8166 fn clone(&self) -> Self {
8168 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
8169 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8172 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
8173 err: core::ptr::null_mut()
8179 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
8180 /// but with all dynamically-allocated buffers duplicated in new buffers.
8181 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
8183 /// The contents of CResult_InvoiceNoneZ
8184 pub union CResult_InvoiceNoneZPtr {
8185 /// A pointer to the contents in the success state.
8186 /// Reading from this pointer when `result_ok` is not set is undefined.
8187 pub result: *mut crate::lightning_invoice::Invoice,
8188 /// Note that this value is always NULL, as there are no contents in the Err variant
8189 pub err: *mut core::ffi::c_void,
8192 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
8193 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
8194 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8195 pub struct CResult_InvoiceNoneZ {
8196 /// The contents of this CResult_InvoiceNoneZ, accessible via either
8197 /// `err` or `result` depending on the state of `result_ok`.
8198 pub contents: CResult_InvoiceNoneZPtr,
8199 /// Whether this CResult_InvoiceNoneZ represents a success state.
8200 pub result_ok: bool,
8203 /// Creates a new CResult_InvoiceNoneZ in the success state.
8204 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
8205 CResult_InvoiceNoneZ {
8206 contents: CResult_InvoiceNoneZPtr {
8207 result: Box::into_raw(Box::new(o)),
8213 /// Creates a new CResult_InvoiceNoneZ in the error state.
8214 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
8215 CResult_InvoiceNoneZ {
8216 contents: CResult_InvoiceNoneZPtr {
8217 err: core::ptr::null_mut(),
8222 /// Checks if the given object is currently in the success state
8224 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
8228 /// Frees any resources used by the CResult_InvoiceNoneZ.
8229 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
8230 impl Drop for CResult_InvoiceNoneZ {
8231 fn drop(&mut self) {
8233 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8234 let _ = unsafe { Box::from_raw(self.contents.result) };
8240 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
8241 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
8242 let contents = if o.result_ok {
8243 let result = unsafe { o.contents.result };
8244 unsafe { o.contents.result = core::ptr::null_mut() };
8245 CResult_InvoiceNoneZPtr { result }
8247 let _ = unsafe { Box::from_raw(o.contents.err) };
8248 o.contents.err = core::ptr::null_mut();
8249 CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
8253 result_ok: o.result_ok,
8257 impl Clone for CResult_InvoiceNoneZ {
8258 fn clone(&self) -> Self {
8260 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
8261 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8264 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
8265 err: core::ptr::null_mut()
8271 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
8272 /// but with all dynamically-allocated buffers duplicated in new buffers.
8273 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
8275 /// The contents of CResult_SignedRawInvoiceNoneZ
8276 pub union CResult_SignedRawInvoiceNoneZPtr {
8277 /// A pointer to the contents in the success state.
8278 /// Reading from this pointer when `result_ok` is not set is undefined.
8279 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8280 /// Note that this value is always NULL, as there are no contents in the Err variant
8281 pub err: *mut core::ffi::c_void,
8284 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
8285 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
8286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8287 pub struct CResult_SignedRawInvoiceNoneZ {
8288 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
8289 /// `err` or `result` depending on the state of `result_ok`.
8290 pub contents: CResult_SignedRawInvoiceNoneZPtr,
8291 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
8292 pub result_ok: bool,
8295 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
8296 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
8297 CResult_SignedRawInvoiceNoneZ {
8298 contents: CResult_SignedRawInvoiceNoneZPtr {
8299 result: Box::into_raw(Box::new(o)),
8305 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
8306 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
8307 CResult_SignedRawInvoiceNoneZ {
8308 contents: CResult_SignedRawInvoiceNoneZPtr {
8309 err: core::ptr::null_mut(),
8314 /// Checks if the given object is currently in the success state
8316 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
8320 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
8321 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
8322 impl Drop for CResult_SignedRawInvoiceNoneZ {
8323 fn drop(&mut self) {
8325 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8326 let _ = unsafe { Box::from_raw(self.contents.result) };
8332 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
8333 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
8334 let contents = if o.result_ok {
8335 let result = unsafe { o.contents.result };
8336 unsafe { o.contents.result = core::ptr::null_mut() };
8337 CResult_SignedRawInvoiceNoneZPtr { result }
8339 let _ = unsafe { Box::from_raw(o.contents.err) };
8340 o.contents.err = core::ptr::null_mut();
8341 CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
8345 result_ok: o.result_ok,
8349 impl Clone for CResult_SignedRawInvoiceNoneZ {
8350 fn clone(&self) -> Self {
8352 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
8353 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8356 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
8357 err: core::ptr::null_mut()
8363 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
8364 /// but with all dynamically-allocated buffers duplicated in new buffers.
8365 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
8367 /// A tuple of 3 elements. See the individual fields for the types contained.
8368 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8369 /// The element at position 0
8370 pub a: crate::lightning_invoice::RawInvoice,
8371 /// The element at position 1
8372 pub b: crate::c_types::ThirtyTwoBytes,
8373 /// The element at position 2
8374 pub c: crate::lightning_invoice::InvoiceSignature,
8376 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8377 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8385 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8386 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8387 (self.a, self.b, self.c)
8390 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8391 fn clone(&self) -> Self {
8393 a: Clone::clone(&self.a),
8394 b: Clone::clone(&self.b),
8395 c: Clone::clone(&self.c),
8400 /// Creates a new tuple which has the same data as `orig`
8401 /// but with all dynamically-allocated buffers duplicated in new buffers.
8402 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8403 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8405 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 {
8406 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8410 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8411 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8413 /// The contents of CResult_PayeePubKeyErrorZ
8414 pub union CResult_PayeePubKeyErrorZPtr {
8415 /// A pointer to the contents in the success state.
8416 /// Reading from this pointer when `result_ok` is not set is undefined.
8417 pub result: *mut crate::lightning_invoice::PayeePubKey,
8418 /// A pointer to the contents in the error state.
8419 /// Reading from this pointer when `result_ok` is set is undefined.
8420 pub err: *mut crate::c_types::Secp256k1Error,
8423 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8424 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8425 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8426 pub struct CResult_PayeePubKeyErrorZ {
8427 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8428 /// `err` or `result` depending on the state of `result_ok`.
8429 pub contents: CResult_PayeePubKeyErrorZPtr,
8430 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8431 pub result_ok: bool,
8434 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8435 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8436 CResult_PayeePubKeyErrorZ {
8437 contents: CResult_PayeePubKeyErrorZPtr {
8438 result: Box::into_raw(Box::new(o)),
8444 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8445 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8446 CResult_PayeePubKeyErrorZ {
8447 contents: CResult_PayeePubKeyErrorZPtr {
8448 err: Box::into_raw(Box::new(e)),
8453 /// Checks if the given object is currently in the success state
8455 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8459 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8460 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8461 impl Drop for CResult_PayeePubKeyErrorZ {
8462 fn drop(&mut self) {
8464 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8465 let _ = unsafe { Box::from_raw(self.contents.result) };
8468 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8469 let _ = unsafe { Box::from_raw(self.contents.err) };
8474 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8475 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8476 let contents = if o.result_ok {
8477 let result = unsafe { o.contents.result };
8478 unsafe { o.contents.result = core::ptr::null_mut() };
8479 CResult_PayeePubKeyErrorZPtr { result }
8481 let err = unsafe { o.contents.err };
8482 unsafe { o.contents.err = core::ptr::null_mut(); }
8483 CResult_PayeePubKeyErrorZPtr { err }
8487 result_ok: o.result_ok,
8491 impl Clone for CResult_PayeePubKeyErrorZ {
8492 fn clone(&self) -> Self {
8494 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8495 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8498 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8499 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8505 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8506 /// but with all dynamically-allocated buffers duplicated in new buffers.
8507 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8509 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8510 /// This corresponds to std::vector in C++
8511 pub struct CVec_PrivateRouteZ {
8512 /// The elements in the array.
8513 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8514 pub data: *mut crate::lightning_invoice::PrivateRoute,
8515 /// The number of elements pointed to by `data`.
8518 impl CVec_PrivateRouteZ {
8519 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8520 if self.datalen == 0 { return Vec::new(); }
8521 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8522 self.data = core::ptr::null_mut();
8526 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8527 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8530 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8531 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8532 let datalen = v.len();
8533 let data = Box::into_raw(v.into_boxed_slice());
8534 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8538 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8539 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8540 impl Drop for CVec_PrivateRouteZ {
8541 fn drop(&mut self) {
8542 if self.datalen == 0 { return; }
8543 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8546 impl Clone for CVec_PrivateRouteZ {
8547 fn clone(&self) -> Self {
8548 let mut res = Vec::new();
8549 if self.datalen == 0 { return Self::from(res); }
8550 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8555 /// The contents of CResult_PositiveTimestampCreationErrorZ
8556 pub union CResult_PositiveTimestampCreationErrorZPtr {
8557 /// A pointer to the contents in the success state.
8558 /// Reading from this pointer when `result_ok` is not set is undefined.
8559 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8560 /// A pointer to the contents in the error state.
8561 /// Reading from this pointer when `result_ok` is set is undefined.
8562 pub err: *mut crate::lightning_invoice::CreationError,
8565 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8566 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8568 pub struct CResult_PositiveTimestampCreationErrorZ {
8569 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8570 /// `err` or `result` depending on the state of `result_ok`.
8571 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8572 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8573 pub result_ok: bool,
8576 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8577 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8578 CResult_PositiveTimestampCreationErrorZ {
8579 contents: CResult_PositiveTimestampCreationErrorZPtr {
8580 result: Box::into_raw(Box::new(o)),
8586 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8587 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8588 CResult_PositiveTimestampCreationErrorZ {
8589 contents: CResult_PositiveTimestampCreationErrorZPtr {
8590 err: Box::into_raw(Box::new(e)),
8595 /// Checks if the given object is currently in the success state
8597 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8601 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8602 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8603 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8604 fn drop(&mut self) {
8606 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8607 let _ = unsafe { Box::from_raw(self.contents.result) };
8610 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8611 let _ = unsafe { Box::from_raw(self.contents.err) };
8616 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8617 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8618 let contents = if o.result_ok {
8619 let result = unsafe { o.contents.result };
8620 unsafe { o.contents.result = core::ptr::null_mut() };
8621 CResult_PositiveTimestampCreationErrorZPtr { result }
8623 let err = unsafe { o.contents.err };
8624 unsafe { o.contents.err = core::ptr::null_mut(); }
8625 CResult_PositiveTimestampCreationErrorZPtr { err }
8629 result_ok: o.result_ok,
8633 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8634 fn clone(&self) -> Self {
8636 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8637 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8640 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8641 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8647 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8648 /// but with all dynamically-allocated buffers duplicated in new buffers.
8649 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8651 /// The contents of CResult_NoneSemanticErrorZ
8652 pub union CResult_NoneSemanticErrorZPtr {
8653 /// Note that this value is always NULL, as there are no contents in the OK variant
8654 pub result: *mut core::ffi::c_void,
8655 /// A pointer to the contents in the error state.
8656 /// Reading from this pointer when `result_ok` is set is undefined.
8657 pub err: *mut crate::lightning_invoice::SemanticError,
8660 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8661 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8663 pub struct CResult_NoneSemanticErrorZ {
8664 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8665 /// `err` or `result` depending on the state of `result_ok`.
8666 pub contents: CResult_NoneSemanticErrorZPtr,
8667 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8668 pub result_ok: bool,
8671 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8672 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8673 CResult_NoneSemanticErrorZ {
8674 contents: CResult_NoneSemanticErrorZPtr {
8675 result: core::ptr::null_mut(),
8681 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8682 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8683 CResult_NoneSemanticErrorZ {
8684 contents: CResult_NoneSemanticErrorZPtr {
8685 err: Box::into_raw(Box::new(e)),
8690 /// Checks if the given object is currently in the success state
8692 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8696 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8697 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8698 impl Drop for CResult_NoneSemanticErrorZ {
8699 fn drop(&mut self) {
8702 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8703 let _ = unsafe { Box::from_raw(self.contents.err) };
8708 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8709 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8710 let contents = if o.result_ok {
8711 let _ = unsafe { Box::from_raw(o.contents.result) };
8712 o.contents.result = core::ptr::null_mut();
8713 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8715 let err = unsafe { o.contents.err };
8716 unsafe { o.contents.err = core::ptr::null_mut(); }
8717 CResult_NoneSemanticErrorZPtr { err }
8721 result_ok: o.result_ok,
8725 impl Clone for CResult_NoneSemanticErrorZ {
8726 fn clone(&self) -> Self {
8728 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8729 result: core::ptr::null_mut()
8732 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8733 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8739 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8740 /// but with all dynamically-allocated buffers duplicated in new buffers.
8741 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8743 /// The contents of CResult_InvoiceSemanticErrorZ
8744 pub union CResult_InvoiceSemanticErrorZPtr {
8745 /// A pointer to the contents in the success state.
8746 /// Reading from this pointer when `result_ok` is not set is undefined.
8747 pub result: *mut crate::lightning_invoice::Invoice,
8748 /// A pointer to the contents in the error state.
8749 /// Reading from this pointer when `result_ok` is set is undefined.
8750 pub err: *mut crate::lightning_invoice::SemanticError,
8753 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8754 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8755 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8756 pub struct CResult_InvoiceSemanticErrorZ {
8757 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8758 /// `err` or `result` depending on the state of `result_ok`.
8759 pub contents: CResult_InvoiceSemanticErrorZPtr,
8760 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8761 pub result_ok: bool,
8764 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8765 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8766 CResult_InvoiceSemanticErrorZ {
8767 contents: CResult_InvoiceSemanticErrorZPtr {
8768 result: Box::into_raw(Box::new(o)),
8774 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8775 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8776 CResult_InvoiceSemanticErrorZ {
8777 contents: CResult_InvoiceSemanticErrorZPtr {
8778 err: Box::into_raw(Box::new(e)),
8783 /// Checks if the given object is currently in the success state
8785 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8789 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8790 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8791 impl Drop for CResult_InvoiceSemanticErrorZ {
8792 fn drop(&mut self) {
8794 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8795 let _ = unsafe { Box::from_raw(self.contents.result) };
8798 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8799 let _ = unsafe { Box::from_raw(self.contents.err) };
8804 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8805 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8806 let contents = if o.result_ok {
8807 let result = unsafe { o.contents.result };
8808 unsafe { o.contents.result = core::ptr::null_mut() };
8809 CResult_InvoiceSemanticErrorZPtr { result }
8811 let err = unsafe { o.contents.err };
8812 unsafe { o.contents.err = core::ptr::null_mut(); }
8813 CResult_InvoiceSemanticErrorZPtr { err }
8817 result_ok: o.result_ok,
8821 impl Clone for CResult_InvoiceSemanticErrorZ {
8822 fn clone(&self) -> Self {
8824 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8825 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8828 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8829 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8835 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8836 /// but with all dynamically-allocated buffers duplicated in new buffers.
8837 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8839 /// The contents of CResult_DescriptionCreationErrorZ
8840 pub union CResult_DescriptionCreationErrorZPtr {
8841 /// A pointer to the contents in the success state.
8842 /// Reading from this pointer when `result_ok` is not set is undefined.
8843 pub result: *mut crate::lightning_invoice::Description,
8844 /// A pointer to the contents in the error state.
8845 /// Reading from this pointer when `result_ok` is set is undefined.
8846 pub err: *mut crate::lightning_invoice::CreationError,
8849 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8850 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8851 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8852 pub struct CResult_DescriptionCreationErrorZ {
8853 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8854 /// `err` or `result` depending on the state of `result_ok`.
8855 pub contents: CResult_DescriptionCreationErrorZPtr,
8856 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8857 pub result_ok: bool,
8860 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8861 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8862 CResult_DescriptionCreationErrorZ {
8863 contents: CResult_DescriptionCreationErrorZPtr {
8864 result: Box::into_raw(Box::new(o)),
8870 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8871 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8872 CResult_DescriptionCreationErrorZ {
8873 contents: CResult_DescriptionCreationErrorZPtr {
8874 err: Box::into_raw(Box::new(e)),
8879 /// Checks if the given object is currently in the success state
8881 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8885 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8886 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8887 impl Drop for CResult_DescriptionCreationErrorZ {
8888 fn drop(&mut self) {
8890 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8891 let _ = unsafe { Box::from_raw(self.contents.result) };
8894 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8895 let _ = unsafe { Box::from_raw(self.contents.err) };
8900 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8901 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8902 let contents = if o.result_ok {
8903 let result = unsafe { o.contents.result };
8904 unsafe { o.contents.result = core::ptr::null_mut() };
8905 CResult_DescriptionCreationErrorZPtr { result }
8907 let err = unsafe { o.contents.err };
8908 unsafe { o.contents.err = core::ptr::null_mut(); }
8909 CResult_DescriptionCreationErrorZPtr { err }
8913 result_ok: o.result_ok,
8917 impl Clone for CResult_DescriptionCreationErrorZ {
8918 fn clone(&self) -> Self {
8920 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
8921 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
8924 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
8925 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8931 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
8932 /// but with all dynamically-allocated buffers duplicated in new buffers.
8933 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
8935 /// The contents of CResult_PrivateRouteCreationErrorZ
8936 pub union CResult_PrivateRouteCreationErrorZPtr {
8937 /// A pointer to the contents in the success state.
8938 /// Reading from this pointer when `result_ok` is not set is undefined.
8939 pub result: *mut crate::lightning_invoice::PrivateRoute,
8940 /// A pointer to the contents in the error state.
8941 /// Reading from this pointer when `result_ok` is set is undefined.
8942 pub err: *mut crate::lightning_invoice::CreationError,
8945 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8946 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8947 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8948 pub struct CResult_PrivateRouteCreationErrorZ {
8949 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8950 /// `err` or `result` depending on the state of `result_ok`.
8951 pub contents: CResult_PrivateRouteCreationErrorZPtr,
8952 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8953 pub result_ok: bool,
8956 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
8957 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
8958 CResult_PrivateRouteCreationErrorZ {
8959 contents: CResult_PrivateRouteCreationErrorZPtr {
8960 result: Box::into_raw(Box::new(o)),
8966 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
8967 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
8968 CResult_PrivateRouteCreationErrorZ {
8969 contents: CResult_PrivateRouteCreationErrorZPtr {
8970 err: Box::into_raw(Box::new(e)),
8975 /// Checks if the given object is currently in the success state
8977 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
8981 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
8982 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
8983 impl Drop for CResult_PrivateRouteCreationErrorZ {
8984 fn drop(&mut self) {
8986 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8987 let _ = unsafe { Box::from_raw(self.contents.result) };
8990 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8991 let _ = unsafe { Box::from_raw(self.contents.err) };
8996 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
8997 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
8998 let contents = if o.result_ok {
8999 let result = unsafe { o.contents.result };
9000 unsafe { o.contents.result = core::ptr::null_mut() };
9001 CResult_PrivateRouteCreationErrorZPtr { result }
9003 let err = unsafe { o.contents.err };
9004 unsafe { o.contents.err = core::ptr::null_mut(); }
9005 CResult_PrivateRouteCreationErrorZPtr { err }
9009 result_ok: o.result_ok,
9013 impl Clone for CResult_PrivateRouteCreationErrorZ {
9014 fn clone(&self) -> Self {
9016 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
9017 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
9020 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
9021 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9027 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
9028 /// but with all dynamically-allocated buffers duplicated in new buffers.
9029 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
9031 /// The contents of CResult_StringErrorZ
9032 pub union CResult_StringErrorZPtr {
9033 /// A pointer to the contents in the success state.
9034 /// Reading from this pointer when `result_ok` is not set is undefined.
9035 pub result: *mut crate::c_types::Str,
9036 /// A pointer to the contents in the error state.
9037 /// Reading from this pointer when `result_ok` is set is undefined.
9038 pub err: *mut crate::c_types::Secp256k1Error,
9041 /// A CResult_StringErrorZ represents the result of a fallible operation,
9042 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9044 pub struct CResult_StringErrorZ {
9045 /// The contents of this CResult_StringErrorZ, accessible via either
9046 /// `err` or `result` depending on the state of `result_ok`.
9047 pub contents: CResult_StringErrorZPtr,
9048 /// Whether this CResult_StringErrorZ represents a success state.
9049 pub result_ok: bool,
9052 /// Creates a new CResult_StringErrorZ in the success state.
9053 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
9054 CResult_StringErrorZ {
9055 contents: CResult_StringErrorZPtr {
9056 result: Box::into_raw(Box::new(o)),
9062 /// Creates a new CResult_StringErrorZ in the error state.
9063 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
9064 CResult_StringErrorZ {
9065 contents: CResult_StringErrorZPtr {
9066 err: Box::into_raw(Box::new(e)),
9071 /// Checks if the given object is currently in the success state
9073 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9077 /// Frees any resources used by the CResult_StringErrorZ.
9078 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9079 impl Drop for CResult_StringErrorZ {
9080 fn drop(&mut self) {
9082 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9083 let _ = unsafe { Box::from_raw(self.contents.result) };
9086 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9087 let _ = unsafe { Box::from_raw(self.contents.err) };
9092 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9093 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9094 let contents = if o.result_ok {
9095 let result = unsafe { o.contents.result };
9096 unsafe { o.contents.result = core::ptr::null_mut() };
9097 CResult_StringErrorZPtr { result }
9099 let err = unsafe { o.contents.err };
9100 unsafe { o.contents.err = core::ptr::null_mut(); }
9101 CResult_StringErrorZPtr { err }
9105 result_ok: o.result_ok,
9110 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9111 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9112 /// A pointer to the contents in the success state.
9113 /// Reading from this pointer when `result_ok` is not set is undefined.
9114 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9115 /// A pointer to the contents in the error state.
9116 /// Reading from this pointer when `result_ok` is set is undefined.
9117 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9120 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9121 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9123 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9124 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9125 /// `err` or `result` depending on the state of `result_ok`.
9126 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9127 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9128 pub result_ok: bool,
9131 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9132 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9133 CResult_ChannelMonitorUpdateDecodeErrorZ {
9134 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9135 result: Box::into_raw(Box::new(o)),
9141 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9142 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9143 CResult_ChannelMonitorUpdateDecodeErrorZ {
9144 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9145 err: Box::into_raw(Box::new(e)),
9150 /// Checks if the given object is currently in the success state
9152 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9156 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9157 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9158 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9159 fn drop(&mut self) {
9161 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9162 let _ = unsafe { Box::from_raw(self.contents.result) };
9165 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9166 let _ = unsafe { Box::from_raw(self.contents.err) };
9171 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9172 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9173 let contents = if o.result_ok {
9174 let result = unsafe { o.contents.result };
9175 unsafe { o.contents.result = core::ptr::null_mut() };
9176 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9178 let err = unsafe { o.contents.err };
9179 unsafe { o.contents.err = core::ptr::null_mut(); }
9180 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9184 result_ok: o.result_ok,
9188 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9189 fn clone(&self) -> Self {
9191 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9192 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9195 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9196 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9202 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9203 /// but with all dynamically-allocated buffers duplicated in new buffers.
9204 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9207 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9208 pub enum COption_MonitorEventZ {
9209 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9210 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9211 /// When we're in this state, this COption_MonitorEventZ contains nothing
9214 impl COption_MonitorEventZ {
9215 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9216 if let Self::None = self { false } else { true }
9218 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9221 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9222 if let Self::Some(v) = self { v } else { unreachable!() }
9226 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9227 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9228 COption_MonitorEventZ::Some(o)
9231 /// Constructs a new COption_MonitorEventZ containing nothing
9232 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9233 COption_MonitorEventZ::None
9236 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9237 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9239 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9240 /// but with all dynamically-allocated buffers duplicated in new buffers.
9241 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9243 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9244 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9245 /// A pointer to the contents in the success state.
9246 /// Reading from this pointer when `result_ok` is not set is undefined.
9247 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9248 /// A pointer to the contents in the error state.
9249 /// Reading from this pointer when `result_ok` is set is undefined.
9250 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9253 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9254 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9256 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9257 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9258 /// `err` or `result` depending on the state of `result_ok`.
9259 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9260 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9261 pub result_ok: bool,
9264 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9265 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9266 CResult_COption_MonitorEventZDecodeErrorZ {
9267 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9268 result: Box::into_raw(Box::new(o)),
9274 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9275 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9276 CResult_COption_MonitorEventZDecodeErrorZ {
9277 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9278 err: Box::into_raw(Box::new(e)),
9283 /// Checks if the given object is currently in the success state
9285 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9289 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9290 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9291 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9292 fn drop(&mut self) {
9294 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9295 let _ = unsafe { Box::from_raw(self.contents.result) };
9298 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9299 let _ = unsafe { Box::from_raw(self.contents.err) };
9304 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9305 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9306 let contents = if o.result_ok {
9307 let result = unsafe { o.contents.result };
9308 unsafe { o.contents.result = core::ptr::null_mut() };
9309 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9311 let err = unsafe { o.contents.err };
9312 unsafe { o.contents.err = core::ptr::null_mut(); }
9313 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9317 result_ok: o.result_ok,
9321 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9322 fn clone(&self) -> Self {
9324 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9325 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9328 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9329 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9335 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9336 /// but with all dynamically-allocated buffers duplicated in new buffers.
9337 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9339 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9340 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9341 /// A pointer to the contents in the success state.
9342 /// Reading from this pointer when `result_ok` is not set is undefined.
9343 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9344 /// A pointer to the contents in the error state.
9345 /// Reading from this pointer when `result_ok` is set is undefined.
9346 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9349 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9350 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9352 pub struct CResult_HTLCUpdateDecodeErrorZ {
9353 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9354 /// `err` or `result` depending on the state of `result_ok`.
9355 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9356 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9357 pub result_ok: bool,
9360 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9361 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9362 CResult_HTLCUpdateDecodeErrorZ {
9363 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9364 result: Box::into_raw(Box::new(o)),
9370 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9371 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9372 CResult_HTLCUpdateDecodeErrorZ {
9373 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9374 err: Box::into_raw(Box::new(e)),
9379 /// Checks if the given object is currently in the success state
9381 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9385 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9386 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9387 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9388 fn drop(&mut self) {
9390 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9391 let _ = unsafe { Box::from_raw(self.contents.result) };
9394 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9395 let _ = unsafe { Box::from_raw(self.contents.err) };
9400 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9401 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9402 let contents = if o.result_ok {
9403 let result = unsafe { o.contents.result };
9404 unsafe { o.contents.result = core::ptr::null_mut() };
9405 CResult_HTLCUpdateDecodeErrorZPtr { result }
9407 let err = unsafe { o.contents.err };
9408 unsafe { o.contents.err = core::ptr::null_mut(); }
9409 CResult_HTLCUpdateDecodeErrorZPtr { err }
9413 result_ok: o.result_ok,
9417 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9418 fn clone(&self) -> Self {
9420 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9421 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9424 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9425 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9431 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9432 /// but with all dynamically-allocated buffers duplicated in new buffers.
9433 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9435 /// A tuple of 2 elements. See the individual fields for the types contained.
9436 pub struct C2Tuple_OutPointScriptZ {
9437 /// The element at position 0
9438 pub a: crate::lightning::chain::transaction::OutPoint,
9439 /// The element at position 1
9440 pub b: crate::c_types::derived::CVec_u8Z,
9442 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9443 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9450 impl C2Tuple_OutPointScriptZ {
9451 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9455 impl Clone for C2Tuple_OutPointScriptZ {
9456 fn clone(&self) -> Self {
9458 a: Clone::clone(&self.a),
9459 b: Clone::clone(&self.b),
9464 /// Creates a new tuple which has the same data as `orig`
9465 /// but with all dynamically-allocated buffers duplicated in new buffers.
9466 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9467 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9469 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9470 C2Tuple_OutPointScriptZ { a, b, }
9474 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9475 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9477 /// A tuple of 2 elements. See the individual fields for the types contained.
9478 pub struct C2Tuple_u32ScriptZ {
9479 /// The element at position 0
9481 /// The element at position 1
9482 pub b: crate::c_types::derived::CVec_u8Z,
9484 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9485 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9492 impl C2Tuple_u32ScriptZ {
9493 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9497 impl Clone for C2Tuple_u32ScriptZ {
9498 fn clone(&self) -> Self {
9500 a: Clone::clone(&self.a),
9501 b: Clone::clone(&self.b),
9506 /// Creates a new tuple which has the same data as `orig`
9507 /// but with all dynamically-allocated buffers duplicated in new buffers.
9508 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9509 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9511 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9512 C2Tuple_u32ScriptZ { a, b, }
9516 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9517 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9519 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9520 /// This corresponds to std::vector in C++
9521 pub struct CVec_C2Tuple_u32ScriptZZ {
9522 /// The elements in the array.
9523 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9524 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9525 /// The number of elements pointed to by `data`.
9528 impl CVec_C2Tuple_u32ScriptZZ {
9529 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9530 if self.datalen == 0 { return Vec::new(); }
9531 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9532 self.data = core::ptr::null_mut();
9536 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9537 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9540 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9541 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9542 let datalen = v.len();
9543 let data = Box::into_raw(v.into_boxed_slice());
9544 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9548 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9549 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9550 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9551 fn drop(&mut self) {
9552 if self.datalen == 0 { return; }
9553 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9556 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9557 fn clone(&self) -> Self {
9558 let mut res = Vec::new();
9559 if self.datalen == 0 { return Self::from(res); }
9560 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9565 /// A tuple of 2 elements. See the individual fields for the types contained.
9566 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9567 /// The element at position 0
9568 pub a: crate::c_types::ThirtyTwoBytes,
9569 /// The element at position 1
9570 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9572 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9573 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9580 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9581 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9585 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9586 fn clone(&self) -> Self {
9588 a: Clone::clone(&self.a),
9589 b: Clone::clone(&self.b),
9594 /// Creates a new tuple which has the same data as `orig`
9595 /// but with all dynamically-allocated buffers duplicated in new buffers.
9596 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9597 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9599 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 {
9600 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9604 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9605 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9607 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9608 /// This corresponds to std::vector in C++
9609 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9610 /// The elements in the array.
9611 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9612 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9613 /// The number of elements pointed to by `data`.
9616 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9617 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9618 if self.datalen == 0 { return Vec::new(); }
9619 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9620 self.data = core::ptr::null_mut();
9624 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9625 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9628 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9629 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9630 let datalen = v.len();
9631 let data = Box::into_raw(v.into_boxed_slice());
9632 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9636 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9637 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9638 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9639 fn drop(&mut self) {
9640 if self.datalen == 0 { return; }
9641 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9644 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9645 fn clone(&self) -> Self {
9646 let mut res = Vec::new();
9647 if self.datalen == 0 { return Self::from(res); }
9648 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9653 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9654 /// This corresponds to std::vector in C++
9655 pub struct CVec_EventZ {
9656 /// The elements in the array.
9657 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9658 pub data: *mut crate::lightning::util::events::Event,
9659 /// The number of elements pointed to by `data`.
9663 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9664 if self.datalen == 0 { return Vec::new(); }
9665 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9666 self.data = core::ptr::null_mut();
9670 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9671 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9674 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9675 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9676 let datalen = v.len();
9677 let data = Box::into_raw(v.into_boxed_slice());
9678 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9682 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9683 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9684 impl Drop for CVec_EventZ {
9685 fn drop(&mut self) {
9686 if self.datalen == 0 { return; }
9687 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9690 impl Clone for CVec_EventZ {
9691 fn clone(&self) -> Self {
9692 let mut res = Vec::new();
9693 if self.datalen == 0 { return Self::from(res); }
9694 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9699 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9700 /// This corresponds to std::vector in C++
9701 pub struct CVec_TransactionZ {
9702 /// The elements in the array.
9703 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9704 pub data: *mut crate::c_types::Transaction,
9705 /// The number of elements pointed to by `data`.
9708 impl CVec_TransactionZ {
9709 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9710 if self.datalen == 0 { return Vec::new(); }
9711 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9712 self.data = core::ptr::null_mut();
9716 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9717 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9720 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9721 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9722 let datalen = v.len();
9723 let data = Box::into_raw(v.into_boxed_slice());
9724 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9728 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9729 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9730 impl Drop for CVec_TransactionZ {
9731 fn drop(&mut self) {
9732 if self.datalen == 0 { return; }
9733 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9736 impl Clone for CVec_TransactionZ {
9737 fn clone(&self) -> Self {
9738 let mut res = Vec::new();
9739 if self.datalen == 0 { return Self::from(res); }
9740 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9745 /// A tuple of 2 elements. See the individual fields for the types contained.
9746 pub struct C2Tuple_u32TxOutZ {
9747 /// The element at position 0
9749 /// The element at position 1
9750 pub b: crate::c_types::TxOut,
9752 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9753 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9760 impl C2Tuple_u32TxOutZ {
9761 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9765 impl Clone for C2Tuple_u32TxOutZ {
9766 fn clone(&self) -> Self {
9768 a: Clone::clone(&self.a),
9769 b: Clone::clone(&self.b),
9774 /// Creates a new tuple which has the same data as `orig`
9775 /// but with all dynamically-allocated buffers duplicated in new buffers.
9776 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9777 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9779 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9780 C2Tuple_u32TxOutZ { a, b, }
9784 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9785 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9787 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9788 /// This corresponds to std::vector in C++
9789 pub struct CVec_C2Tuple_u32TxOutZZ {
9790 /// The elements in the array.
9791 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9792 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9793 /// The number of elements pointed to by `data`.
9796 impl CVec_C2Tuple_u32TxOutZZ {
9797 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9798 if self.datalen == 0 { return Vec::new(); }
9799 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9800 self.data = core::ptr::null_mut();
9804 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9805 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9808 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9809 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9810 let datalen = v.len();
9811 let data = Box::into_raw(v.into_boxed_slice());
9812 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9816 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9817 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9818 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9819 fn drop(&mut self) {
9820 if self.datalen == 0 { return; }
9821 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9824 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9825 fn clone(&self) -> Self {
9826 let mut res = Vec::new();
9827 if self.datalen == 0 { return Self::from(res); }
9828 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9833 /// A tuple of 2 elements. See the individual fields for the types contained.
9834 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9835 /// The element at position 0
9836 pub a: crate::c_types::ThirtyTwoBytes,
9837 /// The element at position 1
9838 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9840 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9841 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9848 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9849 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9853 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9854 fn clone(&self) -> Self {
9856 a: Clone::clone(&self.a),
9857 b: Clone::clone(&self.b),
9862 /// Creates a new tuple which has the same data as `orig`
9863 /// but with all dynamically-allocated buffers duplicated in new buffers.
9864 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9865 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9867 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 {
9868 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9872 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9873 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9875 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9876 /// This corresponds to std::vector in C++
9877 pub struct CVec_TransactionOutputsZ {
9878 /// The elements in the array.
9879 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9880 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9881 /// The number of elements pointed to by `data`.
9884 impl CVec_TransactionOutputsZ {
9885 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9886 if self.datalen == 0 { return Vec::new(); }
9887 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9888 self.data = core::ptr::null_mut();
9892 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9893 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9896 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9897 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9898 let datalen = v.len();
9899 let data = Box::into_raw(v.into_boxed_slice());
9900 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9904 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9905 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9906 impl Drop for CVec_TransactionOutputsZ {
9907 fn drop(&mut self) {
9908 if self.datalen == 0 { return; }
9909 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9912 impl Clone for CVec_TransactionOutputsZ {
9913 fn clone(&self) -> Self {
9914 let mut res = Vec::new();
9915 if self.datalen == 0 { return Self::from(res); }
9916 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9921 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9922 /// This corresponds to std::vector in C++
9923 pub struct CVec_BalanceZ {
9924 /// The elements in the array.
9925 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9926 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9927 /// The number of elements pointed to by `data`.
9930 impl CVec_BalanceZ {
9931 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9932 if self.datalen == 0 { return Vec::new(); }
9933 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9934 self.data = core::ptr::null_mut();
9938 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9939 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9942 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9943 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9944 let datalen = v.len();
9945 let data = Box::into_raw(v.into_boxed_slice());
9946 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9950 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9951 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9952 impl Drop for CVec_BalanceZ {
9953 fn drop(&mut self) {
9954 if self.datalen == 0 { return; }
9955 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9958 impl Clone for CVec_BalanceZ {
9959 fn clone(&self) -> Self {
9960 let mut res = Vec::new();
9961 if self.datalen == 0 { return Self::from(res); }
9962 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9967 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9968 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9969 /// A pointer to the contents in the success state.
9970 /// Reading from this pointer when `result_ok` is not set is undefined.
9971 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9972 /// A pointer to the contents in the error state.
9973 /// Reading from this pointer when `result_ok` is set is undefined.
9974 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9977 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9978 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9980 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9981 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9982 /// `err` or `result` depending on the state of `result_ok`.
9983 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
9984 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9985 pub result_ok: bool,
9988 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9989 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9990 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9991 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9992 result: Box::into_raw(Box::new(o)),
9998 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9999 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10000 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10001 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10002 err: Box::into_raw(Box::new(e)),
10007 /// Checks if the given object is currently in the success state
10009 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10013 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10014 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10015 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10016 fn drop(&mut self) {
10017 if self.result_ok {
10018 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10019 let _ = unsafe { Box::from_raw(self.contents.result) };
10022 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10023 let _ = unsafe { Box::from_raw(self.contents.err) };
10028 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10029 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10030 let contents = if o.result_ok {
10031 let result = unsafe { o.contents.result };
10032 unsafe { o.contents.result = core::ptr::null_mut() };
10033 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10035 let err = unsafe { o.contents.err };
10036 unsafe { o.contents.err = core::ptr::null_mut(); }
10037 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10041 result_ok: o.result_ok,
10046 /// The contents of CResult_NoneLightningErrorZ
10047 pub union CResult_NoneLightningErrorZPtr {
10048 /// Note that this value is always NULL, as there are no contents in the OK variant
10049 pub result: *mut core::ffi::c_void,
10050 /// A pointer to the contents in the error state.
10051 /// Reading from this pointer when `result_ok` is set is undefined.
10052 pub err: *mut crate::lightning::ln::msgs::LightningError,
10055 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
10056 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
10057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10058 pub struct CResult_NoneLightningErrorZ {
10059 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
10060 /// `err` or `result` depending on the state of `result_ok`.
10061 pub contents: CResult_NoneLightningErrorZPtr,
10062 /// Whether this CResult_NoneLightningErrorZ represents a success state.
10063 pub result_ok: bool,
10066 /// Creates a new CResult_NoneLightningErrorZ in the success state.
10067 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10068 CResult_NoneLightningErrorZ {
10069 contents: CResult_NoneLightningErrorZPtr {
10070 result: core::ptr::null_mut(),
10076 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10077 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10078 CResult_NoneLightningErrorZ {
10079 contents: CResult_NoneLightningErrorZPtr {
10080 err: Box::into_raw(Box::new(e)),
10085 /// Checks if the given object is currently in the success state
10087 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10091 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10092 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10093 impl Drop for CResult_NoneLightningErrorZ {
10094 fn drop(&mut self) {
10095 if self.result_ok {
10097 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10098 let _ = unsafe { Box::from_raw(self.contents.err) };
10103 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10104 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10105 let contents = if o.result_ok {
10106 let _ = unsafe { Box::from_raw(o.contents.result) };
10107 o.contents.result = core::ptr::null_mut();
10108 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10110 let err = unsafe { o.contents.err };
10111 unsafe { o.contents.err = core::ptr::null_mut(); }
10112 CResult_NoneLightningErrorZPtr { err }
10116 result_ok: o.result_ok,
10120 impl Clone for CResult_NoneLightningErrorZ {
10121 fn clone(&self) -> Self {
10122 if self.result_ok {
10123 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10124 result: core::ptr::null_mut()
10127 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10128 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10134 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10135 /// but with all dynamically-allocated buffers duplicated in new buffers.
10136 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10138 /// A tuple of 2 elements. See the individual fields for the types contained.
10139 pub struct C2Tuple_PublicKeyTypeZ {
10140 /// The element at position 0
10141 pub a: crate::c_types::PublicKey,
10142 /// The element at position 1
10143 pub b: crate::lightning::ln::wire::Type,
10145 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10146 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10153 impl C2Tuple_PublicKeyTypeZ {
10154 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10158 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10160 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10161 C2Tuple_PublicKeyTypeZ { a, b, }
10165 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10166 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10168 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10169 /// This corresponds to std::vector in C++
10170 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10171 /// The elements in the array.
10172 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10173 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10174 /// The number of elements pointed to by `data`.
10177 impl CVec_C2Tuple_PublicKeyTypeZZ {
10178 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10179 if self.datalen == 0 { return Vec::new(); }
10180 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10181 self.data = core::ptr::null_mut();
10185 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10186 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10189 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10190 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10191 let datalen = v.len();
10192 let data = Box::into_raw(v.into_boxed_slice());
10193 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10197 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10198 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10199 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10200 fn drop(&mut self) {
10201 if self.datalen == 0 { return; }
10202 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10206 /// The contents of CResult_boolLightningErrorZ
10207 pub union CResult_boolLightningErrorZPtr {
10208 /// A pointer to the contents in the success state.
10209 /// Reading from this pointer when `result_ok` is not set is undefined.
10210 pub result: *mut bool,
10211 /// A pointer to the contents in the error state.
10212 /// Reading from this pointer when `result_ok` is set is undefined.
10213 pub err: *mut crate::lightning::ln::msgs::LightningError,
10216 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10217 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10219 pub struct CResult_boolLightningErrorZ {
10220 /// The contents of this CResult_boolLightningErrorZ, accessible via either
10221 /// `err` or `result` depending on the state of `result_ok`.
10222 pub contents: CResult_boolLightningErrorZPtr,
10223 /// Whether this CResult_boolLightningErrorZ represents a success state.
10224 pub result_ok: bool,
10227 /// Creates a new CResult_boolLightningErrorZ in the success state.
10228 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10229 CResult_boolLightningErrorZ {
10230 contents: CResult_boolLightningErrorZPtr {
10231 result: Box::into_raw(Box::new(o)),
10237 /// Creates a new CResult_boolLightningErrorZ in the error state.
10238 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10239 CResult_boolLightningErrorZ {
10240 contents: CResult_boolLightningErrorZPtr {
10241 err: Box::into_raw(Box::new(e)),
10246 /// Checks if the given object is currently in the success state
10248 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10252 /// Frees any resources used by the CResult_boolLightningErrorZ.
10253 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10254 impl Drop for CResult_boolLightningErrorZ {
10255 fn drop(&mut self) {
10256 if self.result_ok {
10257 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10258 let _ = unsafe { Box::from_raw(self.contents.result) };
10261 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10262 let _ = unsafe { Box::from_raw(self.contents.err) };
10267 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10268 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10269 let contents = if o.result_ok {
10270 let result = unsafe { o.contents.result };
10271 unsafe { o.contents.result = core::ptr::null_mut() };
10272 CResult_boolLightningErrorZPtr { result }
10274 let err = unsafe { o.contents.err };
10275 unsafe { o.contents.err = core::ptr::null_mut(); }
10276 CResult_boolLightningErrorZPtr { err }
10280 result_ok: o.result_ok,
10284 impl Clone for CResult_boolLightningErrorZ {
10285 fn clone(&self) -> Self {
10286 if self.result_ok {
10287 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10288 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10291 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10292 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10298 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10299 /// but with all dynamically-allocated buffers duplicated in new buffers.
10300 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10302 /// A tuple of 3 elements. See the individual fields for the types contained.
10303 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10304 /// The element at position 0
10305 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10306 /// The element at position 1
10307 pub b: crate::lightning::ln::msgs::ChannelUpdate,
10308 /// The element at position 2
10309 pub c: crate::lightning::ln::msgs::ChannelUpdate,
10311 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10312 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10320 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10321 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10322 (self.a, self.b, self.c)
10325 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10326 fn clone(&self) -> Self {
10328 a: Clone::clone(&self.a),
10329 b: Clone::clone(&self.b),
10330 c: Clone::clone(&self.c),
10335 /// Creates a new tuple which has the same data as `orig`
10336 /// but with all dynamically-allocated buffers duplicated in new buffers.
10337 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10338 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10340 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 {
10341 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10345 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10346 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10348 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10349 /// This corresponds to std::vector in C++
10350 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10351 /// The elements in the array.
10352 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10353 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10354 /// The number of elements pointed to by `data`.
10357 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10358 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10359 if self.datalen == 0 { return Vec::new(); }
10360 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10361 self.data = core::ptr::null_mut();
10365 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10366 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10369 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10370 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10371 let datalen = v.len();
10372 let data = Box::into_raw(v.into_boxed_slice());
10373 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10377 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10378 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10379 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10380 fn drop(&mut self) {
10381 if self.datalen == 0 { return; }
10382 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10385 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10386 fn clone(&self) -> Self {
10387 let mut res = Vec::new();
10388 if self.datalen == 0 { return Self::from(res); }
10389 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10394 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10395 /// This corresponds to std::vector in C++
10396 pub struct CVec_NodeAnnouncementZ {
10397 /// The elements in the array.
10398 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10399 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10400 /// The number of elements pointed to by `data`.
10403 impl CVec_NodeAnnouncementZ {
10404 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10405 if self.datalen == 0 { return Vec::new(); }
10406 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10407 self.data = core::ptr::null_mut();
10411 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10412 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10415 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10416 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10417 let datalen = v.len();
10418 let data = Box::into_raw(v.into_boxed_slice());
10419 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10423 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10424 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10425 impl Drop for CVec_NodeAnnouncementZ {
10426 fn drop(&mut self) {
10427 if self.datalen == 0 { return; }
10428 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10431 impl Clone for CVec_NodeAnnouncementZ {
10432 fn clone(&self) -> Self {
10433 let mut res = Vec::new();
10434 if self.datalen == 0 { return Self::from(res); }
10435 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10440 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10441 /// This corresponds to std::vector in C++
10442 pub struct CVec_PublicKeyZ {
10443 /// The elements in the array.
10444 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10445 pub data: *mut crate::c_types::PublicKey,
10446 /// The number of elements pointed to by `data`.
10449 impl CVec_PublicKeyZ {
10450 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10451 if self.datalen == 0 { return Vec::new(); }
10452 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10453 self.data = core::ptr::null_mut();
10457 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10458 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10461 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10462 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10463 let datalen = v.len();
10464 let data = Box::into_raw(v.into_boxed_slice());
10465 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10469 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10470 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10471 impl Drop for CVec_PublicKeyZ {
10472 fn drop(&mut self) {
10473 if self.datalen == 0 { return; }
10474 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10477 impl Clone for CVec_PublicKeyZ {
10478 fn clone(&self) -> Self {
10479 let mut res = Vec::new();
10480 if self.datalen == 0 { return Self::from(res); }
10481 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10487 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
10488 pub enum COption_NetAddressZ {
10489 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
10490 Some(crate::lightning::ln::msgs::NetAddress),
10491 /// When we're in this state, this COption_NetAddressZ contains nothing
10494 impl COption_NetAddressZ {
10495 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10496 if let Self::None = self { false } else { true }
10498 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10501 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
10502 if let Self::Some(v) = self { v } else { unreachable!() }
10506 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
10507 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
10508 COption_NetAddressZ::Some(o)
10511 /// Constructs a new COption_NetAddressZ containing nothing
10512 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
10513 COption_NetAddressZ::None
10516 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
10517 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
10519 /// Creates a new COption_NetAddressZ which has the same data as `orig`
10520 /// but with all dynamically-allocated buffers duplicated in new buffers.
10521 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
10523 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10524 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10525 /// A pointer to the contents in the success state.
10526 /// Reading from this pointer when `result_ok` is not set is undefined.
10527 pub result: *mut crate::c_types::derived::CVec_u8Z,
10528 /// A pointer to the contents in the error state.
10529 /// Reading from this pointer when `result_ok` is set is undefined.
10530 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10533 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10534 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10535 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10536 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10537 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10538 /// `err` or `result` depending on the state of `result_ok`.
10539 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10540 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10541 pub result_ok: bool,
10544 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10545 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10546 CResult_CVec_u8ZPeerHandleErrorZ {
10547 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10548 result: Box::into_raw(Box::new(o)),
10554 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10555 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10556 CResult_CVec_u8ZPeerHandleErrorZ {
10557 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10558 err: Box::into_raw(Box::new(e)),
10563 /// Checks if the given object is currently in the success state
10565 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10569 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10570 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10571 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10572 fn drop(&mut self) {
10573 if self.result_ok {
10574 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10575 let _ = unsafe { Box::from_raw(self.contents.result) };
10578 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10579 let _ = unsafe { Box::from_raw(self.contents.err) };
10584 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10585 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10586 let contents = if o.result_ok {
10587 let result = unsafe { o.contents.result };
10588 unsafe { o.contents.result = core::ptr::null_mut() };
10589 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10591 let err = unsafe { o.contents.err };
10592 unsafe { o.contents.err = core::ptr::null_mut(); }
10593 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10597 result_ok: o.result_ok,
10601 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10602 fn clone(&self) -> Self {
10603 if self.result_ok {
10604 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10605 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10608 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10609 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10615 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10616 /// but with all dynamically-allocated buffers duplicated in new buffers.
10617 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10619 /// The contents of CResult_NonePeerHandleErrorZ
10620 pub union CResult_NonePeerHandleErrorZPtr {
10621 /// Note that this value is always NULL, as there are no contents in the OK variant
10622 pub result: *mut core::ffi::c_void,
10623 /// A pointer to the contents in the error state.
10624 /// Reading from this pointer when `result_ok` is set is undefined.
10625 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10628 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10629 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10631 pub struct CResult_NonePeerHandleErrorZ {
10632 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10633 /// `err` or `result` depending on the state of `result_ok`.
10634 pub contents: CResult_NonePeerHandleErrorZPtr,
10635 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10636 pub result_ok: bool,
10639 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10640 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10641 CResult_NonePeerHandleErrorZ {
10642 contents: CResult_NonePeerHandleErrorZPtr {
10643 result: core::ptr::null_mut(),
10649 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10650 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10651 CResult_NonePeerHandleErrorZ {
10652 contents: CResult_NonePeerHandleErrorZPtr {
10653 err: Box::into_raw(Box::new(e)),
10658 /// Checks if the given object is currently in the success state
10660 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10664 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10665 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10666 impl Drop for CResult_NonePeerHandleErrorZ {
10667 fn drop(&mut self) {
10668 if self.result_ok {
10670 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10671 let _ = unsafe { Box::from_raw(self.contents.err) };
10676 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10677 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10678 let contents = if o.result_ok {
10679 let _ = unsafe { Box::from_raw(o.contents.result) };
10680 o.contents.result = core::ptr::null_mut();
10681 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10683 let err = unsafe { o.contents.err };
10684 unsafe { o.contents.err = core::ptr::null_mut(); }
10685 CResult_NonePeerHandleErrorZPtr { err }
10689 result_ok: o.result_ok,
10693 impl Clone for CResult_NonePeerHandleErrorZ {
10694 fn clone(&self) -> Self {
10695 if self.result_ok {
10696 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10697 result: core::ptr::null_mut()
10700 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10701 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10707 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10708 /// but with all dynamically-allocated buffers duplicated in new buffers.
10709 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10711 /// The contents of CResult_boolPeerHandleErrorZ
10712 pub union CResult_boolPeerHandleErrorZPtr {
10713 /// A pointer to the contents in the success state.
10714 /// Reading from this pointer when `result_ok` is not set is undefined.
10715 pub result: *mut bool,
10716 /// A pointer to the contents in the error state.
10717 /// Reading from this pointer when `result_ok` is set is undefined.
10718 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10721 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10722 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10724 pub struct CResult_boolPeerHandleErrorZ {
10725 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10726 /// `err` or `result` depending on the state of `result_ok`.
10727 pub contents: CResult_boolPeerHandleErrorZPtr,
10728 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10729 pub result_ok: bool,
10732 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10733 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10734 CResult_boolPeerHandleErrorZ {
10735 contents: CResult_boolPeerHandleErrorZPtr {
10736 result: Box::into_raw(Box::new(o)),
10742 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10743 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10744 CResult_boolPeerHandleErrorZ {
10745 contents: CResult_boolPeerHandleErrorZPtr {
10746 err: Box::into_raw(Box::new(e)),
10751 /// Checks if the given object is currently in the success state
10753 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10757 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10758 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10759 impl Drop for CResult_boolPeerHandleErrorZ {
10760 fn drop(&mut self) {
10761 if self.result_ok {
10762 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10763 let _ = unsafe { Box::from_raw(self.contents.result) };
10766 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10767 let _ = unsafe { Box::from_raw(self.contents.err) };
10772 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10773 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10774 let contents = if o.result_ok {
10775 let result = unsafe { o.contents.result };
10776 unsafe { o.contents.result = core::ptr::null_mut() };
10777 CResult_boolPeerHandleErrorZPtr { result }
10779 let err = unsafe { o.contents.err };
10780 unsafe { o.contents.err = core::ptr::null_mut(); }
10781 CResult_boolPeerHandleErrorZPtr { err }
10785 result_ok: o.result_ok,
10789 impl Clone for CResult_boolPeerHandleErrorZ {
10790 fn clone(&self) -> Self {
10791 if self.result_ok {
10792 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10793 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10796 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10797 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10803 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10804 /// but with all dynamically-allocated buffers duplicated in new buffers.
10805 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10807 /// The contents of CResult_NodeIdDecodeErrorZ
10808 pub union CResult_NodeIdDecodeErrorZPtr {
10809 /// A pointer to the contents in the success state.
10810 /// Reading from this pointer when `result_ok` is not set is undefined.
10811 pub result: *mut crate::lightning::routing::network_graph::NodeId,
10812 /// A pointer to the contents in the error state.
10813 /// Reading from this pointer when `result_ok` is set is undefined.
10814 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10817 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10818 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10819 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10820 pub struct CResult_NodeIdDecodeErrorZ {
10821 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10822 /// `err` or `result` depending on the state of `result_ok`.
10823 pub contents: CResult_NodeIdDecodeErrorZPtr,
10824 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10825 pub result_ok: bool,
10828 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10829 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10830 CResult_NodeIdDecodeErrorZ {
10831 contents: CResult_NodeIdDecodeErrorZPtr {
10832 result: Box::into_raw(Box::new(o)),
10838 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10839 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10840 CResult_NodeIdDecodeErrorZ {
10841 contents: CResult_NodeIdDecodeErrorZPtr {
10842 err: Box::into_raw(Box::new(e)),
10847 /// Checks if the given object is currently in the success state
10849 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10853 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10854 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10855 impl Drop for CResult_NodeIdDecodeErrorZ {
10856 fn drop(&mut self) {
10857 if self.result_ok {
10858 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10859 let _ = unsafe { Box::from_raw(self.contents.result) };
10862 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10863 let _ = unsafe { Box::from_raw(self.contents.err) };
10868 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10869 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10870 let contents = if o.result_ok {
10871 let result = unsafe { o.contents.result };
10872 unsafe { o.contents.result = core::ptr::null_mut() };
10873 CResult_NodeIdDecodeErrorZPtr { result }
10875 let err = unsafe { o.contents.err };
10876 unsafe { o.contents.err = core::ptr::null_mut(); }
10877 CResult_NodeIdDecodeErrorZPtr { err }
10881 result_ok: o.result_ok,
10885 impl Clone for CResult_NodeIdDecodeErrorZ {
10886 fn clone(&self) -> Self {
10887 if self.result_ok {
10888 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10889 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10892 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10893 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10899 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10900 /// but with all dynamically-allocated buffers duplicated in new buffers.
10901 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10903 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10904 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10905 /// A pointer to the contents in the success state.
10906 /// Reading from this pointer when `result_ok` is not set is undefined.
10907 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10908 /// A pointer to the contents in the error state.
10909 /// Reading from this pointer when `result_ok` is set is undefined.
10910 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10913 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10914 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10915 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10916 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10917 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10918 /// `err` or `result` depending on the state of `result_ok`.
10919 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10920 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10921 pub result_ok: bool,
10924 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10925 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10926 CResult_COption_NetworkUpdateZDecodeErrorZ {
10927 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10928 result: Box::into_raw(Box::new(o)),
10934 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10935 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10936 CResult_COption_NetworkUpdateZDecodeErrorZ {
10937 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10938 err: Box::into_raw(Box::new(e)),
10943 /// Checks if the given object is currently in the success state
10945 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10949 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10950 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10951 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10952 fn drop(&mut self) {
10953 if self.result_ok {
10954 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10955 let _ = unsafe { Box::from_raw(self.contents.result) };
10958 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10959 let _ = unsafe { Box::from_raw(self.contents.err) };
10964 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10965 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10966 let contents = if o.result_ok {
10967 let result = unsafe { o.contents.result };
10968 unsafe { o.contents.result = core::ptr::null_mut() };
10969 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10971 let err = unsafe { o.contents.err };
10972 unsafe { o.contents.err = core::ptr::null_mut(); }
10973 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10977 result_ok: o.result_ok,
10981 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10982 fn clone(&self) -> Self {
10983 if self.result_ok {
10984 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10985 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10988 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10989 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10995 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
10996 /// but with all dynamically-allocated buffers duplicated in new buffers.
10997 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
10999 /// An enum which can either contain a crate::lightning::chain::Access or not
11000 pub enum COption_AccessZ {
11001 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
11002 Some(crate::lightning::chain::Access),
11003 /// When we're in this state, this COption_AccessZ contains nothing
11006 impl COption_AccessZ {
11007 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11008 if let Self::None = self { false } else { true }
11010 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11013 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
11014 if let Self::Some(v) = self { v } else { unreachable!() }
11018 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11019 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
11020 COption_AccessZ::Some(o)
11023 /// Constructs a new COption_AccessZ containing nothing
11024 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
11025 COption_AccessZ::None
11028 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11029 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
11031 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
11032 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
11033 /// A pointer to the contents in the success state.
11034 /// Reading from this pointer when `result_ok` is not set is undefined.
11035 pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
11036 /// A pointer to the contents in the error state.
11037 /// Reading from this pointer when `result_ok` is set is undefined.
11038 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11041 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
11042 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11044 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
11045 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
11046 /// `err` or `result` depending on the state of `result_ok`.
11047 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
11048 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
11049 pub result_ok: bool,
11052 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
11053 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11054 CResult_ChannelUpdateInfoDecodeErrorZ {
11055 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11056 result: Box::into_raw(Box::new(o)),
11062 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
11063 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11064 CResult_ChannelUpdateInfoDecodeErrorZ {
11065 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11066 err: Box::into_raw(Box::new(e)),
11071 /// Checks if the given object is currently in the success state
11073 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
11077 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
11078 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
11079 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
11080 fn drop(&mut self) {
11081 if self.result_ok {
11082 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11083 let _ = unsafe { Box::from_raw(self.contents.result) };
11086 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11087 let _ = unsafe { Box::from_raw(self.contents.err) };
11092 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
11093 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11094 let contents = if o.result_ok {
11095 let result = unsafe { o.contents.result };
11096 unsafe { o.contents.result = core::ptr::null_mut() };
11097 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
11099 let err = unsafe { o.contents.err };
11100 unsafe { o.contents.err = core::ptr::null_mut(); }
11101 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11105 result_ok: o.result_ok,
11109 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11110 fn clone(&self) -> Self {
11111 if self.result_ok {
11112 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11113 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11116 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11117 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11123 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11124 /// but with all dynamically-allocated buffers duplicated in new buffers.
11125 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11127 /// The contents of CResult_ChannelInfoDecodeErrorZ
11128 pub union CResult_ChannelInfoDecodeErrorZPtr {
11129 /// A pointer to the contents in the success state.
11130 /// Reading from this pointer when `result_ok` is not set is undefined.
11131 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11132 /// A pointer to the contents in the error state.
11133 /// Reading from this pointer when `result_ok` is set is undefined.
11134 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11137 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11138 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11139 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11140 pub struct CResult_ChannelInfoDecodeErrorZ {
11141 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11142 /// `err` or `result` depending on the state of `result_ok`.
11143 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11144 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11145 pub result_ok: bool,
11148 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11149 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11150 CResult_ChannelInfoDecodeErrorZ {
11151 contents: CResult_ChannelInfoDecodeErrorZPtr {
11152 result: Box::into_raw(Box::new(o)),
11158 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11159 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11160 CResult_ChannelInfoDecodeErrorZ {
11161 contents: CResult_ChannelInfoDecodeErrorZPtr {
11162 err: Box::into_raw(Box::new(e)),
11167 /// Checks if the given object is currently in the success state
11169 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11173 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11174 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11175 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11176 fn drop(&mut self) {
11177 if self.result_ok {
11178 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11179 let _ = unsafe { Box::from_raw(self.contents.result) };
11182 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11183 let _ = unsafe { Box::from_raw(self.contents.err) };
11188 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11189 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11190 let contents = if o.result_ok {
11191 let result = unsafe { o.contents.result };
11192 unsafe { o.contents.result = core::ptr::null_mut() };
11193 CResult_ChannelInfoDecodeErrorZPtr { result }
11195 let err = unsafe { o.contents.err };
11196 unsafe { o.contents.err = core::ptr::null_mut(); }
11197 CResult_ChannelInfoDecodeErrorZPtr { err }
11201 result_ok: o.result_ok,
11205 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11206 fn clone(&self) -> Self {
11207 if self.result_ok {
11208 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11209 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11212 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11213 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11219 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11220 /// but with all dynamically-allocated buffers duplicated in new buffers.
11221 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11223 /// The contents of CResult_RoutingFeesDecodeErrorZ
11224 pub union CResult_RoutingFeesDecodeErrorZPtr {
11225 /// A pointer to the contents in the success state.
11226 /// Reading from this pointer when `result_ok` is not set is undefined.
11227 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11228 /// A pointer to the contents in the error state.
11229 /// Reading from this pointer when `result_ok` is set is undefined.
11230 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11233 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11234 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11236 pub struct CResult_RoutingFeesDecodeErrorZ {
11237 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11238 /// `err` or `result` depending on the state of `result_ok`.
11239 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11240 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11241 pub result_ok: bool,
11244 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11245 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11246 CResult_RoutingFeesDecodeErrorZ {
11247 contents: CResult_RoutingFeesDecodeErrorZPtr {
11248 result: Box::into_raw(Box::new(o)),
11254 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11255 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11256 CResult_RoutingFeesDecodeErrorZ {
11257 contents: CResult_RoutingFeesDecodeErrorZPtr {
11258 err: Box::into_raw(Box::new(e)),
11263 /// Checks if the given object is currently in the success state
11265 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11269 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11270 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11271 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11272 fn drop(&mut self) {
11273 if self.result_ok {
11274 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11275 let _ = unsafe { Box::from_raw(self.contents.result) };
11278 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11279 let _ = unsafe { Box::from_raw(self.contents.err) };
11284 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11285 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11286 let contents = if o.result_ok {
11287 let result = unsafe { o.contents.result };
11288 unsafe { o.contents.result = core::ptr::null_mut() };
11289 CResult_RoutingFeesDecodeErrorZPtr { result }
11291 let err = unsafe { o.contents.err };
11292 unsafe { o.contents.err = core::ptr::null_mut(); }
11293 CResult_RoutingFeesDecodeErrorZPtr { err }
11297 result_ok: o.result_ok,
11301 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11302 fn clone(&self) -> Self {
11303 if self.result_ok {
11304 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11305 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11308 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11309 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11315 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11316 /// but with all dynamically-allocated buffers duplicated in new buffers.
11317 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11319 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11320 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11321 /// A pointer to the contents in the success state.
11322 /// Reading from this pointer when `result_ok` is not set is undefined.
11323 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11324 /// A pointer to the contents in the error state.
11325 /// Reading from this pointer when `result_ok` is set is undefined.
11326 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11329 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11330 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11332 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11333 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11334 /// `err` or `result` depending on the state of `result_ok`.
11335 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11336 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11337 pub result_ok: bool,
11340 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11341 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11342 CResult_NodeAnnouncementInfoDecodeErrorZ {
11343 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11344 result: Box::into_raw(Box::new(o)),
11350 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11351 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11352 CResult_NodeAnnouncementInfoDecodeErrorZ {
11353 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11354 err: Box::into_raw(Box::new(e)),
11359 /// Checks if the given object is currently in the success state
11361 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11365 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11366 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11367 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11368 fn drop(&mut self) {
11369 if self.result_ok {
11370 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11371 let _ = unsafe { Box::from_raw(self.contents.result) };
11374 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11375 let _ = unsafe { Box::from_raw(self.contents.err) };
11380 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11381 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11382 let contents = if o.result_ok {
11383 let result = unsafe { o.contents.result };
11384 unsafe { o.contents.result = core::ptr::null_mut() };
11385 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11387 let err = unsafe { o.contents.err };
11388 unsafe { o.contents.err = core::ptr::null_mut(); }
11389 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11393 result_ok: o.result_ok,
11397 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11398 fn clone(&self) -> Self {
11399 if self.result_ok {
11400 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11401 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11404 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11405 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11411 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11412 /// but with all dynamically-allocated buffers duplicated in new buffers.
11413 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11415 /// A dynamically-allocated array of u64s of arbitrary size.
11416 /// This corresponds to std::vector in C++
11417 pub struct CVec_u64Z {
11418 /// The elements in the array.
11419 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11420 pub data: *mut u64,
11421 /// The number of elements pointed to by `data`.
11425 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11426 if self.datalen == 0 { return Vec::new(); }
11427 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11428 self.data = core::ptr::null_mut();
11432 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11433 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11436 impl From<Vec<u64>> for CVec_u64Z {
11437 fn from(v: Vec<u64>) -> Self {
11438 let datalen = v.len();
11439 let data = Box::into_raw(v.into_boxed_slice());
11440 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11444 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11445 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11446 impl Drop for CVec_u64Z {
11447 fn drop(&mut self) {
11448 if self.datalen == 0 { return; }
11449 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11452 impl Clone for CVec_u64Z {
11453 fn clone(&self) -> Self {
11454 let mut res = Vec::new();
11455 if self.datalen == 0 { return Self::from(res); }
11456 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11461 /// The contents of CResult_NodeInfoDecodeErrorZ
11462 pub union CResult_NodeInfoDecodeErrorZPtr {
11463 /// A pointer to the contents in the success state.
11464 /// Reading from this pointer when `result_ok` is not set is undefined.
11465 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11466 /// A pointer to the contents in the error state.
11467 /// Reading from this pointer when `result_ok` is set is undefined.
11468 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11471 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11472 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11474 pub struct CResult_NodeInfoDecodeErrorZ {
11475 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11476 /// `err` or `result` depending on the state of `result_ok`.
11477 pub contents: CResult_NodeInfoDecodeErrorZPtr,
11478 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11479 pub result_ok: bool,
11482 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11483 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11484 CResult_NodeInfoDecodeErrorZ {
11485 contents: CResult_NodeInfoDecodeErrorZPtr {
11486 result: Box::into_raw(Box::new(o)),
11492 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11493 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11494 CResult_NodeInfoDecodeErrorZ {
11495 contents: CResult_NodeInfoDecodeErrorZPtr {
11496 err: Box::into_raw(Box::new(e)),
11501 /// Checks if the given object is currently in the success state
11503 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11507 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11508 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11509 impl Drop for CResult_NodeInfoDecodeErrorZ {
11510 fn drop(&mut self) {
11511 if self.result_ok {
11512 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11513 let _ = unsafe { Box::from_raw(self.contents.result) };
11516 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11517 let _ = unsafe { Box::from_raw(self.contents.err) };
11522 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11523 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11524 let contents = if o.result_ok {
11525 let result = unsafe { o.contents.result };
11526 unsafe { o.contents.result = core::ptr::null_mut() };
11527 CResult_NodeInfoDecodeErrorZPtr { result }
11529 let err = unsafe { o.contents.err };
11530 unsafe { o.contents.err = core::ptr::null_mut(); }
11531 CResult_NodeInfoDecodeErrorZPtr { err }
11535 result_ok: o.result_ok,
11539 impl Clone for CResult_NodeInfoDecodeErrorZ {
11540 fn clone(&self) -> Self {
11541 if self.result_ok {
11542 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11543 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11546 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11547 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11553 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11554 /// but with all dynamically-allocated buffers duplicated in new buffers.
11555 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11557 /// The contents of CResult_NetworkGraphDecodeErrorZ
11558 pub union CResult_NetworkGraphDecodeErrorZPtr {
11559 /// A pointer to the contents in the success state.
11560 /// Reading from this pointer when `result_ok` is not set is undefined.
11561 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11562 /// A pointer to the contents in the error state.
11563 /// Reading from this pointer when `result_ok` is set is undefined.
11564 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11567 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11568 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11569 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11570 pub struct CResult_NetworkGraphDecodeErrorZ {
11571 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11572 /// `err` or `result` depending on the state of `result_ok`.
11573 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11574 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11575 pub result_ok: bool,
11578 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11579 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11580 CResult_NetworkGraphDecodeErrorZ {
11581 contents: CResult_NetworkGraphDecodeErrorZPtr {
11582 result: Box::into_raw(Box::new(o)),
11588 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11589 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11590 CResult_NetworkGraphDecodeErrorZ {
11591 contents: CResult_NetworkGraphDecodeErrorZPtr {
11592 err: Box::into_raw(Box::new(e)),
11597 /// Checks if the given object is currently in the success state
11599 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11603 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11604 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11605 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11606 fn drop(&mut self) {
11607 if self.result_ok {
11608 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11609 let _ = unsafe { Box::from_raw(self.contents.result) };
11612 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11613 let _ = unsafe { Box::from_raw(self.contents.err) };
11618 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11619 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11620 let contents = if o.result_ok {
11621 let result = unsafe { o.contents.result };
11622 unsafe { o.contents.result = core::ptr::null_mut() };
11623 CResult_NetworkGraphDecodeErrorZPtr { result }
11625 let err = unsafe { o.contents.err };
11626 unsafe { o.contents.err = core::ptr::null_mut(); }
11627 CResult_NetworkGraphDecodeErrorZPtr { err }
11631 result_ok: o.result_ok,
11635 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11636 fn clone(&self) -> Self {
11637 if self.result_ok {
11638 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11639 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11642 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11643 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11649 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11650 /// but with all dynamically-allocated buffers duplicated in new buffers.
11651 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11654 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11655 pub enum COption_CVec_NetAddressZZ {
11656 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11657 Some(crate::c_types::derived::CVec_NetAddressZ),
11658 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11661 impl COption_CVec_NetAddressZZ {
11662 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11663 if let Self::None = self { false } else { true }
11665 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11668 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11669 if let Self::Some(v) = self { v } else { unreachable!() }
11673 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11674 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11675 COption_CVec_NetAddressZZ::Some(o)
11678 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11679 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11680 COption_CVec_NetAddressZZ::None
11683 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11684 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11686 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11687 /// but with all dynamically-allocated buffers duplicated in new buffers.
11688 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11690 /// The contents of CResult_NetAddressDecodeErrorZ
11691 pub union CResult_NetAddressDecodeErrorZPtr {
11692 /// A pointer to the contents in the success state.
11693 /// Reading from this pointer when `result_ok` is not set is undefined.
11694 pub result: *mut crate::lightning::ln::msgs::NetAddress,
11695 /// A pointer to the contents in the error state.
11696 /// Reading from this pointer when `result_ok` is set is undefined.
11697 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11700 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11701 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11703 pub struct CResult_NetAddressDecodeErrorZ {
11704 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11705 /// `err` or `result` depending on the state of `result_ok`.
11706 pub contents: CResult_NetAddressDecodeErrorZPtr,
11707 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11708 pub result_ok: bool,
11711 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11712 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11713 CResult_NetAddressDecodeErrorZ {
11714 contents: CResult_NetAddressDecodeErrorZPtr {
11715 result: Box::into_raw(Box::new(o)),
11721 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11722 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11723 CResult_NetAddressDecodeErrorZ {
11724 contents: CResult_NetAddressDecodeErrorZPtr {
11725 err: Box::into_raw(Box::new(e)),
11730 /// Checks if the given object is currently in the success state
11732 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11736 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11737 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11738 impl Drop for CResult_NetAddressDecodeErrorZ {
11739 fn drop(&mut self) {
11740 if self.result_ok {
11741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11742 let _ = unsafe { Box::from_raw(self.contents.result) };
11745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11746 let _ = unsafe { Box::from_raw(self.contents.err) };
11751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11752 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11753 let contents = if o.result_ok {
11754 let result = unsafe { o.contents.result };
11755 unsafe { o.contents.result = core::ptr::null_mut() };
11756 CResult_NetAddressDecodeErrorZPtr { result }
11758 let err = unsafe { o.contents.err };
11759 unsafe { o.contents.err = core::ptr::null_mut(); }
11760 CResult_NetAddressDecodeErrorZPtr { err }
11764 result_ok: o.result_ok,
11768 impl Clone for CResult_NetAddressDecodeErrorZ {
11769 fn clone(&self) -> Self {
11770 if self.result_ok {
11771 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11772 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11775 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11776 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11782 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11783 /// but with all dynamically-allocated buffers duplicated in new buffers.
11784 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11786 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11787 /// This corresponds to std::vector in C++
11788 pub struct CVec_UpdateAddHTLCZ {
11789 /// The elements in the array.
11790 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11791 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11792 /// The number of elements pointed to by `data`.
11795 impl CVec_UpdateAddHTLCZ {
11796 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11797 if self.datalen == 0 { return Vec::new(); }
11798 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11799 self.data = core::ptr::null_mut();
11803 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11804 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11807 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11808 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11809 let datalen = v.len();
11810 let data = Box::into_raw(v.into_boxed_slice());
11811 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11815 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11816 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11817 impl Drop for CVec_UpdateAddHTLCZ {
11818 fn drop(&mut self) {
11819 if self.datalen == 0 { return; }
11820 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11823 impl Clone for CVec_UpdateAddHTLCZ {
11824 fn clone(&self) -> Self {
11825 let mut res = Vec::new();
11826 if self.datalen == 0 { return Self::from(res); }
11827 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11832 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11833 /// This corresponds to std::vector in C++
11834 pub struct CVec_UpdateFulfillHTLCZ {
11835 /// The elements in the array.
11836 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11837 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11838 /// The number of elements pointed to by `data`.
11841 impl CVec_UpdateFulfillHTLCZ {
11842 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11843 if self.datalen == 0 { return Vec::new(); }
11844 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11845 self.data = core::ptr::null_mut();
11849 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11850 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11853 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11854 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11855 let datalen = v.len();
11856 let data = Box::into_raw(v.into_boxed_slice());
11857 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11861 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11862 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11863 impl Drop for CVec_UpdateFulfillHTLCZ {
11864 fn drop(&mut self) {
11865 if self.datalen == 0 { return; }
11866 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11869 impl Clone for CVec_UpdateFulfillHTLCZ {
11870 fn clone(&self) -> Self {
11871 let mut res = Vec::new();
11872 if self.datalen == 0 { return Self::from(res); }
11873 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11878 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11879 /// This corresponds to std::vector in C++
11880 pub struct CVec_UpdateFailHTLCZ {
11881 /// The elements in the array.
11882 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11883 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11884 /// The number of elements pointed to by `data`.
11887 impl CVec_UpdateFailHTLCZ {
11888 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11889 if self.datalen == 0 { return Vec::new(); }
11890 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11891 self.data = core::ptr::null_mut();
11895 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11896 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11899 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11900 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11901 let datalen = v.len();
11902 let data = Box::into_raw(v.into_boxed_slice());
11903 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11907 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11908 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11909 impl Drop for CVec_UpdateFailHTLCZ {
11910 fn drop(&mut self) {
11911 if self.datalen == 0 { return; }
11912 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11915 impl Clone for CVec_UpdateFailHTLCZ {
11916 fn clone(&self) -> Self {
11917 let mut res = Vec::new();
11918 if self.datalen == 0 { return Self::from(res); }
11919 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11924 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11925 /// This corresponds to std::vector in C++
11926 pub struct CVec_UpdateFailMalformedHTLCZ {
11927 /// The elements in the array.
11928 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11929 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11930 /// The number of elements pointed to by `data`.
11933 impl CVec_UpdateFailMalformedHTLCZ {
11934 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11935 if self.datalen == 0 { return Vec::new(); }
11936 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11937 self.data = core::ptr::null_mut();
11941 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11942 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11945 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11946 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11947 let datalen = v.len();
11948 let data = Box::into_raw(v.into_boxed_slice());
11949 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11953 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11954 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11955 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11956 fn drop(&mut self) {
11957 if self.datalen == 0 { return; }
11958 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11961 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11962 fn clone(&self) -> Self {
11963 let mut res = Vec::new();
11964 if self.datalen == 0 { return Self::from(res); }
11965 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11970 /// The contents of CResult_AcceptChannelDecodeErrorZ
11971 pub union CResult_AcceptChannelDecodeErrorZPtr {
11972 /// A pointer to the contents in the success state.
11973 /// Reading from this pointer when `result_ok` is not set is undefined.
11974 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11975 /// A pointer to the contents in the error state.
11976 /// Reading from this pointer when `result_ok` is set is undefined.
11977 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11980 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11981 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11983 pub struct CResult_AcceptChannelDecodeErrorZ {
11984 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11985 /// `err` or `result` depending on the state of `result_ok`.
11986 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11987 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11988 pub result_ok: bool,
11991 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
11992 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
11993 CResult_AcceptChannelDecodeErrorZ {
11994 contents: CResult_AcceptChannelDecodeErrorZPtr {
11995 result: Box::into_raw(Box::new(o)),
12001 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12002 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12003 CResult_AcceptChannelDecodeErrorZ {
12004 contents: CResult_AcceptChannelDecodeErrorZPtr {
12005 err: Box::into_raw(Box::new(e)),
12010 /// Checks if the given object is currently in the success state
12012 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12016 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12017 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12018 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12019 fn drop(&mut self) {
12020 if self.result_ok {
12021 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12022 let _ = unsafe { Box::from_raw(self.contents.result) };
12025 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12026 let _ = unsafe { Box::from_raw(self.contents.err) };
12031 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12032 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12033 let contents = if o.result_ok {
12034 let result = unsafe { o.contents.result };
12035 unsafe { o.contents.result = core::ptr::null_mut() };
12036 CResult_AcceptChannelDecodeErrorZPtr { result }
12038 let err = unsafe { o.contents.err };
12039 unsafe { o.contents.err = core::ptr::null_mut(); }
12040 CResult_AcceptChannelDecodeErrorZPtr { err }
12044 result_ok: o.result_ok,
12048 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12049 fn clone(&self) -> Self {
12050 if self.result_ok {
12051 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12052 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12055 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12056 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12062 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12063 /// but with all dynamically-allocated buffers duplicated in new buffers.
12064 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12066 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12067 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12068 /// A pointer to the contents in the success state.
12069 /// Reading from this pointer when `result_ok` is not set is undefined.
12070 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12071 /// A pointer to the contents in the error state.
12072 /// Reading from this pointer when `result_ok` is set is undefined.
12073 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12076 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12077 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12079 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12080 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12081 /// `err` or `result` depending on the state of `result_ok`.
12082 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12083 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12084 pub result_ok: bool,
12087 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12088 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12089 CResult_AnnouncementSignaturesDecodeErrorZ {
12090 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12091 result: Box::into_raw(Box::new(o)),
12097 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12098 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12099 CResult_AnnouncementSignaturesDecodeErrorZ {
12100 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12101 err: Box::into_raw(Box::new(e)),
12106 /// Checks if the given object is currently in the success state
12108 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12112 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12113 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12114 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12115 fn drop(&mut self) {
12116 if self.result_ok {
12117 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12118 let _ = unsafe { Box::from_raw(self.contents.result) };
12121 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12122 let _ = unsafe { Box::from_raw(self.contents.err) };
12127 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12128 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12129 let contents = if o.result_ok {
12130 let result = unsafe { o.contents.result };
12131 unsafe { o.contents.result = core::ptr::null_mut() };
12132 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12134 let err = unsafe { o.contents.err };
12135 unsafe { o.contents.err = core::ptr::null_mut(); }
12136 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12140 result_ok: o.result_ok,
12144 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12145 fn clone(&self) -> Self {
12146 if self.result_ok {
12147 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12148 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12151 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12152 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12158 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12159 /// but with all dynamically-allocated buffers duplicated in new buffers.
12160 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12162 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12163 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12164 /// A pointer to the contents in the success state.
12165 /// Reading from this pointer when `result_ok` is not set is undefined.
12166 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12167 /// A pointer to the contents in the error state.
12168 /// Reading from this pointer when `result_ok` is set is undefined.
12169 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12172 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12173 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12174 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12175 pub struct CResult_ChannelReestablishDecodeErrorZ {
12176 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12177 /// `err` or `result` depending on the state of `result_ok`.
12178 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12179 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12180 pub result_ok: bool,
12183 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12184 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12185 CResult_ChannelReestablishDecodeErrorZ {
12186 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12187 result: Box::into_raw(Box::new(o)),
12193 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12194 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12195 CResult_ChannelReestablishDecodeErrorZ {
12196 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12197 err: Box::into_raw(Box::new(e)),
12202 /// Checks if the given object is currently in the success state
12204 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12208 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12209 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12210 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12211 fn drop(&mut self) {
12212 if self.result_ok {
12213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12214 let _ = unsafe { Box::from_raw(self.contents.result) };
12217 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12218 let _ = unsafe { Box::from_raw(self.contents.err) };
12223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12224 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12225 let contents = if o.result_ok {
12226 let result = unsafe { o.contents.result };
12227 unsafe { o.contents.result = core::ptr::null_mut() };
12228 CResult_ChannelReestablishDecodeErrorZPtr { result }
12230 let err = unsafe { o.contents.err };
12231 unsafe { o.contents.err = core::ptr::null_mut(); }
12232 CResult_ChannelReestablishDecodeErrorZPtr { err }
12236 result_ok: o.result_ok,
12240 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12241 fn clone(&self) -> Self {
12242 if self.result_ok {
12243 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12244 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12247 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12248 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12254 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12255 /// but with all dynamically-allocated buffers duplicated in new buffers.
12256 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12258 /// The contents of CResult_ClosingSignedDecodeErrorZ
12259 pub union CResult_ClosingSignedDecodeErrorZPtr {
12260 /// A pointer to the contents in the success state.
12261 /// Reading from this pointer when `result_ok` is not set is undefined.
12262 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12263 /// A pointer to the contents in the error state.
12264 /// Reading from this pointer when `result_ok` is set is undefined.
12265 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12268 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12269 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12271 pub struct CResult_ClosingSignedDecodeErrorZ {
12272 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12273 /// `err` or `result` depending on the state of `result_ok`.
12274 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12275 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12276 pub result_ok: bool,
12279 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12280 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12281 CResult_ClosingSignedDecodeErrorZ {
12282 contents: CResult_ClosingSignedDecodeErrorZPtr {
12283 result: Box::into_raw(Box::new(o)),
12289 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12290 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12291 CResult_ClosingSignedDecodeErrorZ {
12292 contents: CResult_ClosingSignedDecodeErrorZPtr {
12293 err: Box::into_raw(Box::new(e)),
12298 /// Checks if the given object is currently in the success state
12300 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12304 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12305 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12306 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12307 fn drop(&mut self) {
12308 if self.result_ok {
12309 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12310 let _ = unsafe { Box::from_raw(self.contents.result) };
12313 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12314 let _ = unsafe { Box::from_raw(self.contents.err) };
12319 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12320 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12321 let contents = if o.result_ok {
12322 let result = unsafe { o.contents.result };
12323 unsafe { o.contents.result = core::ptr::null_mut() };
12324 CResult_ClosingSignedDecodeErrorZPtr { result }
12326 let err = unsafe { o.contents.err };
12327 unsafe { o.contents.err = core::ptr::null_mut(); }
12328 CResult_ClosingSignedDecodeErrorZPtr { err }
12332 result_ok: o.result_ok,
12336 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12337 fn clone(&self) -> Self {
12338 if self.result_ok {
12339 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12340 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12343 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12344 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12350 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12351 /// but with all dynamically-allocated buffers duplicated in new buffers.
12352 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12354 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12355 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12356 /// A pointer to the contents in the success state.
12357 /// Reading from this pointer when `result_ok` is not set is undefined.
12358 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12359 /// A pointer to the contents in the error state.
12360 /// Reading from this pointer when `result_ok` is set is undefined.
12361 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12364 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12365 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12367 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12368 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12369 /// `err` or `result` depending on the state of `result_ok`.
12370 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12371 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12372 pub result_ok: bool,
12375 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12376 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12377 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12378 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12379 result: Box::into_raw(Box::new(o)),
12385 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12386 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12387 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12388 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12389 err: Box::into_raw(Box::new(e)),
12394 /// Checks if the given object is currently in the success state
12396 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12400 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12401 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12402 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12403 fn drop(&mut self) {
12404 if self.result_ok {
12405 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12406 let _ = unsafe { Box::from_raw(self.contents.result) };
12409 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12410 let _ = unsafe { Box::from_raw(self.contents.err) };
12415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12416 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12417 let contents = if o.result_ok {
12418 let result = unsafe { o.contents.result };
12419 unsafe { o.contents.result = core::ptr::null_mut() };
12420 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12422 let err = unsafe { o.contents.err };
12423 unsafe { o.contents.err = core::ptr::null_mut(); }
12424 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12428 result_ok: o.result_ok,
12432 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12433 fn clone(&self) -> Self {
12434 if self.result_ok {
12435 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12436 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12439 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12440 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12446 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12447 /// but with all dynamically-allocated buffers duplicated in new buffers.
12448 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12450 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12451 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12452 /// A pointer to the contents in the success state.
12453 /// Reading from this pointer when `result_ok` is not set is undefined.
12454 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12455 /// A pointer to the contents in the error state.
12456 /// Reading from this pointer when `result_ok` is set is undefined.
12457 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12460 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12461 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12463 pub struct CResult_CommitmentSignedDecodeErrorZ {
12464 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12465 /// `err` or `result` depending on the state of `result_ok`.
12466 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12467 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12468 pub result_ok: bool,
12471 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12472 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12473 CResult_CommitmentSignedDecodeErrorZ {
12474 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12475 result: Box::into_raw(Box::new(o)),
12481 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12482 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12483 CResult_CommitmentSignedDecodeErrorZ {
12484 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12485 err: Box::into_raw(Box::new(e)),
12490 /// Checks if the given object is currently in the success state
12492 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12496 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12497 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12498 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12499 fn drop(&mut self) {
12500 if self.result_ok {
12501 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12502 let _ = unsafe { Box::from_raw(self.contents.result) };
12505 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12506 let _ = unsafe { Box::from_raw(self.contents.err) };
12511 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12512 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12513 let contents = if o.result_ok {
12514 let result = unsafe { o.contents.result };
12515 unsafe { o.contents.result = core::ptr::null_mut() };
12516 CResult_CommitmentSignedDecodeErrorZPtr { result }
12518 let err = unsafe { o.contents.err };
12519 unsafe { o.contents.err = core::ptr::null_mut(); }
12520 CResult_CommitmentSignedDecodeErrorZPtr { err }
12524 result_ok: o.result_ok,
12528 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12529 fn clone(&self) -> Self {
12530 if self.result_ok {
12531 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12532 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12535 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12536 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12542 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12543 /// but with all dynamically-allocated buffers duplicated in new buffers.
12544 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12546 /// The contents of CResult_FundingCreatedDecodeErrorZ
12547 pub union CResult_FundingCreatedDecodeErrorZPtr {
12548 /// A pointer to the contents in the success state.
12549 /// Reading from this pointer when `result_ok` is not set is undefined.
12550 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12551 /// A pointer to the contents in the error state.
12552 /// Reading from this pointer when `result_ok` is set is undefined.
12553 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12556 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12557 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12559 pub struct CResult_FundingCreatedDecodeErrorZ {
12560 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12561 /// `err` or `result` depending on the state of `result_ok`.
12562 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12563 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12564 pub result_ok: bool,
12567 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12568 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12569 CResult_FundingCreatedDecodeErrorZ {
12570 contents: CResult_FundingCreatedDecodeErrorZPtr {
12571 result: Box::into_raw(Box::new(o)),
12577 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12578 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12579 CResult_FundingCreatedDecodeErrorZ {
12580 contents: CResult_FundingCreatedDecodeErrorZPtr {
12581 err: Box::into_raw(Box::new(e)),
12586 /// Checks if the given object is currently in the success state
12588 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12592 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12593 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12594 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12595 fn drop(&mut self) {
12596 if self.result_ok {
12597 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12598 let _ = unsafe { Box::from_raw(self.contents.result) };
12601 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12602 let _ = unsafe { Box::from_raw(self.contents.err) };
12607 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12608 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12609 let contents = if o.result_ok {
12610 let result = unsafe { o.contents.result };
12611 unsafe { o.contents.result = core::ptr::null_mut() };
12612 CResult_FundingCreatedDecodeErrorZPtr { result }
12614 let err = unsafe { o.contents.err };
12615 unsafe { o.contents.err = core::ptr::null_mut(); }
12616 CResult_FundingCreatedDecodeErrorZPtr { err }
12620 result_ok: o.result_ok,
12624 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12625 fn clone(&self) -> Self {
12626 if self.result_ok {
12627 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12628 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12631 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12632 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12638 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12639 /// but with all dynamically-allocated buffers duplicated in new buffers.
12640 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12642 /// The contents of CResult_FundingSignedDecodeErrorZ
12643 pub union CResult_FundingSignedDecodeErrorZPtr {
12644 /// A pointer to the contents in the success state.
12645 /// Reading from this pointer when `result_ok` is not set is undefined.
12646 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12647 /// A pointer to the contents in the error state.
12648 /// Reading from this pointer when `result_ok` is set is undefined.
12649 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12652 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12653 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12655 pub struct CResult_FundingSignedDecodeErrorZ {
12656 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12657 /// `err` or `result` depending on the state of `result_ok`.
12658 pub contents: CResult_FundingSignedDecodeErrorZPtr,
12659 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12660 pub result_ok: bool,
12663 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12664 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12665 CResult_FundingSignedDecodeErrorZ {
12666 contents: CResult_FundingSignedDecodeErrorZPtr {
12667 result: Box::into_raw(Box::new(o)),
12673 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12674 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12675 CResult_FundingSignedDecodeErrorZ {
12676 contents: CResult_FundingSignedDecodeErrorZPtr {
12677 err: Box::into_raw(Box::new(e)),
12682 /// Checks if the given object is currently in the success state
12684 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12688 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12689 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12690 impl Drop for CResult_FundingSignedDecodeErrorZ {
12691 fn drop(&mut self) {
12692 if self.result_ok {
12693 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12694 let _ = unsafe { Box::from_raw(self.contents.result) };
12697 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12698 let _ = unsafe { Box::from_raw(self.contents.err) };
12703 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12704 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12705 let contents = if o.result_ok {
12706 let result = unsafe { o.contents.result };
12707 unsafe { o.contents.result = core::ptr::null_mut() };
12708 CResult_FundingSignedDecodeErrorZPtr { result }
12710 let err = unsafe { o.contents.err };
12711 unsafe { o.contents.err = core::ptr::null_mut(); }
12712 CResult_FundingSignedDecodeErrorZPtr { err }
12716 result_ok: o.result_ok,
12720 impl Clone for CResult_FundingSignedDecodeErrorZ {
12721 fn clone(&self) -> Self {
12722 if self.result_ok {
12723 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12724 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12727 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12728 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12734 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12735 /// but with all dynamically-allocated buffers duplicated in new buffers.
12736 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12738 /// The contents of CResult_FundingLockedDecodeErrorZ
12739 pub union CResult_FundingLockedDecodeErrorZPtr {
12740 /// A pointer to the contents in the success state.
12741 /// Reading from this pointer when `result_ok` is not set is undefined.
12742 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12743 /// A pointer to the contents in the error state.
12744 /// Reading from this pointer when `result_ok` is set is undefined.
12745 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12748 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12749 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12751 pub struct CResult_FundingLockedDecodeErrorZ {
12752 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12753 /// `err` or `result` depending on the state of `result_ok`.
12754 pub contents: CResult_FundingLockedDecodeErrorZPtr,
12755 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12756 pub result_ok: bool,
12759 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12760 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12761 CResult_FundingLockedDecodeErrorZ {
12762 contents: CResult_FundingLockedDecodeErrorZPtr {
12763 result: Box::into_raw(Box::new(o)),
12769 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12770 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12771 CResult_FundingLockedDecodeErrorZ {
12772 contents: CResult_FundingLockedDecodeErrorZPtr {
12773 err: Box::into_raw(Box::new(e)),
12778 /// Checks if the given object is currently in the success state
12780 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12784 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12785 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12786 impl Drop for CResult_FundingLockedDecodeErrorZ {
12787 fn drop(&mut self) {
12788 if self.result_ok {
12789 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12790 let _ = unsafe { Box::from_raw(self.contents.result) };
12793 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12794 let _ = unsafe { Box::from_raw(self.contents.err) };
12799 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12800 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12801 let contents = if o.result_ok {
12802 let result = unsafe { o.contents.result };
12803 unsafe { o.contents.result = core::ptr::null_mut() };
12804 CResult_FundingLockedDecodeErrorZPtr { result }
12806 let err = unsafe { o.contents.err };
12807 unsafe { o.contents.err = core::ptr::null_mut(); }
12808 CResult_FundingLockedDecodeErrorZPtr { err }
12812 result_ok: o.result_ok,
12816 impl Clone for CResult_FundingLockedDecodeErrorZ {
12817 fn clone(&self) -> Self {
12818 if self.result_ok {
12819 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12820 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12823 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12824 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12830 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12831 /// but with all dynamically-allocated buffers duplicated in new buffers.
12832 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12834 /// The contents of CResult_InitDecodeErrorZ
12835 pub union CResult_InitDecodeErrorZPtr {
12836 /// A pointer to the contents in the success state.
12837 /// Reading from this pointer when `result_ok` is not set is undefined.
12838 pub result: *mut crate::lightning::ln::msgs::Init,
12839 /// A pointer to the contents in the error state.
12840 /// Reading from this pointer when `result_ok` is set is undefined.
12841 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12844 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12845 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12846 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12847 pub struct CResult_InitDecodeErrorZ {
12848 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12849 /// `err` or `result` depending on the state of `result_ok`.
12850 pub contents: CResult_InitDecodeErrorZPtr,
12851 /// Whether this CResult_InitDecodeErrorZ represents a success state.
12852 pub result_ok: bool,
12855 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12856 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12857 CResult_InitDecodeErrorZ {
12858 contents: CResult_InitDecodeErrorZPtr {
12859 result: Box::into_raw(Box::new(o)),
12865 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12866 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12867 CResult_InitDecodeErrorZ {
12868 contents: CResult_InitDecodeErrorZPtr {
12869 err: Box::into_raw(Box::new(e)),
12874 /// Checks if the given object is currently in the success state
12876 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12880 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12881 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12882 impl Drop for CResult_InitDecodeErrorZ {
12883 fn drop(&mut self) {
12884 if self.result_ok {
12885 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12886 let _ = unsafe { Box::from_raw(self.contents.result) };
12889 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12890 let _ = unsafe { Box::from_raw(self.contents.err) };
12895 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12896 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12897 let contents = if o.result_ok {
12898 let result = unsafe { o.contents.result };
12899 unsafe { o.contents.result = core::ptr::null_mut() };
12900 CResult_InitDecodeErrorZPtr { result }
12902 let err = unsafe { o.contents.err };
12903 unsafe { o.contents.err = core::ptr::null_mut(); }
12904 CResult_InitDecodeErrorZPtr { err }
12908 result_ok: o.result_ok,
12912 impl Clone for CResult_InitDecodeErrorZ {
12913 fn clone(&self) -> Self {
12914 if self.result_ok {
12915 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12916 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12919 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12920 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12926 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12927 /// but with all dynamically-allocated buffers duplicated in new buffers.
12928 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12930 /// The contents of CResult_OpenChannelDecodeErrorZ
12931 pub union CResult_OpenChannelDecodeErrorZPtr {
12932 /// A pointer to the contents in the success state.
12933 /// Reading from this pointer when `result_ok` is not set is undefined.
12934 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12935 /// A pointer to the contents in the error state.
12936 /// Reading from this pointer when `result_ok` is set is undefined.
12937 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12940 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12941 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12942 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12943 pub struct CResult_OpenChannelDecodeErrorZ {
12944 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12945 /// `err` or `result` depending on the state of `result_ok`.
12946 pub contents: CResult_OpenChannelDecodeErrorZPtr,
12947 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12948 pub result_ok: bool,
12951 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12952 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12953 CResult_OpenChannelDecodeErrorZ {
12954 contents: CResult_OpenChannelDecodeErrorZPtr {
12955 result: Box::into_raw(Box::new(o)),
12961 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12962 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12963 CResult_OpenChannelDecodeErrorZ {
12964 contents: CResult_OpenChannelDecodeErrorZPtr {
12965 err: Box::into_raw(Box::new(e)),
12970 /// Checks if the given object is currently in the success state
12972 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12976 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12977 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12978 impl Drop for CResult_OpenChannelDecodeErrorZ {
12979 fn drop(&mut self) {
12980 if self.result_ok {
12981 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12982 let _ = unsafe { Box::from_raw(self.contents.result) };
12985 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12986 let _ = unsafe { Box::from_raw(self.contents.err) };
12991 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
12992 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12993 let contents = if o.result_ok {
12994 let result = unsafe { o.contents.result };
12995 unsafe { o.contents.result = core::ptr::null_mut() };
12996 CResult_OpenChannelDecodeErrorZPtr { result }
12998 let err = unsafe { o.contents.err };
12999 unsafe { o.contents.err = core::ptr::null_mut(); }
13000 CResult_OpenChannelDecodeErrorZPtr { err }
13004 result_ok: o.result_ok,
13008 impl Clone for CResult_OpenChannelDecodeErrorZ {
13009 fn clone(&self) -> Self {
13010 if self.result_ok {
13011 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13012 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13015 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13016 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13022 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13023 /// but with all dynamically-allocated buffers duplicated in new buffers.
13024 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13026 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13027 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13028 /// A pointer to the contents in the success state.
13029 /// Reading from this pointer when `result_ok` is not set is undefined.
13030 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13031 /// A pointer to the contents in the error state.
13032 /// Reading from this pointer when `result_ok` is set is undefined.
13033 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13036 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13037 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13038 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13039 pub struct CResult_RevokeAndACKDecodeErrorZ {
13040 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13041 /// `err` or `result` depending on the state of `result_ok`.
13042 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13043 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13044 pub result_ok: bool,
13047 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13048 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13049 CResult_RevokeAndACKDecodeErrorZ {
13050 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13051 result: Box::into_raw(Box::new(o)),
13057 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13058 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13059 CResult_RevokeAndACKDecodeErrorZ {
13060 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13061 err: Box::into_raw(Box::new(e)),
13066 /// Checks if the given object is currently in the success state
13068 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13072 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13073 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13074 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13075 fn drop(&mut self) {
13076 if self.result_ok {
13077 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13078 let _ = unsafe { Box::from_raw(self.contents.result) };
13081 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13082 let _ = unsafe { Box::from_raw(self.contents.err) };
13087 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13088 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13089 let contents = if o.result_ok {
13090 let result = unsafe { o.contents.result };
13091 unsafe { o.contents.result = core::ptr::null_mut() };
13092 CResult_RevokeAndACKDecodeErrorZPtr { result }
13094 let err = unsafe { o.contents.err };
13095 unsafe { o.contents.err = core::ptr::null_mut(); }
13096 CResult_RevokeAndACKDecodeErrorZPtr { err }
13100 result_ok: o.result_ok,
13104 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13105 fn clone(&self) -> Self {
13106 if self.result_ok {
13107 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13108 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13111 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13112 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13118 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13119 /// but with all dynamically-allocated buffers duplicated in new buffers.
13120 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13122 /// The contents of CResult_ShutdownDecodeErrorZ
13123 pub union CResult_ShutdownDecodeErrorZPtr {
13124 /// A pointer to the contents in the success state.
13125 /// Reading from this pointer when `result_ok` is not set is undefined.
13126 pub result: *mut crate::lightning::ln::msgs::Shutdown,
13127 /// A pointer to the contents in the error state.
13128 /// Reading from this pointer when `result_ok` is set is undefined.
13129 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13132 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13133 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13135 pub struct CResult_ShutdownDecodeErrorZ {
13136 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13137 /// `err` or `result` depending on the state of `result_ok`.
13138 pub contents: CResult_ShutdownDecodeErrorZPtr,
13139 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13140 pub result_ok: bool,
13143 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13144 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13145 CResult_ShutdownDecodeErrorZ {
13146 contents: CResult_ShutdownDecodeErrorZPtr {
13147 result: Box::into_raw(Box::new(o)),
13153 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13154 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13155 CResult_ShutdownDecodeErrorZ {
13156 contents: CResult_ShutdownDecodeErrorZPtr {
13157 err: Box::into_raw(Box::new(e)),
13162 /// Checks if the given object is currently in the success state
13164 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13168 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13169 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13170 impl Drop for CResult_ShutdownDecodeErrorZ {
13171 fn drop(&mut self) {
13172 if self.result_ok {
13173 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13174 let _ = unsafe { Box::from_raw(self.contents.result) };
13177 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13178 let _ = unsafe { Box::from_raw(self.contents.err) };
13183 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13184 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13185 let contents = if o.result_ok {
13186 let result = unsafe { o.contents.result };
13187 unsafe { o.contents.result = core::ptr::null_mut() };
13188 CResult_ShutdownDecodeErrorZPtr { result }
13190 let err = unsafe { o.contents.err };
13191 unsafe { o.contents.err = core::ptr::null_mut(); }
13192 CResult_ShutdownDecodeErrorZPtr { err }
13196 result_ok: o.result_ok,
13200 impl Clone for CResult_ShutdownDecodeErrorZ {
13201 fn clone(&self) -> Self {
13202 if self.result_ok {
13203 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13204 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13207 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13208 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13214 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13215 /// but with all dynamically-allocated buffers duplicated in new buffers.
13216 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13218 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13219 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13220 /// A pointer to the contents in the success state.
13221 /// Reading from this pointer when `result_ok` is not set is undefined.
13222 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13223 /// A pointer to the contents in the error state.
13224 /// Reading from this pointer when `result_ok` is set is undefined.
13225 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13228 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13229 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13231 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13232 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13233 /// `err` or `result` depending on the state of `result_ok`.
13234 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13235 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13236 pub result_ok: bool,
13239 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13240 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13241 CResult_UpdateFailHTLCDecodeErrorZ {
13242 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13243 result: Box::into_raw(Box::new(o)),
13249 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13250 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13251 CResult_UpdateFailHTLCDecodeErrorZ {
13252 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13253 err: Box::into_raw(Box::new(e)),
13258 /// Checks if the given object is currently in the success state
13260 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13264 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13265 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13266 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13267 fn drop(&mut self) {
13268 if self.result_ok {
13269 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13270 let _ = unsafe { Box::from_raw(self.contents.result) };
13273 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13274 let _ = unsafe { Box::from_raw(self.contents.err) };
13279 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13280 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13281 let contents = if o.result_ok {
13282 let result = unsafe { o.contents.result };
13283 unsafe { o.contents.result = core::ptr::null_mut() };
13284 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13286 let err = unsafe { o.contents.err };
13287 unsafe { o.contents.err = core::ptr::null_mut(); }
13288 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13292 result_ok: o.result_ok,
13296 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13297 fn clone(&self) -> Self {
13298 if self.result_ok {
13299 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13300 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13303 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13304 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13310 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13311 /// but with all dynamically-allocated buffers duplicated in new buffers.
13312 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13314 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13315 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13316 /// A pointer to the contents in the success state.
13317 /// Reading from this pointer when `result_ok` is not set is undefined.
13318 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13319 /// A pointer to the contents in the error state.
13320 /// Reading from this pointer when `result_ok` is set is undefined.
13321 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13324 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13325 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13327 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13328 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13329 /// `err` or `result` depending on the state of `result_ok`.
13330 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13331 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13332 pub result_ok: bool,
13335 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13336 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13337 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13338 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13339 result: Box::into_raw(Box::new(o)),
13345 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13346 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13347 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13348 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13349 err: Box::into_raw(Box::new(e)),
13354 /// Checks if the given object is currently in the success state
13356 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13360 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13361 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13362 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13363 fn drop(&mut self) {
13364 if self.result_ok {
13365 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13366 let _ = unsafe { Box::from_raw(self.contents.result) };
13369 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13370 let _ = unsafe { Box::from_raw(self.contents.err) };
13375 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13376 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13377 let contents = if o.result_ok {
13378 let result = unsafe { o.contents.result };
13379 unsafe { o.contents.result = core::ptr::null_mut() };
13380 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13382 let err = unsafe { o.contents.err };
13383 unsafe { o.contents.err = core::ptr::null_mut(); }
13384 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13388 result_ok: o.result_ok,
13392 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13393 fn clone(&self) -> Self {
13394 if self.result_ok {
13395 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13396 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13399 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13400 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13406 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13407 /// but with all dynamically-allocated buffers duplicated in new buffers.
13408 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13410 /// The contents of CResult_UpdateFeeDecodeErrorZ
13411 pub union CResult_UpdateFeeDecodeErrorZPtr {
13412 /// A pointer to the contents in the success state.
13413 /// Reading from this pointer when `result_ok` is not set is undefined.
13414 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13415 /// A pointer to the contents in the error state.
13416 /// Reading from this pointer when `result_ok` is set is undefined.
13417 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13420 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13421 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13423 pub struct CResult_UpdateFeeDecodeErrorZ {
13424 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13425 /// `err` or `result` depending on the state of `result_ok`.
13426 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13427 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13428 pub result_ok: bool,
13431 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13432 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13433 CResult_UpdateFeeDecodeErrorZ {
13434 contents: CResult_UpdateFeeDecodeErrorZPtr {
13435 result: Box::into_raw(Box::new(o)),
13441 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13442 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13443 CResult_UpdateFeeDecodeErrorZ {
13444 contents: CResult_UpdateFeeDecodeErrorZPtr {
13445 err: Box::into_raw(Box::new(e)),
13450 /// Checks if the given object is currently in the success state
13452 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13456 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13457 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13458 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13459 fn drop(&mut self) {
13460 if self.result_ok {
13461 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13462 let _ = unsafe { Box::from_raw(self.contents.result) };
13465 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13466 let _ = unsafe { Box::from_raw(self.contents.err) };
13471 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13472 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13473 let contents = if o.result_ok {
13474 let result = unsafe { o.contents.result };
13475 unsafe { o.contents.result = core::ptr::null_mut() };
13476 CResult_UpdateFeeDecodeErrorZPtr { result }
13478 let err = unsafe { o.contents.err };
13479 unsafe { o.contents.err = core::ptr::null_mut(); }
13480 CResult_UpdateFeeDecodeErrorZPtr { err }
13484 result_ok: o.result_ok,
13488 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13489 fn clone(&self) -> Self {
13490 if self.result_ok {
13491 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13492 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13495 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13496 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13502 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13503 /// but with all dynamically-allocated buffers duplicated in new buffers.
13504 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13506 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13507 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13508 /// A pointer to the contents in the success state.
13509 /// Reading from this pointer when `result_ok` is not set is undefined.
13510 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13511 /// A pointer to the contents in the error state.
13512 /// Reading from this pointer when `result_ok` is set is undefined.
13513 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13516 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13517 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13518 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13519 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13520 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13521 /// `err` or `result` depending on the state of `result_ok`.
13522 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13523 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13524 pub result_ok: bool,
13527 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13528 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13529 CResult_UpdateFulfillHTLCDecodeErrorZ {
13530 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13531 result: Box::into_raw(Box::new(o)),
13537 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13538 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13539 CResult_UpdateFulfillHTLCDecodeErrorZ {
13540 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13541 err: Box::into_raw(Box::new(e)),
13546 /// Checks if the given object is currently in the success state
13548 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13552 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13553 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13554 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13555 fn drop(&mut self) {
13556 if self.result_ok {
13557 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13558 let _ = unsafe { Box::from_raw(self.contents.result) };
13561 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13562 let _ = unsafe { Box::from_raw(self.contents.err) };
13567 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13568 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13569 let contents = if o.result_ok {
13570 let result = unsafe { o.contents.result };
13571 unsafe { o.contents.result = core::ptr::null_mut() };
13572 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13574 let err = unsafe { o.contents.err };
13575 unsafe { o.contents.err = core::ptr::null_mut(); }
13576 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13580 result_ok: o.result_ok,
13584 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13585 fn clone(&self) -> Self {
13586 if self.result_ok {
13587 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13588 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13591 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13592 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13598 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13599 /// but with all dynamically-allocated buffers duplicated in new buffers.
13600 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13602 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13603 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13604 /// A pointer to the contents in the success state.
13605 /// Reading from this pointer when `result_ok` is not set is undefined.
13606 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13607 /// A pointer to the contents in the error state.
13608 /// Reading from this pointer when `result_ok` is set is undefined.
13609 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13612 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13613 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13614 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13615 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13616 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13617 /// `err` or `result` depending on the state of `result_ok`.
13618 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13619 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13620 pub result_ok: bool,
13623 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13624 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13625 CResult_UpdateAddHTLCDecodeErrorZ {
13626 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13627 result: Box::into_raw(Box::new(o)),
13633 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13634 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13635 CResult_UpdateAddHTLCDecodeErrorZ {
13636 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13637 err: Box::into_raw(Box::new(e)),
13642 /// Checks if the given object is currently in the success state
13644 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13648 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13649 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13650 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13651 fn drop(&mut self) {
13652 if self.result_ok {
13653 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13654 let _ = unsafe { Box::from_raw(self.contents.result) };
13657 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13658 let _ = unsafe { Box::from_raw(self.contents.err) };
13663 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13664 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13665 let contents = if o.result_ok {
13666 let result = unsafe { o.contents.result };
13667 unsafe { o.contents.result = core::ptr::null_mut() };
13668 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13670 let err = unsafe { o.contents.err };
13671 unsafe { o.contents.err = core::ptr::null_mut(); }
13672 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13676 result_ok: o.result_ok,
13680 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13681 fn clone(&self) -> Self {
13682 if self.result_ok {
13683 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13684 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13687 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13688 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13694 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13695 /// but with all dynamically-allocated buffers duplicated in new buffers.
13696 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13698 /// The contents of CResult_PingDecodeErrorZ
13699 pub union CResult_PingDecodeErrorZPtr {
13700 /// A pointer to the contents in the success state.
13701 /// Reading from this pointer when `result_ok` is not set is undefined.
13702 pub result: *mut crate::lightning::ln::msgs::Ping,
13703 /// A pointer to the contents in the error state.
13704 /// Reading from this pointer when `result_ok` is set is undefined.
13705 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13708 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13709 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13711 pub struct CResult_PingDecodeErrorZ {
13712 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13713 /// `err` or `result` depending on the state of `result_ok`.
13714 pub contents: CResult_PingDecodeErrorZPtr,
13715 /// Whether this CResult_PingDecodeErrorZ represents a success state.
13716 pub result_ok: bool,
13719 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13720 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13721 CResult_PingDecodeErrorZ {
13722 contents: CResult_PingDecodeErrorZPtr {
13723 result: Box::into_raw(Box::new(o)),
13729 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13730 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13731 CResult_PingDecodeErrorZ {
13732 contents: CResult_PingDecodeErrorZPtr {
13733 err: Box::into_raw(Box::new(e)),
13738 /// Checks if the given object is currently in the success state
13740 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13744 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13745 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13746 impl Drop for CResult_PingDecodeErrorZ {
13747 fn drop(&mut self) {
13748 if self.result_ok {
13749 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13750 let _ = unsafe { Box::from_raw(self.contents.result) };
13753 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13754 let _ = unsafe { Box::from_raw(self.contents.err) };
13759 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13760 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13761 let contents = if o.result_ok {
13762 let result = unsafe { o.contents.result };
13763 unsafe { o.contents.result = core::ptr::null_mut() };
13764 CResult_PingDecodeErrorZPtr { result }
13766 let err = unsafe { o.contents.err };
13767 unsafe { o.contents.err = core::ptr::null_mut(); }
13768 CResult_PingDecodeErrorZPtr { err }
13772 result_ok: o.result_ok,
13776 impl Clone for CResult_PingDecodeErrorZ {
13777 fn clone(&self) -> Self {
13778 if self.result_ok {
13779 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13780 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13783 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13784 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13790 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13791 /// but with all dynamically-allocated buffers duplicated in new buffers.
13792 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13794 /// The contents of CResult_PongDecodeErrorZ
13795 pub union CResult_PongDecodeErrorZPtr {
13796 /// A pointer to the contents in the success state.
13797 /// Reading from this pointer when `result_ok` is not set is undefined.
13798 pub result: *mut crate::lightning::ln::msgs::Pong,
13799 /// A pointer to the contents in the error state.
13800 /// Reading from this pointer when `result_ok` is set is undefined.
13801 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13804 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13805 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13807 pub struct CResult_PongDecodeErrorZ {
13808 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13809 /// `err` or `result` depending on the state of `result_ok`.
13810 pub contents: CResult_PongDecodeErrorZPtr,
13811 /// Whether this CResult_PongDecodeErrorZ represents a success state.
13812 pub result_ok: bool,
13815 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13816 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13817 CResult_PongDecodeErrorZ {
13818 contents: CResult_PongDecodeErrorZPtr {
13819 result: Box::into_raw(Box::new(o)),
13825 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13826 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13827 CResult_PongDecodeErrorZ {
13828 contents: CResult_PongDecodeErrorZPtr {
13829 err: Box::into_raw(Box::new(e)),
13834 /// Checks if the given object is currently in the success state
13836 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13840 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13841 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13842 impl Drop for CResult_PongDecodeErrorZ {
13843 fn drop(&mut self) {
13844 if self.result_ok {
13845 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13846 let _ = unsafe { Box::from_raw(self.contents.result) };
13849 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13850 let _ = unsafe { Box::from_raw(self.contents.err) };
13855 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13856 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13857 let contents = if o.result_ok {
13858 let result = unsafe { o.contents.result };
13859 unsafe { o.contents.result = core::ptr::null_mut() };
13860 CResult_PongDecodeErrorZPtr { result }
13862 let err = unsafe { o.contents.err };
13863 unsafe { o.contents.err = core::ptr::null_mut(); }
13864 CResult_PongDecodeErrorZPtr { err }
13868 result_ok: o.result_ok,
13872 impl Clone for CResult_PongDecodeErrorZ {
13873 fn clone(&self) -> Self {
13874 if self.result_ok {
13875 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13876 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13879 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13880 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13886 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13887 /// but with all dynamically-allocated buffers duplicated in new buffers.
13888 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13890 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13891 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13892 /// A pointer to the contents in the success state.
13893 /// Reading from this pointer when `result_ok` is not set is undefined.
13894 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13895 /// A pointer to the contents in the error state.
13896 /// Reading from this pointer when `result_ok` is set is undefined.
13897 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13900 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13901 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13903 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13904 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13905 /// `err` or `result` depending on the state of `result_ok`.
13906 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13907 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13908 pub result_ok: bool,
13911 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13912 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13913 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13914 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13915 result: Box::into_raw(Box::new(o)),
13921 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13922 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13923 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13924 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13925 err: Box::into_raw(Box::new(e)),
13930 /// Checks if the given object is currently in the success state
13932 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13936 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13937 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13938 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13939 fn drop(&mut self) {
13940 if self.result_ok {
13941 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13942 let _ = unsafe { Box::from_raw(self.contents.result) };
13945 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13946 let _ = unsafe { Box::from_raw(self.contents.err) };
13951 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13952 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13953 let contents = if o.result_ok {
13954 let result = unsafe { o.contents.result };
13955 unsafe { o.contents.result = core::ptr::null_mut() };
13956 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13958 let err = unsafe { o.contents.err };
13959 unsafe { o.contents.err = core::ptr::null_mut(); }
13960 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13964 result_ok: o.result_ok,
13968 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13969 fn clone(&self) -> Self {
13970 if self.result_ok {
13971 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13972 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13975 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13976 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13982 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13983 /// but with all dynamically-allocated buffers duplicated in new buffers.
13984 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13986 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13987 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
13988 /// A pointer to the contents in the success state.
13989 /// Reading from this pointer when `result_ok` is not set is undefined.
13990 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
13991 /// A pointer to the contents in the error state.
13992 /// Reading from this pointer when `result_ok` is set is undefined.
13993 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13996 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13997 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13999 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14000 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14001 /// `err` or `result` depending on the state of `result_ok`.
14002 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14003 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14004 pub result_ok: bool,
14007 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14008 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14009 CResult_ChannelAnnouncementDecodeErrorZ {
14010 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14011 result: Box::into_raw(Box::new(o)),
14017 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14018 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14019 CResult_ChannelAnnouncementDecodeErrorZ {
14020 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14021 err: Box::into_raw(Box::new(e)),
14026 /// Checks if the given object is currently in the success state
14028 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14032 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14033 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14034 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14035 fn drop(&mut self) {
14036 if self.result_ok {
14037 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14038 let _ = unsafe { Box::from_raw(self.contents.result) };
14041 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14042 let _ = unsafe { Box::from_raw(self.contents.err) };
14047 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14048 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14049 let contents = if o.result_ok {
14050 let result = unsafe { o.contents.result };
14051 unsafe { o.contents.result = core::ptr::null_mut() };
14052 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14054 let err = unsafe { o.contents.err };
14055 unsafe { o.contents.err = core::ptr::null_mut(); }
14056 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14060 result_ok: o.result_ok,
14064 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14065 fn clone(&self) -> Self {
14066 if self.result_ok {
14067 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14068 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14071 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14072 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14078 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14079 /// but with all dynamically-allocated buffers duplicated in new buffers.
14080 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14082 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14083 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14084 /// A pointer to the contents in the success state.
14085 /// Reading from this pointer when `result_ok` is not set is undefined.
14086 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14087 /// A pointer to the contents in the error state.
14088 /// Reading from this pointer when `result_ok` is set is undefined.
14089 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14092 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14093 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14095 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14096 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14097 /// `err` or `result` depending on the state of `result_ok`.
14098 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14099 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14100 pub result_ok: bool,
14103 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14104 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14105 CResult_UnsignedChannelUpdateDecodeErrorZ {
14106 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14107 result: Box::into_raw(Box::new(o)),
14113 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14114 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14115 CResult_UnsignedChannelUpdateDecodeErrorZ {
14116 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14117 err: Box::into_raw(Box::new(e)),
14122 /// Checks if the given object is currently in the success state
14124 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14128 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14129 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14130 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14131 fn drop(&mut self) {
14132 if self.result_ok {
14133 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14134 let _ = unsafe { Box::from_raw(self.contents.result) };
14137 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14138 let _ = unsafe { Box::from_raw(self.contents.err) };
14143 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14144 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14145 let contents = if o.result_ok {
14146 let result = unsafe { o.contents.result };
14147 unsafe { o.contents.result = core::ptr::null_mut() };
14148 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14150 let err = unsafe { o.contents.err };
14151 unsafe { o.contents.err = core::ptr::null_mut(); }
14152 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14156 result_ok: o.result_ok,
14160 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14161 fn clone(&self) -> Self {
14162 if self.result_ok {
14163 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14164 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14167 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14168 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14174 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14175 /// but with all dynamically-allocated buffers duplicated in new buffers.
14176 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14178 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14179 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14180 /// A pointer to the contents in the success state.
14181 /// Reading from this pointer when `result_ok` is not set is undefined.
14182 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14183 /// A pointer to the contents in the error state.
14184 /// Reading from this pointer when `result_ok` is set is undefined.
14185 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14188 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14189 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14191 pub struct CResult_ChannelUpdateDecodeErrorZ {
14192 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14193 /// `err` or `result` depending on the state of `result_ok`.
14194 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14195 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14196 pub result_ok: bool,
14199 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14200 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14201 CResult_ChannelUpdateDecodeErrorZ {
14202 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14203 result: Box::into_raw(Box::new(o)),
14209 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14210 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14211 CResult_ChannelUpdateDecodeErrorZ {
14212 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14213 err: Box::into_raw(Box::new(e)),
14218 /// Checks if the given object is currently in the success state
14220 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14224 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14225 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14226 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14227 fn drop(&mut self) {
14228 if self.result_ok {
14229 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14230 let _ = unsafe { Box::from_raw(self.contents.result) };
14233 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14234 let _ = unsafe { Box::from_raw(self.contents.err) };
14239 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14240 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14241 let contents = if o.result_ok {
14242 let result = unsafe { o.contents.result };
14243 unsafe { o.contents.result = core::ptr::null_mut() };
14244 CResult_ChannelUpdateDecodeErrorZPtr { result }
14246 let err = unsafe { o.contents.err };
14247 unsafe { o.contents.err = core::ptr::null_mut(); }
14248 CResult_ChannelUpdateDecodeErrorZPtr { err }
14252 result_ok: o.result_ok,
14256 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14257 fn clone(&self) -> Self {
14258 if self.result_ok {
14259 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14260 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14263 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14264 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14270 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14271 /// but with all dynamically-allocated buffers duplicated in new buffers.
14272 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14274 /// The contents of CResult_ErrorMessageDecodeErrorZ
14275 pub union CResult_ErrorMessageDecodeErrorZPtr {
14276 /// A pointer to the contents in the success state.
14277 /// Reading from this pointer when `result_ok` is not set is undefined.
14278 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14279 /// A pointer to the contents in the error state.
14280 /// Reading from this pointer when `result_ok` is set is undefined.
14281 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14284 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14285 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14287 pub struct CResult_ErrorMessageDecodeErrorZ {
14288 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14289 /// `err` or `result` depending on the state of `result_ok`.
14290 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14291 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14292 pub result_ok: bool,
14295 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14296 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14297 CResult_ErrorMessageDecodeErrorZ {
14298 contents: CResult_ErrorMessageDecodeErrorZPtr {
14299 result: Box::into_raw(Box::new(o)),
14305 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14306 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14307 CResult_ErrorMessageDecodeErrorZ {
14308 contents: CResult_ErrorMessageDecodeErrorZPtr {
14309 err: Box::into_raw(Box::new(e)),
14314 /// Checks if the given object is currently in the success state
14316 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14320 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14321 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14322 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14323 fn drop(&mut self) {
14324 if self.result_ok {
14325 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14326 let _ = unsafe { Box::from_raw(self.contents.result) };
14329 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14330 let _ = unsafe { Box::from_raw(self.contents.err) };
14335 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14336 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14337 let contents = if o.result_ok {
14338 let result = unsafe { o.contents.result };
14339 unsafe { o.contents.result = core::ptr::null_mut() };
14340 CResult_ErrorMessageDecodeErrorZPtr { result }
14342 let err = unsafe { o.contents.err };
14343 unsafe { o.contents.err = core::ptr::null_mut(); }
14344 CResult_ErrorMessageDecodeErrorZPtr { err }
14348 result_ok: o.result_ok,
14352 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14353 fn clone(&self) -> Self {
14354 if self.result_ok {
14355 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14356 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14359 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14360 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14366 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14367 /// but with all dynamically-allocated buffers duplicated in new buffers.
14368 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14370 /// The contents of CResult_WarningMessageDecodeErrorZ
14371 pub union CResult_WarningMessageDecodeErrorZPtr {
14372 /// A pointer to the contents in the success state.
14373 /// Reading from this pointer when `result_ok` is not set is undefined.
14374 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14375 /// A pointer to the contents in the error state.
14376 /// Reading from this pointer when `result_ok` is set is undefined.
14377 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14380 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14381 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14383 pub struct CResult_WarningMessageDecodeErrorZ {
14384 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14385 /// `err` or `result` depending on the state of `result_ok`.
14386 pub contents: CResult_WarningMessageDecodeErrorZPtr,
14387 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14388 pub result_ok: bool,
14391 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14392 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14393 CResult_WarningMessageDecodeErrorZ {
14394 contents: CResult_WarningMessageDecodeErrorZPtr {
14395 result: Box::into_raw(Box::new(o)),
14401 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14402 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14403 CResult_WarningMessageDecodeErrorZ {
14404 contents: CResult_WarningMessageDecodeErrorZPtr {
14405 err: Box::into_raw(Box::new(e)),
14410 /// Checks if the given object is currently in the success state
14412 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14416 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14417 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14418 impl Drop for CResult_WarningMessageDecodeErrorZ {
14419 fn drop(&mut self) {
14420 if self.result_ok {
14421 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14422 let _ = unsafe { Box::from_raw(self.contents.result) };
14425 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14426 let _ = unsafe { Box::from_raw(self.contents.err) };
14431 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14432 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14433 let contents = if o.result_ok {
14434 let result = unsafe { o.contents.result };
14435 unsafe { o.contents.result = core::ptr::null_mut() };
14436 CResult_WarningMessageDecodeErrorZPtr { result }
14438 let err = unsafe { o.contents.err };
14439 unsafe { o.contents.err = core::ptr::null_mut(); }
14440 CResult_WarningMessageDecodeErrorZPtr { err }
14444 result_ok: o.result_ok,
14448 impl Clone for CResult_WarningMessageDecodeErrorZ {
14449 fn clone(&self) -> Self {
14450 if self.result_ok {
14451 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14452 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14455 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14456 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14462 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14463 /// but with all dynamically-allocated buffers duplicated in new buffers.
14464 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14466 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14467 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14468 /// A pointer to the contents in the success state.
14469 /// Reading from this pointer when `result_ok` is not set is undefined.
14470 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14471 /// A pointer to the contents in the error state.
14472 /// Reading from this pointer when `result_ok` is set is undefined.
14473 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14476 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14477 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14478 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14479 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14480 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14481 /// `err` or `result` depending on the state of `result_ok`.
14482 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14483 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14484 pub result_ok: bool,
14487 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14488 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14489 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14490 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14491 result: Box::into_raw(Box::new(o)),
14497 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14498 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14499 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14500 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14501 err: Box::into_raw(Box::new(e)),
14506 /// Checks if the given object is currently in the success state
14508 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14512 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14513 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14514 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14515 fn drop(&mut self) {
14516 if self.result_ok {
14517 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14518 let _ = unsafe { Box::from_raw(self.contents.result) };
14521 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14522 let _ = unsafe { Box::from_raw(self.contents.err) };
14527 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14528 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14529 let contents = if o.result_ok {
14530 let result = unsafe { o.contents.result };
14531 unsafe { o.contents.result = core::ptr::null_mut() };
14532 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14534 let err = unsafe { o.contents.err };
14535 unsafe { o.contents.err = core::ptr::null_mut(); }
14536 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14540 result_ok: o.result_ok,
14544 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14545 fn clone(&self) -> Self {
14546 if self.result_ok {
14547 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14548 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14551 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14552 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14558 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14559 /// but with all dynamically-allocated buffers duplicated in new buffers.
14560 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14562 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14563 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14564 /// A pointer to the contents in the success state.
14565 /// Reading from this pointer when `result_ok` is not set is undefined.
14566 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14567 /// A pointer to the contents in the error state.
14568 /// Reading from this pointer when `result_ok` is set is undefined.
14569 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14572 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14573 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14575 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14576 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14577 /// `err` or `result` depending on the state of `result_ok`.
14578 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14579 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14580 pub result_ok: bool,
14583 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14584 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14585 CResult_NodeAnnouncementDecodeErrorZ {
14586 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14587 result: Box::into_raw(Box::new(o)),
14593 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14594 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14595 CResult_NodeAnnouncementDecodeErrorZ {
14596 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14597 err: Box::into_raw(Box::new(e)),
14602 /// Checks if the given object is currently in the success state
14604 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14608 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14609 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14610 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14611 fn drop(&mut self) {
14612 if self.result_ok {
14613 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14614 let _ = unsafe { Box::from_raw(self.contents.result) };
14617 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14618 let _ = unsafe { Box::from_raw(self.contents.err) };
14623 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14624 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14625 let contents = if o.result_ok {
14626 let result = unsafe { o.contents.result };
14627 unsafe { o.contents.result = core::ptr::null_mut() };
14628 CResult_NodeAnnouncementDecodeErrorZPtr { result }
14630 let err = unsafe { o.contents.err };
14631 unsafe { o.contents.err = core::ptr::null_mut(); }
14632 CResult_NodeAnnouncementDecodeErrorZPtr { err }
14636 result_ok: o.result_ok,
14640 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14641 fn clone(&self) -> Self {
14642 if self.result_ok {
14643 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14644 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14647 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14648 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14654 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14655 /// but with all dynamically-allocated buffers duplicated in new buffers.
14656 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14658 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14659 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14660 /// A pointer to the contents in the success state.
14661 /// Reading from this pointer when `result_ok` is not set is undefined.
14662 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14663 /// A pointer to the contents in the error state.
14664 /// Reading from this pointer when `result_ok` is set is undefined.
14665 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14668 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14669 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14670 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14671 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14672 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14673 /// `err` or `result` depending on the state of `result_ok`.
14674 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14675 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14676 pub result_ok: bool,
14679 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14680 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14681 CResult_QueryShortChannelIdsDecodeErrorZ {
14682 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14683 result: Box::into_raw(Box::new(o)),
14689 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14690 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14691 CResult_QueryShortChannelIdsDecodeErrorZ {
14692 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14693 err: Box::into_raw(Box::new(e)),
14698 /// Checks if the given object is currently in the success state
14700 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14704 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14705 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14706 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14707 fn drop(&mut self) {
14708 if self.result_ok {
14709 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14710 let _ = unsafe { Box::from_raw(self.contents.result) };
14713 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14714 let _ = unsafe { Box::from_raw(self.contents.err) };
14719 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14720 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14721 let contents = if o.result_ok {
14722 let result = unsafe { o.contents.result };
14723 unsafe { o.contents.result = core::ptr::null_mut() };
14724 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14726 let err = unsafe { o.contents.err };
14727 unsafe { o.contents.err = core::ptr::null_mut(); }
14728 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14732 result_ok: o.result_ok,
14736 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14737 fn clone(&self) -> Self {
14738 if self.result_ok {
14739 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14740 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14743 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14744 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14750 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14751 /// but with all dynamically-allocated buffers duplicated in new buffers.
14752 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14754 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14755 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14756 /// A pointer to the contents in the success state.
14757 /// Reading from this pointer when `result_ok` is not set is undefined.
14758 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14759 /// A pointer to the contents in the error state.
14760 /// Reading from this pointer when `result_ok` is set is undefined.
14761 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14764 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14765 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14766 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14767 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14768 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14769 /// `err` or `result` depending on the state of `result_ok`.
14770 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14771 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14772 pub result_ok: bool,
14775 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14776 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14777 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14778 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14779 result: Box::into_raw(Box::new(o)),
14785 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14786 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14787 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14788 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14789 err: Box::into_raw(Box::new(e)),
14794 /// Checks if the given object is currently in the success state
14796 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14800 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14801 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14802 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14803 fn drop(&mut self) {
14804 if self.result_ok {
14805 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14806 let _ = unsafe { Box::from_raw(self.contents.result) };
14809 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14810 let _ = unsafe { Box::from_raw(self.contents.err) };
14815 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14816 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14817 let contents = if o.result_ok {
14818 let result = unsafe { o.contents.result };
14819 unsafe { o.contents.result = core::ptr::null_mut() };
14820 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14822 let err = unsafe { o.contents.err };
14823 unsafe { o.contents.err = core::ptr::null_mut(); }
14824 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14828 result_ok: o.result_ok,
14832 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14833 fn clone(&self) -> Self {
14834 if self.result_ok {
14835 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14836 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14839 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14840 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14846 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14847 /// but with all dynamically-allocated buffers duplicated in new buffers.
14848 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14850 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14851 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14852 /// A pointer to the contents in the success state.
14853 /// Reading from this pointer when `result_ok` is not set is undefined.
14854 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14855 /// A pointer to the contents in the error state.
14856 /// Reading from this pointer when `result_ok` is set is undefined.
14857 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14860 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14861 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14862 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14863 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14864 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14865 /// `err` or `result` depending on the state of `result_ok`.
14866 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14867 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14868 pub result_ok: bool,
14871 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14872 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14873 CResult_QueryChannelRangeDecodeErrorZ {
14874 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14875 result: Box::into_raw(Box::new(o)),
14881 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14882 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14883 CResult_QueryChannelRangeDecodeErrorZ {
14884 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14885 err: Box::into_raw(Box::new(e)),
14890 /// Checks if the given object is currently in the success state
14892 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14896 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14897 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14898 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14899 fn drop(&mut self) {
14900 if self.result_ok {
14901 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14902 let _ = unsafe { Box::from_raw(self.contents.result) };
14905 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14906 let _ = unsafe { Box::from_raw(self.contents.err) };
14911 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14912 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14913 let contents = if o.result_ok {
14914 let result = unsafe { o.contents.result };
14915 unsafe { o.contents.result = core::ptr::null_mut() };
14916 CResult_QueryChannelRangeDecodeErrorZPtr { result }
14918 let err = unsafe { o.contents.err };
14919 unsafe { o.contents.err = core::ptr::null_mut(); }
14920 CResult_QueryChannelRangeDecodeErrorZPtr { err }
14924 result_ok: o.result_ok,
14928 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14929 fn clone(&self) -> Self {
14930 if self.result_ok {
14931 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14932 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14935 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14936 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14942 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14943 /// but with all dynamically-allocated buffers duplicated in new buffers.
14944 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14946 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14947 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14948 /// A pointer to the contents in the success state.
14949 /// Reading from this pointer when `result_ok` is not set is undefined.
14950 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
14951 /// A pointer to the contents in the error state.
14952 /// Reading from this pointer when `result_ok` is set is undefined.
14953 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14956 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
14957 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14958 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14959 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
14960 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
14961 /// `err` or `result` depending on the state of `result_ok`.
14962 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
14963 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
14964 pub result_ok: bool,
14967 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
14968 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
14969 CResult_ReplyChannelRangeDecodeErrorZ {
14970 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14971 result: Box::into_raw(Box::new(o)),
14977 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
14978 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
14979 CResult_ReplyChannelRangeDecodeErrorZ {
14980 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14981 err: Box::into_raw(Box::new(e)),
14986 /// Checks if the given object is currently in the success state
14988 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
14992 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
14993 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
14994 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
14995 fn drop(&mut self) {
14996 if self.result_ok {
14997 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14998 let _ = unsafe { Box::from_raw(self.contents.result) };
15001 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15002 let _ = unsafe { Box::from_raw(self.contents.err) };
15007 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15008 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15009 let contents = if o.result_ok {
15010 let result = unsafe { o.contents.result };
15011 unsafe { o.contents.result = core::ptr::null_mut() };
15012 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15014 let err = unsafe { o.contents.err };
15015 unsafe { o.contents.err = core::ptr::null_mut(); }
15016 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15020 result_ok: o.result_ok,
15024 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15025 fn clone(&self) -> Self {
15026 if self.result_ok {
15027 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15028 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15031 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15032 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15038 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15039 /// but with all dynamically-allocated buffers duplicated in new buffers.
15040 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15042 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15043 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15044 /// A pointer to the contents in the success state.
15045 /// Reading from this pointer when `result_ok` is not set is undefined.
15046 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15047 /// A pointer to the contents in the error state.
15048 /// Reading from this pointer when `result_ok` is set is undefined.
15049 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15052 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15053 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15055 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15056 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15057 /// `err` or `result` depending on the state of `result_ok`.
15058 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15059 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15060 pub result_ok: bool,
15063 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15064 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15065 CResult_GossipTimestampFilterDecodeErrorZ {
15066 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15067 result: Box::into_raw(Box::new(o)),
15073 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15074 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15075 CResult_GossipTimestampFilterDecodeErrorZ {
15076 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15077 err: Box::into_raw(Box::new(e)),
15082 /// Checks if the given object is currently in the success state
15084 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15088 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15089 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15090 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15091 fn drop(&mut self) {
15092 if self.result_ok {
15093 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15094 let _ = unsafe { Box::from_raw(self.contents.result) };
15097 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15098 let _ = unsafe { Box::from_raw(self.contents.err) };
15103 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15104 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15105 let contents = if o.result_ok {
15106 let result = unsafe { o.contents.result };
15107 unsafe { o.contents.result = core::ptr::null_mut() };
15108 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15110 let err = unsafe { o.contents.err };
15111 unsafe { o.contents.err = core::ptr::null_mut(); }
15112 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15116 result_ok: o.result_ok,
15120 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15121 fn clone(&self) -> Self {
15122 if self.result_ok {
15123 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15124 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15127 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15128 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15134 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15135 /// but with all dynamically-allocated buffers duplicated in new buffers.
15136 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15138 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15139 /// This corresponds to std::vector in C++
15140 pub struct CVec_PhantomRouteHintsZ {
15141 /// The elements in the array.
15142 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15143 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15144 /// The number of elements pointed to by `data`.
15147 impl CVec_PhantomRouteHintsZ {
15148 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15149 if self.datalen == 0 { return Vec::new(); }
15150 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15151 self.data = core::ptr::null_mut();
15155 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15156 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15159 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15160 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15161 let datalen = v.len();
15162 let data = Box::into_raw(v.into_boxed_slice());
15163 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15167 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15168 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15169 impl Drop for CVec_PhantomRouteHintsZ {
15170 fn drop(&mut self) {
15171 if self.datalen == 0 { return; }
15172 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15175 impl Clone for CVec_PhantomRouteHintsZ {
15176 fn clone(&self) -> Self {
15177 let mut res = Vec::new();
15178 if self.datalen == 0 { return Self::from(res); }
15179 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15184 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15185 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15186 /// A pointer to the contents in the success state.
15187 /// Reading from this pointer when `result_ok` is not set is undefined.
15188 pub result: *mut crate::lightning_invoice::Invoice,
15189 /// A pointer to the contents in the error state.
15190 /// Reading from this pointer when `result_ok` is set is undefined.
15191 pub err: *mut crate::lightning_invoice::SignOrCreationError,
15194 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15195 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15197 pub struct CResult_InvoiceSignOrCreationErrorZ {
15198 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15199 /// `err` or `result` depending on the state of `result_ok`.
15200 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15201 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15202 pub result_ok: bool,
15205 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15206 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15207 CResult_InvoiceSignOrCreationErrorZ {
15208 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15209 result: Box::into_raw(Box::new(o)),
15215 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15216 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15217 CResult_InvoiceSignOrCreationErrorZ {
15218 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15219 err: Box::into_raw(Box::new(e)),
15224 /// Checks if the given object is currently in the success state
15226 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15230 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15231 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15232 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15233 fn drop(&mut self) {
15234 if self.result_ok {
15235 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15236 let _ = unsafe { Box::from_raw(self.contents.result) };
15239 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15240 let _ = unsafe { Box::from_raw(self.contents.err) };
15245 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15246 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15247 let contents = if o.result_ok {
15248 let result = unsafe { o.contents.result };
15249 unsafe { o.contents.result = core::ptr::null_mut() };
15250 CResult_InvoiceSignOrCreationErrorZPtr { result }
15252 let err = unsafe { o.contents.err };
15253 unsafe { o.contents.err = core::ptr::null_mut(); }
15254 CResult_InvoiceSignOrCreationErrorZPtr { err }
15258 result_ok: o.result_ok,
15262 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15263 fn clone(&self) -> Self {
15264 if self.result_ok {
15265 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15266 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15269 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15270 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15276 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15277 /// but with all dynamically-allocated buffers duplicated in new buffers.
15278 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15280 /// An enum which can either contain a crate::lightning::chain::Filter or not
15281 pub enum COption_FilterZ {
15282 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15283 Some(crate::lightning::chain::Filter),
15284 /// When we're in this state, this COption_FilterZ contains nothing
15287 impl COption_FilterZ {
15288 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15289 if let Self::None = self { false } else { true }
15291 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15294 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15295 if let Self::Some(v) = self { v } else { unreachable!() }
15299 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15300 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15301 COption_FilterZ::Some(o)
15304 /// Constructs a new COption_FilterZ containing nothing
15305 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15306 COption_FilterZ::None
15309 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15310 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15312 /// The contents of CResult_LockedChannelMonitorNoneZ
15313 pub union CResult_LockedChannelMonitorNoneZPtr {
15314 /// A pointer to the contents in the success state.
15315 /// Reading from this pointer when `result_ok` is not set is undefined.
15316 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15317 /// Note that this value is always NULL, as there are no contents in the Err variant
15318 pub err: *mut core::ffi::c_void,
15321 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15322 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15324 pub struct CResult_LockedChannelMonitorNoneZ {
15325 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15326 /// `err` or `result` depending on the state of `result_ok`.
15327 pub contents: CResult_LockedChannelMonitorNoneZPtr,
15328 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15329 pub result_ok: bool,
15332 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15333 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15334 CResult_LockedChannelMonitorNoneZ {
15335 contents: CResult_LockedChannelMonitorNoneZPtr {
15336 result: Box::into_raw(Box::new(o)),
15342 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15343 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15344 CResult_LockedChannelMonitorNoneZ {
15345 contents: CResult_LockedChannelMonitorNoneZPtr {
15346 err: core::ptr::null_mut(),
15351 /// Checks if the given object is currently in the success state
15353 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15357 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15358 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15359 impl Drop for CResult_LockedChannelMonitorNoneZ {
15360 fn drop(&mut self) {
15361 if self.result_ok {
15362 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15363 let _ = unsafe { Box::from_raw(self.contents.result) };
15369 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15370 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15371 let contents = if o.result_ok {
15372 let result = unsafe { o.contents.result };
15373 unsafe { o.contents.result = core::ptr::null_mut() };
15374 CResult_LockedChannelMonitorNoneZPtr { result }
15376 let _ = unsafe { Box::from_raw(o.contents.err) };
15377 o.contents.err = core::ptr::null_mut();
15378 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15382 result_ok: o.result_ok,
15387 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15388 /// This corresponds to std::vector in C++
15389 pub struct CVec_OutPointZ {
15390 /// The elements in the array.
15391 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15392 pub data: *mut crate::lightning::chain::transaction::OutPoint,
15393 /// The number of elements pointed to by `data`.
15396 impl CVec_OutPointZ {
15397 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15398 if self.datalen == 0 { return Vec::new(); }
15399 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15400 self.data = core::ptr::null_mut();
15404 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15405 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15408 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15409 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15410 let datalen = v.len();
15411 let data = Box::into_raw(v.into_boxed_slice());
15412 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15416 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15417 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15418 impl Drop for CVec_OutPointZ {
15419 fn drop(&mut self) {
15420 if self.datalen == 0 { return; }
15421 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15424 impl Clone for CVec_OutPointZ {
15425 fn clone(&self) -> Self {
15426 let mut res = Vec::new();
15427 if self.datalen == 0 { return Self::from(res); }
15428 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });