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 /// A dynamically-allocated array of u64s of arbitrary size.
2353 /// This corresponds to std::vector in C++
2354 pub struct CVec_u64Z {
2355 /// The elements in the array.
2356 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2358 /// The number of elements pointed to by `data`.
2362 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2363 if self.datalen == 0 { return Vec::new(); }
2364 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2365 self.data = core::ptr::null_mut();
2369 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2370 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2373 impl From<Vec<u64>> for CVec_u64Z {
2374 fn from(v: Vec<u64>) -> Self {
2375 let datalen = v.len();
2376 let data = Box::into_raw(v.into_boxed_slice());
2377 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2381 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2382 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2383 impl Drop for CVec_u64Z {
2384 fn drop(&mut self) {
2385 if self.datalen == 0 { return; }
2386 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2389 impl Clone for CVec_u64Z {
2390 fn clone(&self) -> Self {
2391 let mut res = Vec::new();
2392 if self.datalen == 0 { return Self::from(res); }
2393 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2398 /// The contents of CResult_PaymentParametersDecodeErrorZ
2399 pub union CResult_PaymentParametersDecodeErrorZPtr {
2400 /// A pointer to the contents in the success state.
2401 /// Reading from this pointer when `result_ok` is not set is undefined.
2402 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2403 /// A pointer to the contents in the error state.
2404 /// Reading from this pointer when `result_ok` is set is undefined.
2405 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2408 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2409 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2411 pub struct CResult_PaymentParametersDecodeErrorZ {
2412 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2413 /// `err` or `result` depending on the state of `result_ok`.
2414 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2415 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2416 pub result_ok: bool,
2419 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2420 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2421 CResult_PaymentParametersDecodeErrorZ {
2422 contents: CResult_PaymentParametersDecodeErrorZPtr {
2423 result: Box::into_raw(Box::new(o)),
2429 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2430 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2431 CResult_PaymentParametersDecodeErrorZ {
2432 contents: CResult_PaymentParametersDecodeErrorZPtr {
2433 err: Box::into_raw(Box::new(e)),
2438 /// Checks if the given object is currently in the success state
2440 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2444 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2445 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2446 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2447 fn drop(&mut self) {
2449 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2450 let _ = unsafe { Box::from_raw(self.contents.result) };
2453 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2454 let _ = unsafe { Box::from_raw(self.contents.err) };
2459 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2460 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2461 let contents = if o.result_ok {
2462 let result = unsafe { o.contents.result };
2463 unsafe { o.contents.result = core::ptr::null_mut() };
2464 CResult_PaymentParametersDecodeErrorZPtr { result }
2466 let err = unsafe { o.contents.err };
2467 unsafe { o.contents.err = core::ptr::null_mut(); }
2468 CResult_PaymentParametersDecodeErrorZPtr { err }
2472 result_ok: o.result_ok,
2476 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2477 fn clone(&self) -> Self {
2479 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2480 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2483 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2484 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2490 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2491 /// but with all dynamically-allocated buffers duplicated in new buffers.
2492 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2494 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2495 /// This corresponds to std::vector in C++
2496 pub struct CVec_RouteHintHopZ {
2497 /// The elements in the array.
2498 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2499 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2500 /// The number of elements pointed to by `data`.
2503 impl CVec_RouteHintHopZ {
2504 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2505 if self.datalen == 0 { return Vec::new(); }
2506 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2507 self.data = core::ptr::null_mut();
2511 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2512 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2515 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2516 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2517 let datalen = v.len();
2518 let data = Box::into_raw(v.into_boxed_slice());
2519 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2523 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2524 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2525 impl Drop for CVec_RouteHintHopZ {
2526 fn drop(&mut self) {
2527 if self.datalen == 0 { return; }
2528 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2531 impl Clone for CVec_RouteHintHopZ {
2532 fn clone(&self) -> Self {
2533 let mut res = Vec::new();
2534 if self.datalen == 0 { return Self::from(res); }
2535 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2540 /// The contents of CResult_RouteHintDecodeErrorZ
2541 pub union CResult_RouteHintDecodeErrorZPtr {
2542 /// A pointer to the contents in the success state.
2543 /// Reading from this pointer when `result_ok` is not set is undefined.
2544 pub result: *mut crate::lightning::routing::router::RouteHint,
2545 /// A pointer to the contents in the error state.
2546 /// Reading from this pointer when `result_ok` is set is undefined.
2547 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2550 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2551 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2552 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2553 pub struct CResult_RouteHintDecodeErrorZ {
2554 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2555 /// `err` or `result` depending on the state of `result_ok`.
2556 pub contents: CResult_RouteHintDecodeErrorZPtr,
2557 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2558 pub result_ok: bool,
2561 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2562 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2563 CResult_RouteHintDecodeErrorZ {
2564 contents: CResult_RouteHintDecodeErrorZPtr {
2565 result: Box::into_raw(Box::new(o)),
2571 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2572 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2573 CResult_RouteHintDecodeErrorZ {
2574 contents: CResult_RouteHintDecodeErrorZPtr {
2575 err: Box::into_raw(Box::new(e)),
2580 /// Checks if the given object is currently in the success state
2582 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2586 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2587 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2588 impl Drop for CResult_RouteHintDecodeErrorZ {
2589 fn drop(&mut self) {
2591 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2592 let _ = unsafe { Box::from_raw(self.contents.result) };
2595 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2596 let _ = unsafe { Box::from_raw(self.contents.err) };
2601 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2602 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2603 let contents = if o.result_ok {
2604 let result = unsafe { o.contents.result };
2605 unsafe { o.contents.result = core::ptr::null_mut() };
2606 CResult_RouteHintDecodeErrorZPtr { result }
2608 let err = unsafe { o.contents.err };
2609 unsafe { o.contents.err = core::ptr::null_mut(); }
2610 CResult_RouteHintDecodeErrorZPtr { err }
2614 result_ok: o.result_ok,
2618 impl Clone for CResult_RouteHintDecodeErrorZ {
2619 fn clone(&self) -> Self {
2621 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2622 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2625 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2626 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2632 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2633 /// but with all dynamically-allocated buffers duplicated in new buffers.
2634 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2636 /// The contents of CResult_RouteHintHopDecodeErrorZ
2637 pub union CResult_RouteHintHopDecodeErrorZPtr {
2638 /// A pointer to the contents in the success state.
2639 /// Reading from this pointer when `result_ok` is not set is undefined.
2640 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2641 /// A pointer to the contents in the error state.
2642 /// Reading from this pointer when `result_ok` is set is undefined.
2643 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2646 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2647 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2648 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2649 pub struct CResult_RouteHintHopDecodeErrorZ {
2650 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2651 /// `err` or `result` depending on the state of `result_ok`.
2652 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2653 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2654 pub result_ok: bool,
2657 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2658 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2659 CResult_RouteHintHopDecodeErrorZ {
2660 contents: CResult_RouteHintHopDecodeErrorZPtr {
2661 result: Box::into_raw(Box::new(o)),
2667 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2668 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2669 CResult_RouteHintHopDecodeErrorZ {
2670 contents: CResult_RouteHintHopDecodeErrorZPtr {
2671 err: Box::into_raw(Box::new(e)),
2676 /// Checks if the given object is currently in the success state
2678 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2682 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2683 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2684 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2685 fn drop(&mut self) {
2687 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2688 let _ = unsafe { Box::from_raw(self.contents.result) };
2691 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2692 let _ = unsafe { Box::from_raw(self.contents.err) };
2697 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2698 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2699 let contents = if o.result_ok {
2700 let result = unsafe { o.contents.result };
2701 unsafe { o.contents.result = core::ptr::null_mut() };
2702 CResult_RouteHintHopDecodeErrorZPtr { result }
2704 let err = unsafe { o.contents.err };
2705 unsafe { o.contents.err = core::ptr::null_mut(); }
2706 CResult_RouteHintHopDecodeErrorZPtr { err }
2710 result_ok: o.result_ok,
2714 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2715 fn clone(&self) -> Self {
2717 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2718 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2721 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2722 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2728 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2729 /// but with all dynamically-allocated buffers duplicated in new buffers.
2730 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2732 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2733 /// This corresponds to std::vector in C++
2734 pub struct CVec_ChannelDetailsZ {
2735 /// The elements in the array.
2736 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2737 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2738 /// The number of elements pointed to by `data`.
2741 impl CVec_ChannelDetailsZ {
2742 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2743 if self.datalen == 0 { return Vec::new(); }
2744 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2745 self.data = core::ptr::null_mut();
2749 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2750 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2753 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2754 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2755 let datalen = v.len();
2756 let data = Box::into_raw(v.into_boxed_slice());
2757 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2761 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2762 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2763 impl Drop for CVec_ChannelDetailsZ {
2764 fn drop(&mut self) {
2765 if self.datalen == 0 { return; }
2766 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2769 impl Clone for CVec_ChannelDetailsZ {
2770 fn clone(&self) -> Self {
2771 let mut res = Vec::new();
2772 if self.datalen == 0 { return Self::from(res); }
2773 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2778 /// The contents of CResult_RouteLightningErrorZ
2779 pub union CResult_RouteLightningErrorZPtr {
2780 /// A pointer to the contents in the success state.
2781 /// Reading from this pointer when `result_ok` is not set is undefined.
2782 pub result: *mut crate::lightning::routing::router::Route,
2783 /// A pointer to the contents in the error state.
2784 /// Reading from this pointer when `result_ok` is set is undefined.
2785 pub err: *mut crate::lightning::ln::msgs::LightningError,
2788 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2789 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2790 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2791 pub struct CResult_RouteLightningErrorZ {
2792 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2793 /// `err` or `result` depending on the state of `result_ok`.
2794 pub contents: CResult_RouteLightningErrorZPtr,
2795 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2796 pub result_ok: bool,
2799 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2800 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2801 CResult_RouteLightningErrorZ {
2802 contents: CResult_RouteLightningErrorZPtr {
2803 result: Box::into_raw(Box::new(o)),
2809 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2810 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2811 CResult_RouteLightningErrorZ {
2812 contents: CResult_RouteLightningErrorZPtr {
2813 err: Box::into_raw(Box::new(e)),
2818 /// Checks if the given object is currently in the success state
2820 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2824 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2825 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2826 impl Drop for CResult_RouteLightningErrorZ {
2827 fn drop(&mut self) {
2829 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2830 let _ = unsafe { Box::from_raw(self.contents.result) };
2833 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2834 let _ = unsafe { Box::from_raw(self.contents.err) };
2839 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2840 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2841 let contents = if o.result_ok {
2842 let result = unsafe { o.contents.result };
2843 unsafe { o.contents.result = core::ptr::null_mut() };
2844 CResult_RouteLightningErrorZPtr { result }
2846 let err = unsafe { o.contents.err };
2847 unsafe { o.contents.err = core::ptr::null_mut(); }
2848 CResult_RouteLightningErrorZPtr { err }
2852 result_ok: o.result_ok,
2856 impl Clone for CResult_RouteLightningErrorZ {
2857 fn clone(&self) -> Self {
2859 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2860 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2863 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2864 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2870 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2871 /// but with all dynamically-allocated buffers duplicated in new buffers.
2872 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2874 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2875 /// This corresponds to std::vector in C++
2876 pub struct CVec_PublicKeyZ {
2877 /// The elements in the array.
2878 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2879 pub data: *mut crate::c_types::PublicKey,
2880 /// The number of elements pointed to by `data`.
2883 impl CVec_PublicKeyZ {
2884 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
2885 if self.datalen == 0 { return Vec::new(); }
2886 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2887 self.data = core::ptr::null_mut();
2891 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
2892 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2895 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
2896 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
2897 let datalen = v.len();
2898 let data = Box::into_raw(v.into_boxed_slice());
2899 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2903 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2904 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
2905 impl Drop for CVec_PublicKeyZ {
2906 fn drop(&mut self) {
2907 if self.datalen == 0 { return; }
2908 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2911 impl Clone for CVec_PublicKeyZ {
2912 fn clone(&self) -> Self {
2913 let mut res = Vec::new();
2914 if self.datalen == 0 { return Self::from(res); }
2915 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2920 /// The contents of CResult_PaymentPurposeDecodeErrorZ
2921 pub union CResult_PaymentPurposeDecodeErrorZPtr {
2922 /// A pointer to the contents in the success state.
2923 /// Reading from this pointer when `result_ok` is not set is undefined.
2924 pub result: *mut crate::lightning::util::events::PaymentPurpose,
2925 /// A pointer to the contents in the error state.
2926 /// Reading from this pointer when `result_ok` is set is undefined.
2927 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2930 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2931 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2932 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2933 pub struct CResult_PaymentPurposeDecodeErrorZ {
2934 /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2935 /// `err` or `result` depending on the state of `result_ok`.
2936 pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
2937 /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2938 pub result_ok: bool,
2941 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
2942 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
2943 CResult_PaymentPurposeDecodeErrorZ {
2944 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2945 result: Box::into_raw(Box::new(o)),
2951 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
2952 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
2953 CResult_PaymentPurposeDecodeErrorZ {
2954 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2955 err: Box::into_raw(Box::new(e)),
2960 /// Checks if the given object is currently in the success state
2962 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
2966 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
2967 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
2968 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
2969 fn drop(&mut self) {
2971 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2972 let _ = unsafe { Box::from_raw(self.contents.result) };
2975 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2976 let _ = unsafe { Box::from_raw(self.contents.err) };
2981 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
2982 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
2983 let contents = if o.result_ok {
2984 let result = unsafe { o.contents.result };
2985 unsafe { o.contents.result = core::ptr::null_mut() };
2986 CResult_PaymentPurposeDecodeErrorZPtr { result }
2988 let err = unsafe { o.contents.err };
2989 unsafe { o.contents.err = core::ptr::null_mut(); }
2990 CResult_PaymentPurposeDecodeErrorZPtr { err }
2994 result_ok: o.result_ok,
2998 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
2999 fn clone(&self) -> Self {
3001 Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3002 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
3005 Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3006 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3012 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
3013 /// but with all dynamically-allocated buffers duplicated in new buffers.
3014 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
3017 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3018 pub enum COption_ClosureReasonZ {
3019 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3020 Some(crate::lightning::util::events::ClosureReason),
3021 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3024 impl COption_ClosureReasonZ {
3025 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3026 if let Self::None = self { false } else { true }
3028 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3031 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3032 if let Self::Some(v) = self { v } else { unreachable!() }
3036 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3037 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3038 COption_ClosureReasonZ::Some(o)
3041 /// Constructs a new COption_ClosureReasonZ containing nothing
3042 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3043 COption_ClosureReasonZ::None
3046 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3047 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3049 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3050 /// but with all dynamically-allocated buffers duplicated in new buffers.
3051 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3053 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3054 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3055 /// A pointer to the contents in the success state.
3056 /// Reading from this pointer when `result_ok` is not set is undefined.
3057 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3058 /// A pointer to the contents in the error state.
3059 /// Reading from this pointer when `result_ok` is set is undefined.
3060 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3063 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3064 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3065 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3066 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3067 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3068 /// `err` or `result` depending on the state of `result_ok`.
3069 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3070 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3071 pub result_ok: bool,
3074 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3075 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3076 CResult_COption_ClosureReasonZDecodeErrorZ {
3077 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3078 result: Box::into_raw(Box::new(o)),
3084 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3085 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3086 CResult_COption_ClosureReasonZDecodeErrorZ {
3087 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3088 err: Box::into_raw(Box::new(e)),
3093 /// Checks if the given object is currently in the success state
3095 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3099 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3100 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3101 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3102 fn drop(&mut self) {
3104 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3105 let _ = unsafe { Box::from_raw(self.contents.result) };
3108 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3109 let _ = unsafe { Box::from_raw(self.contents.err) };
3114 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3115 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3116 let contents = if o.result_ok {
3117 let result = unsafe { o.contents.result };
3118 unsafe { o.contents.result = core::ptr::null_mut() };
3119 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3121 let err = unsafe { o.contents.err };
3122 unsafe { o.contents.err = core::ptr::null_mut(); }
3123 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3127 result_ok: o.result_ok,
3131 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3132 fn clone(&self) -> Self {
3134 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3135 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3138 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3139 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3145 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3146 /// but with all dynamically-allocated buffers duplicated in new buffers.
3147 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3150 /// An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
3151 pub enum COption_HTLCDestinationZ {
3152 /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
3153 Some(crate::lightning::util::events::HTLCDestination),
3154 /// When we're in this state, this COption_HTLCDestinationZ contains nothing
3157 impl COption_HTLCDestinationZ {
3158 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3159 if let Self::None = self { false } else { true }
3161 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3164 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::HTLCDestination {
3165 if let Self::Some(v) = self { v } else { unreachable!() }
3169 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
3170 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::util::events::HTLCDestination) -> COption_HTLCDestinationZ {
3171 COption_HTLCDestinationZ::Some(o)
3174 /// Constructs a new COption_HTLCDestinationZ containing nothing
3175 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
3176 COption_HTLCDestinationZ::None
3179 /// Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
3180 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
3182 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
3183 /// but with all dynamically-allocated buffers duplicated in new buffers.
3184 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
3186 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
3187 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3188 /// A pointer to the contents in the success state.
3189 /// Reading from this pointer when `result_ok` is not set is undefined.
3190 pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
3191 /// A pointer to the contents in the error state.
3192 /// Reading from this pointer when `result_ok` is set is undefined.
3193 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3196 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
3197 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3198 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3199 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
3200 /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
3201 /// `err` or `result` depending on the state of `result_ok`.
3202 pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
3203 /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
3204 pub result_ok: bool,
3207 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
3208 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3209 CResult_COption_HTLCDestinationZDecodeErrorZ {
3210 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3211 result: Box::into_raw(Box::new(o)),
3217 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
3218 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3219 CResult_COption_HTLCDestinationZDecodeErrorZ {
3220 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3221 err: Box::into_raw(Box::new(e)),
3226 /// Checks if the given object is currently in the success state
3228 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
3232 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
3233 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
3234 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
3235 fn drop(&mut self) {
3237 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3238 let _ = unsafe { Box::from_raw(self.contents.result) };
3241 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3242 let _ = unsafe { Box::from_raw(self.contents.err) };
3247 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
3248 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3249 let contents = if o.result_ok {
3250 let result = unsafe { o.contents.result };
3251 unsafe { o.contents.result = core::ptr::null_mut() };
3252 CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
3254 let err = unsafe { o.contents.err };
3255 unsafe { o.contents.err = core::ptr::null_mut(); }
3256 CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
3260 result_ok: o.result_ok,
3264 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
3265 fn clone(&self) -> Self {
3267 Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3268 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
3271 Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3272 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3278 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
3279 /// but with all dynamically-allocated buffers duplicated in new buffers.
3280 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
3283 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3284 pub enum COption_NetworkUpdateZ {
3285 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3286 Some(crate::lightning::routing::gossip::NetworkUpdate),
3287 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3290 impl COption_NetworkUpdateZ {
3291 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3292 if let Self::None = self { false } else { true }
3294 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3297 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3298 if let Self::Some(v) = self { v } else { unreachable!() }
3302 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3303 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3304 COption_NetworkUpdateZ::Some(o)
3307 /// Constructs a new COption_NetworkUpdateZ containing nothing
3308 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3309 COption_NetworkUpdateZ::None
3312 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3313 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3315 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3316 /// but with all dynamically-allocated buffers duplicated in new buffers.
3317 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3319 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3320 /// This corresponds to std::vector in C++
3321 pub struct CVec_SpendableOutputDescriptorZ {
3322 /// The elements in the array.
3323 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3324 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3325 /// The number of elements pointed to by `data`.
3328 impl CVec_SpendableOutputDescriptorZ {
3329 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3330 if self.datalen == 0 { return Vec::new(); }
3331 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3332 self.data = core::ptr::null_mut();
3336 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3337 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3340 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3341 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3342 let datalen = v.len();
3343 let data = Box::into_raw(v.into_boxed_slice());
3344 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3348 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3349 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3350 impl Drop for CVec_SpendableOutputDescriptorZ {
3351 fn drop(&mut self) {
3352 if self.datalen == 0 { return; }
3353 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3356 impl Clone for CVec_SpendableOutputDescriptorZ {
3357 fn clone(&self) -> Self {
3358 let mut res = Vec::new();
3359 if self.datalen == 0 { return Self::from(res); }
3360 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3366 /// An enum which can either contain a crate::lightning::util::events::Event or not
3367 pub enum COption_EventZ {
3368 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3369 Some(crate::lightning::util::events::Event),
3370 /// When we're in this state, this COption_EventZ contains nothing
3373 impl COption_EventZ {
3374 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3375 if let Self::None = self { false } else { true }
3377 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3380 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3381 if let Self::Some(v) = self { v } else { unreachable!() }
3385 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3386 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3387 COption_EventZ::Some(o)
3390 /// Constructs a new COption_EventZ containing nothing
3391 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3392 COption_EventZ::None
3395 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3396 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3398 /// Creates a new COption_EventZ which has the same data as `orig`
3399 /// but with all dynamically-allocated buffers duplicated in new buffers.
3400 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3402 /// The contents of CResult_COption_EventZDecodeErrorZ
3403 pub union CResult_COption_EventZDecodeErrorZPtr {
3404 /// A pointer to the contents in the success state.
3405 /// Reading from this pointer when `result_ok` is not set is undefined.
3406 pub result: *mut crate::c_types::derived::COption_EventZ,
3407 /// A pointer to the contents in the error state.
3408 /// Reading from this pointer when `result_ok` is set is undefined.
3409 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3412 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3413 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3414 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3415 pub struct CResult_COption_EventZDecodeErrorZ {
3416 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3417 /// `err` or `result` depending on the state of `result_ok`.
3418 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3419 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3420 pub result_ok: bool,
3423 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3424 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3425 CResult_COption_EventZDecodeErrorZ {
3426 contents: CResult_COption_EventZDecodeErrorZPtr {
3427 result: Box::into_raw(Box::new(o)),
3433 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3434 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3435 CResult_COption_EventZDecodeErrorZ {
3436 contents: CResult_COption_EventZDecodeErrorZPtr {
3437 err: Box::into_raw(Box::new(e)),
3442 /// Checks if the given object is currently in the success state
3444 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3448 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3449 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3450 impl Drop for CResult_COption_EventZDecodeErrorZ {
3451 fn drop(&mut self) {
3453 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3454 let _ = unsafe { Box::from_raw(self.contents.result) };
3457 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3458 let _ = unsafe { Box::from_raw(self.contents.err) };
3463 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3464 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3465 let contents = if o.result_ok {
3466 let result = unsafe { o.contents.result };
3467 unsafe { o.contents.result = core::ptr::null_mut() };
3468 CResult_COption_EventZDecodeErrorZPtr { result }
3470 let err = unsafe { o.contents.err };
3471 unsafe { o.contents.err = core::ptr::null_mut(); }
3472 CResult_COption_EventZDecodeErrorZPtr { err }
3476 result_ok: o.result_ok,
3480 impl Clone for CResult_COption_EventZDecodeErrorZ {
3481 fn clone(&self) -> Self {
3483 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3484 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3487 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3488 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3494 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3495 /// but with all dynamically-allocated buffers duplicated in new buffers.
3496 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3498 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3499 /// This corresponds to std::vector in C++
3500 pub struct CVec_MessageSendEventZ {
3501 /// The elements in the array.
3502 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3503 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3504 /// The number of elements pointed to by `data`.
3507 impl CVec_MessageSendEventZ {
3508 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3509 if self.datalen == 0 { return Vec::new(); }
3510 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3511 self.data = core::ptr::null_mut();
3515 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3516 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3519 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3520 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3521 let datalen = v.len();
3522 let data = Box::into_raw(v.into_boxed_slice());
3523 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3527 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3528 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3529 impl Drop for CVec_MessageSendEventZ {
3530 fn drop(&mut self) {
3531 if self.datalen == 0 { return; }
3532 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3535 impl Clone for CVec_MessageSendEventZ {
3536 fn clone(&self) -> Self {
3537 let mut res = Vec::new();
3538 if self.datalen == 0 { return Self::from(res); }
3539 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3544 /// The contents of CResult_TxOutAccessErrorZ
3545 pub union CResult_TxOutAccessErrorZPtr {
3546 /// A pointer to the contents in the success state.
3547 /// Reading from this pointer when `result_ok` is not set is undefined.
3548 pub result: *mut crate::c_types::TxOut,
3549 /// A pointer to the contents in the error state.
3550 /// Reading from this pointer when `result_ok` is set is undefined.
3551 pub err: *mut crate::lightning::chain::AccessError,
3554 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3555 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3557 pub struct CResult_TxOutAccessErrorZ {
3558 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3559 /// `err` or `result` depending on the state of `result_ok`.
3560 pub contents: CResult_TxOutAccessErrorZPtr,
3561 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3562 pub result_ok: bool,
3565 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3566 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3567 CResult_TxOutAccessErrorZ {
3568 contents: CResult_TxOutAccessErrorZPtr {
3569 result: Box::into_raw(Box::new(o)),
3575 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3576 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3577 CResult_TxOutAccessErrorZ {
3578 contents: CResult_TxOutAccessErrorZPtr {
3579 err: Box::into_raw(Box::new(e)),
3584 /// Checks if the given object is currently in the success state
3586 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3590 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3591 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3592 impl Drop for CResult_TxOutAccessErrorZ {
3593 fn drop(&mut self) {
3595 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3596 let _ = unsafe { Box::from_raw(self.contents.result) };
3599 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3600 let _ = unsafe { Box::from_raw(self.contents.err) };
3605 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3606 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3607 let contents = if o.result_ok {
3608 let result = unsafe { o.contents.result };
3609 unsafe { o.contents.result = core::ptr::null_mut() };
3610 CResult_TxOutAccessErrorZPtr { result }
3612 let err = unsafe { o.contents.err };
3613 unsafe { o.contents.err = core::ptr::null_mut(); }
3614 CResult_TxOutAccessErrorZPtr { err }
3618 result_ok: o.result_ok,
3622 impl Clone for CResult_TxOutAccessErrorZ {
3623 fn clone(&self) -> Self {
3625 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3626 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3629 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3630 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3636 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3637 /// but with all dynamically-allocated buffers duplicated in new buffers.
3638 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3640 /// A tuple of 2 elements. See the individual fields for the types contained.
3641 pub struct C2Tuple_usizeTransactionZ {
3642 /// The element at position 0
3644 /// The element at position 1
3645 pub b: crate::c_types::Transaction,
3647 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3648 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3655 impl C2Tuple_usizeTransactionZ {
3656 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3660 impl Clone for C2Tuple_usizeTransactionZ {
3661 fn clone(&self) -> Self {
3663 a: Clone::clone(&self.a),
3664 b: Clone::clone(&self.b),
3669 /// Creates a new tuple which has the same data as `orig`
3670 /// but with all dynamically-allocated buffers duplicated in new buffers.
3671 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3672 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3674 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3675 C2Tuple_usizeTransactionZ { a, b, }
3679 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3680 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3682 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3683 /// This corresponds to std::vector in C++
3684 pub struct CVec_C2Tuple_usizeTransactionZZ {
3685 /// The elements in the array.
3686 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3687 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3688 /// The number of elements pointed to by `data`.
3691 impl CVec_C2Tuple_usizeTransactionZZ {
3692 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3693 if self.datalen == 0 { return Vec::new(); }
3694 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3695 self.data = core::ptr::null_mut();
3699 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3700 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3703 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3704 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3705 let datalen = v.len();
3706 let data = Box::into_raw(v.into_boxed_slice());
3707 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3711 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3712 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3713 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3714 fn drop(&mut self) {
3715 if self.datalen == 0 { return; }
3716 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3719 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3720 fn clone(&self) -> Self {
3721 let mut res = Vec::new();
3722 if self.datalen == 0 { return Self::from(res); }
3723 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3728 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3729 /// This corresponds to std::vector in C++
3730 pub struct CVec_TxidZ {
3731 /// The elements in the array.
3732 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3733 pub data: *mut crate::c_types::ThirtyTwoBytes,
3734 /// The number of elements pointed to by `data`.
3738 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3739 if self.datalen == 0 { return Vec::new(); }
3740 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3741 self.data = core::ptr::null_mut();
3745 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3746 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3749 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3750 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3751 let datalen = v.len();
3752 let data = Box::into_raw(v.into_boxed_slice());
3753 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3757 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3758 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3759 impl Drop for CVec_TxidZ {
3760 fn drop(&mut self) {
3761 if self.datalen == 0 { return; }
3762 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3765 impl Clone for CVec_TxidZ {
3766 fn clone(&self) -> Self {
3767 let mut res = Vec::new();
3768 if self.datalen == 0 { return Self::from(res); }
3769 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3774 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3775 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3776 /// Note that this value is always NULL, as there are no contents in the OK variant
3777 pub result: *mut core::ffi::c_void,
3778 /// A pointer to the contents in the error state.
3779 /// Reading from this pointer when `result_ok` is set is undefined.
3780 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3783 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3784 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3786 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3787 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3788 /// `err` or `result` depending on the state of `result_ok`.
3789 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3790 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3791 pub result_ok: bool,
3794 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3795 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3796 CResult_NoneChannelMonitorUpdateErrZ {
3797 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3798 result: core::ptr::null_mut(),
3804 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3805 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3806 CResult_NoneChannelMonitorUpdateErrZ {
3807 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3808 err: Box::into_raw(Box::new(e)),
3813 /// Checks if the given object is currently in the success state
3815 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3819 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3820 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3821 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3822 fn drop(&mut self) {
3825 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3826 let _ = unsafe { Box::from_raw(self.contents.err) };
3831 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3832 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3833 let contents = if o.result_ok {
3834 let _ = unsafe { Box::from_raw(o.contents.result) };
3835 o.contents.result = core::ptr::null_mut();
3836 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3838 let err = unsafe { o.contents.err };
3839 unsafe { o.contents.err = core::ptr::null_mut(); }
3840 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3844 result_ok: o.result_ok,
3848 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3849 fn clone(&self) -> Self {
3851 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3852 result: core::ptr::null_mut()
3855 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3856 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3862 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3863 /// but with all dynamically-allocated buffers duplicated in new buffers.
3864 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3866 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3867 /// This corresponds to std::vector in C++
3868 pub struct CVec_MonitorEventZ {
3869 /// The elements in the array.
3870 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3871 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3872 /// The number of elements pointed to by `data`.
3875 impl CVec_MonitorEventZ {
3876 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3877 if self.datalen == 0 { return Vec::new(); }
3878 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3879 self.data = core::ptr::null_mut();
3883 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3884 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3887 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3888 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3889 let datalen = v.len();
3890 let data = Box::into_raw(v.into_boxed_slice());
3891 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3895 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3896 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3897 impl Drop for CVec_MonitorEventZ {
3898 fn drop(&mut self) {
3899 if self.datalen == 0 { return; }
3900 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3903 impl Clone for CVec_MonitorEventZ {
3904 fn clone(&self) -> Self {
3905 let mut res = Vec::new();
3906 if self.datalen == 0 { return Self::from(res); }
3907 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3912 /// A tuple of 3 elements. See the individual fields for the types contained.
3913 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3914 /// The element at position 0
3915 pub a: crate::lightning::chain::transaction::OutPoint,
3916 /// The element at position 1
3917 pub b: crate::c_types::derived::CVec_MonitorEventZ,
3918 /// The element at position 2
3919 pub c: crate::c_types::PublicKey,
3921 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3922 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
3930 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3931 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
3932 (self.a, self.b, self.c)
3935 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3936 fn clone(&self) -> Self {
3938 a: Clone::clone(&self.a),
3939 b: Clone::clone(&self.b),
3940 c: Clone::clone(&self.c),
3945 /// Creates a new tuple which has the same data as `orig`
3946 /// but with all dynamically-allocated buffers duplicated in new buffers.
3947 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
3948 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
3950 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ, c: crate::c_types::PublicKey) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3951 C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
3955 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
3956 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
3958 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
3959 /// This corresponds to std::vector in C++
3960 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3961 /// The elements in the array.
3962 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3963 pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
3964 /// The number of elements pointed to by `data`.
3967 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3968 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
3969 if self.datalen == 0 { return Vec::new(); }
3970 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3971 self.data = core::ptr::null_mut();
3975 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
3976 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3979 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3980 fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
3981 let datalen = v.len();
3982 let data = Box::into_raw(v.into_boxed_slice());
3983 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3987 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3988 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
3989 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3990 fn drop(&mut self) {
3991 if self.datalen == 0 { return; }
3992 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3995 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3996 fn clone(&self) -> Self {
3997 let mut res = Vec::new();
3998 if self.datalen == 0 { return Self::from(res); }
3999 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4005 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4006 pub enum COption_C2Tuple_usizeTransactionZZ {
4007 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4008 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
4009 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4012 impl COption_C2Tuple_usizeTransactionZZ {
4013 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4014 if let Self::None = self { false } else { true }
4016 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4019 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
4020 if let Self::Some(v) = self { v } else { unreachable!() }
4024 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
4025 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
4026 COption_C2Tuple_usizeTransactionZZ::Some(o)
4029 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
4030 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
4031 COption_C2Tuple_usizeTransactionZZ::None
4034 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
4035 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
4037 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
4038 /// but with all dynamically-allocated buffers duplicated in new buffers.
4039 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
4041 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4042 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4043 /// A pointer to the contents in the success state.
4044 /// Reading from this pointer when `result_ok` is not set is undefined.
4045 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4046 /// A pointer to the contents in the error state.
4047 /// Reading from this pointer when `result_ok` is set is undefined.
4048 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4051 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4052 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4053 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4054 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4055 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4056 /// `err` or `result` depending on the state of `result_ok`.
4057 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4058 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4059 pub result_ok: bool,
4062 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4063 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4064 CResult_FixedPenaltyScorerDecodeErrorZ {
4065 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4066 result: Box::into_raw(Box::new(o)),
4072 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4073 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4074 CResult_FixedPenaltyScorerDecodeErrorZ {
4075 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4076 err: Box::into_raw(Box::new(e)),
4081 /// Checks if the given object is currently in the success state
4083 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4087 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4088 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4089 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4090 fn drop(&mut self) {
4092 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4093 let _ = unsafe { Box::from_raw(self.contents.result) };
4096 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4097 let _ = unsafe { Box::from_raw(self.contents.err) };
4102 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4103 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4104 let contents = if o.result_ok {
4105 let result = unsafe { o.contents.result };
4106 unsafe { o.contents.result = core::ptr::null_mut() };
4107 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4109 let err = unsafe { o.contents.err };
4110 unsafe { o.contents.err = core::ptr::null_mut(); }
4111 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4115 result_ok: o.result_ok,
4119 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4120 fn clone(&self) -> Self {
4122 Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4123 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4126 Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4127 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4133 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4134 /// but with all dynamically-allocated buffers duplicated in new buffers.
4135 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4137 /// A tuple of 2 elements. See the individual fields for the types contained.
4138 pub struct C2Tuple_u64u64Z {
4139 /// The element at position 0
4141 /// The element at position 1
4144 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4145 fn from (tup: (u64, u64)) -> Self {
4152 impl C2Tuple_u64u64Z {
4153 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4157 impl Clone for C2Tuple_u64u64Z {
4158 fn clone(&self) -> Self {
4160 a: Clone::clone(&self.a),
4161 b: Clone::clone(&self.b),
4166 /// Creates a new tuple which has the same data as `orig`
4167 /// but with all dynamically-allocated buffers duplicated in new buffers.
4168 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4169 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4171 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4172 C2Tuple_u64u64Z { a, b, }
4176 /// Frees any resources used by the C2Tuple_u64u64Z.
4177 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4180 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4181 pub enum COption_C2Tuple_u64u64ZZ {
4182 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4183 Some(crate::c_types::derived::C2Tuple_u64u64Z),
4184 /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4187 impl COption_C2Tuple_u64u64ZZ {
4188 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4189 if let Self::None = self { false } else { true }
4191 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4194 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4195 if let Self::Some(v) = self { v } else { unreachable!() }
4199 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4200 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4201 COption_C2Tuple_u64u64ZZ::Some(o)
4204 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4205 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4206 COption_C2Tuple_u64u64ZZ::None
4209 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4210 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4212 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4213 /// but with all dynamically-allocated buffers duplicated in new buffers.
4214 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4216 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4217 /// This corresponds to std::vector in C++
4218 pub struct CVec_NodeIdZ {
4219 /// The elements in the array.
4220 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4221 pub data: *mut crate::lightning::routing::gossip::NodeId,
4222 /// The number of elements pointed to by `data`.
4226 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4227 if self.datalen == 0 { return Vec::new(); }
4228 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4229 self.data = core::ptr::null_mut();
4233 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4234 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4237 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4238 fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4239 let datalen = v.len();
4240 let data = Box::into_raw(v.into_boxed_slice());
4241 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4245 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4246 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4247 impl Drop for CVec_NodeIdZ {
4248 fn drop(&mut self) {
4249 if self.datalen == 0 { return; }
4250 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4253 impl Clone for CVec_NodeIdZ {
4254 fn clone(&self) -> Self {
4255 let mut res = Vec::new();
4256 if self.datalen == 0 { return Self::from(res); }
4257 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4262 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4263 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4264 /// A pointer to the contents in the success state.
4265 /// Reading from this pointer when `result_ok` is not set is undefined.
4266 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4267 /// A pointer to the contents in the error state.
4268 /// Reading from this pointer when `result_ok` is set is undefined.
4269 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4272 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4273 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4274 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4275 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4276 /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4277 /// `err` or `result` depending on the state of `result_ok`.
4278 pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4279 /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4280 pub result_ok: bool,
4283 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4284 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4285 CResult_ProbabilisticScorerDecodeErrorZ {
4286 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4287 result: Box::into_raw(Box::new(o)),
4293 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4294 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4295 CResult_ProbabilisticScorerDecodeErrorZ {
4296 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4297 err: Box::into_raw(Box::new(e)),
4302 /// Checks if the given object is currently in the success state
4304 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4308 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4309 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4310 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4311 fn drop(&mut self) {
4313 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4314 let _ = unsafe { Box::from_raw(self.contents.result) };
4317 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4318 let _ = unsafe { Box::from_raw(self.contents.err) };
4323 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4324 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4325 let contents = if o.result_ok {
4326 let result = unsafe { o.contents.result };
4327 unsafe { o.contents.result = core::ptr::null_mut() };
4328 CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4330 let err = unsafe { o.contents.err };
4331 unsafe { o.contents.err = core::ptr::null_mut(); }
4332 CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4336 result_ok: o.result_ok,
4341 /// The contents of CResult_InitFeaturesDecodeErrorZ
4342 pub union CResult_InitFeaturesDecodeErrorZPtr {
4343 /// A pointer to the contents in the success state.
4344 /// Reading from this pointer when `result_ok` is not set is undefined.
4345 pub result: *mut crate::lightning::ln::features::InitFeatures,
4346 /// A pointer to the contents in the error state.
4347 /// Reading from this pointer when `result_ok` is set is undefined.
4348 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4351 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4352 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4353 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4354 pub struct CResult_InitFeaturesDecodeErrorZ {
4355 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4356 /// `err` or `result` depending on the state of `result_ok`.
4357 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4358 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4359 pub result_ok: bool,
4362 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4363 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4364 CResult_InitFeaturesDecodeErrorZ {
4365 contents: CResult_InitFeaturesDecodeErrorZPtr {
4366 result: Box::into_raw(Box::new(o)),
4372 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4373 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4374 CResult_InitFeaturesDecodeErrorZ {
4375 contents: CResult_InitFeaturesDecodeErrorZPtr {
4376 err: Box::into_raw(Box::new(e)),
4381 /// Checks if the given object is currently in the success state
4383 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4387 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4388 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4389 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4390 fn drop(&mut self) {
4392 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4393 let _ = unsafe { Box::from_raw(self.contents.result) };
4396 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4397 let _ = unsafe { Box::from_raw(self.contents.err) };
4402 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4403 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4404 let contents = if o.result_ok {
4405 let result = unsafe { o.contents.result };
4406 unsafe { o.contents.result = core::ptr::null_mut() };
4407 CResult_InitFeaturesDecodeErrorZPtr { result }
4409 let err = unsafe { o.contents.err };
4410 unsafe { o.contents.err = core::ptr::null_mut(); }
4411 CResult_InitFeaturesDecodeErrorZPtr { err }
4415 result_ok: o.result_ok,
4419 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4420 fn clone(&self) -> Self {
4422 Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4423 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4426 Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4427 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4433 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4434 /// but with all dynamically-allocated buffers duplicated in new buffers.
4435 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4437 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4438 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4439 /// A pointer to the contents in the success state.
4440 /// Reading from this pointer when `result_ok` is not set is undefined.
4441 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4442 /// A pointer to the contents in the error state.
4443 /// Reading from this pointer when `result_ok` is set is undefined.
4444 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4447 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4448 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4450 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4451 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4452 /// `err` or `result` depending on the state of `result_ok`.
4453 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4454 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4455 pub result_ok: bool,
4458 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4459 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4460 CResult_ChannelFeaturesDecodeErrorZ {
4461 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4462 result: Box::into_raw(Box::new(o)),
4468 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4469 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4470 CResult_ChannelFeaturesDecodeErrorZ {
4471 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4472 err: Box::into_raw(Box::new(e)),
4477 /// Checks if the given object is currently in the success state
4479 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4483 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4484 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4485 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4486 fn drop(&mut self) {
4488 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4489 let _ = unsafe { Box::from_raw(self.contents.result) };
4492 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4493 let _ = unsafe { Box::from_raw(self.contents.err) };
4498 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4499 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4500 let contents = if o.result_ok {
4501 let result = unsafe { o.contents.result };
4502 unsafe { o.contents.result = core::ptr::null_mut() };
4503 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4505 let err = unsafe { o.contents.err };
4506 unsafe { o.contents.err = core::ptr::null_mut(); }
4507 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4511 result_ok: o.result_ok,
4515 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4516 fn clone(&self) -> Self {
4518 Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4519 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4522 Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4523 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4529 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4530 /// but with all dynamically-allocated buffers duplicated in new buffers.
4531 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4533 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4534 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4535 /// A pointer to the contents in the success state.
4536 /// Reading from this pointer when `result_ok` is not set is undefined.
4537 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4538 /// A pointer to the contents in the error state.
4539 /// Reading from this pointer when `result_ok` is set is undefined.
4540 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4543 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4544 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4545 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4546 pub struct CResult_NodeFeaturesDecodeErrorZ {
4547 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4548 /// `err` or `result` depending on the state of `result_ok`.
4549 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4550 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4551 pub result_ok: bool,
4554 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4555 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4556 CResult_NodeFeaturesDecodeErrorZ {
4557 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4558 result: Box::into_raw(Box::new(o)),
4564 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4565 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4566 CResult_NodeFeaturesDecodeErrorZ {
4567 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4568 err: Box::into_raw(Box::new(e)),
4573 /// Checks if the given object is currently in the success state
4575 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4579 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4580 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4581 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4582 fn drop(&mut self) {
4584 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4585 let _ = unsafe { Box::from_raw(self.contents.result) };
4588 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4589 let _ = unsafe { Box::from_raw(self.contents.err) };
4594 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4595 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4596 let contents = if o.result_ok {
4597 let result = unsafe { o.contents.result };
4598 unsafe { o.contents.result = core::ptr::null_mut() };
4599 CResult_NodeFeaturesDecodeErrorZPtr { result }
4601 let err = unsafe { o.contents.err };
4602 unsafe { o.contents.err = core::ptr::null_mut(); }
4603 CResult_NodeFeaturesDecodeErrorZPtr { err }
4607 result_ok: o.result_ok,
4611 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4612 fn clone(&self) -> Self {
4614 Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4615 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4618 Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4619 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4625 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4626 /// but with all dynamically-allocated buffers duplicated in new buffers.
4627 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4629 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4630 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4631 /// A pointer to the contents in the success state.
4632 /// Reading from this pointer when `result_ok` is not set is undefined.
4633 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4634 /// A pointer to the contents in the error state.
4635 /// Reading from this pointer when `result_ok` is set is undefined.
4636 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4639 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4640 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4641 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4642 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4643 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4644 /// `err` or `result` depending on the state of `result_ok`.
4645 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4646 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4647 pub result_ok: bool,
4650 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4651 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4652 CResult_InvoiceFeaturesDecodeErrorZ {
4653 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4654 result: Box::into_raw(Box::new(o)),
4660 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4661 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4662 CResult_InvoiceFeaturesDecodeErrorZ {
4663 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4664 err: Box::into_raw(Box::new(e)),
4669 /// Checks if the given object is currently in the success state
4671 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4675 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4676 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4677 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4678 fn drop(&mut self) {
4680 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4681 let _ = unsafe { Box::from_raw(self.contents.result) };
4684 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4685 let _ = unsafe { Box::from_raw(self.contents.err) };
4690 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4691 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4692 let contents = if o.result_ok {
4693 let result = unsafe { o.contents.result };
4694 unsafe { o.contents.result = core::ptr::null_mut() };
4695 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4697 let err = unsafe { o.contents.err };
4698 unsafe { o.contents.err = core::ptr::null_mut(); }
4699 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4703 result_ok: o.result_ok,
4707 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4708 fn clone(&self) -> Self {
4710 Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4711 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4714 Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4715 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4721 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4722 /// but with all dynamically-allocated buffers duplicated in new buffers.
4723 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4725 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4726 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4727 /// A pointer to the contents in the success state.
4728 /// Reading from this pointer when `result_ok` is not set is undefined.
4729 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4730 /// A pointer to the contents in the error state.
4731 /// Reading from this pointer when `result_ok` is set is undefined.
4732 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4735 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4736 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4738 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4739 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4740 /// `err` or `result` depending on the state of `result_ok`.
4741 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4742 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4743 pub result_ok: bool,
4746 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4747 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4748 CResult_ChannelTypeFeaturesDecodeErrorZ {
4749 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4750 result: Box::into_raw(Box::new(o)),
4756 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4757 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4758 CResult_ChannelTypeFeaturesDecodeErrorZ {
4759 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4760 err: Box::into_raw(Box::new(e)),
4765 /// Checks if the given object is currently in the success state
4767 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4771 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4772 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4773 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4774 fn drop(&mut self) {
4776 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4777 let _ = unsafe { Box::from_raw(self.contents.result) };
4780 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4781 let _ = unsafe { Box::from_raw(self.contents.err) };
4786 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4787 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4788 let contents = if o.result_ok {
4789 let result = unsafe { o.contents.result };
4790 unsafe { o.contents.result = core::ptr::null_mut() };
4791 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4793 let err = unsafe { o.contents.err };
4794 unsafe { o.contents.err = core::ptr::null_mut(); }
4795 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4799 result_ok: o.result_ok,
4803 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4804 fn clone(&self) -> Self {
4806 Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4807 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4810 Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4811 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4817 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4818 /// but with all dynamically-allocated buffers duplicated in new buffers.
4819 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4821 /// The contents of CResult_NodeIdDecodeErrorZ
4822 pub union CResult_NodeIdDecodeErrorZPtr {
4823 /// A pointer to the contents in the success state.
4824 /// Reading from this pointer when `result_ok` is not set is undefined.
4825 pub result: *mut crate::lightning::routing::gossip::NodeId,
4826 /// A pointer to the contents in the error state.
4827 /// Reading from this pointer when `result_ok` is set is undefined.
4828 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4831 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4832 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4834 pub struct CResult_NodeIdDecodeErrorZ {
4835 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4836 /// `err` or `result` depending on the state of `result_ok`.
4837 pub contents: CResult_NodeIdDecodeErrorZPtr,
4838 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4839 pub result_ok: bool,
4842 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
4843 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
4844 CResult_NodeIdDecodeErrorZ {
4845 contents: CResult_NodeIdDecodeErrorZPtr {
4846 result: Box::into_raw(Box::new(o)),
4852 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
4853 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
4854 CResult_NodeIdDecodeErrorZ {
4855 contents: CResult_NodeIdDecodeErrorZPtr {
4856 err: Box::into_raw(Box::new(e)),
4861 /// Checks if the given object is currently in the success state
4863 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
4867 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
4868 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
4869 impl Drop for CResult_NodeIdDecodeErrorZ {
4870 fn drop(&mut self) {
4872 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4873 let _ = unsafe { Box::from_raw(self.contents.result) };
4876 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4877 let _ = unsafe { Box::from_raw(self.contents.err) };
4882 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
4883 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
4884 let contents = if o.result_ok {
4885 let result = unsafe { o.contents.result };
4886 unsafe { o.contents.result = core::ptr::null_mut() };
4887 CResult_NodeIdDecodeErrorZPtr { result }
4889 let err = unsafe { o.contents.err };
4890 unsafe { o.contents.err = core::ptr::null_mut(); }
4891 CResult_NodeIdDecodeErrorZPtr { err }
4895 result_ok: o.result_ok,
4899 impl Clone for CResult_NodeIdDecodeErrorZ {
4900 fn clone(&self) -> Self {
4902 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
4903 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
4906 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
4907 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4913 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
4914 /// but with all dynamically-allocated buffers duplicated in new buffers.
4915 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
4917 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4918 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4919 /// A pointer to the contents in the success state.
4920 /// Reading from this pointer when `result_ok` is not set is undefined.
4921 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
4922 /// A pointer to the contents in the error state.
4923 /// Reading from this pointer when `result_ok` is set is undefined.
4924 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4927 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
4928 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4930 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
4931 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
4932 /// `err` or `result` depending on the state of `result_ok`.
4933 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
4934 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
4935 pub result_ok: bool,
4938 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
4939 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4940 CResult_COption_NetworkUpdateZDecodeErrorZ {
4941 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4942 result: Box::into_raw(Box::new(o)),
4948 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
4949 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4950 CResult_COption_NetworkUpdateZDecodeErrorZ {
4951 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4952 err: Box::into_raw(Box::new(e)),
4957 /// Checks if the given object is currently in the success state
4959 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
4963 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
4964 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
4965 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
4966 fn drop(&mut self) {
4968 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4969 let _ = unsafe { Box::from_raw(self.contents.result) };
4972 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4973 let _ = unsafe { Box::from_raw(self.contents.err) };
4978 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
4979 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4980 let contents = if o.result_ok {
4981 let result = unsafe { o.contents.result };
4982 unsafe { o.contents.result = core::ptr::null_mut() };
4983 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
4985 let err = unsafe { o.contents.err };
4986 unsafe { o.contents.err = core::ptr::null_mut(); }
4987 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
4991 result_ok: o.result_ok,
4995 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
4996 fn clone(&self) -> Self {
4998 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4999 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
5002 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5003 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5009 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
5010 /// but with all dynamically-allocated buffers duplicated in new buffers.
5011 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
5013 /// An enum which can either contain a crate::lightning::chain::Access or not
5014 pub enum COption_AccessZ {
5015 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5016 Some(crate::lightning::chain::Access),
5017 /// When we're in this state, this COption_AccessZ contains nothing
5020 impl COption_AccessZ {
5021 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5022 if let Self::None = self { false } else { true }
5024 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5027 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
5028 if let Self::Some(v) = self { v } else { unreachable!() }
5032 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
5033 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
5034 COption_AccessZ::Some(o)
5037 /// Constructs a new COption_AccessZ containing nothing
5038 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
5039 COption_AccessZ::None
5042 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
5043 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
5045 /// The contents of CResult_boolLightningErrorZ
5046 pub union CResult_boolLightningErrorZPtr {
5047 /// A pointer to the contents in the success state.
5048 /// Reading from this pointer when `result_ok` is not set is undefined.
5049 pub result: *mut bool,
5050 /// A pointer to the contents in the error state.
5051 /// Reading from this pointer when `result_ok` is set is undefined.
5052 pub err: *mut crate::lightning::ln::msgs::LightningError,
5055 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
5056 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5058 pub struct CResult_boolLightningErrorZ {
5059 /// The contents of this CResult_boolLightningErrorZ, accessible via either
5060 /// `err` or `result` depending on the state of `result_ok`.
5061 pub contents: CResult_boolLightningErrorZPtr,
5062 /// Whether this CResult_boolLightningErrorZ represents a success state.
5063 pub result_ok: bool,
5066 /// Creates a new CResult_boolLightningErrorZ in the success state.
5067 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
5068 CResult_boolLightningErrorZ {
5069 contents: CResult_boolLightningErrorZPtr {
5070 result: Box::into_raw(Box::new(o)),
5076 /// Creates a new CResult_boolLightningErrorZ in the error state.
5077 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
5078 CResult_boolLightningErrorZ {
5079 contents: CResult_boolLightningErrorZPtr {
5080 err: Box::into_raw(Box::new(e)),
5085 /// Checks if the given object is currently in the success state
5087 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
5091 /// Frees any resources used by the CResult_boolLightningErrorZ.
5092 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
5093 impl Drop for CResult_boolLightningErrorZ {
5094 fn drop(&mut self) {
5096 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5097 let _ = unsafe { Box::from_raw(self.contents.result) };
5100 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5101 let _ = unsafe { Box::from_raw(self.contents.err) };
5106 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
5107 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
5108 let contents = if o.result_ok {
5109 let result = unsafe { o.contents.result };
5110 unsafe { o.contents.result = core::ptr::null_mut() };
5111 CResult_boolLightningErrorZPtr { result }
5113 let err = unsafe { o.contents.err };
5114 unsafe { o.contents.err = core::ptr::null_mut(); }
5115 CResult_boolLightningErrorZPtr { err }
5119 result_ok: o.result_ok,
5123 impl Clone for CResult_boolLightningErrorZ {
5124 fn clone(&self) -> Self {
5126 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
5127 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
5130 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
5131 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5137 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
5138 /// but with all dynamically-allocated buffers duplicated in new buffers.
5139 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
5141 /// A tuple of 3 elements. See the individual fields for the types contained.
5142 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5143 /// The element at position 0
5144 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
5145 /// The element at position 1
5146 pub b: crate::lightning::ln::msgs::ChannelUpdate,
5147 /// The element at position 2
5148 pub c: crate::lightning::ln::msgs::ChannelUpdate,
5150 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5151 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
5159 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5160 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
5161 (self.a, self.b, self.c)
5164 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5165 fn clone(&self) -> Self {
5167 a: Clone::clone(&self.a),
5168 b: Clone::clone(&self.b),
5169 c: Clone::clone(&self.c),
5174 /// Creates a new tuple which has the same data as `orig`
5175 /// but with all dynamically-allocated buffers duplicated in new buffers.
5176 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
5177 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
5179 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 {
5180 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5184 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5185 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5187 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5188 /// This corresponds to std::vector in C++
5189 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5190 /// The elements in the array.
5191 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5192 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
5193 /// The number of elements pointed to by `data`.
5196 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5197 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
5198 if self.datalen == 0 { return Vec::new(); }
5199 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5200 self.data = core::ptr::null_mut();
5204 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
5205 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5208 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5209 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
5210 let datalen = v.len();
5211 let data = Box::into_raw(v.into_boxed_slice());
5212 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5216 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5217 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5218 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5219 fn drop(&mut self) {
5220 if self.datalen == 0 { return; }
5221 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5224 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5225 fn clone(&self) -> Self {
5226 let mut res = Vec::new();
5227 if self.datalen == 0 { return Self::from(res); }
5228 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5233 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5234 /// This corresponds to std::vector in C++
5235 pub struct CVec_NodeAnnouncementZ {
5236 /// The elements in the array.
5237 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5238 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
5239 /// The number of elements pointed to by `data`.
5242 impl CVec_NodeAnnouncementZ {
5243 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
5244 if self.datalen == 0 { return Vec::new(); }
5245 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5246 self.data = core::ptr::null_mut();
5250 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
5251 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5254 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
5255 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
5256 let datalen = v.len();
5257 let data = Box::into_raw(v.into_boxed_slice());
5258 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5262 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5263 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
5264 impl Drop for CVec_NodeAnnouncementZ {
5265 fn drop(&mut self) {
5266 if self.datalen == 0 { return; }
5267 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5270 impl Clone for CVec_NodeAnnouncementZ {
5271 fn clone(&self) -> Self {
5272 let mut res = Vec::new();
5273 if self.datalen == 0 { return Self::from(res); }
5274 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5279 /// The contents of CResult_NoneLightningErrorZ
5280 pub union CResult_NoneLightningErrorZPtr {
5281 /// Note that this value is always NULL, as there are no contents in the OK variant
5282 pub result: *mut core::ffi::c_void,
5283 /// A pointer to the contents in the error state.
5284 /// Reading from this pointer when `result_ok` is set is undefined.
5285 pub err: *mut crate::lightning::ln::msgs::LightningError,
5288 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5289 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5290 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5291 pub struct CResult_NoneLightningErrorZ {
5292 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5293 /// `err` or `result` depending on the state of `result_ok`.
5294 pub contents: CResult_NoneLightningErrorZPtr,
5295 /// Whether this CResult_NoneLightningErrorZ represents a success state.
5296 pub result_ok: bool,
5299 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5300 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5301 CResult_NoneLightningErrorZ {
5302 contents: CResult_NoneLightningErrorZPtr {
5303 result: core::ptr::null_mut(),
5309 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5310 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5311 CResult_NoneLightningErrorZ {
5312 contents: CResult_NoneLightningErrorZPtr {
5313 err: Box::into_raw(Box::new(e)),
5318 /// Checks if the given object is currently in the success state
5320 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5324 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5325 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5326 impl Drop for CResult_NoneLightningErrorZ {
5327 fn drop(&mut self) {
5330 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5331 let _ = unsafe { Box::from_raw(self.contents.err) };
5336 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5337 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5338 let contents = if o.result_ok {
5339 let _ = unsafe { Box::from_raw(o.contents.result) };
5340 o.contents.result = core::ptr::null_mut();
5341 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5343 let err = unsafe { o.contents.err };
5344 unsafe { o.contents.err = core::ptr::null_mut(); }
5345 CResult_NoneLightningErrorZPtr { err }
5349 result_ok: o.result_ok,
5353 impl Clone for CResult_NoneLightningErrorZ {
5354 fn clone(&self) -> Self {
5356 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5357 result: core::ptr::null_mut()
5360 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5361 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5367 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5368 /// but with all dynamically-allocated buffers duplicated in new buffers.
5369 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5371 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5372 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5373 /// A pointer to the contents in the success state.
5374 /// Reading from this pointer when `result_ok` is not set is undefined.
5375 pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5376 /// A pointer to the contents in the error state.
5377 /// Reading from this pointer when `result_ok` is set is undefined.
5378 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5381 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5382 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5384 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5385 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5386 /// `err` or `result` depending on the state of `result_ok`.
5387 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5388 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5389 pub result_ok: bool,
5392 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5393 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5394 CResult_ChannelUpdateInfoDecodeErrorZ {
5395 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5396 result: Box::into_raw(Box::new(o)),
5402 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5403 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5404 CResult_ChannelUpdateInfoDecodeErrorZ {
5405 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5406 err: Box::into_raw(Box::new(e)),
5411 /// Checks if the given object is currently in the success state
5413 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5417 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5418 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5419 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5420 fn drop(&mut self) {
5422 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5423 let _ = unsafe { Box::from_raw(self.contents.result) };
5426 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5427 let _ = unsafe { Box::from_raw(self.contents.err) };
5432 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5433 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5434 let contents = if o.result_ok {
5435 let result = unsafe { o.contents.result };
5436 unsafe { o.contents.result = core::ptr::null_mut() };
5437 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5439 let err = unsafe { o.contents.err };
5440 unsafe { o.contents.err = core::ptr::null_mut(); }
5441 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5445 result_ok: o.result_ok,
5449 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5450 fn clone(&self) -> Self {
5452 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5453 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5456 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5457 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5463 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5464 /// but with all dynamically-allocated buffers duplicated in new buffers.
5465 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5467 /// The contents of CResult_ChannelInfoDecodeErrorZ
5468 pub union CResult_ChannelInfoDecodeErrorZPtr {
5469 /// A pointer to the contents in the success state.
5470 /// Reading from this pointer when `result_ok` is not set is undefined.
5471 pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5472 /// A pointer to the contents in the error state.
5473 /// Reading from this pointer when `result_ok` is set is undefined.
5474 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5477 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5478 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5479 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5480 pub struct CResult_ChannelInfoDecodeErrorZ {
5481 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5482 /// `err` or `result` depending on the state of `result_ok`.
5483 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5484 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5485 pub result_ok: bool,
5488 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5489 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5490 CResult_ChannelInfoDecodeErrorZ {
5491 contents: CResult_ChannelInfoDecodeErrorZPtr {
5492 result: Box::into_raw(Box::new(o)),
5498 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5499 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5500 CResult_ChannelInfoDecodeErrorZ {
5501 contents: CResult_ChannelInfoDecodeErrorZPtr {
5502 err: Box::into_raw(Box::new(e)),
5507 /// Checks if the given object is currently in the success state
5509 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5513 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5514 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5515 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5516 fn drop(&mut self) {
5518 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5519 let _ = unsafe { Box::from_raw(self.contents.result) };
5522 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5523 let _ = unsafe { Box::from_raw(self.contents.err) };
5528 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5529 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5530 let contents = if o.result_ok {
5531 let result = unsafe { o.contents.result };
5532 unsafe { o.contents.result = core::ptr::null_mut() };
5533 CResult_ChannelInfoDecodeErrorZPtr { result }
5535 let err = unsafe { o.contents.err };
5536 unsafe { o.contents.err = core::ptr::null_mut(); }
5537 CResult_ChannelInfoDecodeErrorZPtr { err }
5541 result_ok: o.result_ok,
5545 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5546 fn clone(&self) -> Self {
5548 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5549 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5552 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5553 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5559 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5560 /// but with all dynamically-allocated buffers duplicated in new buffers.
5561 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5563 /// The contents of CResult_RoutingFeesDecodeErrorZ
5564 pub union CResult_RoutingFeesDecodeErrorZPtr {
5565 /// A pointer to the contents in the success state.
5566 /// Reading from this pointer when `result_ok` is not set is undefined.
5567 pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5568 /// A pointer to the contents in the error state.
5569 /// Reading from this pointer when `result_ok` is set is undefined.
5570 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5573 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5574 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5576 pub struct CResult_RoutingFeesDecodeErrorZ {
5577 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5578 /// `err` or `result` depending on the state of `result_ok`.
5579 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5580 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5581 pub result_ok: bool,
5584 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5585 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5586 CResult_RoutingFeesDecodeErrorZ {
5587 contents: CResult_RoutingFeesDecodeErrorZPtr {
5588 result: Box::into_raw(Box::new(o)),
5594 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5595 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5596 CResult_RoutingFeesDecodeErrorZ {
5597 contents: CResult_RoutingFeesDecodeErrorZPtr {
5598 err: Box::into_raw(Box::new(e)),
5603 /// Checks if the given object is currently in the success state
5605 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5609 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5610 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5611 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5612 fn drop(&mut self) {
5614 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5615 let _ = unsafe { Box::from_raw(self.contents.result) };
5618 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5619 let _ = unsafe { Box::from_raw(self.contents.err) };
5624 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5625 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5626 let contents = if o.result_ok {
5627 let result = unsafe { o.contents.result };
5628 unsafe { o.contents.result = core::ptr::null_mut() };
5629 CResult_RoutingFeesDecodeErrorZPtr { result }
5631 let err = unsafe { o.contents.err };
5632 unsafe { o.contents.err = core::ptr::null_mut(); }
5633 CResult_RoutingFeesDecodeErrorZPtr { err }
5637 result_ok: o.result_ok,
5641 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5642 fn clone(&self) -> Self {
5644 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5645 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5648 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5649 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5655 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5656 /// but with all dynamically-allocated buffers duplicated in new buffers.
5657 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5659 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5660 /// This corresponds to std::vector in C++
5661 pub struct CVec_NetAddressZ {
5662 /// The elements in the array.
5663 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5664 pub data: *mut crate::lightning::ln::msgs::NetAddress,
5665 /// The number of elements pointed to by `data`.
5668 impl CVec_NetAddressZ {
5669 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5670 if self.datalen == 0 { return Vec::new(); }
5671 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5672 self.data = core::ptr::null_mut();
5676 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5677 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5680 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5681 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5682 let datalen = v.len();
5683 let data = Box::into_raw(v.into_boxed_slice());
5684 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5688 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5689 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5690 impl Drop for CVec_NetAddressZ {
5691 fn drop(&mut self) {
5692 if self.datalen == 0 { return; }
5693 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5696 impl Clone for CVec_NetAddressZ {
5697 fn clone(&self) -> Self {
5698 let mut res = Vec::new();
5699 if self.datalen == 0 { return Self::from(res); }
5700 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5705 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5706 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5707 /// A pointer to the contents in the success state.
5708 /// Reading from this pointer when `result_ok` is not set is undefined.
5709 pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5710 /// A pointer to the contents in the error state.
5711 /// Reading from this pointer when `result_ok` is set is undefined.
5712 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5715 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5716 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5718 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5719 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5720 /// `err` or `result` depending on the state of `result_ok`.
5721 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5722 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5723 pub result_ok: bool,
5726 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5727 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5728 CResult_NodeAnnouncementInfoDecodeErrorZ {
5729 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5730 result: Box::into_raw(Box::new(o)),
5736 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5737 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5738 CResult_NodeAnnouncementInfoDecodeErrorZ {
5739 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5740 err: Box::into_raw(Box::new(e)),
5745 /// Checks if the given object is currently in the success state
5747 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5751 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5752 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5753 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5754 fn drop(&mut self) {
5756 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5757 let _ = unsafe { Box::from_raw(self.contents.result) };
5760 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5761 let _ = unsafe { Box::from_raw(self.contents.err) };
5766 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5767 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5768 let contents = if o.result_ok {
5769 let result = unsafe { o.contents.result };
5770 unsafe { o.contents.result = core::ptr::null_mut() };
5771 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5773 let err = unsafe { o.contents.err };
5774 unsafe { o.contents.err = core::ptr::null_mut(); }
5775 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5779 result_ok: o.result_ok,
5783 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5784 fn clone(&self) -> Self {
5786 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5787 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5790 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5791 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5797 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5798 /// but with all dynamically-allocated buffers duplicated in new buffers.
5799 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5801 /// The contents of CResult_NodeAliasDecodeErrorZ
5802 pub union CResult_NodeAliasDecodeErrorZPtr {
5803 /// A pointer to the contents in the success state.
5804 /// Reading from this pointer when `result_ok` is not set is undefined.
5805 pub result: *mut crate::lightning::routing::gossip::NodeAlias,
5806 /// A pointer to the contents in the error state.
5807 /// Reading from this pointer when `result_ok` is set is undefined.
5808 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5811 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
5812 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
5813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5814 pub struct CResult_NodeAliasDecodeErrorZ {
5815 /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
5816 /// `err` or `result` depending on the state of `result_ok`.
5817 pub contents: CResult_NodeAliasDecodeErrorZPtr,
5818 /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
5819 pub result_ok: bool,
5822 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
5823 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
5824 CResult_NodeAliasDecodeErrorZ {
5825 contents: CResult_NodeAliasDecodeErrorZPtr {
5826 result: Box::into_raw(Box::new(o)),
5832 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
5833 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
5834 CResult_NodeAliasDecodeErrorZ {
5835 contents: CResult_NodeAliasDecodeErrorZPtr {
5836 err: Box::into_raw(Box::new(e)),
5841 /// Checks if the given object is currently in the success state
5843 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
5847 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
5848 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
5849 impl Drop for CResult_NodeAliasDecodeErrorZ {
5850 fn drop(&mut self) {
5852 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5853 let _ = unsafe { Box::from_raw(self.contents.result) };
5856 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5857 let _ = unsafe { Box::from_raw(self.contents.err) };
5862 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
5863 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
5864 let contents = if o.result_ok {
5865 let result = unsafe { o.contents.result };
5866 unsafe { o.contents.result = core::ptr::null_mut() };
5867 CResult_NodeAliasDecodeErrorZPtr { result }
5869 let err = unsafe { o.contents.err };
5870 unsafe { o.contents.err = core::ptr::null_mut(); }
5871 CResult_NodeAliasDecodeErrorZPtr { err }
5875 result_ok: o.result_ok,
5879 impl Clone for CResult_NodeAliasDecodeErrorZ {
5880 fn clone(&self) -> Self {
5882 Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
5883 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
5886 Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
5887 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5893 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
5894 /// but with all dynamically-allocated buffers duplicated in new buffers.
5895 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
5897 /// The contents of CResult_NodeInfoDecodeErrorZ
5898 pub union CResult_NodeInfoDecodeErrorZPtr {
5899 /// A pointer to the contents in the success state.
5900 /// Reading from this pointer when `result_ok` is not set is undefined.
5901 pub result: *mut crate::lightning::routing::gossip::NodeInfo,
5902 /// A pointer to the contents in the error state.
5903 /// Reading from this pointer when `result_ok` is set is undefined.
5904 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5907 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5908 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5909 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5910 pub struct CResult_NodeInfoDecodeErrorZ {
5911 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5912 /// `err` or `result` depending on the state of `result_ok`.
5913 pub contents: CResult_NodeInfoDecodeErrorZPtr,
5914 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5915 pub result_ok: bool,
5918 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5919 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5920 CResult_NodeInfoDecodeErrorZ {
5921 contents: CResult_NodeInfoDecodeErrorZPtr {
5922 result: Box::into_raw(Box::new(o)),
5928 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5929 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5930 CResult_NodeInfoDecodeErrorZ {
5931 contents: CResult_NodeInfoDecodeErrorZPtr {
5932 err: Box::into_raw(Box::new(e)),
5937 /// Checks if the given object is currently in the success state
5939 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
5943 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5944 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5945 impl Drop for CResult_NodeInfoDecodeErrorZ {
5946 fn drop(&mut self) {
5948 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5949 let _ = unsafe { Box::from_raw(self.contents.result) };
5952 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5953 let _ = unsafe { Box::from_raw(self.contents.err) };
5958 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5959 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5960 let contents = if o.result_ok {
5961 let result = unsafe { o.contents.result };
5962 unsafe { o.contents.result = core::ptr::null_mut() };
5963 CResult_NodeInfoDecodeErrorZPtr { result }
5965 let err = unsafe { o.contents.err };
5966 unsafe { o.contents.err = core::ptr::null_mut(); }
5967 CResult_NodeInfoDecodeErrorZPtr { err }
5971 result_ok: o.result_ok,
5975 impl Clone for CResult_NodeInfoDecodeErrorZ {
5976 fn clone(&self) -> Self {
5978 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5979 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
5982 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5983 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5989 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5990 /// but with all dynamically-allocated buffers duplicated in new buffers.
5991 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
5993 /// The contents of CResult_NetworkGraphDecodeErrorZ
5994 pub union CResult_NetworkGraphDecodeErrorZPtr {
5995 /// A pointer to the contents in the success state.
5996 /// Reading from this pointer when `result_ok` is not set is undefined.
5997 pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
5998 /// A pointer to the contents in the error state.
5999 /// Reading from this pointer when `result_ok` is set is undefined.
6000 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6003 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6004 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6006 pub struct CResult_NetworkGraphDecodeErrorZ {
6007 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6008 /// `err` or `result` depending on the state of `result_ok`.
6009 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
6010 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6011 pub result_ok: bool,
6014 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
6015 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
6016 CResult_NetworkGraphDecodeErrorZ {
6017 contents: CResult_NetworkGraphDecodeErrorZPtr {
6018 result: Box::into_raw(Box::new(o)),
6024 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
6025 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
6026 CResult_NetworkGraphDecodeErrorZ {
6027 contents: CResult_NetworkGraphDecodeErrorZPtr {
6028 err: Box::into_raw(Box::new(e)),
6033 /// Checks if the given object is currently in the success state
6035 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
6039 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
6040 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
6041 impl Drop for CResult_NetworkGraphDecodeErrorZ {
6042 fn drop(&mut self) {
6044 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6045 let _ = unsafe { Box::from_raw(self.contents.result) };
6048 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6049 let _ = unsafe { Box::from_raw(self.contents.err) };
6054 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
6055 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
6056 let contents = if o.result_ok {
6057 let result = unsafe { o.contents.result };
6058 unsafe { o.contents.result = core::ptr::null_mut() };
6059 CResult_NetworkGraphDecodeErrorZPtr { result }
6061 let err = unsafe { o.contents.err };
6062 unsafe { o.contents.err = core::ptr::null_mut(); }
6063 CResult_NetworkGraphDecodeErrorZPtr { err }
6067 result_ok: o.result_ok,
6073 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6074 pub enum COption_CVec_NetAddressZZ {
6075 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6076 Some(crate::c_types::derived::CVec_NetAddressZ),
6077 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6080 impl COption_CVec_NetAddressZZ {
6081 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6082 if let Self::None = self { false } else { true }
6084 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6087 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
6088 if let Self::Some(v) = self { v } else { unreachable!() }
6092 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
6093 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
6094 COption_CVec_NetAddressZZ::Some(o)
6097 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
6098 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
6099 COption_CVec_NetAddressZZ::None
6102 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
6103 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
6105 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
6106 /// but with all dynamically-allocated buffers duplicated in new buffers.
6107 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
6109 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6110 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6111 /// A pointer to the contents in the success state.
6112 /// Reading from this pointer when `result_ok` is not set is undefined.
6113 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
6114 /// A pointer to the contents in the error state.
6115 /// Reading from this pointer when `result_ok` is set is undefined.
6116 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6119 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6120 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6121 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6122 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6123 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6124 /// `err` or `result` depending on the state of `result_ok`.
6125 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
6126 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6127 pub result_ok: bool,
6130 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
6131 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6132 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6133 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6134 result: Box::into_raw(Box::new(o)),
6140 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6141 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6142 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6143 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6144 err: Box::into_raw(Box::new(e)),
6149 /// Checks if the given object is currently in the success state
6151 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6155 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6156 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6157 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6158 fn drop(&mut self) {
6160 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6161 let _ = unsafe { Box::from_raw(self.contents.result) };
6164 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6165 let _ = unsafe { Box::from_raw(self.contents.err) };
6170 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6171 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6172 let contents = if o.result_ok {
6173 let result = unsafe { o.contents.result };
6174 unsafe { o.contents.result = core::ptr::null_mut() };
6175 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6177 let err = unsafe { o.contents.err };
6178 unsafe { o.contents.err = core::ptr::null_mut(); }
6179 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6183 result_ok: o.result_ok,
6187 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6188 fn clone(&self) -> Self {
6190 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6191 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6194 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6195 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6201 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6202 /// but with all dynamically-allocated buffers duplicated in new buffers.
6203 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6205 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6206 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6207 /// A pointer to the contents in the success state.
6208 /// Reading from this pointer when `result_ok` is not set is undefined.
6209 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6210 /// A pointer to the contents in the error state.
6211 /// Reading from this pointer when `result_ok` is set is undefined.
6212 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6215 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6216 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6217 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6218 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6219 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6220 /// `err` or `result` depending on the state of `result_ok`.
6221 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6222 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6223 pub result_ok: bool,
6226 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6227 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6228 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6229 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6230 result: Box::into_raw(Box::new(o)),
6236 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6237 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6238 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6239 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6240 err: Box::into_raw(Box::new(e)),
6245 /// Checks if the given object is currently in the success state
6247 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6251 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6252 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6253 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6254 fn drop(&mut self) {
6256 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6257 let _ = unsafe { Box::from_raw(self.contents.result) };
6260 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6261 let _ = unsafe { Box::from_raw(self.contents.err) };
6266 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6267 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6268 let contents = if o.result_ok {
6269 let result = unsafe { o.contents.result };
6270 unsafe { o.contents.result = core::ptr::null_mut() };
6271 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6273 let err = unsafe { o.contents.err };
6274 unsafe { o.contents.err = core::ptr::null_mut(); }
6275 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6279 result_ok: o.result_ok,
6283 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6284 fn clone(&self) -> Self {
6286 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6287 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6290 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6291 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6297 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6298 /// but with all dynamically-allocated buffers duplicated in new buffers.
6299 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6301 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6302 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6303 /// A pointer to the contents in the success state.
6304 /// Reading from this pointer when `result_ok` is not set is undefined.
6305 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6306 /// A pointer to the contents in the error state.
6307 /// Reading from this pointer when `result_ok` is set is undefined.
6308 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6311 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6312 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6313 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6314 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6315 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6316 /// `err` or `result` depending on the state of `result_ok`.
6317 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6318 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6319 pub result_ok: bool,
6322 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6323 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6324 CResult_SpendableOutputDescriptorDecodeErrorZ {
6325 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6326 result: Box::into_raw(Box::new(o)),
6332 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6333 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6334 CResult_SpendableOutputDescriptorDecodeErrorZ {
6335 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6336 err: Box::into_raw(Box::new(e)),
6341 /// Checks if the given object is currently in the success state
6343 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6347 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6348 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6349 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6350 fn drop(&mut self) {
6352 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6353 let _ = unsafe { Box::from_raw(self.contents.result) };
6356 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6357 let _ = unsafe { Box::from_raw(self.contents.err) };
6362 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6363 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6364 let contents = if o.result_ok {
6365 let result = unsafe { o.contents.result };
6366 unsafe { o.contents.result = core::ptr::null_mut() };
6367 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6369 let err = unsafe { o.contents.err };
6370 unsafe { o.contents.err = core::ptr::null_mut(); }
6371 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6375 result_ok: o.result_ok,
6379 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6380 fn clone(&self) -> Self {
6382 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6383 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6386 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6387 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6393 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6394 /// but with all dynamically-allocated buffers duplicated in new buffers.
6395 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6397 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6398 /// This corresponds to std::vector in C++
6399 pub struct CVec_PaymentPreimageZ {
6400 /// The elements in the array.
6401 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6402 pub data: *mut crate::c_types::ThirtyTwoBytes,
6403 /// The number of elements pointed to by `data`.
6406 impl CVec_PaymentPreimageZ {
6407 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6408 if self.datalen == 0 { return Vec::new(); }
6409 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6410 self.data = core::ptr::null_mut();
6414 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6415 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6418 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6419 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6420 let datalen = v.len();
6421 let data = Box::into_raw(v.into_boxed_slice());
6422 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6426 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6427 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6428 impl Drop for CVec_PaymentPreimageZ {
6429 fn drop(&mut self) {
6430 if self.datalen == 0 { return; }
6431 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6434 impl Clone for CVec_PaymentPreimageZ {
6435 fn clone(&self) -> Self {
6436 let mut res = Vec::new();
6437 if self.datalen == 0 { return Self::from(res); }
6438 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6443 /// A tuple of 2 elements. See the individual fields for the types contained.
6444 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6445 /// The element at position 0
6446 pub a: crate::c_types::Signature,
6447 /// The element at position 1
6448 pub b: crate::c_types::derived::CVec_SignatureZ,
6450 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6451 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6458 impl C2Tuple_SignatureCVec_SignatureZZ {
6459 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6463 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6464 fn clone(&self) -> Self {
6466 a: Clone::clone(&self.a),
6467 b: Clone::clone(&self.b),
6472 /// Creates a new tuple which has the same data as `orig`
6473 /// but with all dynamically-allocated buffers duplicated in new buffers.
6474 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6475 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6477 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6478 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6482 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6483 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6485 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6486 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6487 /// A pointer to the contents in the success state.
6488 /// Reading from this pointer when `result_ok` is not set is undefined.
6489 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6490 /// Note that this value is always NULL, as there are no contents in the Err variant
6491 pub err: *mut core::ffi::c_void,
6494 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6495 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6497 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6498 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6499 /// `err` or `result` depending on the state of `result_ok`.
6500 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6501 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6502 pub result_ok: bool,
6505 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6506 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6507 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6508 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6509 result: Box::into_raw(Box::new(o)),
6515 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6516 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6517 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6518 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6519 err: core::ptr::null_mut(),
6524 /// Checks if the given object is currently in the success state
6526 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6530 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6531 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6532 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6533 fn drop(&mut self) {
6535 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6536 let _ = unsafe { Box::from_raw(self.contents.result) };
6542 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6543 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6544 let contents = if o.result_ok {
6545 let result = unsafe { o.contents.result };
6546 unsafe { o.contents.result = core::ptr::null_mut() };
6547 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6549 let _ = unsafe { Box::from_raw(o.contents.err) };
6550 o.contents.err = core::ptr::null_mut();
6551 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6555 result_ok: o.result_ok,
6559 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6560 fn clone(&self) -> Self {
6562 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6563 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6566 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6567 err: core::ptr::null_mut()
6573 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6574 /// but with all dynamically-allocated buffers duplicated in new buffers.
6575 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6577 /// The contents of CResult_SignatureNoneZ
6578 pub union CResult_SignatureNoneZPtr {
6579 /// A pointer to the contents in the success state.
6580 /// Reading from this pointer when `result_ok` is not set is undefined.
6581 pub result: *mut crate::c_types::Signature,
6582 /// Note that this value is always NULL, as there are no contents in the Err variant
6583 pub err: *mut core::ffi::c_void,
6586 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6587 /// containing a crate::c_types::Signature on success and a () on failure.
6588 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6589 pub struct CResult_SignatureNoneZ {
6590 /// The contents of this CResult_SignatureNoneZ, accessible via either
6591 /// `err` or `result` depending on the state of `result_ok`.
6592 pub contents: CResult_SignatureNoneZPtr,
6593 /// Whether this CResult_SignatureNoneZ represents a success state.
6594 pub result_ok: bool,
6597 /// Creates a new CResult_SignatureNoneZ in the success state.
6598 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6599 CResult_SignatureNoneZ {
6600 contents: CResult_SignatureNoneZPtr {
6601 result: Box::into_raw(Box::new(o)),
6607 /// Creates a new CResult_SignatureNoneZ in the error state.
6608 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6609 CResult_SignatureNoneZ {
6610 contents: CResult_SignatureNoneZPtr {
6611 err: core::ptr::null_mut(),
6616 /// Checks if the given object is currently in the success state
6618 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6622 /// Frees any resources used by the CResult_SignatureNoneZ.
6623 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6624 impl Drop for CResult_SignatureNoneZ {
6625 fn drop(&mut self) {
6627 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6628 let _ = unsafe { Box::from_raw(self.contents.result) };
6634 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6635 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6636 let contents = if o.result_ok {
6637 let result = unsafe { o.contents.result };
6638 unsafe { o.contents.result = core::ptr::null_mut() };
6639 CResult_SignatureNoneZPtr { result }
6641 let _ = unsafe { Box::from_raw(o.contents.err) };
6642 o.contents.err = core::ptr::null_mut();
6643 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6647 result_ok: o.result_ok,
6651 impl Clone for CResult_SignatureNoneZ {
6652 fn clone(&self) -> Self {
6654 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6655 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6658 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6659 err: core::ptr::null_mut()
6665 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6666 /// but with all dynamically-allocated buffers duplicated in new buffers.
6667 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6669 /// A tuple of 2 elements. See the individual fields for the types contained.
6670 pub struct C2Tuple_SignatureSignatureZ {
6671 /// The element at position 0
6672 pub a: crate::c_types::Signature,
6673 /// The element at position 1
6674 pub b: crate::c_types::Signature,
6676 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6677 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6684 impl C2Tuple_SignatureSignatureZ {
6685 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6689 impl Clone for C2Tuple_SignatureSignatureZ {
6690 fn clone(&self) -> Self {
6692 a: Clone::clone(&self.a),
6693 b: Clone::clone(&self.b),
6698 /// Creates a new tuple which has the same data as `orig`
6699 /// but with all dynamically-allocated buffers duplicated in new buffers.
6700 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6701 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6703 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6704 C2Tuple_SignatureSignatureZ { a, b, }
6708 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6709 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6711 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6712 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6713 /// A pointer to the contents in the success state.
6714 /// Reading from this pointer when `result_ok` is not set is undefined.
6715 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6716 /// Note that this value is always NULL, as there are no contents in the Err variant
6717 pub err: *mut core::ffi::c_void,
6720 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6721 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6723 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6724 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6725 /// `err` or `result` depending on the state of `result_ok`.
6726 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6727 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6728 pub result_ok: bool,
6731 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6732 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6733 CResult_C2Tuple_SignatureSignatureZNoneZ {
6734 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6735 result: Box::into_raw(Box::new(o)),
6741 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6742 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6743 CResult_C2Tuple_SignatureSignatureZNoneZ {
6744 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6745 err: core::ptr::null_mut(),
6750 /// Checks if the given object is currently in the success state
6752 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6756 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6757 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6758 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
6759 fn drop(&mut self) {
6761 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6762 let _ = unsafe { Box::from_raw(self.contents.result) };
6768 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6769 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
6770 let contents = if o.result_ok {
6771 let result = unsafe { o.contents.result };
6772 unsafe { o.contents.result = core::ptr::null_mut() };
6773 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
6775 let _ = unsafe { Box::from_raw(o.contents.err) };
6776 o.contents.err = core::ptr::null_mut();
6777 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6781 result_ok: o.result_ok,
6785 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6786 fn clone(&self) -> Self {
6788 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6789 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6792 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6793 err: core::ptr::null_mut()
6799 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6800 /// but with all dynamically-allocated buffers duplicated in new buffers.
6801 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6803 /// The contents of CResult_SecretKeyNoneZ
6804 pub union CResult_SecretKeyNoneZPtr {
6805 /// A pointer to the contents in the success state.
6806 /// Reading from this pointer when `result_ok` is not set is undefined.
6807 pub result: *mut crate::c_types::SecretKey,
6808 /// Note that this value is always NULL, as there are no contents in the Err variant
6809 pub err: *mut core::ffi::c_void,
6812 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6813 /// containing a crate::c_types::SecretKey on success and a () on failure.
6814 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6815 pub struct CResult_SecretKeyNoneZ {
6816 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6817 /// `err` or `result` depending on the state of `result_ok`.
6818 pub contents: CResult_SecretKeyNoneZPtr,
6819 /// Whether this CResult_SecretKeyNoneZ represents a success state.
6820 pub result_ok: bool,
6823 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6824 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6825 CResult_SecretKeyNoneZ {
6826 contents: CResult_SecretKeyNoneZPtr {
6827 result: Box::into_raw(Box::new(o)),
6833 /// Creates a new CResult_SecretKeyNoneZ in the error state.
6834 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
6835 CResult_SecretKeyNoneZ {
6836 contents: CResult_SecretKeyNoneZPtr {
6837 err: core::ptr::null_mut(),
6842 /// Checks if the given object is currently in the success state
6844 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
6848 /// Frees any resources used by the CResult_SecretKeyNoneZ.
6849 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
6850 impl Drop for CResult_SecretKeyNoneZ {
6851 fn drop(&mut self) {
6853 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6854 let _ = unsafe { Box::from_raw(self.contents.result) };
6860 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
6861 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
6862 let contents = if o.result_ok {
6863 let result = unsafe { o.contents.result };
6864 unsafe { o.contents.result = core::ptr::null_mut() };
6865 CResult_SecretKeyNoneZPtr { result }
6867 let _ = unsafe { Box::from_raw(o.contents.err) };
6868 o.contents.err = core::ptr::null_mut();
6869 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
6873 result_ok: o.result_ok,
6877 impl Clone for CResult_SecretKeyNoneZ {
6878 fn clone(&self) -> Self {
6880 Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
6881 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
6884 Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
6885 err: core::ptr::null_mut()
6891 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
6892 /// but with all dynamically-allocated buffers duplicated in new buffers.
6893 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
6895 /// The contents of CResult_SignDecodeErrorZ
6896 pub union CResult_SignDecodeErrorZPtr {
6897 /// A pointer to the contents in the success state.
6898 /// Reading from this pointer when `result_ok` is not set is undefined.
6899 pub result: *mut crate::lightning::chain::keysinterface::Sign,
6900 /// A pointer to the contents in the error state.
6901 /// Reading from this pointer when `result_ok` is set is undefined.
6902 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6905 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6906 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6907 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6908 pub struct CResult_SignDecodeErrorZ {
6909 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
6910 /// `err` or `result` depending on the state of `result_ok`.
6911 pub contents: CResult_SignDecodeErrorZPtr,
6912 /// Whether this CResult_SignDecodeErrorZ represents a success state.
6913 pub result_ok: bool,
6916 /// Creates a new CResult_SignDecodeErrorZ in the success state.
6917 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
6918 CResult_SignDecodeErrorZ {
6919 contents: CResult_SignDecodeErrorZPtr {
6920 result: Box::into_raw(Box::new(o)),
6926 /// Creates a new CResult_SignDecodeErrorZ in the error state.
6927 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
6928 CResult_SignDecodeErrorZ {
6929 contents: CResult_SignDecodeErrorZPtr {
6930 err: Box::into_raw(Box::new(e)),
6935 /// Checks if the given object is currently in the success state
6937 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
6941 /// Frees any resources used by the CResult_SignDecodeErrorZ.
6942 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
6943 impl Drop for CResult_SignDecodeErrorZ {
6944 fn drop(&mut self) {
6946 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6947 let _ = unsafe { Box::from_raw(self.contents.result) };
6950 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6951 let _ = unsafe { Box::from_raw(self.contents.err) };
6956 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
6957 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
6958 let contents = if o.result_ok {
6959 let result = unsafe { o.contents.result };
6960 unsafe { o.contents.result = core::ptr::null_mut() };
6961 CResult_SignDecodeErrorZPtr { result }
6963 let err = unsafe { o.contents.err };
6964 unsafe { o.contents.err = core::ptr::null_mut(); }
6965 CResult_SignDecodeErrorZPtr { err }
6969 result_ok: o.result_ok,
6973 impl Clone for CResult_SignDecodeErrorZ {
6974 fn clone(&self) -> Self {
6976 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
6977 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
6980 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
6981 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6987 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
6988 /// but with all dynamically-allocated buffers duplicated in new buffers.
6989 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
6991 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6992 /// This corresponds to std::vector in C++
6993 pub struct CVec_u5Z {
6994 /// The elements in the array.
6995 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6996 pub data: *mut crate::c_types::u5,
6997 /// The number of elements pointed to by `data`.
7001 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
7002 if self.datalen == 0 { return Vec::new(); }
7003 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7004 self.data = core::ptr::null_mut();
7008 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
7009 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7012 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
7013 fn from(v: Vec<crate::c_types::u5>) -> Self {
7014 let datalen = v.len();
7015 let data = Box::into_raw(v.into_boxed_slice());
7016 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7020 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7021 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
7022 impl Drop for CVec_u5Z {
7023 fn drop(&mut self) {
7024 if self.datalen == 0 { return; }
7025 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7028 impl Clone for CVec_u5Z {
7029 fn clone(&self) -> Self {
7030 let mut res = Vec::new();
7031 if self.datalen == 0 { return Self::from(res); }
7032 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7037 /// The contents of CResult_RecoverableSignatureNoneZ
7038 pub union CResult_RecoverableSignatureNoneZPtr {
7039 /// A pointer to the contents in the success state.
7040 /// Reading from this pointer when `result_ok` is not set is undefined.
7041 pub result: *mut crate::c_types::RecoverableSignature,
7042 /// Note that this value is always NULL, as there are no contents in the Err variant
7043 pub err: *mut core::ffi::c_void,
7046 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7047 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
7048 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7049 pub struct CResult_RecoverableSignatureNoneZ {
7050 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7051 /// `err` or `result` depending on the state of `result_ok`.
7052 pub contents: CResult_RecoverableSignatureNoneZPtr,
7053 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7054 pub result_ok: bool,
7057 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
7058 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
7059 CResult_RecoverableSignatureNoneZ {
7060 contents: CResult_RecoverableSignatureNoneZPtr {
7061 result: Box::into_raw(Box::new(o)),
7067 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
7068 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
7069 CResult_RecoverableSignatureNoneZ {
7070 contents: CResult_RecoverableSignatureNoneZPtr {
7071 err: core::ptr::null_mut(),
7076 /// Checks if the given object is currently in the success state
7078 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
7082 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
7083 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
7084 impl Drop for CResult_RecoverableSignatureNoneZ {
7085 fn drop(&mut self) {
7087 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7088 let _ = unsafe { Box::from_raw(self.contents.result) };
7094 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
7095 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
7096 let contents = if o.result_ok {
7097 let result = unsafe { o.contents.result };
7098 unsafe { o.contents.result = core::ptr::null_mut() };
7099 CResult_RecoverableSignatureNoneZPtr { result }
7101 let _ = unsafe { Box::from_raw(o.contents.err) };
7102 o.contents.err = core::ptr::null_mut();
7103 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
7107 result_ok: o.result_ok,
7111 impl Clone for CResult_RecoverableSignatureNoneZ {
7112 fn clone(&self) -> Self {
7114 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
7115 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
7118 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
7119 err: core::ptr::null_mut()
7125 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
7126 /// but with all dynamically-allocated buffers duplicated in new buffers.
7127 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
7129 /// A dynamically-allocated array of u8s of arbitrary size.
7130 /// This corresponds to std::vector in C++
7131 pub struct CVec_u8Z {
7132 /// The elements in the array.
7133 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7135 /// The number of elements pointed to by `data`.
7139 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
7140 if self.datalen == 0 { return Vec::new(); }
7141 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7142 self.data = core::ptr::null_mut();
7146 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
7147 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7150 impl From<Vec<u8>> for CVec_u8Z {
7151 fn from(v: Vec<u8>) -> Self {
7152 let datalen = v.len();
7153 let data = Box::into_raw(v.into_boxed_slice());
7154 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7158 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7159 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
7160 impl Drop for CVec_u8Z {
7161 fn drop(&mut self) {
7162 if self.datalen == 0 { return; }
7163 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7166 impl Clone for CVec_u8Z {
7167 fn clone(&self) -> Self {
7168 let mut res = Vec::new();
7169 if self.datalen == 0 { return Self::from(res); }
7170 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7175 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7176 /// This corresponds to std::vector in C++
7177 pub struct CVec_CVec_u8ZZ {
7178 /// The elements in the array.
7179 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7180 pub data: *mut crate::c_types::derived::CVec_u8Z,
7181 /// The number of elements pointed to by `data`.
7184 impl CVec_CVec_u8ZZ {
7185 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
7186 if self.datalen == 0 { return Vec::new(); }
7187 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7188 self.data = core::ptr::null_mut();
7192 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
7193 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7196 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
7197 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
7198 let datalen = v.len();
7199 let data = Box::into_raw(v.into_boxed_slice());
7200 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7204 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7205 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
7206 impl Drop for CVec_CVec_u8ZZ {
7207 fn drop(&mut self) {
7208 if self.datalen == 0 { return; }
7209 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7212 impl Clone for CVec_CVec_u8ZZ {
7213 fn clone(&self) -> Self {
7214 let mut res = Vec::new();
7215 if self.datalen == 0 { return Self::from(res); }
7216 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7221 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
7222 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
7223 /// A pointer to the contents in the success state.
7224 /// Reading from this pointer when `result_ok` is not set is undefined.
7225 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
7226 /// Note that this value is always NULL, as there are no contents in the Err variant
7227 pub err: *mut core::ffi::c_void,
7230 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7231 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7233 pub struct CResult_CVec_CVec_u8ZZNoneZ {
7234 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7235 /// `err` or `result` depending on the state of `result_ok`.
7236 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
7237 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7238 pub result_ok: bool,
7241 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
7242 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
7243 CResult_CVec_CVec_u8ZZNoneZ {
7244 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7245 result: Box::into_raw(Box::new(o)),
7251 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
7252 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
7253 CResult_CVec_CVec_u8ZZNoneZ {
7254 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7255 err: core::ptr::null_mut(),
7260 /// Checks if the given object is currently in the success state
7262 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
7266 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
7267 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
7268 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
7269 fn drop(&mut self) {
7271 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7272 let _ = unsafe { Box::from_raw(self.contents.result) };
7278 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
7279 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
7280 let contents = if o.result_ok {
7281 let result = unsafe { o.contents.result };
7282 unsafe { o.contents.result = core::ptr::null_mut() };
7283 CResult_CVec_CVec_u8ZZNoneZPtr { result }
7285 let _ = unsafe { Box::from_raw(o.contents.err) };
7286 o.contents.err = core::ptr::null_mut();
7287 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
7291 result_ok: o.result_ok,
7295 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
7296 fn clone(&self) -> Self {
7298 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7299 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
7302 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7303 err: core::ptr::null_mut()
7309 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
7310 /// but with all dynamically-allocated buffers duplicated in new buffers.
7311 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
7313 /// The contents of CResult_InMemorySignerDecodeErrorZ
7314 pub union CResult_InMemorySignerDecodeErrorZPtr {
7315 /// A pointer to the contents in the success state.
7316 /// Reading from this pointer when `result_ok` is not set is undefined.
7317 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
7318 /// A pointer to the contents in the error state.
7319 /// Reading from this pointer when `result_ok` is set is undefined.
7320 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7323 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7324 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7325 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7326 pub struct CResult_InMemorySignerDecodeErrorZ {
7327 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7328 /// `err` or `result` depending on the state of `result_ok`.
7329 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7330 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7331 pub result_ok: bool,
7334 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7335 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7336 CResult_InMemorySignerDecodeErrorZ {
7337 contents: CResult_InMemorySignerDecodeErrorZPtr {
7338 result: Box::into_raw(Box::new(o)),
7344 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7345 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7346 CResult_InMemorySignerDecodeErrorZ {
7347 contents: CResult_InMemorySignerDecodeErrorZPtr {
7348 err: Box::into_raw(Box::new(e)),
7353 /// Checks if the given object is currently in the success state
7355 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7359 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7360 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7361 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7362 fn drop(&mut self) {
7364 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7365 let _ = unsafe { Box::from_raw(self.contents.result) };
7368 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7369 let _ = unsafe { Box::from_raw(self.contents.err) };
7374 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7375 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7376 let contents = if o.result_ok {
7377 let result = unsafe { o.contents.result };
7378 unsafe { o.contents.result = core::ptr::null_mut() };
7379 CResult_InMemorySignerDecodeErrorZPtr { result }
7381 let err = unsafe { o.contents.err };
7382 unsafe { o.contents.err = core::ptr::null_mut(); }
7383 CResult_InMemorySignerDecodeErrorZPtr { err }
7387 result_ok: o.result_ok,
7391 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7392 fn clone(&self) -> Self {
7394 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7395 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7398 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7399 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7405 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7406 /// but with all dynamically-allocated buffers duplicated in new buffers.
7407 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7409 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7410 /// This corresponds to std::vector in C++
7411 pub struct CVec_TxOutZ {
7412 /// The elements in the array.
7413 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7414 pub data: *mut crate::c_types::TxOut,
7415 /// The number of elements pointed to by `data`.
7419 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7420 if self.datalen == 0 { return Vec::new(); }
7421 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7422 self.data = core::ptr::null_mut();
7426 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7427 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7430 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7431 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7432 let datalen = v.len();
7433 let data = Box::into_raw(v.into_boxed_slice());
7434 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7438 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7439 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7440 impl Drop for CVec_TxOutZ {
7441 fn drop(&mut self) {
7442 if self.datalen == 0 { return; }
7443 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7446 impl Clone for CVec_TxOutZ {
7447 fn clone(&self) -> Self {
7448 let mut res = Vec::new();
7449 if self.datalen == 0 { return Self::from(res); }
7450 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7455 /// The contents of CResult_TransactionNoneZ
7456 pub union CResult_TransactionNoneZPtr {
7457 /// A pointer to the contents in the success state.
7458 /// Reading from this pointer when `result_ok` is not set is undefined.
7459 pub result: *mut crate::c_types::Transaction,
7460 /// Note that this value is always NULL, as there are no contents in the Err variant
7461 pub err: *mut core::ffi::c_void,
7464 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7465 /// containing a crate::c_types::Transaction on success and a () on failure.
7466 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7467 pub struct CResult_TransactionNoneZ {
7468 /// The contents of this CResult_TransactionNoneZ, accessible via either
7469 /// `err` or `result` depending on the state of `result_ok`.
7470 pub contents: CResult_TransactionNoneZPtr,
7471 /// Whether this CResult_TransactionNoneZ represents a success state.
7472 pub result_ok: bool,
7475 /// Creates a new CResult_TransactionNoneZ in the success state.
7476 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7477 CResult_TransactionNoneZ {
7478 contents: CResult_TransactionNoneZPtr {
7479 result: Box::into_raw(Box::new(o)),
7485 /// Creates a new CResult_TransactionNoneZ in the error state.
7486 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7487 CResult_TransactionNoneZ {
7488 contents: CResult_TransactionNoneZPtr {
7489 err: core::ptr::null_mut(),
7494 /// Checks if the given object is currently in the success state
7496 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7500 /// Frees any resources used by the CResult_TransactionNoneZ.
7501 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7502 impl Drop for CResult_TransactionNoneZ {
7503 fn drop(&mut self) {
7505 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7506 let _ = unsafe { Box::from_raw(self.contents.result) };
7512 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7513 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7514 let contents = if o.result_ok {
7515 let result = unsafe { o.contents.result };
7516 unsafe { o.contents.result = core::ptr::null_mut() };
7517 CResult_TransactionNoneZPtr { result }
7519 let _ = unsafe { Box::from_raw(o.contents.err) };
7520 o.contents.err = core::ptr::null_mut();
7521 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7525 result_ok: o.result_ok,
7529 impl Clone for CResult_TransactionNoneZ {
7530 fn clone(&self) -> Self {
7532 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7533 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7536 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7537 err: core::ptr::null_mut()
7543 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7544 /// but with all dynamically-allocated buffers duplicated in new buffers.
7545 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7547 /// A tuple of 2 elements. See the individual fields for the types contained.
7548 pub struct C2Tuple_BlockHashChannelMonitorZ {
7549 /// The element at position 0
7550 pub a: crate::c_types::ThirtyTwoBytes,
7551 /// The element at position 1
7552 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7554 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7555 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7562 impl C2Tuple_BlockHashChannelMonitorZ {
7563 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
7567 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
7569 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
7570 C2Tuple_BlockHashChannelMonitorZ { a, b, }
7574 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
7575 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
7577 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7578 /// This corresponds to std::vector in C++
7579 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
7580 /// The elements in the array.
7581 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7582 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7583 /// The number of elements pointed to by `data`.
7586 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
7587 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
7588 if self.datalen == 0 { return Vec::new(); }
7589 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7590 self.data = core::ptr::null_mut();
7594 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
7595 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7598 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7599 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
7600 let datalen = v.len();
7601 let data = Box::into_raw(v.into_boxed_slice());
7602 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7606 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7607 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
7608 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7609 fn drop(&mut self) {
7610 if self.datalen == 0 { return; }
7611 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7615 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7616 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7617 /// A pointer to the contents in the success state.
7618 /// Reading from this pointer when `result_ok` is not set is undefined.
7619 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
7620 /// A pointer to the contents in the error state.
7621 /// Reading from this pointer when `result_ok` is set is undefined.
7622 pub err: *mut crate::c_types::IOError,
7625 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7626 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7628 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7629 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7630 /// `err` or `result` depending on the state of `result_ok`.
7631 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
7632 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7633 pub result_ok: bool,
7636 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
7637 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7638 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7639 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7640 result: Box::into_raw(Box::new(o)),
7646 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
7647 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7648 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7649 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7650 err: Box::into_raw(Box::new(e)),
7655 /// Checks if the given object is currently in the success state
7657 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
7661 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
7662 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
7663 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7664 fn drop(&mut self) {
7666 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7667 let _ = unsafe { Box::from_raw(self.contents.result) };
7670 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7671 let _ = unsafe { Box::from_raw(self.contents.err) };
7676 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7677 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
7678 let contents = if o.result_ok {
7679 let result = unsafe { o.contents.result };
7680 unsafe { o.contents.result = core::ptr::null_mut() };
7681 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
7683 let err = unsafe { o.contents.err };
7684 unsafe { o.contents.err = core::ptr::null_mut(); }
7685 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
7689 result_ok: o.result_ok,
7695 /// An enum which can either contain a u16 or not
7696 pub enum COption_u16Z {
7697 /// When we're in this state, this COption_u16Z contains a u16
7699 /// When we're in this state, this COption_u16Z contains nothing
7703 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7704 if let Self::None = self { false } else { true }
7706 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7709 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
7710 if let Self::Some(v) = self { v } else { unreachable!() }
7714 /// Constructs a new COption_u16Z containing a u16
7715 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
7716 COption_u16Z::Some(o)
7719 /// Constructs a new COption_u16Z containing nothing
7720 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
7724 /// Frees any resources associated with the u16, if we are in the Some state
7725 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
7727 /// Creates a new COption_u16Z which has the same data as `orig`
7728 /// but with all dynamically-allocated buffers duplicated in new buffers.
7729 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
7731 /// The contents of CResult_NoneAPIErrorZ
7732 pub union CResult_NoneAPIErrorZPtr {
7733 /// Note that this value is always NULL, as there are no contents in the OK variant
7734 pub result: *mut core::ffi::c_void,
7735 /// A pointer to the contents in the error state.
7736 /// Reading from this pointer when `result_ok` is set is undefined.
7737 pub err: *mut crate::lightning::util::errors::APIError,
7740 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7741 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
7742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7743 pub struct CResult_NoneAPIErrorZ {
7744 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
7745 /// `err` or `result` depending on the state of `result_ok`.
7746 pub contents: CResult_NoneAPIErrorZPtr,
7747 /// Whether this CResult_NoneAPIErrorZ represents a success state.
7748 pub result_ok: bool,
7751 /// Creates a new CResult_NoneAPIErrorZ in the success state.
7752 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
7753 CResult_NoneAPIErrorZ {
7754 contents: CResult_NoneAPIErrorZPtr {
7755 result: core::ptr::null_mut(),
7761 /// Creates a new CResult_NoneAPIErrorZ in the error state.
7762 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
7763 CResult_NoneAPIErrorZ {
7764 contents: CResult_NoneAPIErrorZPtr {
7765 err: Box::into_raw(Box::new(e)),
7770 /// Checks if the given object is currently in the success state
7772 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
7776 /// Frees any resources used by the CResult_NoneAPIErrorZ.
7777 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
7778 impl Drop for CResult_NoneAPIErrorZ {
7779 fn drop(&mut self) {
7782 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7783 let _ = unsafe { Box::from_raw(self.contents.err) };
7788 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
7789 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
7790 let contents = if o.result_ok {
7791 let _ = unsafe { Box::from_raw(o.contents.result) };
7792 o.contents.result = core::ptr::null_mut();
7793 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
7795 let err = unsafe { o.contents.err };
7796 unsafe { o.contents.err = core::ptr::null_mut(); }
7797 CResult_NoneAPIErrorZPtr { err }
7801 result_ok: o.result_ok,
7805 impl Clone for CResult_NoneAPIErrorZ {
7806 fn clone(&self) -> Self {
7808 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
7809 result: core::ptr::null_mut()
7812 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
7813 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7819 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
7820 /// but with all dynamically-allocated buffers duplicated in new buffers.
7821 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
7823 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7824 /// This corresponds to std::vector in C++
7825 pub struct CVec_CResult_NoneAPIErrorZZ {
7826 /// The elements in the array.
7827 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7828 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
7829 /// The number of elements pointed to by `data`.
7832 impl CVec_CResult_NoneAPIErrorZZ {
7833 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
7834 if self.datalen == 0 { return Vec::new(); }
7835 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7836 self.data = core::ptr::null_mut();
7840 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
7841 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7844 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
7845 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
7846 let datalen = v.len();
7847 let data = Box::into_raw(v.into_boxed_slice());
7848 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7852 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7853 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
7854 impl Drop for CVec_CResult_NoneAPIErrorZZ {
7855 fn drop(&mut self) {
7856 if self.datalen == 0 { return; }
7857 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7860 impl Clone for CVec_CResult_NoneAPIErrorZZ {
7861 fn clone(&self) -> Self {
7862 let mut res = Vec::new();
7863 if self.datalen == 0 { return Self::from(res); }
7864 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7869 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7870 /// This corresponds to std::vector in C++
7871 pub struct CVec_APIErrorZ {
7872 /// The elements in the array.
7873 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7874 pub data: *mut crate::lightning::util::errors::APIError,
7875 /// The number of elements pointed to by `data`.
7878 impl CVec_APIErrorZ {
7879 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
7880 if self.datalen == 0 { return Vec::new(); }
7881 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7882 self.data = core::ptr::null_mut();
7886 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
7887 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7890 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
7891 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
7892 let datalen = v.len();
7893 let data = Box::into_raw(v.into_boxed_slice());
7894 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7898 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7899 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
7900 impl Drop for CVec_APIErrorZ {
7901 fn drop(&mut self) {
7902 if self.datalen == 0 { return; }
7903 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7906 impl Clone for CVec_APIErrorZ {
7907 fn clone(&self) -> Self {
7908 let mut res = Vec::new();
7909 if self.datalen == 0 { return Self::from(res); }
7910 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7915 /// The contents of CResult__u832APIErrorZ
7916 pub union CResult__u832APIErrorZPtr {
7917 /// A pointer to the contents in the success state.
7918 /// Reading from this pointer when `result_ok` is not set is undefined.
7919 pub result: *mut crate::c_types::ThirtyTwoBytes,
7920 /// A pointer to the contents in the error state.
7921 /// Reading from this pointer when `result_ok` is set is undefined.
7922 pub err: *mut crate::lightning::util::errors::APIError,
7925 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
7926 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7928 pub struct CResult__u832APIErrorZ {
7929 /// The contents of this CResult__u832APIErrorZ, accessible via either
7930 /// `err` or `result` depending on the state of `result_ok`.
7931 pub contents: CResult__u832APIErrorZPtr,
7932 /// Whether this CResult__u832APIErrorZ represents a success state.
7933 pub result_ok: bool,
7936 /// Creates a new CResult__u832APIErrorZ in the success state.
7937 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
7938 CResult__u832APIErrorZ {
7939 contents: CResult__u832APIErrorZPtr {
7940 result: Box::into_raw(Box::new(o)),
7946 /// Creates a new CResult__u832APIErrorZ in the error state.
7947 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
7948 CResult__u832APIErrorZ {
7949 contents: CResult__u832APIErrorZPtr {
7950 err: Box::into_raw(Box::new(e)),
7955 /// Checks if the given object is currently in the success state
7957 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
7961 /// Frees any resources used by the CResult__u832APIErrorZ.
7962 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
7963 impl Drop for CResult__u832APIErrorZ {
7964 fn drop(&mut self) {
7966 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7967 let _ = unsafe { Box::from_raw(self.contents.result) };
7970 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7971 let _ = unsafe { Box::from_raw(self.contents.err) };
7976 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
7977 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7978 let contents = if o.result_ok {
7979 let result = unsafe { o.contents.result };
7980 unsafe { o.contents.result = core::ptr::null_mut() };
7981 CResult__u832APIErrorZPtr { result }
7983 let err = unsafe { o.contents.err };
7984 unsafe { o.contents.err = core::ptr::null_mut(); }
7985 CResult__u832APIErrorZPtr { err }
7989 result_ok: o.result_ok,
7993 impl Clone for CResult__u832APIErrorZ {
7994 fn clone(&self) -> Self {
7996 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
7997 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8000 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8001 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8007 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8008 /// but with all dynamically-allocated buffers duplicated in new buffers.
8009 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8011 /// The contents of CResult_PaymentIdPaymentSendFailureZ
8012 pub union CResult_PaymentIdPaymentSendFailureZPtr {
8013 /// A pointer to the contents in the success state.
8014 /// Reading from this pointer when `result_ok` is not set is undefined.
8015 pub result: *mut crate::c_types::ThirtyTwoBytes,
8016 /// A pointer to the contents in the error state.
8017 /// Reading from this pointer when `result_ok` is set is undefined.
8018 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8021 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
8022 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8023 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8024 pub struct CResult_PaymentIdPaymentSendFailureZ {
8025 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
8026 /// `err` or `result` depending on the state of `result_ok`.
8027 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
8028 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
8029 pub result_ok: bool,
8032 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
8033 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
8034 CResult_PaymentIdPaymentSendFailureZ {
8035 contents: CResult_PaymentIdPaymentSendFailureZPtr {
8036 result: Box::into_raw(Box::new(o)),
8042 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
8043 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
8044 CResult_PaymentIdPaymentSendFailureZ {
8045 contents: CResult_PaymentIdPaymentSendFailureZPtr {
8046 err: Box::into_raw(Box::new(e)),
8051 /// Checks if the given object is currently in the success state
8053 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
8057 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
8058 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
8059 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
8060 fn drop(&mut self) {
8062 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8063 let _ = unsafe { Box::from_raw(self.contents.result) };
8066 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8067 let _ = unsafe { Box::from_raw(self.contents.err) };
8072 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
8073 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8074 let contents = if o.result_ok {
8075 let result = unsafe { o.contents.result };
8076 unsafe { o.contents.result = core::ptr::null_mut() };
8077 CResult_PaymentIdPaymentSendFailureZPtr { result }
8079 let err = unsafe { o.contents.err };
8080 unsafe { o.contents.err = core::ptr::null_mut(); }
8081 CResult_PaymentIdPaymentSendFailureZPtr { err }
8085 result_ok: o.result_ok,
8089 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
8090 fn clone(&self) -> Self {
8092 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
8093 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8096 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
8097 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8103 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
8104 /// but with all dynamically-allocated buffers duplicated in new buffers.
8105 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
8107 /// The contents of CResult_NonePaymentSendFailureZ
8108 pub union CResult_NonePaymentSendFailureZPtr {
8109 /// Note that this value is always NULL, as there are no contents in the OK variant
8110 pub result: *mut core::ffi::c_void,
8111 /// A pointer to the contents in the error state.
8112 /// Reading from this pointer when `result_ok` is set is undefined.
8113 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8116 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8117 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8118 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8119 pub struct CResult_NonePaymentSendFailureZ {
8120 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8121 /// `err` or `result` depending on the state of `result_ok`.
8122 pub contents: CResult_NonePaymentSendFailureZPtr,
8123 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8124 pub result_ok: bool,
8127 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8128 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8129 CResult_NonePaymentSendFailureZ {
8130 contents: CResult_NonePaymentSendFailureZPtr {
8131 result: core::ptr::null_mut(),
8137 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8138 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8139 CResult_NonePaymentSendFailureZ {
8140 contents: CResult_NonePaymentSendFailureZPtr {
8141 err: Box::into_raw(Box::new(e)),
8146 /// Checks if the given object is currently in the success state
8148 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8152 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8153 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8154 impl Drop for CResult_NonePaymentSendFailureZ {
8155 fn drop(&mut self) {
8158 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8159 let _ = unsafe { Box::from_raw(self.contents.err) };
8164 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8165 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8166 let contents = if o.result_ok {
8167 let _ = unsafe { Box::from_raw(o.contents.result) };
8168 o.contents.result = core::ptr::null_mut();
8169 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8171 let err = unsafe { o.contents.err };
8172 unsafe { o.contents.err = core::ptr::null_mut(); }
8173 CResult_NonePaymentSendFailureZPtr { err }
8177 result_ok: o.result_ok,
8181 impl Clone for CResult_NonePaymentSendFailureZ {
8182 fn clone(&self) -> Self {
8184 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8185 result: core::ptr::null_mut()
8188 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8189 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8195 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8196 /// but with all dynamically-allocated buffers duplicated in new buffers.
8197 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8199 /// A tuple of 2 elements. See the individual fields for the types contained.
8200 pub struct C2Tuple_PaymentHashPaymentIdZ {
8201 /// The element at position 0
8202 pub a: crate::c_types::ThirtyTwoBytes,
8203 /// The element at position 1
8204 pub b: crate::c_types::ThirtyTwoBytes,
8206 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8207 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8214 impl C2Tuple_PaymentHashPaymentIdZ {
8215 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8219 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8220 fn clone(&self) -> Self {
8222 a: Clone::clone(&self.a),
8223 b: Clone::clone(&self.b),
8228 /// Creates a new tuple which has the same data as `orig`
8229 /// but with all dynamically-allocated buffers duplicated in new buffers.
8230 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8231 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8233 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8234 C2Tuple_PaymentHashPaymentIdZ { a, b, }
8238 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8239 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8241 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8242 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8243 /// A pointer to the contents in the success state.
8244 /// Reading from this pointer when `result_ok` is not set is undefined.
8245 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8246 /// A pointer to the contents in the error state.
8247 /// Reading from this pointer when `result_ok` is set is undefined.
8248 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8251 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8252 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8254 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8255 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8256 /// `err` or `result` depending on the state of `result_ok`.
8257 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8258 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8259 pub result_ok: bool,
8262 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8263 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8264 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8265 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8266 result: Box::into_raw(Box::new(o)),
8272 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8273 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8274 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8275 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8276 err: Box::into_raw(Box::new(e)),
8281 /// Checks if the given object is currently in the success state
8283 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8287 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8288 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8289 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8290 fn drop(&mut self) {
8292 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8293 let _ = unsafe { Box::from_raw(self.contents.result) };
8296 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8297 let _ = unsafe { Box::from_raw(self.contents.err) };
8302 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8303 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8304 let contents = if o.result_ok {
8305 let result = unsafe { o.contents.result };
8306 unsafe { o.contents.result = core::ptr::null_mut() };
8307 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8309 let err = unsafe { o.contents.err };
8310 unsafe { o.contents.err = core::ptr::null_mut(); }
8311 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8315 result_ok: o.result_ok,
8319 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8320 fn clone(&self) -> Self {
8322 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8323 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8326 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8327 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8333 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8334 /// but with all dynamically-allocated buffers duplicated in new buffers.
8335 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8337 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8338 /// This corresponds to std::vector in C++
8339 pub struct CVec_ThirtyTwoBytesZ {
8340 /// The elements in the array.
8341 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8342 pub data: *mut crate::c_types::ThirtyTwoBytes,
8343 /// The number of elements pointed to by `data`.
8346 impl CVec_ThirtyTwoBytesZ {
8347 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8348 if self.datalen == 0 { return Vec::new(); }
8349 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8350 self.data = core::ptr::null_mut();
8354 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8355 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8358 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8359 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8360 let datalen = v.len();
8361 let data = Box::into_raw(v.into_boxed_slice());
8362 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8366 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8367 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8368 impl Drop for CVec_ThirtyTwoBytesZ {
8369 fn drop(&mut self) {
8370 if self.datalen == 0 { return; }
8371 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8374 impl Clone for CVec_ThirtyTwoBytesZ {
8375 fn clone(&self) -> Self {
8376 let mut res = Vec::new();
8377 if self.datalen == 0 { return Self::from(res); }
8378 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8383 /// A tuple of 2 elements. See the individual fields for the types contained.
8384 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8385 /// The element at position 0
8386 pub a: crate::c_types::ThirtyTwoBytes,
8387 /// The element at position 1
8388 pub b: crate::c_types::ThirtyTwoBytes,
8390 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8391 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8398 impl C2Tuple_PaymentHashPaymentSecretZ {
8399 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8403 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8404 fn clone(&self) -> Self {
8406 a: Clone::clone(&self.a),
8407 b: Clone::clone(&self.b),
8412 /// Creates a new tuple which has the same data as `orig`
8413 /// but with all dynamically-allocated buffers duplicated in new buffers.
8414 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8415 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8417 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8418 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8422 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8423 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8425 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8426 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8427 /// A pointer to the contents in the success state.
8428 /// Reading from this pointer when `result_ok` is not set is undefined.
8429 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8430 /// Note that this value is always NULL, as there are no contents in the Err variant
8431 pub err: *mut core::ffi::c_void,
8434 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8435 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8436 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8437 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8438 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8439 /// `err` or `result` depending on the state of `result_ok`.
8440 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8441 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8442 pub result_ok: bool,
8445 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8446 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8447 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8448 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8449 result: Box::into_raw(Box::new(o)),
8455 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8456 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8457 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8458 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8459 err: core::ptr::null_mut(),
8464 /// Checks if the given object is currently in the success state
8466 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8470 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8471 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8472 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8473 fn drop(&mut self) {
8475 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8476 let _ = unsafe { Box::from_raw(self.contents.result) };
8482 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8483 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8484 let contents = if o.result_ok {
8485 let result = unsafe { o.contents.result };
8486 unsafe { o.contents.result = core::ptr::null_mut() };
8487 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8489 let _ = unsafe { Box::from_raw(o.contents.err) };
8490 o.contents.err = core::ptr::null_mut();
8491 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8495 result_ok: o.result_ok,
8499 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8500 fn clone(&self) -> Self {
8502 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8503 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8506 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8507 err: core::ptr::null_mut()
8513 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8514 /// but with all dynamically-allocated buffers duplicated in new buffers.
8515 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8517 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8518 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8519 /// A pointer to the contents in the success state.
8520 /// Reading from this pointer when `result_ok` is not set is undefined.
8521 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8522 /// A pointer to the contents in the error state.
8523 /// Reading from this pointer when `result_ok` is set is undefined.
8524 pub err: *mut crate::lightning::util::errors::APIError,
8527 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8528 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8529 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8530 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8531 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8532 /// `err` or `result` depending on the state of `result_ok`.
8533 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8534 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8535 pub result_ok: bool,
8538 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8539 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8540 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8541 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8542 result: Box::into_raw(Box::new(o)),
8548 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8549 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8550 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8551 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8552 err: Box::into_raw(Box::new(e)),
8557 /// Checks if the given object is currently in the success state
8559 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
8563 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
8564 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
8565 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8566 fn drop(&mut self) {
8568 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8569 let _ = unsafe { Box::from_raw(self.contents.result) };
8572 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8573 let _ = unsafe { Box::from_raw(self.contents.err) };
8578 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8579 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
8580 let contents = if o.result_ok {
8581 let result = unsafe { o.contents.result };
8582 unsafe { o.contents.result = core::ptr::null_mut() };
8583 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
8585 let err = unsafe { o.contents.err };
8586 unsafe { o.contents.err = core::ptr::null_mut(); }
8587 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
8591 result_ok: o.result_ok,
8595 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8596 fn clone(&self) -> Self {
8598 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8599 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8602 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8603 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8609 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
8610 /// but with all dynamically-allocated buffers duplicated in new buffers.
8611 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
8613 /// The contents of CResult_PaymentSecretNoneZ
8614 pub union CResult_PaymentSecretNoneZPtr {
8615 /// A pointer to the contents in the success state.
8616 /// Reading from this pointer when `result_ok` is not set is undefined.
8617 pub result: *mut crate::c_types::ThirtyTwoBytes,
8618 /// Note that this value is always NULL, as there are no contents in the Err variant
8619 pub err: *mut core::ffi::c_void,
8622 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8623 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8624 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8625 pub struct CResult_PaymentSecretNoneZ {
8626 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8627 /// `err` or `result` depending on the state of `result_ok`.
8628 pub contents: CResult_PaymentSecretNoneZPtr,
8629 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8630 pub result_ok: bool,
8633 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8634 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8635 CResult_PaymentSecretNoneZ {
8636 contents: CResult_PaymentSecretNoneZPtr {
8637 result: Box::into_raw(Box::new(o)),
8643 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8644 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8645 CResult_PaymentSecretNoneZ {
8646 contents: CResult_PaymentSecretNoneZPtr {
8647 err: core::ptr::null_mut(),
8652 /// Checks if the given object is currently in the success state
8654 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8658 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8659 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8660 impl Drop for CResult_PaymentSecretNoneZ {
8661 fn drop(&mut self) {
8663 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8664 let _ = unsafe { Box::from_raw(self.contents.result) };
8670 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8671 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8672 let contents = if o.result_ok {
8673 let result = unsafe { o.contents.result };
8674 unsafe { o.contents.result = core::ptr::null_mut() };
8675 CResult_PaymentSecretNoneZPtr { result }
8677 let _ = unsafe { Box::from_raw(o.contents.err) };
8678 o.contents.err = core::ptr::null_mut();
8679 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8683 result_ok: o.result_ok,
8687 impl Clone for CResult_PaymentSecretNoneZ {
8688 fn clone(&self) -> Self {
8690 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8691 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8694 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8695 err: core::ptr::null_mut()
8701 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8702 /// but with all dynamically-allocated buffers duplicated in new buffers.
8703 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
8705 /// The contents of CResult_PaymentSecretAPIErrorZ
8706 pub union CResult_PaymentSecretAPIErrorZPtr {
8707 /// A pointer to the contents in the success state.
8708 /// Reading from this pointer when `result_ok` is not set is undefined.
8709 pub result: *mut crate::c_types::ThirtyTwoBytes,
8710 /// A pointer to the contents in the error state.
8711 /// Reading from this pointer when `result_ok` is set is undefined.
8712 pub err: *mut crate::lightning::util::errors::APIError,
8715 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8716 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8718 pub struct CResult_PaymentSecretAPIErrorZ {
8719 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8720 /// `err` or `result` depending on the state of `result_ok`.
8721 pub contents: CResult_PaymentSecretAPIErrorZPtr,
8722 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8723 pub result_ok: bool,
8726 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
8727 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
8728 CResult_PaymentSecretAPIErrorZ {
8729 contents: CResult_PaymentSecretAPIErrorZPtr {
8730 result: Box::into_raw(Box::new(o)),
8736 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
8737 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
8738 CResult_PaymentSecretAPIErrorZ {
8739 contents: CResult_PaymentSecretAPIErrorZPtr {
8740 err: Box::into_raw(Box::new(e)),
8745 /// Checks if the given object is currently in the success state
8747 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
8751 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
8752 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
8753 impl Drop for CResult_PaymentSecretAPIErrorZ {
8754 fn drop(&mut self) {
8756 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8757 let _ = unsafe { Box::from_raw(self.contents.result) };
8760 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8761 let _ = unsafe { Box::from_raw(self.contents.err) };
8766 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
8767 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8768 let contents = if o.result_ok {
8769 let result = unsafe { o.contents.result };
8770 unsafe { o.contents.result = core::ptr::null_mut() };
8771 CResult_PaymentSecretAPIErrorZPtr { result }
8773 let err = unsafe { o.contents.err };
8774 unsafe { o.contents.err = core::ptr::null_mut(); }
8775 CResult_PaymentSecretAPIErrorZPtr { err }
8779 result_ok: o.result_ok,
8783 impl Clone for CResult_PaymentSecretAPIErrorZ {
8784 fn clone(&self) -> Self {
8786 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
8787 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8790 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
8791 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8797 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
8798 /// but with all dynamically-allocated buffers duplicated in new buffers.
8799 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
8801 /// The contents of CResult_PaymentPreimageAPIErrorZ
8802 pub union CResult_PaymentPreimageAPIErrorZPtr {
8803 /// A pointer to the contents in the success state.
8804 /// Reading from this pointer when `result_ok` is not set is undefined.
8805 pub result: *mut crate::c_types::ThirtyTwoBytes,
8806 /// A pointer to the contents in the error state.
8807 /// Reading from this pointer when `result_ok` is set is undefined.
8808 pub err: *mut crate::lightning::util::errors::APIError,
8811 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8812 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8814 pub struct CResult_PaymentPreimageAPIErrorZ {
8815 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8816 /// `err` or `result` depending on the state of `result_ok`.
8817 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
8818 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8819 pub result_ok: bool,
8822 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
8823 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
8824 CResult_PaymentPreimageAPIErrorZ {
8825 contents: CResult_PaymentPreimageAPIErrorZPtr {
8826 result: Box::into_raw(Box::new(o)),
8832 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
8833 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
8834 CResult_PaymentPreimageAPIErrorZ {
8835 contents: CResult_PaymentPreimageAPIErrorZPtr {
8836 err: Box::into_raw(Box::new(e)),
8841 /// Checks if the given object is currently in the success state
8843 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
8847 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
8848 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
8849 impl Drop for CResult_PaymentPreimageAPIErrorZ {
8850 fn drop(&mut self) {
8852 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8853 let _ = unsafe { Box::from_raw(self.contents.result) };
8856 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8857 let _ = unsafe { Box::from_raw(self.contents.err) };
8862 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
8863 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8864 let contents = if o.result_ok {
8865 let result = unsafe { o.contents.result };
8866 unsafe { o.contents.result = core::ptr::null_mut() };
8867 CResult_PaymentPreimageAPIErrorZPtr { result }
8869 let err = unsafe { o.contents.err };
8870 unsafe { o.contents.err = core::ptr::null_mut(); }
8871 CResult_PaymentPreimageAPIErrorZPtr { err }
8875 result_ok: o.result_ok,
8879 impl Clone for CResult_PaymentPreimageAPIErrorZ {
8880 fn clone(&self) -> Self {
8882 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
8883 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8886 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
8887 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8893 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
8894 /// but with all dynamically-allocated buffers duplicated in new buffers.
8895 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
8897 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8898 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8899 /// A pointer to the contents in the success state.
8900 /// Reading from this pointer when `result_ok` is not set is undefined.
8901 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
8902 /// A pointer to the contents in the error state.
8903 /// Reading from this pointer when `result_ok` is set is undefined.
8904 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8907 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8908 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8909 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8910 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
8911 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8912 /// `err` or `result` depending on the state of `result_ok`.
8913 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
8914 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8915 pub result_ok: bool,
8918 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
8919 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8920 CResult_CounterpartyForwardingInfoDecodeErrorZ {
8921 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8922 result: Box::into_raw(Box::new(o)),
8928 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
8929 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8930 CResult_CounterpartyForwardingInfoDecodeErrorZ {
8931 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8932 err: Box::into_raw(Box::new(e)),
8937 /// Checks if the given object is currently in the success state
8939 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
8943 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
8944 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
8945 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8946 fn drop(&mut self) {
8948 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8949 let _ = unsafe { Box::from_raw(self.contents.result) };
8952 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8953 let _ = unsafe { Box::from_raw(self.contents.err) };
8958 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8959 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8960 let contents = if o.result_ok {
8961 let result = unsafe { o.contents.result };
8962 unsafe { o.contents.result = core::ptr::null_mut() };
8963 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
8965 let err = unsafe { o.contents.err };
8966 unsafe { o.contents.err = core::ptr::null_mut(); }
8967 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
8971 result_ok: o.result_ok,
8975 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8976 fn clone(&self) -> Self {
8978 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8979 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
8982 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8983 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8989 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
8990 /// but with all dynamically-allocated buffers duplicated in new buffers.
8991 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
8993 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
8994 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
8995 /// A pointer to the contents in the success state.
8996 /// Reading from this pointer when `result_ok` is not set is undefined.
8997 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
8998 /// A pointer to the contents in the error state.
8999 /// Reading from this pointer when `result_ok` is set is undefined.
9000 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9003 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9004 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9006 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9007 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9008 /// `err` or `result` depending on the state of `result_ok`.
9009 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9010 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9011 pub result_ok: bool,
9014 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9015 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9016 CResult_ChannelCounterpartyDecodeErrorZ {
9017 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9018 result: Box::into_raw(Box::new(o)),
9024 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9025 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9026 CResult_ChannelCounterpartyDecodeErrorZ {
9027 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9028 err: Box::into_raw(Box::new(e)),
9033 /// Checks if the given object is currently in the success state
9035 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9039 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9040 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9041 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9042 fn drop(&mut self) {
9044 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9045 let _ = unsafe { Box::from_raw(self.contents.result) };
9048 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9049 let _ = unsafe { Box::from_raw(self.contents.err) };
9054 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9055 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9056 let contents = if o.result_ok {
9057 let result = unsafe { o.contents.result };
9058 unsafe { o.contents.result = core::ptr::null_mut() };
9059 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9061 let err = unsafe { o.contents.err };
9062 unsafe { o.contents.err = core::ptr::null_mut(); }
9063 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9067 result_ok: o.result_ok,
9071 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9072 fn clone(&self) -> Self {
9074 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9075 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9078 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9079 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9085 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9086 /// but with all dynamically-allocated buffers duplicated in new buffers.
9087 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9089 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9090 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9091 /// A pointer to the contents in the success state.
9092 /// Reading from this pointer when `result_ok` is not set is undefined.
9093 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9094 /// A pointer to the contents in the error state.
9095 /// Reading from this pointer when `result_ok` is set is undefined.
9096 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9099 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9100 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9101 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9102 pub struct CResult_ChannelDetailsDecodeErrorZ {
9103 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9104 /// `err` or `result` depending on the state of `result_ok`.
9105 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9106 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9107 pub result_ok: bool,
9110 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9111 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9112 CResult_ChannelDetailsDecodeErrorZ {
9113 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9114 result: Box::into_raw(Box::new(o)),
9120 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9121 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9122 CResult_ChannelDetailsDecodeErrorZ {
9123 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9124 err: Box::into_raw(Box::new(e)),
9129 /// Checks if the given object is currently in the success state
9131 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9135 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9136 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9137 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9138 fn drop(&mut self) {
9140 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9141 let _ = unsafe { Box::from_raw(self.contents.result) };
9144 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9145 let _ = unsafe { Box::from_raw(self.contents.err) };
9150 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9151 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9152 let contents = if o.result_ok {
9153 let result = unsafe { o.contents.result };
9154 unsafe { o.contents.result = core::ptr::null_mut() };
9155 CResult_ChannelDetailsDecodeErrorZPtr { result }
9157 let err = unsafe { o.contents.err };
9158 unsafe { o.contents.err = core::ptr::null_mut(); }
9159 CResult_ChannelDetailsDecodeErrorZPtr { err }
9163 result_ok: o.result_ok,
9167 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9168 fn clone(&self) -> Self {
9170 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9171 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9174 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9175 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9181 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9182 /// but with all dynamically-allocated buffers duplicated in new buffers.
9183 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9185 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9186 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9187 /// A pointer to the contents in the success state.
9188 /// Reading from this pointer when `result_ok` is not set is undefined.
9189 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9190 /// A pointer to the contents in the error state.
9191 /// Reading from this pointer when `result_ok` is set is undefined.
9192 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9195 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9196 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9198 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9199 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9200 /// `err` or `result` depending on the state of `result_ok`.
9201 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9202 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9203 pub result_ok: bool,
9206 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9207 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9208 CResult_PhantomRouteHintsDecodeErrorZ {
9209 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9210 result: Box::into_raw(Box::new(o)),
9216 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9217 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9218 CResult_PhantomRouteHintsDecodeErrorZ {
9219 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9220 err: Box::into_raw(Box::new(e)),
9225 /// Checks if the given object is currently in the success state
9227 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9231 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9232 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9233 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9234 fn drop(&mut self) {
9236 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9237 let _ = unsafe { Box::from_raw(self.contents.result) };
9240 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9241 let _ = unsafe { Box::from_raw(self.contents.err) };
9246 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9247 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9248 let contents = if o.result_ok {
9249 let result = unsafe { o.contents.result };
9250 unsafe { o.contents.result = core::ptr::null_mut() };
9251 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9253 let err = unsafe { o.contents.err };
9254 unsafe { o.contents.err = core::ptr::null_mut(); }
9255 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9259 result_ok: o.result_ok,
9263 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9264 fn clone(&self) -> Self {
9266 Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9267 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9270 Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9271 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9277 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9278 /// but with all dynamically-allocated buffers duplicated in new buffers.
9279 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9281 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9282 /// This corresponds to std::vector in C++
9283 pub struct CVec_ChannelMonitorZ {
9284 /// The elements in the array.
9285 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9286 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9287 /// The number of elements pointed to by `data`.
9290 impl CVec_ChannelMonitorZ {
9291 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9292 if self.datalen == 0 { return Vec::new(); }
9293 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9294 self.data = core::ptr::null_mut();
9298 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9299 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9302 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9303 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9304 let datalen = v.len();
9305 let data = Box::into_raw(v.into_boxed_slice());
9306 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9310 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9311 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9312 impl Drop for CVec_ChannelMonitorZ {
9313 fn drop(&mut self) {
9314 if self.datalen == 0 { return; }
9315 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9319 /// A tuple of 2 elements. See the individual fields for the types contained.
9320 pub struct C2Tuple_BlockHashChannelManagerZ {
9321 /// The element at position 0
9322 pub a: crate::c_types::ThirtyTwoBytes,
9323 /// The element at position 1
9324 pub b: crate::lightning::ln::channelmanager::ChannelManager,
9326 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9327 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9334 impl C2Tuple_BlockHashChannelManagerZ {
9335 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9339 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9341 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9342 C2Tuple_BlockHashChannelManagerZ { a, b, }
9346 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9347 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9349 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9350 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9351 /// A pointer to the contents in the success state.
9352 /// Reading from this pointer when `result_ok` is not set is undefined.
9353 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9354 /// A pointer to the contents in the error state.
9355 /// Reading from this pointer when `result_ok` is set is undefined.
9356 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9359 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9360 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9362 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9363 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9364 /// `err` or `result` depending on the state of `result_ok`.
9365 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9366 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9367 pub result_ok: bool,
9370 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9371 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9372 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9373 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9374 result: Box::into_raw(Box::new(o)),
9380 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9381 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9382 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9383 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9384 err: Box::into_raw(Box::new(e)),
9389 /// Checks if the given object is currently in the success state
9391 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9395 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9396 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9397 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9398 fn drop(&mut self) {
9400 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9401 let _ = unsafe { Box::from_raw(self.contents.result) };
9404 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9405 let _ = unsafe { Box::from_raw(self.contents.err) };
9410 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9411 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9412 let contents = if o.result_ok {
9413 let result = unsafe { o.contents.result };
9414 unsafe { o.contents.result = core::ptr::null_mut() };
9415 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9417 let err = unsafe { o.contents.err };
9418 unsafe { o.contents.err = core::ptr::null_mut(); }
9419 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9423 result_ok: o.result_ok,
9428 /// The contents of CResult_ChannelConfigDecodeErrorZ
9429 pub union CResult_ChannelConfigDecodeErrorZPtr {
9430 /// A pointer to the contents in the success state.
9431 /// Reading from this pointer when `result_ok` is not set is undefined.
9432 pub result: *mut crate::lightning::util::config::ChannelConfig,
9433 /// A pointer to the contents in the error state.
9434 /// Reading from this pointer when `result_ok` is set is undefined.
9435 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9438 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9439 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9440 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9441 pub struct CResult_ChannelConfigDecodeErrorZ {
9442 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9443 /// `err` or `result` depending on the state of `result_ok`.
9444 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9445 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9446 pub result_ok: bool,
9449 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9450 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9451 CResult_ChannelConfigDecodeErrorZ {
9452 contents: CResult_ChannelConfigDecodeErrorZPtr {
9453 result: Box::into_raw(Box::new(o)),
9459 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9460 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9461 CResult_ChannelConfigDecodeErrorZ {
9462 contents: CResult_ChannelConfigDecodeErrorZPtr {
9463 err: Box::into_raw(Box::new(e)),
9468 /// Checks if the given object is currently in the success state
9470 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9474 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9475 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9476 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9477 fn drop(&mut self) {
9479 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9480 let _ = unsafe { Box::from_raw(self.contents.result) };
9483 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9484 let _ = unsafe { Box::from_raw(self.contents.err) };
9489 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9490 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9491 let contents = if o.result_ok {
9492 let result = unsafe { o.contents.result };
9493 unsafe { o.contents.result = core::ptr::null_mut() };
9494 CResult_ChannelConfigDecodeErrorZPtr { result }
9496 let err = unsafe { o.contents.err };
9497 unsafe { o.contents.err = core::ptr::null_mut(); }
9498 CResult_ChannelConfigDecodeErrorZPtr { err }
9502 result_ok: o.result_ok,
9506 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9507 fn clone(&self) -> Self {
9509 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9510 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9513 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9514 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9520 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9521 /// but with all dynamically-allocated buffers duplicated in new buffers.
9522 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9524 /// The contents of CResult_OutPointDecodeErrorZ
9525 pub union CResult_OutPointDecodeErrorZPtr {
9526 /// A pointer to the contents in the success state.
9527 /// Reading from this pointer when `result_ok` is not set is undefined.
9528 pub result: *mut crate::lightning::chain::transaction::OutPoint,
9529 /// A pointer to the contents in the error state.
9530 /// Reading from this pointer when `result_ok` is set is undefined.
9531 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9534 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9535 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9537 pub struct CResult_OutPointDecodeErrorZ {
9538 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9539 /// `err` or `result` depending on the state of `result_ok`.
9540 pub contents: CResult_OutPointDecodeErrorZPtr,
9541 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9542 pub result_ok: bool,
9545 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9546 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9547 CResult_OutPointDecodeErrorZ {
9548 contents: CResult_OutPointDecodeErrorZPtr {
9549 result: Box::into_raw(Box::new(o)),
9555 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9556 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9557 CResult_OutPointDecodeErrorZ {
9558 contents: CResult_OutPointDecodeErrorZPtr {
9559 err: Box::into_raw(Box::new(e)),
9564 /// Checks if the given object is currently in the success state
9566 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
9570 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
9571 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
9572 impl Drop for CResult_OutPointDecodeErrorZ {
9573 fn drop(&mut self) {
9575 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9576 let _ = unsafe { Box::from_raw(self.contents.result) };
9579 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9580 let _ = unsafe { Box::from_raw(self.contents.err) };
9585 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
9586 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
9587 let contents = if o.result_ok {
9588 let result = unsafe { o.contents.result };
9589 unsafe { o.contents.result = core::ptr::null_mut() };
9590 CResult_OutPointDecodeErrorZPtr { result }
9592 let err = unsafe { o.contents.err };
9593 unsafe { o.contents.err = core::ptr::null_mut(); }
9594 CResult_OutPointDecodeErrorZPtr { err }
9598 result_ok: o.result_ok,
9602 impl Clone for CResult_OutPointDecodeErrorZ {
9603 fn clone(&self) -> Self {
9605 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
9606 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
9609 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
9610 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9616 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9617 /// but with all dynamically-allocated buffers duplicated in new buffers.
9618 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
9620 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
9621 pub enum COption_TypeZ {
9622 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9623 Some(crate::lightning::ln::wire::Type),
9624 /// When we're in this state, this COption_TypeZ contains nothing
9627 impl COption_TypeZ {
9628 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9629 if let Self::None = self { false } else { true }
9631 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9634 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
9635 if let Self::Some(v) = self { v } else { unreachable!() }
9639 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
9640 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
9641 COption_TypeZ::Some(o)
9644 /// Constructs a new COption_TypeZ containing nothing
9645 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
9649 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
9650 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
9652 /// The contents of CResult_COption_TypeZDecodeErrorZ
9653 pub union CResult_COption_TypeZDecodeErrorZPtr {
9654 /// A pointer to the contents in the success state.
9655 /// Reading from this pointer when `result_ok` is not set is undefined.
9656 pub result: *mut crate::c_types::derived::COption_TypeZ,
9657 /// A pointer to the contents in the error state.
9658 /// Reading from this pointer when `result_ok` is set is undefined.
9659 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9662 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9663 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9664 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9665 pub struct CResult_COption_TypeZDecodeErrorZ {
9666 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9667 /// `err` or `result` depending on the state of `result_ok`.
9668 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
9669 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9670 pub result_ok: bool,
9673 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
9674 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
9675 CResult_COption_TypeZDecodeErrorZ {
9676 contents: CResult_COption_TypeZDecodeErrorZPtr {
9677 result: Box::into_raw(Box::new(o)),
9683 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
9684 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
9685 CResult_COption_TypeZDecodeErrorZ {
9686 contents: CResult_COption_TypeZDecodeErrorZPtr {
9687 err: Box::into_raw(Box::new(e)),
9692 /// Checks if the given object is currently in the success state
9694 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
9698 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
9699 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
9700 impl Drop for CResult_COption_TypeZDecodeErrorZ {
9701 fn drop(&mut self) {
9703 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9704 let _ = unsafe { Box::from_raw(self.contents.result) };
9707 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9708 let _ = unsafe { Box::from_raw(self.contents.err) };
9713 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
9714 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9715 let contents = if o.result_ok {
9716 let result = unsafe { o.contents.result };
9717 unsafe { o.contents.result = core::ptr::null_mut() };
9718 CResult_COption_TypeZDecodeErrorZPtr { result }
9720 let err = unsafe { o.contents.err };
9721 unsafe { o.contents.err = core::ptr::null_mut(); }
9722 CResult_COption_TypeZDecodeErrorZPtr { err }
9726 result_ok: o.result_ok,
9731 /// The contents of CResult_PaymentIdPaymentErrorZ
9732 pub union CResult_PaymentIdPaymentErrorZPtr {
9733 /// A pointer to the contents in the success state.
9734 /// Reading from this pointer when `result_ok` is not set is undefined.
9735 pub result: *mut crate::c_types::ThirtyTwoBytes,
9736 /// A pointer to the contents in the error state.
9737 /// Reading from this pointer when `result_ok` is set is undefined.
9738 pub err: *mut crate::lightning_invoice::payment::PaymentError,
9741 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
9742 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
9743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9744 pub struct CResult_PaymentIdPaymentErrorZ {
9745 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
9746 /// `err` or `result` depending on the state of `result_ok`.
9747 pub contents: CResult_PaymentIdPaymentErrorZPtr,
9748 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
9749 pub result_ok: bool,
9752 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
9753 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
9754 CResult_PaymentIdPaymentErrorZ {
9755 contents: CResult_PaymentIdPaymentErrorZPtr {
9756 result: Box::into_raw(Box::new(o)),
9762 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
9763 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
9764 CResult_PaymentIdPaymentErrorZ {
9765 contents: CResult_PaymentIdPaymentErrorZPtr {
9766 err: Box::into_raw(Box::new(e)),
9771 /// Checks if the given object is currently in the success state
9773 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
9777 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
9778 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
9779 impl Drop for CResult_PaymentIdPaymentErrorZ {
9780 fn drop(&mut self) {
9782 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9783 let _ = unsafe { Box::from_raw(self.contents.result) };
9786 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9787 let _ = unsafe { Box::from_raw(self.contents.err) };
9792 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
9793 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
9794 let contents = if o.result_ok {
9795 let result = unsafe { o.contents.result };
9796 unsafe { o.contents.result = core::ptr::null_mut() };
9797 CResult_PaymentIdPaymentErrorZPtr { result }
9799 let err = unsafe { o.contents.err };
9800 unsafe { o.contents.err = core::ptr::null_mut(); }
9801 CResult_PaymentIdPaymentErrorZPtr { err }
9805 result_ok: o.result_ok,
9809 impl Clone for CResult_PaymentIdPaymentErrorZ {
9810 fn clone(&self) -> Self {
9812 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
9813 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9816 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
9817 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
9823 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
9824 /// but with all dynamically-allocated buffers duplicated in new buffers.
9825 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
9827 /// The contents of CResult_SiPrefixParseErrorZ
9828 pub union CResult_SiPrefixParseErrorZPtr {
9829 /// A pointer to the contents in the success state.
9830 /// Reading from this pointer when `result_ok` is not set is undefined.
9831 pub result: *mut crate::lightning_invoice::SiPrefix,
9832 /// A pointer to the contents in the error state.
9833 /// Reading from this pointer when `result_ok` is set is undefined.
9834 pub err: *mut crate::lightning_invoice::ParseError,
9837 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
9838 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
9839 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9840 pub struct CResult_SiPrefixParseErrorZ {
9841 /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
9842 /// `err` or `result` depending on the state of `result_ok`.
9843 pub contents: CResult_SiPrefixParseErrorZPtr,
9844 /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
9845 pub result_ok: bool,
9848 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
9849 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
9850 CResult_SiPrefixParseErrorZ {
9851 contents: CResult_SiPrefixParseErrorZPtr {
9852 result: Box::into_raw(Box::new(o)),
9858 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
9859 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
9860 CResult_SiPrefixParseErrorZ {
9861 contents: CResult_SiPrefixParseErrorZPtr {
9862 err: Box::into_raw(Box::new(e)),
9867 /// Checks if the given object is currently in the success state
9869 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
9873 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
9874 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
9875 impl Drop for CResult_SiPrefixParseErrorZ {
9876 fn drop(&mut self) {
9878 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9879 let _ = unsafe { Box::from_raw(self.contents.result) };
9882 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9883 let _ = unsafe { Box::from_raw(self.contents.err) };
9888 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
9889 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
9890 let contents = if o.result_ok {
9891 let result = unsafe { o.contents.result };
9892 unsafe { o.contents.result = core::ptr::null_mut() };
9893 CResult_SiPrefixParseErrorZPtr { result }
9895 let err = unsafe { o.contents.err };
9896 unsafe { o.contents.err = core::ptr::null_mut(); }
9897 CResult_SiPrefixParseErrorZPtr { err }
9901 result_ok: o.result_ok,
9905 impl Clone for CResult_SiPrefixParseErrorZ {
9906 fn clone(&self) -> Self {
9908 Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
9909 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
9912 Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
9913 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9919 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
9920 /// but with all dynamically-allocated buffers duplicated in new buffers.
9921 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
9923 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
9924 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
9925 /// A pointer to the contents in the success state.
9926 /// Reading from this pointer when `result_ok` is not set is undefined.
9927 pub result: *mut crate::lightning_invoice::Invoice,
9928 /// A pointer to the contents in the error state.
9929 /// Reading from this pointer when `result_ok` is set is undefined.
9930 pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
9933 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
9934 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
9935 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9936 pub struct CResult_InvoiceParseOrSemanticErrorZ {
9937 /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
9938 /// `err` or `result` depending on the state of `result_ok`.
9939 pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
9940 /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
9941 pub result_ok: bool,
9944 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
9945 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
9946 CResult_InvoiceParseOrSemanticErrorZ {
9947 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9948 result: Box::into_raw(Box::new(o)),
9954 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
9955 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
9956 CResult_InvoiceParseOrSemanticErrorZ {
9957 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9958 err: Box::into_raw(Box::new(e)),
9963 /// Checks if the given object is currently in the success state
9965 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
9969 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
9970 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
9971 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
9972 fn drop(&mut self) {
9974 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9975 let _ = unsafe { Box::from_raw(self.contents.result) };
9978 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9979 let _ = unsafe { Box::from_raw(self.contents.err) };
9984 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
9985 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
9986 let contents = if o.result_ok {
9987 let result = unsafe { o.contents.result };
9988 unsafe { o.contents.result = core::ptr::null_mut() };
9989 CResult_InvoiceParseOrSemanticErrorZPtr { result }
9991 let err = unsafe { o.contents.err };
9992 unsafe { o.contents.err = core::ptr::null_mut(); }
9993 CResult_InvoiceParseOrSemanticErrorZPtr { err }
9997 result_ok: o.result_ok,
10001 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
10002 fn clone(&self) -> Self {
10003 if self.result_ok {
10004 Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10005 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10008 Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10009 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
10015 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
10016 /// but with all dynamically-allocated buffers duplicated in new buffers.
10017 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
10019 /// The contents of CResult_SignedRawInvoiceParseErrorZ
10020 pub union CResult_SignedRawInvoiceParseErrorZPtr {
10021 /// A pointer to the contents in the success state.
10022 /// Reading from this pointer when `result_ok` is not set is undefined.
10023 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
10024 /// A pointer to the contents in the error state.
10025 /// Reading from this pointer when `result_ok` is set is undefined.
10026 pub err: *mut crate::lightning_invoice::ParseError,
10029 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
10030 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
10031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10032 pub struct CResult_SignedRawInvoiceParseErrorZ {
10033 /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
10034 /// `err` or `result` depending on the state of `result_ok`.
10035 pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
10036 /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
10037 pub result_ok: bool,
10040 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
10041 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
10042 CResult_SignedRawInvoiceParseErrorZ {
10043 contents: CResult_SignedRawInvoiceParseErrorZPtr {
10044 result: Box::into_raw(Box::new(o)),
10050 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
10051 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
10052 CResult_SignedRawInvoiceParseErrorZ {
10053 contents: CResult_SignedRawInvoiceParseErrorZPtr {
10054 err: Box::into_raw(Box::new(e)),
10059 /// Checks if the given object is currently in the success state
10061 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
10065 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
10066 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
10067 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
10068 fn drop(&mut self) {
10069 if self.result_ok {
10070 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10071 let _ = unsafe { Box::from_raw(self.contents.result) };
10074 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10075 let _ = unsafe { Box::from_raw(self.contents.err) };
10080 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
10081 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
10082 let contents = if o.result_ok {
10083 let result = unsafe { o.contents.result };
10084 unsafe { o.contents.result = core::ptr::null_mut() };
10085 CResult_SignedRawInvoiceParseErrorZPtr { result }
10087 let err = unsafe { o.contents.err };
10088 unsafe { o.contents.err = core::ptr::null_mut(); }
10089 CResult_SignedRawInvoiceParseErrorZPtr { err }
10093 result_ok: o.result_ok,
10097 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
10098 fn clone(&self) -> Self {
10099 if self.result_ok {
10100 Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
10101 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
10104 Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
10105 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
10111 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
10112 /// but with all dynamically-allocated buffers duplicated in new buffers.
10113 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
10115 /// A tuple of 3 elements. See the individual fields for the types contained.
10116 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10117 /// The element at position 0
10118 pub a: crate::lightning_invoice::RawInvoice,
10119 /// The element at position 1
10120 pub b: crate::c_types::ThirtyTwoBytes,
10121 /// The element at position 2
10122 pub c: crate::lightning_invoice::InvoiceSignature,
10124 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10125 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
10133 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10134 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
10135 (self.a, self.b, self.c)
10138 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10139 fn clone(&self) -> Self {
10141 a: Clone::clone(&self.a),
10142 b: Clone::clone(&self.b),
10143 c: Clone::clone(&self.c),
10148 /// Creates a new tuple which has the same data as `orig`
10149 /// but with all dynamically-allocated buffers duplicated in new buffers.
10150 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
10151 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10153 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 {
10154 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
10158 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10159 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
10161 /// The contents of CResult_PayeePubKeyErrorZ
10162 pub union CResult_PayeePubKeyErrorZPtr {
10163 /// A pointer to the contents in the success state.
10164 /// Reading from this pointer when `result_ok` is not set is undefined.
10165 pub result: *mut crate::lightning_invoice::PayeePubKey,
10166 /// A pointer to the contents in the error state.
10167 /// Reading from this pointer when `result_ok` is set is undefined.
10168 pub err: *mut crate::c_types::Secp256k1Error,
10171 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
10172 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
10173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10174 pub struct CResult_PayeePubKeyErrorZ {
10175 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
10176 /// `err` or `result` depending on the state of `result_ok`.
10177 pub contents: CResult_PayeePubKeyErrorZPtr,
10178 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
10179 pub result_ok: bool,
10182 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
10183 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
10184 CResult_PayeePubKeyErrorZ {
10185 contents: CResult_PayeePubKeyErrorZPtr {
10186 result: Box::into_raw(Box::new(o)),
10192 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
10193 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
10194 CResult_PayeePubKeyErrorZ {
10195 contents: CResult_PayeePubKeyErrorZPtr {
10196 err: Box::into_raw(Box::new(e)),
10201 /// Checks if the given object is currently in the success state
10203 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
10207 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
10208 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
10209 impl Drop for CResult_PayeePubKeyErrorZ {
10210 fn drop(&mut self) {
10211 if self.result_ok {
10212 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10213 let _ = unsafe { Box::from_raw(self.contents.result) };
10216 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10217 let _ = unsafe { Box::from_raw(self.contents.err) };
10222 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
10223 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
10224 let contents = if o.result_ok {
10225 let result = unsafe { o.contents.result };
10226 unsafe { o.contents.result = core::ptr::null_mut() };
10227 CResult_PayeePubKeyErrorZPtr { result }
10229 let err = unsafe { o.contents.err };
10230 unsafe { o.contents.err = core::ptr::null_mut(); }
10231 CResult_PayeePubKeyErrorZPtr { err }
10235 result_ok: o.result_ok,
10239 impl Clone for CResult_PayeePubKeyErrorZ {
10240 fn clone(&self) -> Self {
10241 if self.result_ok {
10242 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
10243 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
10246 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
10247 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10253 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10254 /// but with all dynamically-allocated buffers duplicated in new buffers.
10255 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
10257 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
10258 /// This corresponds to std::vector in C++
10259 pub struct CVec_PrivateRouteZ {
10260 /// The elements in the array.
10261 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10262 pub data: *mut crate::lightning_invoice::PrivateRoute,
10263 /// The number of elements pointed to by `data`.
10266 impl CVec_PrivateRouteZ {
10267 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
10268 if self.datalen == 0 { return Vec::new(); }
10269 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10270 self.data = core::ptr::null_mut();
10274 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
10275 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10278 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
10279 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
10280 let datalen = v.len();
10281 let data = Box::into_raw(v.into_boxed_slice());
10282 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10286 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10287 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
10288 impl Drop for CVec_PrivateRouteZ {
10289 fn drop(&mut self) {
10290 if self.datalen == 0 { return; }
10291 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10294 impl Clone for CVec_PrivateRouteZ {
10295 fn clone(&self) -> Self {
10296 let mut res = Vec::new();
10297 if self.datalen == 0 { return Self::from(res); }
10298 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10303 /// The contents of CResult_PositiveTimestampCreationErrorZ
10304 pub union CResult_PositiveTimestampCreationErrorZPtr {
10305 /// A pointer to the contents in the success state.
10306 /// Reading from this pointer when `result_ok` is not set is undefined.
10307 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
10308 /// A pointer to the contents in the error state.
10309 /// Reading from this pointer when `result_ok` is set is undefined.
10310 pub err: *mut crate::lightning_invoice::CreationError,
10313 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
10314 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
10315 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10316 pub struct CResult_PositiveTimestampCreationErrorZ {
10317 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
10318 /// `err` or `result` depending on the state of `result_ok`.
10319 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
10320 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
10321 pub result_ok: bool,
10324 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10325 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
10326 CResult_PositiveTimestampCreationErrorZ {
10327 contents: CResult_PositiveTimestampCreationErrorZPtr {
10328 result: Box::into_raw(Box::new(o)),
10334 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10335 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
10336 CResult_PositiveTimestampCreationErrorZ {
10337 contents: CResult_PositiveTimestampCreationErrorZPtr {
10338 err: Box::into_raw(Box::new(e)),
10343 /// Checks if the given object is currently in the success state
10345 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
10349 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10350 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
10351 impl Drop for CResult_PositiveTimestampCreationErrorZ {
10352 fn drop(&mut self) {
10353 if self.result_ok {
10354 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10355 let _ = unsafe { Box::from_raw(self.contents.result) };
10358 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10359 let _ = unsafe { Box::from_raw(self.contents.err) };
10364 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
10365 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
10366 let contents = if o.result_ok {
10367 let result = unsafe { o.contents.result };
10368 unsafe { o.contents.result = core::ptr::null_mut() };
10369 CResult_PositiveTimestampCreationErrorZPtr { result }
10371 let err = unsafe { o.contents.err };
10372 unsafe { o.contents.err = core::ptr::null_mut(); }
10373 CResult_PositiveTimestampCreationErrorZPtr { err }
10377 result_ok: o.result_ok,
10381 impl Clone for CResult_PositiveTimestampCreationErrorZ {
10382 fn clone(&self) -> Self {
10383 if self.result_ok {
10384 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
10385 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
10388 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
10389 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10395 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10396 /// but with all dynamically-allocated buffers duplicated in new buffers.
10397 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
10399 /// The contents of CResult_NoneSemanticErrorZ
10400 pub union CResult_NoneSemanticErrorZPtr {
10401 /// Note that this value is always NULL, as there are no contents in the OK variant
10402 pub result: *mut core::ffi::c_void,
10403 /// A pointer to the contents in the error state.
10404 /// Reading from this pointer when `result_ok` is set is undefined.
10405 pub err: *mut crate::lightning_invoice::SemanticError,
10408 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10409 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10411 pub struct CResult_NoneSemanticErrorZ {
10412 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
10413 /// `err` or `result` depending on the state of `result_ok`.
10414 pub contents: CResult_NoneSemanticErrorZPtr,
10415 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
10416 pub result_ok: bool,
10419 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
10420 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
10421 CResult_NoneSemanticErrorZ {
10422 contents: CResult_NoneSemanticErrorZPtr {
10423 result: core::ptr::null_mut(),
10429 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
10430 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
10431 CResult_NoneSemanticErrorZ {
10432 contents: CResult_NoneSemanticErrorZPtr {
10433 err: Box::into_raw(Box::new(e)),
10438 /// Checks if the given object is currently in the success state
10440 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
10444 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
10445 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
10446 impl Drop for CResult_NoneSemanticErrorZ {
10447 fn drop(&mut self) {
10448 if self.result_ok {
10450 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10451 let _ = unsafe { Box::from_raw(self.contents.err) };
10456 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
10457 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
10458 let contents = if o.result_ok {
10459 let _ = unsafe { Box::from_raw(o.contents.result) };
10460 o.contents.result = core::ptr::null_mut();
10461 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
10463 let err = unsafe { o.contents.err };
10464 unsafe { o.contents.err = core::ptr::null_mut(); }
10465 CResult_NoneSemanticErrorZPtr { err }
10469 result_ok: o.result_ok,
10473 impl Clone for CResult_NoneSemanticErrorZ {
10474 fn clone(&self) -> Self {
10475 if self.result_ok {
10476 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
10477 result: core::ptr::null_mut()
10480 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
10481 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10487 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10488 /// but with all dynamically-allocated buffers duplicated in new buffers.
10489 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
10491 /// The contents of CResult_InvoiceSemanticErrorZ
10492 pub union CResult_InvoiceSemanticErrorZPtr {
10493 /// A pointer to the contents in the success state.
10494 /// Reading from this pointer when `result_ok` is not set is undefined.
10495 pub result: *mut crate::lightning_invoice::Invoice,
10496 /// A pointer to the contents in the error state.
10497 /// Reading from this pointer when `result_ok` is set is undefined.
10498 pub err: *mut crate::lightning_invoice::SemanticError,
10501 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10502 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10504 pub struct CResult_InvoiceSemanticErrorZ {
10505 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10506 /// `err` or `result` depending on the state of `result_ok`.
10507 pub contents: CResult_InvoiceSemanticErrorZPtr,
10508 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10509 pub result_ok: bool,
10512 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10513 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
10514 CResult_InvoiceSemanticErrorZ {
10515 contents: CResult_InvoiceSemanticErrorZPtr {
10516 result: Box::into_raw(Box::new(o)),
10522 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10523 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
10524 CResult_InvoiceSemanticErrorZ {
10525 contents: CResult_InvoiceSemanticErrorZPtr {
10526 err: Box::into_raw(Box::new(e)),
10531 /// Checks if the given object is currently in the success state
10533 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
10537 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10538 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
10539 impl Drop for CResult_InvoiceSemanticErrorZ {
10540 fn drop(&mut self) {
10541 if self.result_ok {
10542 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10543 let _ = unsafe { Box::from_raw(self.contents.result) };
10546 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10547 let _ = unsafe { Box::from_raw(self.contents.err) };
10552 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
10553 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
10554 let contents = if o.result_ok {
10555 let result = unsafe { o.contents.result };
10556 unsafe { o.contents.result = core::ptr::null_mut() };
10557 CResult_InvoiceSemanticErrorZPtr { result }
10559 let err = unsafe { o.contents.err };
10560 unsafe { o.contents.err = core::ptr::null_mut(); }
10561 CResult_InvoiceSemanticErrorZPtr { err }
10565 result_ok: o.result_ok,
10569 impl Clone for CResult_InvoiceSemanticErrorZ {
10570 fn clone(&self) -> Self {
10571 if self.result_ok {
10572 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
10573 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10576 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
10577 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10583 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10584 /// but with all dynamically-allocated buffers duplicated in new buffers.
10585 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
10587 /// The contents of CResult_DescriptionCreationErrorZ
10588 pub union CResult_DescriptionCreationErrorZPtr {
10589 /// A pointer to the contents in the success state.
10590 /// Reading from this pointer when `result_ok` is not set is undefined.
10591 pub result: *mut crate::lightning_invoice::Description,
10592 /// A pointer to the contents in the error state.
10593 /// Reading from this pointer when `result_ok` is set is undefined.
10594 pub err: *mut crate::lightning_invoice::CreationError,
10597 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10598 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10600 pub struct CResult_DescriptionCreationErrorZ {
10601 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10602 /// `err` or `result` depending on the state of `result_ok`.
10603 pub contents: CResult_DescriptionCreationErrorZPtr,
10604 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
10605 pub result_ok: bool,
10608 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
10609 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
10610 CResult_DescriptionCreationErrorZ {
10611 contents: CResult_DescriptionCreationErrorZPtr {
10612 result: Box::into_raw(Box::new(o)),
10618 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
10619 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
10620 CResult_DescriptionCreationErrorZ {
10621 contents: CResult_DescriptionCreationErrorZPtr {
10622 err: Box::into_raw(Box::new(e)),
10627 /// Checks if the given object is currently in the success state
10629 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
10633 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
10634 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
10635 impl Drop for CResult_DescriptionCreationErrorZ {
10636 fn drop(&mut self) {
10637 if self.result_ok {
10638 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10639 let _ = unsafe { Box::from_raw(self.contents.result) };
10642 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10643 let _ = unsafe { Box::from_raw(self.contents.err) };
10648 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
10649 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
10650 let contents = if o.result_ok {
10651 let result = unsafe { o.contents.result };
10652 unsafe { o.contents.result = core::ptr::null_mut() };
10653 CResult_DescriptionCreationErrorZPtr { result }
10655 let err = unsafe { o.contents.err };
10656 unsafe { o.contents.err = core::ptr::null_mut(); }
10657 CResult_DescriptionCreationErrorZPtr { err }
10661 result_ok: o.result_ok,
10665 impl Clone for CResult_DescriptionCreationErrorZ {
10666 fn clone(&self) -> Self {
10667 if self.result_ok {
10668 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
10669 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
10672 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
10673 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10679 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10680 /// but with all dynamically-allocated buffers duplicated in new buffers.
10681 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
10683 /// The contents of CResult_PrivateRouteCreationErrorZ
10684 pub union CResult_PrivateRouteCreationErrorZPtr {
10685 /// A pointer to the contents in the success state.
10686 /// Reading from this pointer when `result_ok` is not set is undefined.
10687 pub result: *mut crate::lightning_invoice::PrivateRoute,
10688 /// A pointer to the contents in the error state.
10689 /// Reading from this pointer when `result_ok` is set is undefined.
10690 pub err: *mut crate::lightning_invoice::CreationError,
10693 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
10694 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
10695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10696 pub struct CResult_PrivateRouteCreationErrorZ {
10697 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
10698 /// `err` or `result` depending on the state of `result_ok`.
10699 pub contents: CResult_PrivateRouteCreationErrorZPtr,
10700 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
10701 pub result_ok: bool,
10704 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10705 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
10706 CResult_PrivateRouteCreationErrorZ {
10707 contents: CResult_PrivateRouteCreationErrorZPtr {
10708 result: Box::into_raw(Box::new(o)),
10714 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10715 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
10716 CResult_PrivateRouteCreationErrorZ {
10717 contents: CResult_PrivateRouteCreationErrorZPtr {
10718 err: Box::into_raw(Box::new(e)),
10723 /// Checks if the given object is currently in the success state
10725 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
10729 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10730 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
10731 impl Drop for CResult_PrivateRouteCreationErrorZ {
10732 fn drop(&mut self) {
10733 if self.result_ok {
10734 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10735 let _ = unsafe { Box::from_raw(self.contents.result) };
10738 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10739 let _ = unsafe { Box::from_raw(self.contents.err) };
10744 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
10745 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
10746 let contents = if o.result_ok {
10747 let result = unsafe { o.contents.result };
10748 unsafe { o.contents.result = core::ptr::null_mut() };
10749 CResult_PrivateRouteCreationErrorZPtr { result }
10751 let err = unsafe { o.contents.err };
10752 unsafe { o.contents.err = core::ptr::null_mut(); }
10753 CResult_PrivateRouteCreationErrorZPtr { err }
10757 result_ok: o.result_ok,
10761 impl Clone for CResult_PrivateRouteCreationErrorZ {
10762 fn clone(&self) -> Self {
10763 if self.result_ok {
10764 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
10765 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
10768 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
10769 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10775 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10776 /// but with all dynamically-allocated buffers duplicated in new buffers.
10777 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
10779 /// The contents of CResult_StringErrorZ
10780 pub union CResult_StringErrorZPtr {
10781 /// A pointer to the contents in the success state.
10782 /// Reading from this pointer when `result_ok` is not set is undefined.
10783 pub result: *mut crate::c_types::Str,
10784 /// A pointer to the contents in the error state.
10785 /// Reading from this pointer when `result_ok` is set is undefined.
10786 pub err: *mut crate::c_types::Secp256k1Error,
10789 /// A CResult_StringErrorZ represents the result of a fallible operation,
10790 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10792 pub struct CResult_StringErrorZ {
10793 /// The contents of this CResult_StringErrorZ, accessible via either
10794 /// `err` or `result` depending on the state of `result_ok`.
10795 pub contents: CResult_StringErrorZPtr,
10796 /// Whether this CResult_StringErrorZ represents a success state.
10797 pub result_ok: bool,
10800 /// Creates a new CResult_StringErrorZ in the success state.
10801 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10802 CResult_StringErrorZ {
10803 contents: CResult_StringErrorZPtr {
10804 result: Box::into_raw(Box::new(o)),
10810 /// Creates a new CResult_StringErrorZ in the error state.
10811 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10812 CResult_StringErrorZ {
10813 contents: CResult_StringErrorZPtr {
10814 err: Box::into_raw(Box::new(e)),
10819 /// Checks if the given object is currently in the success state
10821 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10825 /// Frees any resources used by the CResult_StringErrorZ.
10826 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10827 impl Drop for CResult_StringErrorZ {
10828 fn drop(&mut self) {
10829 if self.result_ok {
10830 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10831 let _ = unsafe { Box::from_raw(self.contents.result) };
10834 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10835 let _ = unsafe { Box::from_raw(self.contents.err) };
10840 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10841 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10842 let contents = if o.result_ok {
10843 let result = unsafe { o.contents.result };
10844 unsafe { o.contents.result = core::ptr::null_mut() };
10845 CResult_StringErrorZPtr { result }
10847 let err = unsafe { o.contents.err };
10848 unsafe { o.contents.err = core::ptr::null_mut(); }
10849 CResult_StringErrorZPtr { err }
10853 result_ok: o.result_ok,
10857 impl Clone for CResult_StringErrorZ {
10858 fn clone(&self) -> Self {
10859 if self.result_ok {
10860 Self { result_ok: true, contents: CResult_StringErrorZPtr {
10861 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10864 Self { result_ok: false, contents: CResult_StringErrorZPtr {
10865 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10871 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10872 /// but with all dynamically-allocated buffers duplicated in new buffers.
10873 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10875 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10876 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10877 /// A pointer to the contents in the success state.
10878 /// Reading from this pointer when `result_ok` is not set is undefined.
10879 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10880 /// A pointer to the contents in the error state.
10881 /// Reading from this pointer when `result_ok` is set is undefined.
10882 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10885 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10886 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10888 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10889 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10890 /// `err` or `result` depending on the state of `result_ok`.
10891 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10892 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10893 pub result_ok: bool,
10896 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10897 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10898 CResult_ChannelMonitorUpdateDecodeErrorZ {
10899 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10900 result: Box::into_raw(Box::new(o)),
10906 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10907 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10908 CResult_ChannelMonitorUpdateDecodeErrorZ {
10909 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10910 err: Box::into_raw(Box::new(e)),
10915 /// Checks if the given object is currently in the success state
10917 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10921 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10922 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10923 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10924 fn drop(&mut self) {
10925 if self.result_ok {
10926 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10927 let _ = unsafe { Box::from_raw(self.contents.result) };
10930 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10931 let _ = unsafe { Box::from_raw(self.contents.err) };
10936 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10937 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10938 let contents = if o.result_ok {
10939 let result = unsafe { o.contents.result };
10940 unsafe { o.contents.result = core::ptr::null_mut() };
10941 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10943 let err = unsafe { o.contents.err };
10944 unsafe { o.contents.err = core::ptr::null_mut(); }
10945 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10949 result_ok: o.result_ok,
10953 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10954 fn clone(&self) -> Self {
10955 if self.result_ok {
10956 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10957 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10960 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10961 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10967 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10968 /// but with all dynamically-allocated buffers duplicated in new buffers.
10969 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10972 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10973 pub enum COption_MonitorEventZ {
10974 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10975 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10976 /// When we're in this state, this COption_MonitorEventZ contains nothing
10979 impl COption_MonitorEventZ {
10980 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10981 if let Self::None = self { false } else { true }
10983 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10986 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10987 if let Self::Some(v) = self { v } else { unreachable!() }
10991 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10992 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10993 COption_MonitorEventZ::Some(o)
10996 /// Constructs a new COption_MonitorEventZ containing nothing
10997 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10998 COption_MonitorEventZ::None
11001 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
11002 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
11004 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
11005 /// but with all dynamically-allocated buffers duplicated in new buffers.
11006 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
11008 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
11009 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
11010 /// A pointer to the contents in the success state.
11011 /// Reading from this pointer when `result_ok` is not set is undefined.
11012 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
11013 /// A pointer to the contents in the error state.
11014 /// Reading from this pointer when `result_ok` is set is undefined.
11015 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11018 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
11019 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11020 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11021 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
11022 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
11023 /// `err` or `result` depending on the state of `result_ok`.
11024 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
11025 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
11026 pub result_ok: bool,
11029 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
11030 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
11031 CResult_COption_MonitorEventZDecodeErrorZ {
11032 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11033 result: Box::into_raw(Box::new(o)),
11039 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
11040 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
11041 CResult_COption_MonitorEventZDecodeErrorZ {
11042 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11043 err: Box::into_raw(Box::new(e)),
11048 /// Checks if the given object is currently in the success state
11050 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
11054 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
11055 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
11056 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
11057 fn drop(&mut self) {
11058 if self.result_ok {
11059 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11060 let _ = unsafe { Box::from_raw(self.contents.result) };
11063 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11064 let _ = unsafe { Box::from_raw(self.contents.err) };
11069 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
11070 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11071 let contents = if o.result_ok {
11072 let result = unsafe { o.contents.result };
11073 unsafe { o.contents.result = core::ptr::null_mut() };
11074 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
11076 let err = unsafe { o.contents.err };
11077 unsafe { o.contents.err = core::ptr::null_mut(); }
11078 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
11082 result_ok: o.result_ok,
11086 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
11087 fn clone(&self) -> Self {
11088 if self.result_ok {
11089 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11090 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
11093 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11094 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11100 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
11101 /// but with all dynamically-allocated buffers duplicated in new buffers.
11102 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
11104 /// The contents of CResult_HTLCUpdateDecodeErrorZ
11105 pub union CResult_HTLCUpdateDecodeErrorZPtr {
11106 /// A pointer to the contents in the success state.
11107 /// Reading from this pointer when `result_ok` is not set is undefined.
11108 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
11109 /// A pointer to the contents in the error state.
11110 /// Reading from this pointer when `result_ok` is set is undefined.
11111 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11114 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
11115 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11116 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11117 pub struct CResult_HTLCUpdateDecodeErrorZ {
11118 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
11119 /// `err` or `result` depending on the state of `result_ok`.
11120 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
11121 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
11122 pub result_ok: bool,
11125 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11126 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11127 CResult_HTLCUpdateDecodeErrorZ {
11128 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11129 result: Box::into_raw(Box::new(o)),
11135 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11136 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11137 CResult_HTLCUpdateDecodeErrorZ {
11138 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11139 err: Box::into_raw(Box::new(e)),
11144 /// Checks if the given object is currently in the success state
11146 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11150 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11151 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11152 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11153 fn drop(&mut self) {
11154 if self.result_ok {
11155 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11156 let _ = unsafe { Box::from_raw(self.contents.result) };
11159 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11160 let _ = unsafe { Box::from_raw(self.contents.err) };
11165 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11166 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11167 let contents = if o.result_ok {
11168 let result = unsafe { o.contents.result };
11169 unsafe { o.contents.result = core::ptr::null_mut() };
11170 CResult_HTLCUpdateDecodeErrorZPtr { result }
11172 let err = unsafe { o.contents.err };
11173 unsafe { o.contents.err = core::ptr::null_mut(); }
11174 CResult_HTLCUpdateDecodeErrorZPtr { err }
11178 result_ok: o.result_ok,
11182 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11183 fn clone(&self) -> Self {
11184 if self.result_ok {
11185 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11186 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11189 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11190 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11196 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11197 /// but with all dynamically-allocated buffers duplicated in new buffers.
11198 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11200 /// A tuple of 2 elements. See the individual fields for the types contained.
11201 pub struct C2Tuple_OutPointScriptZ {
11202 /// The element at position 0
11203 pub a: crate::lightning::chain::transaction::OutPoint,
11204 /// The element at position 1
11205 pub b: crate::c_types::derived::CVec_u8Z,
11207 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11208 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11215 impl C2Tuple_OutPointScriptZ {
11216 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11220 impl Clone for C2Tuple_OutPointScriptZ {
11221 fn clone(&self) -> Self {
11223 a: Clone::clone(&self.a),
11224 b: Clone::clone(&self.b),
11229 /// Creates a new tuple which has the same data as `orig`
11230 /// but with all dynamically-allocated buffers duplicated in new buffers.
11231 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11232 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11234 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11235 C2Tuple_OutPointScriptZ { a, b, }
11239 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11240 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11242 /// A tuple of 2 elements. See the individual fields for the types contained.
11243 pub struct C2Tuple_u32ScriptZ {
11244 /// The element at position 0
11246 /// The element at position 1
11247 pub b: crate::c_types::derived::CVec_u8Z,
11249 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11250 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11257 impl C2Tuple_u32ScriptZ {
11258 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11262 impl Clone for C2Tuple_u32ScriptZ {
11263 fn clone(&self) -> Self {
11265 a: Clone::clone(&self.a),
11266 b: Clone::clone(&self.b),
11271 /// Creates a new tuple which has the same data as `orig`
11272 /// but with all dynamically-allocated buffers duplicated in new buffers.
11273 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11274 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11276 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11277 C2Tuple_u32ScriptZ { a, b, }
11281 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11282 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11284 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11285 /// This corresponds to std::vector in C++
11286 pub struct CVec_C2Tuple_u32ScriptZZ {
11287 /// The elements in the array.
11288 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11289 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11290 /// The number of elements pointed to by `data`.
11293 impl CVec_C2Tuple_u32ScriptZZ {
11294 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11295 if self.datalen == 0 { return Vec::new(); }
11296 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11297 self.data = core::ptr::null_mut();
11301 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11302 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11305 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11306 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11307 let datalen = v.len();
11308 let data = Box::into_raw(v.into_boxed_slice());
11309 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11313 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11314 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11315 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11316 fn drop(&mut self) {
11317 if self.datalen == 0 { return; }
11318 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11321 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11322 fn clone(&self) -> Self {
11323 let mut res = Vec::new();
11324 if self.datalen == 0 { return Self::from(res); }
11325 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11330 /// A tuple of 2 elements. See the individual fields for the types contained.
11331 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11332 /// The element at position 0
11333 pub a: crate::c_types::ThirtyTwoBytes,
11334 /// The element at position 1
11335 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11337 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11338 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11345 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11346 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11350 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11351 fn clone(&self) -> Self {
11353 a: Clone::clone(&self.a),
11354 b: Clone::clone(&self.b),
11359 /// Creates a new tuple which has the same data as `orig`
11360 /// but with all dynamically-allocated buffers duplicated in new buffers.
11361 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11362 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11364 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 {
11365 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11369 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11370 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11372 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11373 /// This corresponds to std::vector in C++
11374 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11375 /// The elements in the array.
11376 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11377 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11378 /// The number of elements pointed to by `data`.
11381 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11382 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11383 if self.datalen == 0 { return Vec::new(); }
11384 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11385 self.data = core::ptr::null_mut();
11389 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11390 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11393 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11394 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11395 let datalen = v.len();
11396 let data = Box::into_raw(v.into_boxed_slice());
11397 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11401 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11402 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11403 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11404 fn drop(&mut self) {
11405 if self.datalen == 0 { return; }
11406 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11409 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11410 fn clone(&self) -> Self {
11411 let mut res = Vec::new();
11412 if self.datalen == 0 { return Self::from(res); }
11413 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11418 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11419 /// This corresponds to std::vector in C++
11420 pub struct CVec_EventZ {
11421 /// The elements in the array.
11422 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11423 pub data: *mut crate::lightning::util::events::Event,
11424 /// The number of elements pointed to by `data`.
11428 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11429 if self.datalen == 0 { return Vec::new(); }
11430 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11431 self.data = core::ptr::null_mut();
11435 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11436 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11439 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11440 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11441 let datalen = v.len();
11442 let data = Box::into_raw(v.into_boxed_slice());
11443 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11447 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11448 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11449 impl Drop for CVec_EventZ {
11450 fn drop(&mut self) {
11451 if self.datalen == 0 { return; }
11452 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11455 impl Clone for CVec_EventZ {
11456 fn clone(&self) -> Self {
11457 let mut res = Vec::new();
11458 if self.datalen == 0 { return Self::from(res); }
11459 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11464 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11465 /// This corresponds to std::vector in C++
11466 pub struct CVec_TransactionZ {
11467 /// The elements in the array.
11468 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11469 pub data: *mut crate::c_types::Transaction,
11470 /// The number of elements pointed to by `data`.
11473 impl CVec_TransactionZ {
11474 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11475 if self.datalen == 0 { return Vec::new(); }
11476 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11477 self.data = core::ptr::null_mut();
11481 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11482 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11485 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11486 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11487 let datalen = v.len();
11488 let data = Box::into_raw(v.into_boxed_slice());
11489 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11493 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11494 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11495 impl Drop for CVec_TransactionZ {
11496 fn drop(&mut self) {
11497 if self.datalen == 0 { return; }
11498 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11501 impl Clone for CVec_TransactionZ {
11502 fn clone(&self) -> Self {
11503 let mut res = Vec::new();
11504 if self.datalen == 0 { return Self::from(res); }
11505 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11510 /// A tuple of 2 elements. See the individual fields for the types contained.
11511 pub struct C2Tuple_u32TxOutZ {
11512 /// The element at position 0
11514 /// The element at position 1
11515 pub b: crate::c_types::TxOut,
11517 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11518 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11525 impl C2Tuple_u32TxOutZ {
11526 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11530 impl Clone for C2Tuple_u32TxOutZ {
11531 fn clone(&self) -> Self {
11533 a: Clone::clone(&self.a),
11534 b: Clone::clone(&self.b),
11539 /// Creates a new tuple which has the same data as `orig`
11540 /// but with all dynamically-allocated buffers duplicated in new buffers.
11541 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11542 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11544 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11545 C2Tuple_u32TxOutZ { a, b, }
11549 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11550 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11552 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11553 /// This corresponds to std::vector in C++
11554 pub struct CVec_C2Tuple_u32TxOutZZ {
11555 /// The elements in the array.
11556 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11557 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11558 /// The number of elements pointed to by `data`.
11561 impl CVec_C2Tuple_u32TxOutZZ {
11562 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11563 if self.datalen == 0 { return Vec::new(); }
11564 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11565 self.data = core::ptr::null_mut();
11569 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11570 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11573 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11574 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11575 let datalen = v.len();
11576 let data = Box::into_raw(v.into_boxed_slice());
11577 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11581 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11582 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11583 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11584 fn drop(&mut self) {
11585 if self.datalen == 0 { return; }
11586 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11589 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11590 fn clone(&self) -> Self {
11591 let mut res = Vec::new();
11592 if self.datalen == 0 { return Self::from(res); }
11593 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11598 /// A tuple of 2 elements. See the individual fields for the types contained.
11599 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11600 /// The element at position 0
11601 pub a: crate::c_types::ThirtyTwoBytes,
11602 /// The element at position 1
11603 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11605 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11606 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11613 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11614 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11618 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11619 fn clone(&self) -> Self {
11621 a: Clone::clone(&self.a),
11622 b: Clone::clone(&self.b),
11627 /// Creates a new tuple which has the same data as `orig`
11628 /// but with all dynamically-allocated buffers duplicated in new buffers.
11629 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11630 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11632 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 {
11633 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11637 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11638 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11640 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11641 /// This corresponds to std::vector in C++
11642 pub struct CVec_TransactionOutputsZ {
11643 /// The elements in the array.
11644 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11645 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11646 /// The number of elements pointed to by `data`.
11649 impl CVec_TransactionOutputsZ {
11650 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11651 if self.datalen == 0 { return Vec::new(); }
11652 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11653 self.data = core::ptr::null_mut();
11657 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11658 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11661 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11662 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11663 let datalen = v.len();
11664 let data = Box::into_raw(v.into_boxed_slice());
11665 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11669 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11670 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11671 impl Drop for CVec_TransactionOutputsZ {
11672 fn drop(&mut self) {
11673 if self.datalen == 0 { return; }
11674 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11677 impl Clone for CVec_TransactionOutputsZ {
11678 fn clone(&self) -> Self {
11679 let mut res = Vec::new();
11680 if self.datalen == 0 { return Self::from(res); }
11681 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11686 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11687 /// This corresponds to std::vector in C++
11688 pub struct CVec_BalanceZ {
11689 /// The elements in the array.
11690 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11691 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11692 /// The number of elements pointed to by `data`.
11695 impl CVec_BalanceZ {
11696 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11697 if self.datalen == 0 { return Vec::new(); }
11698 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11699 self.data = core::ptr::null_mut();
11703 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11704 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11707 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11708 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11709 let datalen = v.len();
11710 let data = Box::into_raw(v.into_boxed_slice());
11711 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11716 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11717 impl Drop for CVec_BalanceZ {
11718 fn drop(&mut self) {
11719 if self.datalen == 0 { return; }
11720 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11723 impl Clone for CVec_BalanceZ {
11724 fn clone(&self) -> Self {
11725 let mut res = Vec::new();
11726 if self.datalen == 0 { return Self::from(res); }
11727 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11732 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11733 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11734 /// A pointer to the contents in the success state.
11735 /// Reading from this pointer when `result_ok` is not set is undefined.
11736 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11737 /// A pointer to the contents in the error state.
11738 /// Reading from this pointer when `result_ok` is set is undefined.
11739 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11742 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11743 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11745 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11746 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11747 /// `err` or `result` depending on the state of `result_ok`.
11748 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11749 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11750 pub result_ok: bool,
11753 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11754 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11755 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11756 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11757 result: Box::into_raw(Box::new(o)),
11763 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11764 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11765 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11766 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11767 err: Box::into_raw(Box::new(e)),
11772 /// Checks if the given object is currently in the success state
11774 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11778 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11779 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11780 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11781 fn drop(&mut self) {
11782 if self.result_ok {
11783 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11784 let _ = unsafe { Box::from_raw(self.contents.result) };
11787 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11788 let _ = unsafe { Box::from_raw(self.contents.err) };
11793 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11794 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11795 let contents = if o.result_ok {
11796 let result = unsafe { o.contents.result };
11797 unsafe { o.contents.result = core::ptr::null_mut() };
11798 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11800 let err = unsafe { o.contents.err };
11801 unsafe { o.contents.err = core::ptr::null_mut(); }
11802 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11806 result_ok: o.result_ok,
11811 /// A tuple of 2 elements. See the individual fields for the types contained.
11812 pub struct C2Tuple_PublicKeyTypeZ {
11813 /// The element at position 0
11814 pub a: crate::c_types::PublicKey,
11815 /// The element at position 1
11816 pub b: crate::lightning::ln::wire::Type,
11818 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11819 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11826 impl C2Tuple_PublicKeyTypeZ {
11827 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11831 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11833 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11834 C2Tuple_PublicKeyTypeZ { a, b, }
11838 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11839 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11841 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11842 /// This corresponds to std::vector in C++
11843 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11844 /// The elements in the array.
11845 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11846 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11847 /// The number of elements pointed to by `data`.
11850 impl CVec_C2Tuple_PublicKeyTypeZZ {
11851 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11852 if self.datalen == 0 { return Vec::new(); }
11853 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11854 self.data = core::ptr::null_mut();
11858 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11859 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11862 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11863 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11864 let datalen = v.len();
11865 let data = Box::into_raw(v.into_boxed_slice());
11866 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11870 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11871 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11872 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11873 fn drop(&mut self) {
11874 if self.datalen == 0 { return; }
11875 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11880 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11881 pub enum COption_NetAddressZ {
11882 /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11883 Some(crate::lightning::ln::msgs::NetAddress),
11884 /// When we're in this state, this COption_NetAddressZ contains nothing
11887 impl COption_NetAddressZ {
11888 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11889 if let Self::None = self { false } else { true }
11891 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11894 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11895 if let Self::Some(v) = self { v } else { unreachable!() }
11899 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11900 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11901 COption_NetAddressZ::Some(o)
11904 /// Constructs a new COption_NetAddressZ containing nothing
11905 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11906 COption_NetAddressZ::None
11909 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11910 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11912 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11913 /// but with all dynamically-allocated buffers duplicated in new buffers.
11914 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11916 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11917 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11918 /// A pointer to the contents in the success state.
11919 /// Reading from this pointer when `result_ok` is not set is undefined.
11920 pub result: *mut crate::c_types::derived::CVec_u8Z,
11921 /// A pointer to the contents in the error state.
11922 /// Reading from this pointer when `result_ok` is set is undefined.
11923 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11926 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11927 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11929 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11930 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11931 /// `err` or `result` depending on the state of `result_ok`.
11932 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11933 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11934 pub result_ok: bool,
11937 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11938 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11939 CResult_CVec_u8ZPeerHandleErrorZ {
11940 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11941 result: Box::into_raw(Box::new(o)),
11947 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11948 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11949 CResult_CVec_u8ZPeerHandleErrorZ {
11950 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11951 err: Box::into_raw(Box::new(e)),
11956 /// Checks if the given object is currently in the success state
11958 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11962 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11963 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11964 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11965 fn drop(&mut self) {
11966 if self.result_ok {
11967 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11968 let _ = unsafe { Box::from_raw(self.contents.result) };
11971 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11972 let _ = unsafe { Box::from_raw(self.contents.err) };
11977 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11978 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11979 let contents = if o.result_ok {
11980 let result = unsafe { o.contents.result };
11981 unsafe { o.contents.result = core::ptr::null_mut() };
11982 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11984 let err = unsafe { o.contents.err };
11985 unsafe { o.contents.err = core::ptr::null_mut(); }
11986 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11990 result_ok: o.result_ok,
11994 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11995 fn clone(&self) -> Self {
11996 if self.result_ok {
11997 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11998 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12001 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12002 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12008 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12009 /// but with all dynamically-allocated buffers duplicated in new buffers.
12010 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12012 /// The contents of CResult_NonePeerHandleErrorZ
12013 pub union CResult_NonePeerHandleErrorZPtr {
12014 /// Note that this value is always NULL, as there are no contents in the OK variant
12015 pub result: *mut core::ffi::c_void,
12016 /// A pointer to the contents in the error state.
12017 /// Reading from this pointer when `result_ok` is set is undefined.
12018 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12021 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12022 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12023 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12024 pub struct CResult_NonePeerHandleErrorZ {
12025 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12026 /// `err` or `result` depending on the state of `result_ok`.
12027 pub contents: CResult_NonePeerHandleErrorZPtr,
12028 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12029 pub result_ok: bool,
12032 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12033 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12034 CResult_NonePeerHandleErrorZ {
12035 contents: CResult_NonePeerHandleErrorZPtr {
12036 result: core::ptr::null_mut(),
12042 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12043 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12044 CResult_NonePeerHandleErrorZ {
12045 contents: CResult_NonePeerHandleErrorZPtr {
12046 err: Box::into_raw(Box::new(e)),
12051 /// Checks if the given object is currently in the success state
12053 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12057 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12058 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12059 impl Drop for CResult_NonePeerHandleErrorZ {
12060 fn drop(&mut self) {
12061 if self.result_ok {
12063 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12064 let _ = unsafe { Box::from_raw(self.contents.err) };
12069 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12070 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12071 let contents = if o.result_ok {
12072 let _ = unsafe { Box::from_raw(o.contents.result) };
12073 o.contents.result = core::ptr::null_mut();
12074 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12076 let err = unsafe { o.contents.err };
12077 unsafe { o.contents.err = core::ptr::null_mut(); }
12078 CResult_NonePeerHandleErrorZPtr { err }
12082 result_ok: o.result_ok,
12086 impl Clone for CResult_NonePeerHandleErrorZ {
12087 fn clone(&self) -> Self {
12088 if self.result_ok {
12089 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12090 result: core::ptr::null_mut()
12093 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12094 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12100 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12101 /// but with all dynamically-allocated buffers duplicated in new buffers.
12102 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12104 /// The contents of CResult_boolPeerHandleErrorZ
12105 pub union CResult_boolPeerHandleErrorZPtr {
12106 /// A pointer to the contents in the success state.
12107 /// Reading from this pointer when `result_ok` is not set is undefined.
12108 pub result: *mut bool,
12109 /// A pointer to the contents in the error state.
12110 /// Reading from this pointer when `result_ok` is set is undefined.
12111 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12114 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12115 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12116 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12117 pub struct CResult_boolPeerHandleErrorZ {
12118 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12119 /// `err` or `result` depending on the state of `result_ok`.
12120 pub contents: CResult_boolPeerHandleErrorZPtr,
12121 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12122 pub result_ok: bool,
12125 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12126 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12127 CResult_boolPeerHandleErrorZ {
12128 contents: CResult_boolPeerHandleErrorZPtr {
12129 result: Box::into_raw(Box::new(o)),
12135 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12136 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12137 CResult_boolPeerHandleErrorZ {
12138 contents: CResult_boolPeerHandleErrorZPtr {
12139 err: Box::into_raw(Box::new(e)),
12144 /// Checks if the given object is currently in the success state
12146 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12150 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12151 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12152 impl Drop for CResult_boolPeerHandleErrorZ {
12153 fn drop(&mut self) {
12154 if self.result_ok {
12155 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12156 let _ = unsafe { Box::from_raw(self.contents.result) };
12159 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12160 let _ = unsafe { Box::from_raw(self.contents.err) };
12165 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12166 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12167 let contents = if o.result_ok {
12168 let result = unsafe { o.contents.result };
12169 unsafe { o.contents.result = core::ptr::null_mut() };
12170 CResult_boolPeerHandleErrorZPtr { result }
12172 let err = unsafe { o.contents.err };
12173 unsafe { o.contents.err = core::ptr::null_mut(); }
12174 CResult_boolPeerHandleErrorZPtr { err }
12178 result_ok: o.result_ok,
12182 impl Clone for CResult_boolPeerHandleErrorZ {
12183 fn clone(&self) -> Self {
12184 if self.result_ok {
12185 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12186 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12189 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12190 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12196 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12197 /// but with all dynamically-allocated buffers duplicated in new buffers.
12198 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12200 /// The contents of CResult_u32GraphSyncErrorZ
12201 pub union CResult_u32GraphSyncErrorZPtr {
12202 /// A pointer to the contents in the success state.
12203 /// Reading from this pointer when `result_ok` is not set is undefined.
12204 pub result: *mut u32,
12205 /// A pointer to the contents in the error state.
12206 /// Reading from this pointer when `result_ok` is set is undefined.
12207 pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12210 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12211 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12213 pub struct CResult_u32GraphSyncErrorZ {
12214 /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12215 /// `err` or `result` depending on the state of `result_ok`.
12216 pub contents: CResult_u32GraphSyncErrorZPtr,
12217 /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12218 pub result_ok: bool,
12221 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12222 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12223 CResult_u32GraphSyncErrorZ {
12224 contents: CResult_u32GraphSyncErrorZPtr {
12225 result: Box::into_raw(Box::new(o)),
12231 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12232 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12233 CResult_u32GraphSyncErrorZ {
12234 contents: CResult_u32GraphSyncErrorZPtr {
12235 err: Box::into_raw(Box::new(e)),
12240 /// Checks if the given object is currently in the success state
12242 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12246 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12247 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12248 impl Drop for CResult_u32GraphSyncErrorZ {
12249 fn drop(&mut self) {
12250 if self.result_ok {
12251 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12252 let _ = unsafe { Box::from_raw(self.contents.result) };
12255 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12256 let _ = unsafe { Box::from_raw(self.contents.err) };
12261 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12262 fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12263 let contents = if o.result_ok {
12264 let result = unsafe { o.contents.result };
12265 unsafe { o.contents.result = core::ptr::null_mut() };
12266 CResult_u32GraphSyncErrorZPtr { result }
12268 let err = unsafe { o.contents.err };
12269 unsafe { o.contents.err = core::ptr::null_mut(); }
12270 CResult_u32GraphSyncErrorZPtr { err }
12274 result_ok: o.result_ok,
12279 /// The contents of CResult_NetAddressDecodeErrorZ
12280 pub union CResult_NetAddressDecodeErrorZPtr {
12281 /// A pointer to the contents in the success state.
12282 /// Reading from this pointer when `result_ok` is not set is undefined.
12283 pub result: *mut crate::lightning::ln::msgs::NetAddress,
12284 /// A pointer to the contents in the error state.
12285 /// Reading from this pointer when `result_ok` is set is undefined.
12286 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12289 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
12290 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
12291 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12292 pub struct CResult_NetAddressDecodeErrorZ {
12293 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
12294 /// `err` or `result` depending on the state of `result_ok`.
12295 pub contents: CResult_NetAddressDecodeErrorZPtr,
12296 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
12297 pub result_ok: bool,
12300 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
12301 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
12302 CResult_NetAddressDecodeErrorZ {
12303 contents: CResult_NetAddressDecodeErrorZPtr {
12304 result: Box::into_raw(Box::new(o)),
12310 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
12311 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
12312 CResult_NetAddressDecodeErrorZ {
12313 contents: CResult_NetAddressDecodeErrorZPtr {
12314 err: Box::into_raw(Box::new(e)),
12319 /// Checks if the given object is currently in the success state
12321 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
12325 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
12326 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
12327 impl Drop for CResult_NetAddressDecodeErrorZ {
12328 fn drop(&mut self) {
12329 if self.result_ok {
12330 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12331 let _ = unsafe { Box::from_raw(self.contents.result) };
12334 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12335 let _ = unsafe { Box::from_raw(self.contents.err) };
12340 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
12341 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
12342 let contents = if o.result_ok {
12343 let result = unsafe { o.contents.result };
12344 unsafe { o.contents.result = core::ptr::null_mut() };
12345 CResult_NetAddressDecodeErrorZPtr { result }
12347 let err = unsafe { o.contents.err };
12348 unsafe { o.contents.err = core::ptr::null_mut(); }
12349 CResult_NetAddressDecodeErrorZPtr { err }
12353 result_ok: o.result_ok,
12357 impl Clone for CResult_NetAddressDecodeErrorZ {
12358 fn clone(&self) -> Self {
12359 if self.result_ok {
12360 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
12361 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
12364 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
12365 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12371 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12372 /// but with all dynamically-allocated buffers duplicated in new buffers.
12373 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
12375 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
12376 /// This corresponds to std::vector in C++
12377 pub struct CVec_UpdateAddHTLCZ {
12378 /// The elements in the array.
12379 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12380 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12381 /// The number of elements pointed to by `data`.
12384 impl CVec_UpdateAddHTLCZ {
12385 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
12386 if self.datalen == 0 { return Vec::new(); }
12387 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12388 self.data = core::ptr::null_mut();
12392 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
12393 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12396 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
12397 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
12398 let datalen = v.len();
12399 let data = Box::into_raw(v.into_boxed_slice());
12400 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12404 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12405 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12406 impl Drop for CVec_UpdateAddHTLCZ {
12407 fn drop(&mut self) {
12408 if self.datalen == 0 { return; }
12409 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12412 impl Clone for CVec_UpdateAddHTLCZ {
12413 fn clone(&self) -> Self {
12414 let mut res = Vec::new();
12415 if self.datalen == 0 { return Self::from(res); }
12416 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12421 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12422 /// This corresponds to std::vector in C++
12423 pub struct CVec_UpdateFulfillHTLCZ {
12424 /// The elements in the array.
12425 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12426 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12427 /// The number of elements pointed to by `data`.
12430 impl CVec_UpdateFulfillHTLCZ {
12431 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12432 if self.datalen == 0 { return Vec::new(); }
12433 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12434 self.data = core::ptr::null_mut();
12438 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12439 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12442 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12443 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12444 let datalen = v.len();
12445 let data = Box::into_raw(v.into_boxed_slice());
12446 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12450 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12451 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12452 impl Drop for CVec_UpdateFulfillHTLCZ {
12453 fn drop(&mut self) {
12454 if self.datalen == 0 { return; }
12455 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12458 impl Clone for CVec_UpdateFulfillHTLCZ {
12459 fn clone(&self) -> Self {
12460 let mut res = Vec::new();
12461 if self.datalen == 0 { return Self::from(res); }
12462 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12467 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12468 /// This corresponds to std::vector in C++
12469 pub struct CVec_UpdateFailHTLCZ {
12470 /// The elements in the array.
12471 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12472 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12473 /// The number of elements pointed to by `data`.
12476 impl CVec_UpdateFailHTLCZ {
12477 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12478 if self.datalen == 0 { return Vec::new(); }
12479 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12480 self.data = core::ptr::null_mut();
12484 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12485 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12488 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12489 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12490 let datalen = v.len();
12491 let data = Box::into_raw(v.into_boxed_slice());
12492 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12496 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12497 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12498 impl Drop for CVec_UpdateFailHTLCZ {
12499 fn drop(&mut self) {
12500 if self.datalen == 0 { return; }
12501 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12504 impl Clone for CVec_UpdateFailHTLCZ {
12505 fn clone(&self) -> Self {
12506 let mut res = Vec::new();
12507 if self.datalen == 0 { return Self::from(res); }
12508 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12513 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12514 /// This corresponds to std::vector in C++
12515 pub struct CVec_UpdateFailMalformedHTLCZ {
12516 /// The elements in the array.
12517 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12518 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12519 /// The number of elements pointed to by `data`.
12522 impl CVec_UpdateFailMalformedHTLCZ {
12523 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12524 if self.datalen == 0 { return Vec::new(); }
12525 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12526 self.data = core::ptr::null_mut();
12530 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12531 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12534 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12535 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12536 let datalen = v.len();
12537 let data = Box::into_raw(v.into_boxed_slice());
12538 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12542 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12543 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12544 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12545 fn drop(&mut self) {
12546 if self.datalen == 0 { return; }
12547 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12550 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12551 fn clone(&self) -> Self {
12552 let mut res = Vec::new();
12553 if self.datalen == 0 { return Self::from(res); }
12554 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12559 /// The contents of CResult_AcceptChannelDecodeErrorZ
12560 pub union CResult_AcceptChannelDecodeErrorZPtr {
12561 /// A pointer to the contents in the success state.
12562 /// Reading from this pointer when `result_ok` is not set is undefined.
12563 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12564 /// A pointer to the contents in the error state.
12565 /// Reading from this pointer when `result_ok` is set is undefined.
12566 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12569 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12570 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12571 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12572 pub struct CResult_AcceptChannelDecodeErrorZ {
12573 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12574 /// `err` or `result` depending on the state of `result_ok`.
12575 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12576 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12577 pub result_ok: bool,
12580 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12581 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12582 CResult_AcceptChannelDecodeErrorZ {
12583 contents: CResult_AcceptChannelDecodeErrorZPtr {
12584 result: Box::into_raw(Box::new(o)),
12590 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12591 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12592 CResult_AcceptChannelDecodeErrorZ {
12593 contents: CResult_AcceptChannelDecodeErrorZPtr {
12594 err: Box::into_raw(Box::new(e)),
12599 /// Checks if the given object is currently in the success state
12601 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12605 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12606 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12607 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12608 fn drop(&mut self) {
12609 if self.result_ok {
12610 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12611 let _ = unsafe { Box::from_raw(self.contents.result) };
12614 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12615 let _ = unsafe { Box::from_raw(self.contents.err) };
12620 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12621 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12622 let contents = if o.result_ok {
12623 let result = unsafe { o.contents.result };
12624 unsafe { o.contents.result = core::ptr::null_mut() };
12625 CResult_AcceptChannelDecodeErrorZPtr { result }
12627 let err = unsafe { o.contents.err };
12628 unsafe { o.contents.err = core::ptr::null_mut(); }
12629 CResult_AcceptChannelDecodeErrorZPtr { err }
12633 result_ok: o.result_ok,
12637 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12638 fn clone(&self) -> Self {
12639 if self.result_ok {
12640 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12641 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12644 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12645 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12651 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12652 /// but with all dynamically-allocated buffers duplicated in new buffers.
12653 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12655 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12656 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12657 /// A pointer to the contents in the success state.
12658 /// Reading from this pointer when `result_ok` is not set is undefined.
12659 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12660 /// A pointer to the contents in the error state.
12661 /// Reading from this pointer when `result_ok` is set is undefined.
12662 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12665 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12666 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12667 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12668 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12669 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12670 /// `err` or `result` depending on the state of `result_ok`.
12671 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12672 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12673 pub result_ok: bool,
12676 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12677 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12678 CResult_AnnouncementSignaturesDecodeErrorZ {
12679 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12680 result: Box::into_raw(Box::new(o)),
12686 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12687 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12688 CResult_AnnouncementSignaturesDecodeErrorZ {
12689 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12690 err: Box::into_raw(Box::new(e)),
12695 /// Checks if the given object is currently in the success state
12697 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12701 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12702 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12703 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12704 fn drop(&mut self) {
12705 if self.result_ok {
12706 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12707 let _ = unsafe { Box::from_raw(self.contents.result) };
12710 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12711 let _ = unsafe { Box::from_raw(self.contents.err) };
12716 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12717 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12718 let contents = if o.result_ok {
12719 let result = unsafe { o.contents.result };
12720 unsafe { o.contents.result = core::ptr::null_mut() };
12721 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12723 let err = unsafe { o.contents.err };
12724 unsafe { o.contents.err = core::ptr::null_mut(); }
12725 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12729 result_ok: o.result_ok,
12733 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12734 fn clone(&self) -> Self {
12735 if self.result_ok {
12736 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12737 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12740 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12741 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12747 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12748 /// but with all dynamically-allocated buffers duplicated in new buffers.
12749 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12751 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12752 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12753 /// A pointer to the contents in the success state.
12754 /// Reading from this pointer when `result_ok` is not set is undefined.
12755 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12756 /// A pointer to the contents in the error state.
12757 /// Reading from this pointer when `result_ok` is set is undefined.
12758 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12761 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12762 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12764 pub struct CResult_ChannelReestablishDecodeErrorZ {
12765 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12766 /// `err` or `result` depending on the state of `result_ok`.
12767 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12768 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12769 pub result_ok: bool,
12772 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12773 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12774 CResult_ChannelReestablishDecodeErrorZ {
12775 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12776 result: Box::into_raw(Box::new(o)),
12782 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12783 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12784 CResult_ChannelReestablishDecodeErrorZ {
12785 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12786 err: Box::into_raw(Box::new(e)),
12791 /// Checks if the given object is currently in the success state
12793 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12797 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12798 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12799 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12800 fn drop(&mut self) {
12801 if self.result_ok {
12802 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12803 let _ = unsafe { Box::from_raw(self.contents.result) };
12806 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12807 let _ = unsafe { Box::from_raw(self.contents.err) };
12812 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12813 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12814 let contents = if o.result_ok {
12815 let result = unsafe { o.contents.result };
12816 unsafe { o.contents.result = core::ptr::null_mut() };
12817 CResult_ChannelReestablishDecodeErrorZPtr { result }
12819 let err = unsafe { o.contents.err };
12820 unsafe { o.contents.err = core::ptr::null_mut(); }
12821 CResult_ChannelReestablishDecodeErrorZPtr { err }
12825 result_ok: o.result_ok,
12829 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12830 fn clone(&self) -> Self {
12831 if self.result_ok {
12832 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12833 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12836 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12837 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12843 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12844 /// but with all dynamically-allocated buffers duplicated in new buffers.
12845 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12847 /// The contents of CResult_ClosingSignedDecodeErrorZ
12848 pub union CResult_ClosingSignedDecodeErrorZPtr {
12849 /// A pointer to the contents in the success state.
12850 /// Reading from this pointer when `result_ok` is not set is undefined.
12851 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12852 /// A pointer to the contents in the error state.
12853 /// Reading from this pointer when `result_ok` is set is undefined.
12854 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12857 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12858 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12860 pub struct CResult_ClosingSignedDecodeErrorZ {
12861 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12862 /// `err` or `result` depending on the state of `result_ok`.
12863 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12864 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12865 pub result_ok: bool,
12868 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12869 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12870 CResult_ClosingSignedDecodeErrorZ {
12871 contents: CResult_ClosingSignedDecodeErrorZPtr {
12872 result: Box::into_raw(Box::new(o)),
12878 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12879 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12880 CResult_ClosingSignedDecodeErrorZ {
12881 contents: CResult_ClosingSignedDecodeErrorZPtr {
12882 err: Box::into_raw(Box::new(e)),
12887 /// Checks if the given object is currently in the success state
12889 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12893 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12894 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12895 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12896 fn drop(&mut self) {
12897 if self.result_ok {
12898 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12899 let _ = unsafe { Box::from_raw(self.contents.result) };
12902 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12903 let _ = unsafe { Box::from_raw(self.contents.err) };
12908 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12909 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12910 let contents = if o.result_ok {
12911 let result = unsafe { o.contents.result };
12912 unsafe { o.contents.result = core::ptr::null_mut() };
12913 CResult_ClosingSignedDecodeErrorZPtr { result }
12915 let err = unsafe { o.contents.err };
12916 unsafe { o.contents.err = core::ptr::null_mut(); }
12917 CResult_ClosingSignedDecodeErrorZPtr { err }
12921 result_ok: o.result_ok,
12925 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12926 fn clone(&self) -> Self {
12927 if self.result_ok {
12928 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12929 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12932 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12933 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12939 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12940 /// but with all dynamically-allocated buffers duplicated in new buffers.
12941 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12943 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12944 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12945 /// A pointer to the contents in the success state.
12946 /// Reading from this pointer when `result_ok` is not set is undefined.
12947 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12948 /// A pointer to the contents in the error state.
12949 /// Reading from this pointer when `result_ok` is set is undefined.
12950 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12953 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12954 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12956 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12957 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12958 /// `err` or `result` depending on the state of `result_ok`.
12959 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12960 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12961 pub result_ok: bool,
12964 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12965 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12966 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12967 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12968 result: Box::into_raw(Box::new(o)),
12974 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12975 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12976 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12977 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12978 err: Box::into_raw(Box::new(e)),
12983 /// Checks if the given object is currently in the success state
12985 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12989 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12990 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12991 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12992 fn drop(&mut self) {
12993 if self.result_ok {
12994 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12995 let _ = unsafe { Box::from_raw(self.contents.result) };
12998 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12999 let _ = unsafe { Box::from_raw(self.contents.err) };
13004 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13005 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13006 let contents = if o.result_ok {
13007 let result = unsafe { o.contents.result };
13008 unsafe { o.contents.result = core::ptr::null_mut() };
13009 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
13011 let err = unsafe { o.contents.err };
13012 unsafe { o.contents.err = core::ptr::null_mut(); }
13013 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
13017 result_ok: o.result_ok,
13021 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13022 fn clone(&self) -> Self {
13023 if self.result_ok {
13024 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13025 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
13028 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13029 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13035 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13036 /// but with all dynamically-allocated buffers duplicated in new buffers.
13037 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
13039 /// The contents of CResult_CommitmentSignedDecodeErrorZ
13040 pub union CResult_CommitmentSignedDecodeErrorZPtr {
13041 /// A pointer to the contents in the success state.
13042 /// Reading from this pointer when `result_ok` is not set is undefined.
13043 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
13044 /// A pointer to the contents in the error state.
13045 /// Reading from this pointer when `result_ok` is set is undefined.
13046 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13049 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
13050 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13052 pub struct CResult_CommitmentSignedDecodeErrorZ {
13053 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
13054 /// `err` or `result` depending on the state of `result_ok`.
13055 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
13056 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
13057 pub result_ok: bool,
13060 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13061 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
13062 CResult_CommitmentSignedDecodeErrorZ {
13063 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13064 result: Box::into_raw(Box::new(o)),
13070 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13071 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
13072 CResult_CommitmentSignedDecodeErrorZ {
13073 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13074 err: Box::into_raw(Box::new(e)),
13079 /// Checks if the given object is currently in the success state
13081 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
13085 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13086 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
13087 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
13088 fn drop(&mut self) {
13089 if self.result_ok {
13090 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13091 let _ = unsafe { Box::from_raw(self.contents.result) };
13094 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13095 let _ = unsafe { Box::from_raw(self.contents.err) };
13100 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
13101 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13102 let contents = if o.result_ok {
13103 let result = unsafe { o.contents.result };
13104 unsafe { o.contents.result = core::ptr::null_mut() };
13105 CResult_CommitmentSignedDecodeErrorZPtr { result }
13107 let err = unsafe { o.contents.err };
13108 unsafe { o.contents.err = core::ptr::null_mut(); }
13109 CResult_CommitmentSignedDecodeErrorZPtr { err }
13113 result_ok: o.result_ok,
13117 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
13118 fn clone(&self) -> Self {
13119 if self.result_ok {
13120 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13121 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
13124 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13125 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13131 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13132 /// but with all dynamically-allocated buffers duplicated in new buffers.
13133 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
13135 /// The contents of CResult_FundingCreatedDecodeErrorZ
13136 pub union CResult_FundingCreatedDecodeErrorZPtr {
13137 /// A pointer to the contents in the success state.
13138 /// Reading from this pointer when `result_ok` is not set is undefined.
13139 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13140 /// A pointer to the contents in the error state.
13141 /// Reading from this pointer when `result_ok` is set is undefined.
13142 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13145 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13146 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13148 pub struct CResult_FundingCreatedDecodeErrorZ {
13149 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13150 /// `err` or `result` depending on the state of `result_ok`.
13151 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13152 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13153 pub result_ok: bool,
13156 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13157 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13158 CResult_FundingCreatedDecodeErrorZ {
13159 contents: CResult_FundingCreatedDecodeErrorZPtr {
13160 result: Box::into_raw(Box::new(o)),
13166 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13167 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13168 CResult_FundingCreatedDecodeErrorZ {
13169 contents: CResult_FundingCreatedDecodeErrorZPtr {
13170 err: Box::into_raw(Box::new(e)),
13175 /// Checks if the given object is currently in the success state
13177 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13181 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13182 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13183 impl Drop for CResult_FundingCreatedDecodeErrorZ {
13184 fn drop(&mut self) {
13185 if self.result_ok {
13186 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13187 let _ = unsafe { Box::from_raw(self.contents.result) };
13190 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13191 let _ = unsafe { Box::from_raw(self.contents.err) };
13196 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
13197 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
13198 let contents = if o.result_ok {
13199 let result = unsafe { o.contents.result };
13200 unsafe { o.contents.result = core::ptr::null_mut() };
13201 CResult_FundingCreatedDecodeErrorZPtr { result }
13203 let err = unsafe { o.contents.err };
13204 unsafe { o.contents.err = core::ptr::null_mut(); }
13205 CResult_FundingCreatedDecodeErrorZPtr { err }
13209 result_ok: o.result_ok,
13213 impl Clone for CResult_FundingCreatedDecodeErrorZ {
13214 fn clone(&self) -> Self {
13215 if self.result_ok {
13216 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
13217 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
13220 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
13221 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13227 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13228 /// but with all dynamically-allocated buffers duplicated in new buffers.
13229 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
13231 /// The contents of CResult_FundingSignedDecodeErrorZ
13232 pub union CResult_FundingSignedDecodeErrorZPtr {
13233 /// A pointer to the contents in the success state.
13234 /// Reading from this pointer when `result_ok` is not set is undefined.
13235 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
13236 /// A pointer to the contents in the error state.
13237 /// Reading from this pointer when `result_ok` is set is undefined.
13238 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13241 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
13242 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13244 pub struct CResult_FundingSignedDecodeErrorZ {
13245 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
13246 /// `err` or `result` depending on the state of `result_ok`.
13247 pub contents: CResult_FundingSignedDecodeErrorZPtr,
13248 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
13249 pub result_ok: bool,
13252 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13253 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
13254 CResult_FundingSignedDecodeErrorZ {
13255 contents: CResult_FundingSignedDecodeErrorZPtr {
13256 result: Box::into_raw(Box::new(o)),
13262 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13263 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
13264 CResult_FundingSignedDecodeErrorZ {
13265 contents: CResult_FundingSignedDecodeErrorZPtr {
13266 err: Box::into_raw(Box::new(e)),
13271 /// Checks if the given object is currently in the success state
13273 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
13277 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13278 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
13279 impl Drop for CResult_FundingSignedDecodeErrorZ {
13280 fn drop(&mut self) {
13281 if self.result_ok {
13282 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13283 let _ = unsafe { Box::from_raw(self.contents.result) };
13286 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13287 let _ = unsafe { Box::from_raw(self.contents.err) };
13292 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
13293 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13294 let contents = if o.result_ok {
13295 let result = unsafe { o.contents.result };
13296 unsafe { o.contents.result = core::ptr::null_mut() };
13297 CResult_FundingSignedDecodeErrorZPtr { result }
13299 let err = unsafe { o.contents.err };
13300 unsafe { o.contents.err = core::ptr::null_mut(); }
13301 CResult_FundingSignedDecodeErrorZPtr { err }
13305 result_ok: o.result_ok,
13309 impl Clone for CResult_FundingSignedDecodeErrorZ {
13310 fn clone(&self) -> Self {
13311 if self.result_ok {
13312 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
13313 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
13316 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
13317 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13323 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13324 /// but with all dynamically-allocated buffers duplicated in new buffers.
13325 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
13327 /// The contents of CResult_ChannelReadyDecodeErrorZ
13328 pub union CResult_ChannelReadyDecodeErrorZPtr {
13329 /// A pointer to the contents in the success state.
13330 /// Reading from this pointer when `result_ok` is not set is undefined.
13331 pub result: *mut crate::lightning::ln::msgs::ChannelReady,
13332 /// A pointer to the contents in the error state.
13333 /// Reading from this pointer when `result_ok` is set is undefined.
13334 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13337 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
13338 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
13339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13340 pub struct CResult_ChannelReadyDecodeErrorZ {
13341 /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
13342 /// `err` or `result` depending on the state of `result_ok`.
13343 pub contents: CResult_ChannelReadyDecodeErrorZPtr,
13344 /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
13345 pub result_ok: bool,
13348 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
13349 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
13350 CResult_ChannelReadyDecodeErrorZ {
13351 contents: CResult_ChannelReadyDecodeErrorZPtr {
13352 result: Box::into_raw(Box::new(o)),
13358 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
13359 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
13360 CResult_ChannelReadyDecodeErrorZ {
13361 contents: CResult_ChannelReadyDecodeErrorZPtr {
13362 err: Box::into_raw(Box::new(e)),
13367 /// Checks if the given object is currently in the success state
13369 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13373 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13374 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13375 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13376 fn drop(&mut self) {
13377 if self.result_ok {
13378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13379 let _ = unsafe { Box::from_raw(self.contents.result) };
13382 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13383 let _ = unsafe { Box::from_raw(self.contents.err) };
13388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13389 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13390 let contents = if o.result_ok {
13391 let result = unsafe { o.contents.result };
13392 unsafe { o.contents.result = core::ptr::null_mut() };
13393 CResult_ChannelReadyDecodeErrorZPtr { result }
13395 let err = unsafe { o.contents.err };
13396 unsafe { o.contents.err = core::ptr::null_mut(); }
13397 CResult_ChannelReadyDecodeErrorZPtr { err }
13401 result_ok: o.result_ok,
13405 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13406 fn clone(&self) -> Self {
13407 if self.result_ok {
13408 Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13409 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13412 Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13413 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13419 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13420 /// but with all dynamically-allocated buffers duplicated in new buffers.
13421 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13423 /// The contents of CResult_InitDecodeErrorZ
13424 pub union CResult_InitDecodeErrorZPtr {
13425 /// A pointer to the contents in the success state.
13426 /// Reading from this pointer when `result_ok` is not set is undefined.
13427 pub result: *mut crate::lightning::ln::msgs::Init,
13428 /// A pointer to the contents in the error state.
13429 /// Reading from this pointer when `result_ok` is set is undefined.
13430 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13433 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13434 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13436 pub struct CResult_InitDecodeErrorZ {
13437 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13438 /// `err` or `result` depending on the state of `result_ok`.
13439 pub contents: CResult_InitDecodeErrorZPtr,
13440 /// Whether this CResult_InitDecodeErrorZ represents a success state.
13441 pub result_ok: bool,
13444 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13445 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13446 CResult_InitDecodeErrorZ {
13447 contents: CResult_InitDecodeErrorZPtr {
13448 result: Box::into_raw(Box::new(o)),
13454 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13455 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13456 CResult_InitDecodeErrorZ {
13457 contents: CResult_InitDecodeErrorZPtr {
13458 err: Box::into_raw(Box::new(e)),
13463 /// Checks if the given object is currently in the success state
13465 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13469 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13470 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13471 impl Drop for CResult_InitDecodeErrorZ {
13472 fn drop(&mut self) {
13473 if self.result_ok {
13474 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13475 let _ = unsafe { Box::from_raw(self.contents.result) };
13478 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13479 let _ = unsafe { Box::from_raw(self.contents.err) };
13484 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
13485 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
13486 let contents = if o.result_ok {
13487 let result = unsafe { o.contents.result };
13488 unsafe { o.contents.result = core::ptr::null_mut() };
13489 CResult_InitDecodeErrorZPtr { result }
13491 let err = unsafe { o.contents.err };
13492 unsafe { o.contents.err = core::ptr::null_mut(); }
13493 CResult_InitDecodeErrorZPtr { err }
13497 result_ok: o.result_ok,
13501 impl Clone for CResult_InitDecodeErrorZ {
13502 fn clone(&self) -> Self {
13503 if self.result_ok {
13504 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
13505 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
13508 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
13509 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13515 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13516 /// but with all dynamically-allocated buffers duplicated in new buffers.
13517 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
13519 /// The contents of CResult_OpenChannelDecodeErrorZ
13520 pub union CResult_OpenChannelDecodeErrorZPtr {
13521 /// A pointer to the contents in the success state.
13522 /// Reading from this pointer when `result_ok` is not set is undefined.
13523 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
13524 /// A pointer to the contents in the error state.
13525 /// Reading from this pointer when `result_ok` is set is undefined.
13526 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13529 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
13530 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13532 pub struct CResult_OpenChannelDecodeErrorZ {
13533 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
13534 /// `err` or `result` depending on the state of `result_ok`.
13535 pub contents: CResult_OpenChannelDecodeErrorZPtr,
13536 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
13537 pub result_ok: bool,
13540 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13541 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13542 CResult_OpenChannelDecodeErrorZ {
13543 contents: CResult_OpenChannelDecodeErrorZPtr {
13544 result: Box::into_raw(Box::new(o)),
13550 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13551 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13552 CResult_OpenChannelDecodeErrorZ {
13553 contents: CResult_OpenChannelDecodeErrorZPtr {
13554 err: Box::into_raw(Box::new(e)),
13559 /// Checks if the given object is currently in the success state
13561 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13565 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13566 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13567 impl Drop for CResult_OpenChannelDecodeErrorZ {
13568 fn drop(&mut self) {
13569 if self.result_ok {
13570 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13571 let _ = unsafe { Box::from_raw(self.contents.result) };
13574 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13575 let _ = unsafe { Box::from_raw(self.contents.err) };
13580 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13581 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13582 let contents = if o.result_ok {
13583 let result = unsafe { o.contents.result };
13584 unsafe { o.contents.result = core::ptr::null_mut() };
13585 CResult_OpenChannelDecodeErrorZPtr { result }
13587 let err = unsafe { o.contents.err };
13588 unsafe { o.contents.err = core::ptr::null_mut(); }
13589 CResult_OpenChannelDecodeErrorZPtr { err }
13593 result_ok: o.result_ok,
13597 impl Clone for CResult_OpenChannelDecodeErrorZ {
13598 fn clone(&self) -> Self {
13599 if self.result_ok {
13600 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13601 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13604 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13605 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13611 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13612 /// but with all dynamically-allocated buffers duplicated in new buffers.
13613 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13615 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13616 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13617 /// A pointer to the contents in the success state.
13618 /// Reading from this pointer when `result_ok` is not set is undefined.
13619 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13620 /// A pointer to the contents in the error state.
13621 /// Reading from this pointer when `result_ok` is set is undefined.
13622 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13625 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13626 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13628 pub struct CResult_RevokeAndACKDecodeErrorZ {
13629 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13630 /// `err` or `result` depending on the state of `result_ok`.
13631 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13632 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13633 pub result_ok: bool,
13636 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13637 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13638 CResult_RevokeAndACKDecodeErrorZ {
13639 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13640 result: Box::into_raw(Box::new(o)),
13646 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13647 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13648 CResult_RevokeAndACKDecodeErrorZ {
13649 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13650 err: Box::into_raw(Box::new(e)),
13655 /// Checks if the given object is currently in the success state
13657 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13661 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13662 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13663 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13664 fn drop(&mut self) {
13665 if self.result_ok {
13666 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13667 let _ = unsafe { Box::from_raw(self.contents.result) };
13670 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13671 let _ = unsafe { Box::from_raw(self.contents.err) };
13676 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13677 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13678 let contents = if o.result_ok {
13679 let result = unsafe { o.contents.result };
13680 unsafe { o.contents.result = core::ptr::null_mut() };
13681 CResult_RevokeAndACKDecodeErrorZPtr { result }
13683 let err = unsafe { o.contents.err };
13684 unsafe { o.contents.err = core::ptr::null_mut(); }
13685 CResult_RevokeAndACKDecodeErrorZPtr { err }
13689 result_ok: o.result_ok,
13693 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13694 fn clone(&self) -> Self {
13695 if self.result_ok {
13696 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13697 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13700 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13701 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13707 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13708 /// but with all dynamically-allocated buffers duplicated in new buffers.
13709 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13711 /// The contents of CResult_ShutdownDecodeErrorZ
13712 pub union CResult_ShutdownDecodeErrorZPtr {
13713 /// A pointer to the contents in the success state.
13714 /// Reading from this pointer when `result_ok` is not set is undefined.
13715 pub result: *mut crate::lightning::ln::msgs::Shutdown,
13716 /// A pointer to the contents in the error state.
13717 /// Reading from this pointer when `result_ok` is set is undefined.
13718 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13721 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13722 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13724 pub struct CResult_ShutdownDecodeErrorZ {
13725 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13726 /// `err` or `result` depending on the state of `result_ok`.
13727 pub contents: CResult_ShutdownDecodeErrorZPtr,
13728 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13729 pub result_ok: bool,
13732 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13733 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13734 CResult_ShutdownDecodeErrorZ {
13735 contents: CResult_ShutdownDecodeErrorZPtr {
13736 result: Box::into_raw(Box::new(o)),
13742 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13743 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13744 CResult_ShutdownDecodeErrorZ {
13745 contents: CResult_ShutdownDecodeErrorZPtr {
13746 err: Box::into_raw(Box::new(e)),
13751 /// Checks if the given object is currently in the success state
13753 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13757 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13758 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13759 impl Drop for CResult_ShutdownDecodeErrorZ {
13760 fn drop(&mut self) {
13761 if self.result_ok {
13762 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13763 let _ = unsafe { Box::from_raw(self.contents.result) };
13766 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13767 let _ = unsafe { Box::from_raw(self.contents.err) };
13772 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13773 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13774 let contents = if o.result_ok {
13775 let result = unsafe { o.contents.result };
13776 unsafe { o.contents.result = core::ptr::null_mut() };
13777 CResult_ShutdownDecodeErrorZPtr { result }
13779 let err = unsafe { o.contents.err };
13780 unsafe { o.contents.err = core::ptr::null_mut(); }
13781 CResult_ShutdownDecodeErrorZPtr { err }
13785 result_ok: o.result_ok,
13789 impl Clone for CResult_ShutdownDecodeErrorZ {
13790 fn clone(&self) -> Self {
13791 if self.result_ok {
13792 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13793 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13796 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13797 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13803 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13804 /// but with all dynamically-allocated buffers duplicated in new buffers.
13805 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13807 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13808 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13809 /// A pointer to the contents in the success state.
13810 /// Reading from this pointer when `result_ok` is not set is undefined.
13811 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13812 /// A pointer to the contents in the error state.
13813 /// Reading from this pointer when `result_ok` is set is undefined.
13814 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13817 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13818 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13819 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13820 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13821 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13822 /// `err` or `result` depending on the state of `result_ok`.
13823 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13824 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13825 pub result_ok: bool,
13828 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13829 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13830 CResult_UpdateFailHTLCDecodeErrorZ {
13831 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13832 result: Box::into_raw(Box::new(o)),
13838 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13839 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13840 CResult_UpdateFailHTLCDecodeErrorZ {
13841 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13842 err: Box::into_raw(Box::new(e)),
13847 /// Checks if the given object is currently in the success state
13849 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13853 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13854 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13855 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13856 fn drop(&mut self) {
13857 if self.result_ok {
13858 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13859 let _ = unsafe { Box::from_raw(self.contents.result) };
13862 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13863 let _ = unsafe { Box::from_raw(self.contents.err) };
13868 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13869 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13870 let contents = if o.result_ok {
13871 let result = unsafe { o.contents.result };
13872 unsafe { o.contents.result = core::ptr::null_mut() };
13873 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13875 let err = unsafe { o.contents.err };
13876 unsafe { o.contents.err = core::ptr::null_mut(); }
13877 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13881 result_ok: o.result_ok,
13885 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13886 fn clone(&self) -> Self {
13887 if self.result_ok {
13888 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13889 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13892 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13893 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13899 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13900 /// but with all dynamically-allocated buffers duplicated in new buffers.
13901 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13903 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13904 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13905 /// A pointer to the contents in the success state.
13906 /// Reading from this pointer when `result_ok` is not set is undefined.
13907 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13908 /// A pointer to the contents in the error state.
13909 /// Reading from this pointer when `result_ok` is set is undefined.
13910 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13913 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13914 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13915 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13916 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13917 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13918 /// `err` or `result` depending on the state of `result_ok`.
13919 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13920 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13921 pub result_ok: bool,
13924 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13925 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13926 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13927 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13928 result: Box::into_raw(Box::new(o)),
13934 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13935 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13936 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13937 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13938 err: Box::into_raw(Box::new(e)),
13943 /// Checks if the given object is currently in the success state
13945 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13949 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13950 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13951 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13952 fn drop(&mut self) {
13953 if self.result_ok {
13954 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13955 let _ = unsafe { Box::from_raw(self.contents.result) };
13958 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13959 let _ = unsafe { Box::from_raw(self.contents.err) };
13964 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13965 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13966 let contents = if o.result_ok {
13967 let result = unsafe { o.contents.result };
13968 unsafe { o.contents.result = core::ptr::null_mut() };
13969 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13971 let err = unsafe { o.contents.err };
13972 unsafe { o.contents.err = core::ptr::null_mut(); }
13973 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13977 result_ok: o.result_ok,
13981 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13982 fn clone(&self) -> Self {
13983 if self.result_ok {
13984 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13985 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13988 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13989 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13995 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13996 /// but with all dynamically-allocated buffers duplicated in new buffers.
13997 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13999 /// The contents of CResult_UpdateFeeDecodeErrorZ
14000 pub union CResult_UpdateFeeDecodeErrorZPtr {
14001 /// A pointer to the contents in the success state.
14002 /// Reading from this pointer when `result_ok` is not set is undefined.
14003 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
14004 /// A pointer to the contents in the error state.
14005 /// Reading from this pointer when `result_ok` is set is undefined.
14006 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14009 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
14010 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
14011 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14012 pub struct CResult_UpdateFeeDecodeErrorZ {
14013 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
14014 /// `err` or `result` depending on the state of `result_ok`.
14015 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
14016 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
14017 pub result_ok: bool,
14020 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14021 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
14022 CResult_UpdateFeeDecodeErrorZ {
14023 contents: CResult_UpdateFeeDecodeErrorZPtr {
14024 result: Box::into_raw(Box::new(o)),
14030 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14031 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
14032 CResult_UpdateFeeDecodeErrorZ {
14033 contents: CResult_UpdateFeeDecodeErrorZPtr {
14034 err: Box::into_raw(Box::new(e)),
14039 /// Checks if the given object is currently in the success state
14041 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
14045 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14046 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
14047 impl Drop for CResult_UpdateFeeDecodeErrorZ {
14048 fn drop(&mut self) {
14049 if self.result_ok {
14050 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14051 let _ = unsafe { Box::from_raw(self.contents.result) };
14054 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14055 let _ = unsafe { Box::from_raw(self.contents.err) };
14060 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
14061 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
14062 let contents = if o.result_ok {
14063 let result = unsafe { o.contents.result };
14064 unsafe { o.contents.result = core::ptr::null_mut() };
14065 CResult_UpdateFeeDecodeErrorZPtr { result }
14067 let err = unsafe { o.contents.err };
14068 unsafe { o.contents.err = core::ptr::null_mut(); }
14069 CResult_UpdateFeeDecodeErrorZPtr { err }
14073 result_ok: o.result_ok,
14077 impl Clone for CResult_UpdateFeeDecodeErrorZ {
14078 fn clone(&self) -> Self {
14079 if self.result_ok {
14080 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
14081 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
14084 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
14085 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14091 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14092 /// but with all dynamically-allocated buffers duplicated in new buffers.
14093 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
14095 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
14096 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14097 /// A pointer to the contents in the success state.
14098 /// Reading from this pointer when `result_ok` is not set is undefined.
14099 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14100 /// A pointer to the contents in the error state.
14101 /// Reading from this pointer when `result_ok` is set is undefined.
14102 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14105 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
14106 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14108 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
14109 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
14110 /// `err` or `result` depending on the state of `result_ok`.
14111 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
14112 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
14113 pub result_ok: bool,
14116 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14117 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14118 CResult_UpdateFulfillHTLCDecodeErrorZ {
14119 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14120 result: Box::into_raw(Box::new(o)),
14126 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14127 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14128 CResult_UpdateFulfillHTLCDecodeErrorZ {
14129 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14130 err: Box::into_raw(Box::new(e)),
14135 /// Checks if the given object is currently in the success state
14137 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14141 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14142 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14143 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14144 fn drop(&mut self) {
14145 if self.result_ok {
14146 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14147 let _ = unsafe { Box::from_raw(self.contents.result) };
14150 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14151 let _ = unsafe { Box::from_raw(self.contents.err) };
14156 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14157 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14158 let contents = if o.result_ok {
14159 let result = unsafe { o.contents.result };
14160 unsafe { o.contents.result = core::ptr::null_mut() };
14161 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14163 let err = unsafe { o.contents.err };
14164 unsafe { o.contents.err = core::ptr::null_mut(); }
14165 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14169 result_ok: o.result_ok,
14173 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14174 fn clone(&self) -> Self {
14175 if self.result_ok {
14176 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14177 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14180 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14181 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14187 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14188 /// but with all dynamically-allocated buffers duplicated in new buffers.
14189 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
14191 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
14192 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
14193 /// A pointer to the contents in the success state.
14194 /// Reading from this pointer when `result_ok` is not set is undefined.
14195 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14196 /// A pointer to the contents in the error state.
14197 /// Reading from this pointer when `result_ok` is set is undefined.
14198 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14201 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
14202 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14204 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
14205 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
14206 /// `err` or `result` depending on the state of `result_ok`.
14207 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
14208 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
14209 pub result_ok: bool,
14212 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14213 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
14214 CResult_UpdateAddHTLCDecodeErrorZ {
14215 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14216 result: Box::into_raw(Box::new(o)),
14222 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14223 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
14224 CResult_UpdateAddHTLCDecodeErrorZ {
14225 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14226 err: Box::into_raw(Box::new(e)),
14231 /// Checks if the given object is currently in the success state
14233 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
14237 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14238 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
14239 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
14240 fn drop(&mut self) {
14241 if self.result_ok {
14242 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14243 let _ = unsafe { Box::from_raw(self.contents.result) };
14246 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14247 let _ = unsafe { Box::from_raw(self.contents.err) };
14252 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
14253 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14254 let contents = if o.result_ok {
14255 let result = unsafe { o.contents.result };
14256 unsafe { o.contents.result = core::ptr::null_mut() };
14257 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
14259 let err = unsafe { o.contents.err };
14260 unsafe { o.contents.err = core::ptr::null_mut(); }
14261 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
14265 result_ok: o.result_ok,
14269 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
14270 fn clone(&self) -> Self {
14271 if self.result_ok {
14272 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14273 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
14276 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14277 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14283 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14284 /// but with all dynamically-allocated buffers duplicated in new buffers.
14285 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
14287 /// The contents of CResult_PingDecodeErrorZ
14288 pub union CResult_PingDecodeErrorZPtr {
14289 /// A pointer to the contents in the success state.
14290 /// Reading from this pointer when `result_ok` is not set is undefined.
14291 pub result: *mut crate::lightning::ln::msgs::Ping,
14292 /// A pointer to the contents in the error state.
14293 /// Reading from this pointer when `result_ok` is set is undefined.
14294 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14297 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
14298 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
14299 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14300 pub struct CResult_PingDecodeErrorZ {
14301 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
14302 /// `err` or `result` depending on the state of `result_ok`.
14303 pub contents: CResult_PingDecodeErrorZPtr,
14304 /// Whether this CResult_PingDecodeErrorZ represents a success state.
14305 pub result_ok: bool,
14308 /// Creates a new CResult_PingDecodeErrorZ in the success state.
14309 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
14310 CResult_PingDecodeErrorZ {
14311 contents: CResult_PingDecodeErrorZPtr {
14312 result: Box::into_raw(Box::new(o)),
14318 /// Creates a new CResult_PingDecodeErrorZ in the error state.
14319 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
14320 CResult_PingDecodeErrorZ {
14321 contents: CResult_PingDecodeErrorZPtr {
14322 err: Box::into_raw(Box::new(e)),
14327 /// Checks if the given object is currently in the success state
14329 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
14333 /// Frees any resources used by the CResult_PingDecodeErrorZ.
14334 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
14335 impl Drop for CResult_PingDecodeErrorZ {
14336 fn drop(&mut self) {
14337 if self.result_ok {
14338 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14339 let _ = unsafe { Box::from_raw(self.contents.result) };
14342 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14343 let _ = unsafe { Box::from_raw(self.contents.err) };
14348 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
14349 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
14350 let contents = if o.result_ok {
14351 let result = unsafe { o.contents.result };
14352 unsafe { o.contents.result = core::ptr::null_mut() };
14353 CResult_PingDecodeErrorZPtr { result }
14355 let err = unsafe { o.contents.err };
14356 unsafe { o.contents.err = core::ptr::null_mut(); }
14357 CResult_PingDecodeErrorZPtr { err }
14361 result_ok: o.result_ok,
14365 impl Clone for CResult_PingDecodeErrorZ {
14366 fn clone(&self) -> Self {
14367 if self.result_ok {
14368 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
14369 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
14372 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
14373 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14379 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
14380 /// but with all dynamically-allocated buffers duplicated in new buffers.
14381 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
14383 /// The contents of CResult_PongDecodeErrorZ
14384 pub union CResult_PongDecodeErrorZPtr {
14385 /// A pointer to the contents in the success state.
14386 /// Reading from this pointer when `result_ok` is not set is undefined.
14387 pub result: *mut crate::lightning::ln::msgs::Pong,
14388 /// A pointer to the contents in the error state.
14389 /// Reading from this pointer when `result_ok` is set is undefined.
14390 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14393 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
14394 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
14395 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14396 pub struct CResult_PongDecodeErrorZ {
14397 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
14398 /// `err` or `result` depending on the state of `result_ok`.
14399 pub contents: CResult_PongDecodeErrorZPtr,
14400 /// Whether this CResult_PongDecodeErrorZ represents a success state.
14401 pub result_ok: bool,
14404 /// Creates a new CResult_PongDecodeErrorZ in the success state.
14405 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
14406 CResult_PongDecodeErrorZ {
14407 contents: CResult_PongDecodeErrorZPtr {
14408 result: Box::into_raw(Box::new(o)),
14414 /// Creates a new CResult_PongDecodeErrorZ in the error state.
14415 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
14416 CResult_PongDecodeErrorZ {
14417 contents: CResult_PongDecodeErrorZPtr {
14418 err: Box::into_raw(Box::new(e)),
14423 /// Checks if the given object is currently in the success state
14425 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
14429 /// Frees any resources used by the CResult_PongDecodeErrorZ.
14430 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
14431 impl Drop for CResult_PongDecodeErrorZ {
14432 fn drop(&mut self) {
14433 if self.result_ok {
14434 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14435 let _ = unsafe { Box::from_raw(self.contents.result) };
14438 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14439 let _ = unsafe { Box::from_raw(self.contents.err) };
14444 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
14445 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
14446 let contents = if o.result_ok {
14447 let result = unsafe { o.contents.result };
14448 unsafe { o.contents.result = core::ptr::null_mut() };
14449 CResult_PongDecodeErrorZPtr { result }
14451 let err = unsafe { o.contents.err };
14452 unsafe { o.contents.err = core::ptr::null_mut(); }
14453 CResult_PongDecodeErrorZPtr { err }
14457 result_ok: o.result_ok,
14461 impl Clone for CResult_PongDecodeErrorZ {
14462 fn clone(&self) -> Self {
14463 if self.result_ok {
14464 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
14465 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
14468 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
14469 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14475 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
14476 /// but with all dynamically-allocated buffers duplicated in new buffers.
14477 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
14479 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
14480 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14481 /// A pointer to the contents in the success state.
14482 /// Reading from this pointer when `result_ok` is not set is undefined.
14483 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
14484 /// A pointer to the contents in the error state.
14485 /// Reading from this pointer when `result_ok` is set is undefined.
14486 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14489 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14490 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14491 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14492 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14493 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
14494 /// `err` or `result` depending on the state of `result_ok`.
14495 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
14496 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
14497 pub result_ok: bool,
14500 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
14501 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14502 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14503 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14504 result: Box::into_raw(Box::new(o)),
14510 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
14511 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14512 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14513 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14514 err: Box::into_raw(Box::new(e)),
14519 /// Checks if the given object is currently in the success state
14521 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
14525 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
14526 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
14527 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14528 fn drop(&mut self) {
14529 if self.result_ok {
14530 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14531 let _ = unsafe { Box::from_raw(self.contents.result) };
14534 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14535 let _ = unsafe { Box::from_raw(self.contents.err) };
14540 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14541 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14542 let contents = if o.result_ok {
14543 let result = unsafe { o.contents.result };
14544 unsafe { o.contents.result = core::ptr::null_mut() };
14545 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
14547 let err = unsafe { o.contents.err };
14548 unsafe { o.contents.err = core::ptr::null_mut(); }
14549 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14553 result_ok: o.result_ok,
14557 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14558 fn clone(&self) -> Self {
14559 if self.result_ok {
14560 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14561 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14564 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14565 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14571 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14572 /// but with all dynamically-allocated buffers duplicated in new buffers.
14573 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14575 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14576 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14577 /// A pointer to the contents in the success state.
14578 /// Reading from this pointer when `result_ok` is not set is undefined.
14579 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14580 /// A pointer to the contents in the error state.
14581 /// Reading from this pointer when `result_ok` is set is undefined.
14582 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14585 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14586 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14587 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14588 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14589 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14590 /// `err` or `result` depending on the state of `result_ok`.
14591 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14592 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14593 pub result_ok: bool,
14596 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14597 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14598 CResult_ChannelAnnouncementDecodeErrorZ {
14599 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14600 result: Box::into_raw(Box::new(o)),
14606 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14607 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14608 CResult_ChannelAnnouncementDecodeErrorZ {
14609 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14610 err: Box::into_raw(Box::new(e)),
14615 /// Checks if the given object is currently in the success state
14617 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14621 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14622 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14623 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14624 fn drop(&mut self) {
14625 if self.result_ok {
14626 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14627 let _ = unsafe { Box::from_raw(self.contents.result) };
14630 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14631 let _ = unsafe { Box::from_raw(self.contents.err) };
14636 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14637 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14638 let contents = if o.result_ok {
14639 let result = unsafe { o.contents.result };
14640 unsafe { o.contents.result = core::ptr::null_mut() };
14641 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14643 let err = unsafe { o.contents.err };
14644 unsafe { o.contents.err = core::ptr::null_mut(); }
14645 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14649 result_ok: o.result_ok,
14653 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14654 fn clone(&self) -> Self {
14655 if self.result_ok {
14656 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14657 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14660 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14661 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14667 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14668 /// but with all dynamically-allocated buffers duplicated in new buffers.
14669 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14671 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14672 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14673 /// A pointer to the contents in the success state.
14674 /// Reading from this pointer when `result_ok` is not set is undefined.
14675 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14676 /// A pointer to the contents in the error state.
14677 /// Reading from this pointer when `result_ok` is set is undefined.
14678 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14681 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14682 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14683 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14684 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14685 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14686 /// `err` or `result` depending on the state of `result_ok`.
14687 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14688 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14689 pub result_ok: bool,
14692 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14693 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14694 CResult_UnsignedChannelUpdateDecodeErrorZ {
14695 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14696 result: Box::into_raw(Box::new(o)),
14702 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14703 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14704 CResult_UnsignedChannelUpdateDecodeErrorZ {
14705 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14706 err: Box::into_raw(Box::new(e)),
14711 /// Checks if the given object is currently in the success state
14713 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14717 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14718 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14719 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14720 fn drop(&mut self) {
14721 if self.result_ok {
14722 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14723 let _ = unsafe { Box::from_raw(self.contents.result) };
14726 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14727 let _ = unsafe { Box::from_raw(self.contents.err) };
14732 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14733 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14734 let contents = if o.result_ok {
14735 let result = unsafe { o.contents.result };
14736 unsafe { o.contents.result = core::ptr::null_mut() };
14737 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14739 let err = unsafe { o.contents.err };
14740 unsafe { o.contents.err = core::ptr::null_mut(); }
14741 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14745 result_ok: o.result_ok,
14749 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14750 fn clone(&self) -> Self {
14751 if self.result_ok {
14752 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14753 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14756 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14757 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14763 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14764 /// but with all dynamically-allocated buffers duplicated in new buffers.
14765 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14767 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14768 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14769 /// A pointer to the contents in the success state.
14770 /// Reading from this pointer when `result_ok` is not set is undefined.
14771 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14772 /// A pointer to the contents in the error state.
14773 /// Reading from this pointer when `result_ok` is set is undefined.
14774 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14777 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14778 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14779 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14780 pub struct CResult_ChannelUpdateDecodeErrorZ {
14781 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14782 /// `err` or `result` depending on the state of `result_ok`.
14783 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14784 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14785 pub result_ok: bool,
14788 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14789 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14790 CResult_ChannelUpdateDecodeErrorZ {
14791 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14792 result: Box::into_raw(Box::new(o)),
14798 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14799 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14800 CResult_ChannelUpdateDecodeErrorZ {
14801 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14802 err: Box::into_raw(Box::new(e)),
14807 /// Checks if the given object is currently in the success state
14809 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14813 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14814 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14815 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14816 fn drop(&mut self) {
14817 if self.result_ok {
14818 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14819 let _ = unsafe { Box::from_raw(self.contents.result) };
14822 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14823 let _ = unsafe { Box::from_raw(self.contents.err) };
14828 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14829 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14830 let contents = if o.result_ok {
14831 let result = unsafe { o.contents.result };
14832 unsafe { o.contents.result = core::ptr::null_mut() };
14833 CResult_ChannelUpdateDecodeErrorZPtr { result }
14835 let err = unsafe { o.contents.err };
14836 unsafe { o.contents.err = core::ptr::null_mut(); }
14837 CResult_ChannelUpdateDecodeErrorZPtr { err }
14841 result_ok: o.result_ok,
14845 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14846 fn clone(&self) -> Self {
14847 if self.result_ok {
14848 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14849 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14852 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14853 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14859 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14860 /// but with all dynamically-allocated buffers duplicated in new buffers.
14861 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14863 /// The contents of CResult_ErrorMessageDecodeErrorZ
14864 pub union CResult_ErrorMessageDecodeErrorZPtr {
14865 /// A pointer to the contents in the success state.
14866 /// Reading from this pointer when `result_ok` is not set is undefined.
14867 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14868 /// A pointer to the contents in the error state.
14869 /// Reading from this pointer when `result_ok` is set is undefined.
14870 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14873 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14874 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14875 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14876 pub struct CResult_ErrorMessageDecodeErrorZ {
14877 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14878 /// `err` or `result` depending on the state of `result_ok`.
14879 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14880 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14881 pub result_ok: bool,
14884 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14885 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14886 CResult_ErrorMessageDecodeErrorZ {
14887 contents: CResult_ErrorMessageDecodeErrorZPtr {
14888 result: Box::into_raw(Box::new(o)),
14894 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14895 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14896 CResult_ErrorMessageDecodeErrorZ {
14897 contents: CResult_ErrorMessageDecodeErrorZPtr {
14898 err: Box::into_raw(Box::new(e)),
14903 /// Checks if the given object is currently in the success state
14905 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14909 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14910 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14911 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14912 fn drop(&mut self) {
14913 if self.result_ok {
14914 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14915 let _ = unsafe { Box::from_raw(self.contents.result) };
14918 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14919 let _ = unsafe { Box::from_raw(self.contents.err) };
14924 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14925 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14926 let contents = if o.result_ok {
14927 let result = unsafe { o.contents.result };
14928 unsafe { o.contents.result = core::ptr::null_mut() };
14929 CResult_ErrorMessageDecodeErrorZPtr { result }
14931 let err = unsafe { o.contents.err };
14932 unsafe { o.contents.err = core::ptr::null_mut(); }
14933 CResult_ErrorMessageDecodeErrorZPtr { err }
14937 result_ok: o.result_ok,
14941 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14942 fn clone(&self) -> Self {
14943 if self.result_ok {
14944 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14945 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14948 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14949 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14955 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14956 /// but with all dynamically-allocated buffers duplicated in new buffers.
14957 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14959 /// The contents of CResult_WarningMessageDecodeErrorZ
14960 pub union CResult_WarningMessageDecodeErrorZPtr {
14961 /// A pointer to the contents in the success state.
14962 /// Reading from this pointer when `result_ok` is not set is undefined.
14963 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14964 /// A pointer to the contents in the error state.
14965 /// Reading from this pointer when `result_ok` is set is undefined.
14966 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14969 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14970 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14972 pub struct CResult_WarningMessageDecodeErrorZ {
14973 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14974 /// `err` or `result` depending on the state of `result_ok`.
14975 pub contents: CResult_WarningMessageDecodeErrorZPtr,
14976 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14977 pub result_ok: bool,
14980 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14981 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14982 CResult_WarningMessageDecodeErrorZ {
14983 contents: CResult_WarningMessageDecodeErrorZPtr {
14984 result: Box::into_raw(Box::new(o)),
14990 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14991 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14992 CResult_WarningMessageDecodeErrorZ {
14993 contents: CResult_WarningMessageDecodeErrorZPtr {
14994 err: Box::into_raw(Box::new(e)),
14999 /// Checks if the given object is currently in the success state
15001 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
15005 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
15006 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
15007 impl Drop for CResult_WarningMessageDecodeErrorZ {
15008 fn drop(&mut self) {
15009 if self.result_ok {
15010 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15011 let _ = unsafe { Box::from_raw(self.contents.result) };
15014 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15015 let _ = unsafe { Box::from_raw(self.contents.err) };
15020 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
15021 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15022 let contents = if o.result_ok {
15023 let result = unsafe { o.contents.result };
15024 unsafe { o.contents.result = core::ptr::null_mut() };
15025 CResult_WarningMessageDecodeErrorZPtr { result }
15027 let err = unsafe { o.contents.err };
15028 unsafe { o.contents.err = core::ptr::null_mut(); }
15029 CResult_WarningMessageDecodeErrorZPtr { err }
15033 result_ok: o.result_ok,
15037 impl Clone for CResult_WarningMessageDecodeErrorZ {
15038 fn clone(&self) -> Self {
15039 if self.result_ok {
15040 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
15041 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
15044 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
15045 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15051 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
15052 /// but with all dynamically-allocated buffers duplicated in new buffers.
15053 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
15055 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
15056 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15057 /// A pointer to the contents in the success state.
15058 /// Reading from this pointer when `result_ok` is not set is undefined.
15059 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
15060 /// A pointer to the contents in the error state.
15061 /// Reading from this pointer when `result_ok` is set is undefined.
15062 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15065 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15066 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15067 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15068 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15069 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
15070 /// `err` or `result` depending on the state of `result_ok`.
15071 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
15072 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
15073 pub result_ok: bool,
15076 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15077 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15078 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15079 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15080 result: Box::into_raw(Box::new(o)),
15086 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15087 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15088 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15089 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15090 err: Box::into_raw(Box::new(e)),
15095 /// Checks if the given object is currently in the success state
15097 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
15101 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
15102 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
15103 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15104 fn drop(&mut self) {
15105 if self.result_ok {
15106 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15107 let _ = unsafe { Box::from_raw(self.contents.result) };
15110 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15111 let _ = unsafe { Box::from_raw(self.contents.err) };
15116 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15117 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15118 let contents = if o.result_ok {
15119 let result = unsafe { o.contents.result };
15120 unsafe { o.contents.result = core::ptr::null_mut() };
15121 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
15123 let err = unsafe { o.contents.err };
15124 unsafe { o.contents.err = core::ptr::null_mut(); }
15125 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
15129 result_ok: o.result_ok,
15133 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15134 fn clone(&self) -> Self {
15135 if self.result_ok {
15136 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15137 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15140 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15141 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15147 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15148 /// but with all dynamically-allocated buffers duplicated in new buffers.
15149 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15151 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
15152 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
15153 /// A pointer to the contents in the success state.
15154 /// Reading from this pointer when `result_ok` is not set is undefined.
15155 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
15156 /// A pointer to the contents in the error state.
15157 /// Reading from this pointer when `result_ok` is set is undefined.
15158 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15161 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15162 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15164 pub struct CResult_NodeAnnouncementDecodeErrorZ {
15165 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
15166 /// `err` or `result` depending on the state of `result_ok`.
15167 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
15168 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
15169 pub result_ok: bool,
15172 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15173 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
15174 CResult_NodeAnnouncementDecodeErrorZ {
15175 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15176 result: Box::into_raw(Box::new(o)),
15182 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15183 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
15184 CResult_NodeAnnouncementDecodeErrorZ {
15185 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15186 err: Box::into_raw(Box::new(e)),
15191 /// Checks if the given object is currently in the success state
15193 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
15197 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15198 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
15199 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
15200 fn drop(&mut self) {
15201 if self.result_ok {
15202 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15203 let _ = unsafe { Box::from_raw(self.contents.result) };
15206 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15207 let _ = unsafe { Box::from_raw(self.contents.err) };
15212 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
15213 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15214 let contents = if o.result_ok {
15215 let result = unsafe { o.contents.result };
15216 unsafe { o.contents.result = core::ptr::null_mut() };
15217 CResult_NodeAnnouncementDecodeErrorZPtr { result }
15219 let err = unsafe { o.contents.err };
15220 unsafe { o.contents.err = core::ptr::null_mut(); }
15221 CResult_NodeAnnouncementDecodeErrorZPtr { err }
15225 result_ok: o.result_ok,
15229 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
15230 fn clone(&self) -> Self {
15231 if self.result_ok {
15232 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15233 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15236 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15237 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15243 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15244 /// but with all dynamically-allocated buffers duplicated in new buffers.
15245 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15247 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
15248 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
15249 /// A pointer to the contents in the success state.
15250 /// Reading from this pointer when `result_ok` is not set is undefined.
15251 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
15252 /// A pointer to the contents in the error state.
15253 /// Reading from this pointer when `result_ok` is set is undefined.
15254 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15257 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
15258 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
15259 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15260 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
15261 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
15262 /// `err` or `result` depending on the state of `result_ok`.
15263 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
15264 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
15265 pub result_ok: bool,
15268 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15269 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15270 CResult_QueryShortChannelIdsDecodeErrorZ {
15271 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15272 result: Box::into_raw(Box::new(o)),
15278 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15279 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15280 CResult_QueryShortChannelIdsDecodeErrorZ {
15281 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15282 err: Box::into_raw(Box::new(e)),
15287 /// Checks if the given object is currently in the success state
15289 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
15293 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
15294 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
15295 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
15296 fn drop(&mut self) {
15297 if self.result_ok {
15298 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15299 let _ = unsafe { Box::from_raw(self.contents.result) };
15302 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15303 let _ = unsafe { Box::from_raw(self.contents.err) };
15308 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
15309 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
15310 let contents = if o.result_ok {
15311 let result = unsafe { o.contents.result };
15312 unsafe { o.contents.result = core::ptr::null_mut() };
15313 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
15315 let err = unsafe { o.contents.err };
15316 unsafe { o.contents.err = core::ptr::null_mut(); }
15317 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
15321 result_ok: o.result_ok,
15325 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
15326 fn clone(&self) -> Self {
15327 if self.result_ok {
15328 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15329 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
15332 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15333 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15339 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
15340 /// but with all dynamically-allocated buffers duplicated in new buffers.
15341 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
15343 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
15344 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15345 /// A pointer to the contents in the success state.
15346 /// Reading from this pointer when `result_ok` is not set is undefined.
15347 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
15348 /// A pointer to the contents in the error state.
15349 /// Reading from this pointer when `result_ok` is set is undefined.
15350 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15353 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
15354 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
15355 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15356 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15357 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
15358 /// `err` or `result` depending on the state of `result_ok`.
15359 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
15360 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
15361 pub result_ok: bool,
15364 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
15365 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15366 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15367 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15368 result: Box::into_raw(Box::new(o)),
15374 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
15375 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15376 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15377 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15378 err: Box::into_raw(Box::new(e)),
15383 /// Checks if the given object is currently in the success state
15385 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
15389 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
15390 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
15391 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15392 fn drop(&mut self) {
15393 if self.result_ok {
15394 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15395 let _ = unsafe { Box::from_raw(self.contents.result) };
15398 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15399 let _ = unsafe { Box::from_raw(self.contents.err) };
15404 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15405 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
15406 let contents = if o.result_ok {
15407 let result = unsafe { o.contents.result };
15408 unsafe { o.contents.result = core::ptr::null_mut() };
15409 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
15411 let err = unsafe { o.contents.err };
15412 unsafe { o.contents.err = core::ptr::null_mut(); }
15413 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
15417 result_ok: o.result_ok,
15421 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15422 fn clone(&self) -> Self {
15423 if self.result_ok {
15424 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15425 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
15428 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15429 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15435 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15436 /// but with all dynamically-allocated buffers duplicated in new buffers.
15437 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
15439 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
15440 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
15441 /// A pointer to the contents in the success state.
15442 /// Reading from this pointer when `result_ok` is not set is undefined.
15443 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
15444 /// A pointer to the contents in the error state.
15445 /// Reading from this pointer when `result_ok` is set is undefined.
15446 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15449 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
15450 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15452 pub struct CResult_QueryChannelRangeDecodeErrorZ {
15453 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
15454 /// `err` or `result` depending on the state of `result_ok`.
15455 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
15456 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
15457 pub result_ok: bool,
15460 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
15461 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
15462 CResult_QueryChannelRangeDecodeErrorZ {
15463 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15464 result: Box::into_raw(Box::new(o)),
15470 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
15471 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
15472 CResult_QueryChannelRangeDecodeErrorZ {
15473 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15474 err: Box::into_raw(Box::new(e)),
15479 /// Checks if the given object is currently in the success state
15481 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
15485 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
15486 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
15487 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
15488 fn drop(&mut self) {
15489 if self.result_ok {
15490 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15491 let _ = unsafe { Box::from_raw(self.contents.result) };
15494 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15495 let _ = unsafe { Box::from_raw(self.contents.err) };
15500 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
15501 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15502 let contents = if o.result_ok {
15503 let result = unsafe { o.contents.result };
15504 unsafe { o.contents.result = core::ptr::null_mut() };
15505 CResult_QueryChannelRangeDecodeErrorZPtr { result }
15507 let err = unsafe { o.contents.err };
15508 unsafe { o.contents.err = core::ptr::null_mut(); }
15509 CResult_QueryChannelRangeDecodeErrorZPtr { err }
15513 result_ok: o.result_ok,
15517 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
15518 fn clone(&self) -> Self {
15519 if self.result_ok {
15520 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15521 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
15524 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15525 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15531 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
15532 /// but with all dynamically-allocated buffers duplicated in new buffers.
15533 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15535 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
15536 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
15537 /// A pointer to the contents in the success state.
15538 /// Reading from this pointer when `result_ok` is not set is undefined.
15539 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
15540 /// A pointer to the contents in the error state.
15541 /// Reading from this pointer when `result_ok` is set is undefined.
15542 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15545 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
15546 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15548 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
15549 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
15550 /// `err` or `result` depending on the state of `result_ok`.
15551 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15552 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15553 pub result_ok: bool,
15556 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15557 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15558 CResult_ReplyChannelRangeDecodeErrorZ {
15559 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15560 result: Box::into_raw(Box::new(o)),
15566 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15567 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15568 CResult_ReplyChannelRangeDecodeErrorZ {
15569 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15570 err: Box::into_raw(Box::new(e)),
15575 /// Checks if the given object is currently in the success state
15577 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15581 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15582 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15583 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15584 fn drop(&mut self) {
15585 if self.result_ok {
15586 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15587 let _ = unsafe { Box::from_raw(self.contents.result) };
15590 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15591 let _ = unsafe { Box::from_raw(self.contents.err) };
15596 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15597 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15598 let contents = if o.result_ok {
15599 let result = unsafe { o.contents.result };
15600 unsafe { o.contents.result = core::ptr::null_mut() };
15601 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15603 let err = unsafe { o.contents.err };
15604 unsafe { o.contents.err = core::ptr::null_mut(); }
15605 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15609 result_ok: o.result_ok,
15613 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15614 fn clone(&self) -> Self {
15615 if self.result_ok {
15616 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15617 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15620 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15621 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15627 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15628 /// but with all dynamically-allocated buffers duplicated in new buffers.
15629 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15631 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15632 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15633 /// A pointer to the contents in the success state.
15634 /// Reading from this pointer when `result_ok` is not set is undefined.
15635 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15636 /// A pointer to the contents in the error state.
15637 /// Reading from this pointer when `result_ok` is set is undefined.
15638 pub err: *mut crate::lightning::ln::msgs::DecodeError,
15641 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15642 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15643 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15644 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15645 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15646 /// `err` or `result` depending on the state of `result_ok`.
15647 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15648 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15649 pub result_ok: bool,
15652 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15653 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15654 CResult_GossipTimestampFilterDecodeErrorZ {
15655 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15656 result: Box::into_raw(Box::new(o)),
15662 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15663 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15664 CResult_GossipTimestampFilterDecodeErrorZ {
15665 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15666 err: Box::into_raw(Box::new(e)),
15671 /// Checks if the given object is currently in the success state
15673 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15677 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15678 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15679 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15680 fn drop(&mut self) {
15681 if self.result_ok {
15682 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15683 let _ = unsafe { Box::from_raw(self.contents.result) };
15686 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15687 let _ = unsafe { Box::from_raw(self.contents.err) };
15692 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15693 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15694 let contents = if o.result_ok {
15695 let result = unsafe { o.contents.result };
15696 unsafe { o.contents.result = core::ptr::null_mut() };
15697 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15699 let err = unsafe { o.contents.err };
15700 unsafe { o.contents.err = core::ptr::null_mut(); }
15701 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15705 result_ok: o.result_ok,
15709 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15710 fn clone(&self) -> Self {
15711 if self.result_ok {
15712 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15713 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15716 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15717 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15723 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15724 /// but with all dynamically-allocated buffers duplicated in new buffers.
15725 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15727 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15728 /// This corresponds to std::vector in C++
15729 pub struct CVec_PhantomRouteHintsZ {
15730 /// The elements in the array.
15731 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15732 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15733 /// The number of elements pointed to by `data`.
15736 impl CVec_PhantomRouteHintsZ {
15737 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15738 if self.datalen == 0 { return Vec::new(); }
15739 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15740 self.data = core::ptr::null_mut();
15744 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15745 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15748 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15749 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15750 let datalen = v.len();
15751 let data = Box::into_raw(v.into_boxed_slice());
15752 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15756 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15757 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15758 impl Drop for CVec_PhantomRouteHintsZ {
15759 fn drop(&mut self) {
15760 if self.datalen == 0 { return; }
15761 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15764 impl Clone for CVec_PhantomRouteHintsZ {
15765 fn clone(&self) -> Self {
15766 let mut res = Vec::new();
15767 if self.datalen == 0 { return Self::from(res); }
15768 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15773 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15774 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15775 /// A pointer to the contents in the success state.
15776 /// Reading from this pointer when `result_ok` is not set is undefined.
15777 pub result: *mut crate::lightning_invoice::Invoice,
15778 /// A pointer to the contents in the error state.
15779 /// Reading from this pointer when `result_ok` is set is undefined.
15780 pub err: *mut crate::lightning_invoice::SignOrCreationError,
15783 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15784 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15786 pub struct CResult_InvoiceSignOrCreationErrorZ {
15787 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15788 /// `err` or `result` depending on the state of `result_ok`.
15789 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15790 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15791 pub result_ok: bool,
15794 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15795 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15796 CResult_InvoiceSignOrCreationErrorZ {
15797 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15798 result: Box::into_raw(Box::new(o)),
15804 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15805 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15806 CResult_InvoiceSignOrCreationErrorZ {
15807 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15808 err: Box::into_raw(Box::new(e)),
15813 /// Checks if the given object is currently in the success state
15815 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15819 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15820 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15821 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15822 fn drop(&mut self) {
15823 if self.result_ok {
15824 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15825 let _ = unsafe { Box::from_raw(self.contents.result) };
15828 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15829 let _ = unsafe { Box::from_raw(self.contents.err) };
15834 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15835 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15836 let contents = if o.result_ok {
15837 let result = unsafe { o.contents.result };
15838 unsafe { o.contents.result = core::ptr::null_mut() };
15839 CResult_InvoiceSignOrCreationErrorZPtr { result }
15841 let err = unsafe { o.contents.err };
15842 unsafe { o.contents.err = core::ptr::null_mut(); }
15843 CResult_InvoiceSignOrCreationErrorZPtr { err }
15847 result_ok: o.result_ok,
15851 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15852 fn clone(&self) -> Self {
15853 if self.result_ok {
15854 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15855 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15858 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15859 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15865 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15866 /// but with all dynamically-allocated buffers duplicated in new buffers.
15867 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15869 /// An enum which can either contain a crate::lightning::chain::Filter or not
15870 pub enum COption_FilterZ {
15871 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15872 Some(crate::lightning::chain::Filter),
15873 /// When we're in this state, this COption_FilterZ contains nothing
15876 impl COption_FilterZ {
15877 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15878 if let Self::None = self { false } else { true }
15880 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15883 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15884 if let Self::Some(v) = self { v } else { unreachable!() }
15888 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15889 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15890 COption_FilterZ::Some(o)
15893 /// Constructs a new COption_FilterZ containing nothing
15894 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15895 COption_FilterZ::None
15898 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15899 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15901 /// The contents of CResult_LockedChannelMonitorNoneZ
15902 pub union CResult_LockedChannelMonitorNoneZPtr {
15903 /// A pointer to the contents in the success state.
15904 /// Reading from this pointer when `result_ok` is not set is undefined.
15905 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15906 /// Note that this value is always NULL, as there are no contents in the Err variant
15907 pub err: *mut core::ffi::c_void,
15910 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15911 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15913 pub struct CResult_LockedChannelMonitorNoneZ {
15914 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15915 /// `err` or `result` depending on the state of `result_ok`.
15916 pub contents: CResult_LockedChannelMonitorNoneZPtr,
15917 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15918 pub result_ok: bool,
15921 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15922 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15923 CResult_LockedChannelMonitorNoneZ {
15924 contents: CResult_LockedChannelMonitorNoneZPtr {
15925 result: Box::into_raw(Box::new(o)),
15931 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15932 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15933 CResult_LockedChannelMonitorNoneZ {
15934 contents: CResult_LockedChannelMonitorNoneZPtr {
15935 err: core::ptr::null_mut(),
15940 /// Checks if the given object is currently in the success state
15942 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15946 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15947 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15948 impl Drop for CResult_LockedChannelMonitorNoneZ {
15949 fn drop(&mut self) {
15950 if self.result_ok {
15951 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15952 let _ = unsafe { Box::from_raw(self.contents.result) };
15958 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15959 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15960 let contents = if o.result_ok {
15961 let result = unsafe { o.contents.result };
15962 unsafe { o.contents.result = core::ptr::null_mut() };
15963 CResult_LockedChannelMonitorNoneZPtr { result }
15965 let _ = unsafe { Box::from_raw(o.contents.err) };
15966 o.contents.err = core::ptr::null_mut();
15967 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15971 result_ok: o.result_ok,
15976 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15977 /// This corresponds to std::vector in C++
15978 pub struct CVec_OutPointZ {
15979 /// The elements in the array.
15980 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15981 pub data: *mut crate::lightning::chain::transaction::OutPoint,
15982 /// The number of elements pointed to by `data`.
15985 impl CVec_OutPointZ {
15986 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15987 if self.datalen == 0 { return Vec::new(); }
15988 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15989 self.data = core::ptr::null_mut();
15993 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15994 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15997 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15998 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15999 let datalen = v.len();
16000 let data = Box::into_raw(v.into_boxed_slice());
16001 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16005 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16006 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
16007 impl Drop for CVec_OutPointZ {
16008 fn drop(&mut self) {
16009 if self.datalen == 0 { return; }
16010 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16013 impl Clone for CVec_OutPointZ {
16014 fn clone(&self) -> Self {
16015 let mut res = Vec::new();
16016 if self.datalen == 0 { return Self::from(res); }
16017 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });