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,
274 /// The contents of CResult_PublicKeyErrorZ
275 pub union CResult_PublicKeyErrorZPtr {
276 /// A pointer to the contents in the success state.
277 /// Reading from this pointer when `result_ok` is not set is undefined.
278 pub result: *mut crate::c_types::PublicKey,
279 /// A pointer to the contents in the error state.
280 /// Reading from this pointer when `result_ok` is set is undefined.
281 pub err: *mut crate::c_types::Secp256k1Error,
284 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
285 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
287 pub struct CResult_PublicKeyErrorZ {
288 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
289 /// `err` or `result` depending on the state of `result_ok`.
290 pub contents: CResult_PublicKeyErrorZPtr,
291 /// Whether this CResult_PublicKeyErrorZ represents a success state.
295 /// Creates a new CResult_PublicKeyErrorZ in the success state.
296 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
297 CResult_PublicKeyErrorZ {
298 contents: CResult_PublicKeyErrorZPtr {
299 result: Box::into_raw(Box::new(o)),
305 /// Creates a new CResult_PublicKeyErrorZ in the error state.
306 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
307 CResult_PublicKeyErrorZ {
308 contents: CResult_PublicKeyErrorZPtr {
309 err: Box::into_raw(Box::new(e)),
314 /// Checks if the given object is currently in the success state
316 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
320 /// Frees any resources used by the CResult_PublicKeyErrorZ.
321 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
322 impl Drop for CResult_PublicKeyErrorZ {
325 if unsafe { !(self.contents.result as *mut ()).is_null() } {
326 let _ = unsafe { Box::from_raw(self.contents.result) };
329 if unsafe { !(self.contents.err as *mut ()).is_null() } {
330 let _ = unsafe { Box::from_raw(self.contents.err) };
335 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
336 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
337 let contents = if o.result_ok {
338 let result = unsafe { o.contents.result };
339 unsafe { o.contents.result = core::ptr::null_mut() };
340 CResult_PublicKeyErrorZPtr { result }
342 let err = unsafe { o.contents.err };
343 unsafe { o.contents.err = core::ptr::null_mut(); }
344 CResult_PublicKeyErrorZPtr { err }
348 result_ok: o.result_ok,
352 impl Clone for CResult_PublicKeyErrorZ {
353 fn clone(&self) -> Self {
355 Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
356 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
359 Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
360 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
366 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
367 /// but with all dynamically-allocated buffers duplicated in new buffers.
368 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
370 /// The contents of CResult_TxCreationKeysDecodeErrorZ
371 pub union CResult_TxCreationKeysDecodeErrorZPtr {
372 /// A pointer to the contents in the success state.
373 /// Reading from this pointer when `result_ok` is not set is undefined.
374 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
375 /// A pointer to the contents in the error state.
376 /// Reading from this pointer when `result_ok` is set is undefined.
377 pub err: *mut crate::lightning::ln::msgs::DecodeError,
380 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
381 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
383 pub struct CResult_TxCreationKeysDecodeErrorZ {
384 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
385 /// `err` or `result` depending on the state of `result_ok`.
386 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
387 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
391 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
392 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
393 CResult_TxCreationKeysDecodeErrorZ {
394 contents: CResult_TxCreationKeysDecodeErrorZPtr {
395 result: Box::into_raw(Box::new(o)),
401 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
402 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
403 CResult_TxCreationKeysDecodeErrorZ {
404 contents: CResult_TxCreationKeysDecodeErrorZPtr {
405 err: Box::into_raw(Box::new(e)),
410 /// Checks if the given object is currently in the success state
412 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
416 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
417 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
418 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
421 if unsafe { !(self.contents.result as *mut ()).is_null() } {
422 let _ = unsafe { Box::from_raw(self.contents.result) };
425 if unsafe { !(self.contents.err as *mut ()).is_null() } {
426 let _ = unsafe { Box::from_raw(self.contents.err) };
431 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
432 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
433 let contents = if o.result_ok {
434 let result = unsafe { o.contents.result };
435 unsafe { o.contents.result = core::ptr::null_mut() };
436 CResult_TxCreationKeysDecodeErrorZPtr { result }
438 let err = unsafe { o.contents.err };
439 unsafe { o.contents.err = core::ptr::null_mut(); }
440 CResult_TxCreationKeysDecodeErrorZPtr { err }
444 result_ok: o.result_ok,
448 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
449 fn clone(&self) -> Self {
451 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
452 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
455 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
456 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
462 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
463 /// but with all dynamically-allocated buffers duplicated in new buffers.
464 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
466 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
467 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
468 /// A pointer to the contents in the success state.
469 /// Reading from this pointer when `result_ok` is not set is undefined.
470 pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
471 /// A pointer to the contents in the error state.
472 /// Reading from this pointer when `result_ok` is set is undefined.
473 pub err: *mut crate::lightning::ln::msgs::DecodeError,
476 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
477 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
478 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
479 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
480 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
481 /// `err` or `result` depending on the state of `result_ok`.
482 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
483 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
487 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
488 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
489 CResult_ChannelPublicKeysDecodeErrorZ {
490 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
491 result: Box::into_raw(Box::new(o)),
497 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
498 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
499 CResult_ChannelPublicKeysDecodeErrorZ {
500 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
501 err: Box::into_raw(Box::new(e)),
506 /// Checks if the given object is currently in the success state
508 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
512 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
513 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
514 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
517 if unsafe { !(self.contents.result as *mut ()).is_null() } {
518 let _ = unsafe { Box::from_raw(self.contents.result) };
521 if unsafe { !(self.contents.err as *mut ()).is_null() } {
522 let _ = unsafe { Box::from_raw(self.contents.err) };
527 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
528 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
529 let contents = if o.result_ok {
530 let result = unsafe { o.contents.result };
531 unsafe { o.contents.result = core::ptr::null_mut() };
532 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
534 let err = unsafe { o.contents.err };
535 unsafe { o.contents.err = core::ptr::null_mut(); }
536 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
540 result_ok: o.result_ok,
544 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
545 fn clone(&self) -> Self {
547 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
548 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
551 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
552 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
558 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
559 /// but with all dynamically-allocated buffers duplicated in new buffers.
560 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
562 /// The contents of CResult_TxCreationKeysErrorZ
563 pub union CResult_TxCreationKeysErrorZPtr {
564 /// A pointer to the contents in the success state.
565 /// Reading from this pointer when `result_ok` is not set is undefined.
566 pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
567 /// A pointer to the contents in the error state.
568 /// Reading from this pointer when `result_ok` is set is undefined.
569 pub err: *mut crate::c_types::Secp256k1Error,
572 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
573 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
575 pub struct CResult_TxCreationKeysErrorZ {
576 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
577 /// `err` or `result` depending on the state of `result_ok`.
578 pub contents: CResult_TxCreationKeysErrorZPtr,
579 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
583 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
584 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
585 CResult_TxCreationKeysErrorZ {
586 contents: CResult_TxCreationKeysErrorZPtr {
587 result: Box::into_raw(Box::new(o)),
593 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
594 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
595 CResult_TxCreationKeysErrorZ {
596 contents: CResult_TxCreationKeysErrorZPtr {
597 err: Box::into_raw(Box::new(e)),
602 /// Checks if the given object is currently in the success state
604 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
608 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
609 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
610 impl Drop for CResult_TxCreationKeysErrorZ {
613 if unsafe { !(self.contents.result as *mut ()).is_null() } {
614 let _ = unsafe { Box::from_raw(self.contents.result) };
617 if unsafe { !(self.contents.err as *mut ()).is_null() } {
618 let _ = unsafe { Box::from_raw(self.contents.err) };
623 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
624 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
625 let contents = if o.result_ok {
626 let result = unsafe { o.contents.result };
627 unsafe { o.contents.result = core::ptr::null_mut() };
628 CResult_TxCreationKeysErrorZPtr { result }
630 let err = unsafe { o.contents.err };
631 unsafe { o.contents.err = core::ptr::null_mut(); }
632 CResult_TxCreationKeysErrorZPtr { err }
636 result_ok: o.result_ok,
640 impl Clone for CResult_TxCreationKeysErrorZ {
641 fn clone(&self) -> Self {
643 Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
644 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
647 Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
648 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
654 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
655 /// but with all dynamically-allocated buffers duplicated in new buffers.
656 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
659 /// An enum which can either contain a u32 or not
660 pub enum COption_u32Z {
661 /// When we're in this state, this COption_u32Z contains a u32
663 /// When we're in this state, this COption_u32Z contains nothing
667 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
668 if let Self::None = self { false } else { true }
670 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
673 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
674 if let Self::Some(v) = self { v } else { unreachable!() }
678 /// Constructs a new COption_u32Z containing a u32
679 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
680 COption_u32Z::Some(o)
683 /// Constructs a new COption_u32Z containing nothing
684 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
688 /// Frees any resources associated with the u32, if we are in the Some state
689 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
691 /// Creates a new COption_u32Z which has the same data as `orig`
692 /// but with all dynamically-allocated buffers duplicated in new buffers.
693 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
695 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
696 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
697 /// A pointer to the contents in the success state.
698 /// Reading from this pointer when `result_ok` is not set is undefined.
699 pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
700 /// A pointer to the contents in the error state.
701 /// Reading from this pointer when `result_ok` is set is undefined.
702 pub err: *mut crate::lightning::ln::msgs::DecodeError,
705 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
706 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
708 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
709 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
710 /// `err` or `result` depending on the state of `result_ok`.
711 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
712 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
716 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
717 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
718 CResult_HTLCOutputInCommitmentDecodeErrorZ {
719 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
720 result: Box::into_raw(Box::new(o)),
726 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
727 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
728 CResult_HTLCOutputInCommitmentDecodeErrorZ {
729 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
730 err: Box::into_raw(Box::new(e)),
735 /// Checks if the given object is currently in the success state
737 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
741 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
742 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
743 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
746 if unsafe { !(self.contents.result as *mut ()).is_null() } {
747 let _ = unsafe { Box::from_raw(self.contents.result) };
750 if unsafe { !(self.contents.err as *mut ()).is_null() } {
751 let _ = unsafe { Box::from_raw(self.contents.err) };
756 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
757 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
758 let contents = if o.result_ok {
759 let result = unsafe { o.contents.result };
760 unsafe { o.contents.result = core::ptr::null_mut() };
761 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
763 let err = unsafe { o.contents.err };
764 unsafe { o.contents.err = core::ptr::null_mut(); }
765 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
769 result_ok: o.result_ok,
773 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774 fn clone(&self) -> Self {
776 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
777 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
780 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
781 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
787 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
788 /// but with all dynamically-allocated buffers duplicated in new buffers.
789 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
791 /// An enum which can either contain a or not
792 pub enum COption_NoneZ {
793 /// When we're in this state, this COption_NoneZ contains a
795 /// When we're in this state, this COption_NoneZ contains nothing
799 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
800 if let Self::None = self { false } else { true }
802 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
807 /// Constructs a new COption_NoneZ containing a
808 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
812 /// Constructs a new COption_NoneZ containing nothing
813 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
817 /// Frees any resources associated with the , if we are in the Some state
818 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
820 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
821 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
822 /// A pointer to the contents in the success state.
823 /// Reading from this pointer when `result_ok` is not set is undefined.
824 pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
825 /// A pointer to the contents in the error state.
826 /// Reading from this pointer when `result_ok` is set is undefined.
827 pub err: *mut crate::lightning::ln::msgs::DecodeError,
830 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
831 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
833 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
834 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
835 /// `err` or `result` depending on the state of `result_ok`.
836 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
837 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
841 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
842 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
843 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
844 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
845 result: Box::into_raw(Box::new(o)),
851 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
852 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
853 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
854 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
855 err: Box::into_raw(Box::new(e)),
860 /// Checks if the given object is currently in the success state
862 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
866 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
867 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
868 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871 if unsafe { !(self.contents.result as *mut ()).is_null() } {
872 let _ = unsafe { Box::from_raw(self.contents.result) };
875 if unsafe { !(self.contents.err as *mut ()).is_null() } {
876 let _ = unsafe { Box::from_raw(self.contents.err) };
881 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
882 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
883 let contents = if o.result_ok {
884 let result = unsafe { o.contents.result };
885 unsafe { o.contents.result = core::ptr::null_mut() };
886 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
888 let err = unsafe { o.contents.err };
889 unsafe { o.contents.err = core::ptr::null_mut(); }
890 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
894 result_ok: o.result_ok,
898 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899 fn clone(&self) -> Self {
901 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
902 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
905 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
906 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
912 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
913 /// but with all dynamically-allocated buffers duplicated in new buffers.
914 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
916 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
917 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
918 /// A pointer to the contents in the success state.
919 /// Reading from this pointer when `result_ok` is not set is undefined.
920 pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
921 /// A pointer to the contents in the error state.
922 /// Reading from this pointer when `result_ok` is set is undefined.
923 pub err: *mut crate::lightning::ln::msgs::DecodeError,
926 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
927 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
929 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
930 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
931 /// `err` or `result` depending on the state of `result_ok`.
932 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
933 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
937 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
938 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
939 CResult_ChannelTransactionParametersDecodeErrorZ {
940 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
941 result: Box::into_raw(Box::new(o)),
947 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
948 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
949 CResult_ChannelTransactionParametersDecodeErrorZ {
950 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
951 err: Box::into_raw(Box::new(e)),
956 /// Checks if the given object is currently in the success state
958 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
962 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
963 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
964 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
967 if unsafe { !(self.contents.result as *mut ()).is_null() } {
968 let _ = unsafe { Box::from_raw(self.contents.result) };
971 if unsafe { !(self.contents.err as *mut ()).is_null() } {
972 let _ = unsafe { Box::from_raw(self.contents.err) };
977 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
978 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
979 let contents = if o.result_ok {
980 let result = unsafe { o.contents.result };
981 unsafe { o.contents.result = core::ptr::null_mut() };
982 CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
984 let err = unsafe { o.contents.err };
985 unsafe { o.contents.err = core::ptr::null_mut(); }
986 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
990 result_ok: o.result_ok,
994 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
995 fn clone(&self) -> Self {
997 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
998 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1001 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1002 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1008 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1009 /// but with all dynamically-allocated buffers duplicated in new buffers.
1010 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1012 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1013 /// This corresponds to std::vector in C++
1014 pub struct CVec_SignatureZ {
1015 /// The elements in the array.
1016 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1017 pub data: *mut crate::c_types::Signature,
1018 /// The number of elements pointed to by `data`.
1021 impl CVec_SignatureZ {
1022 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1023 if self.datalen == 0 { return Vec::new(); }
1024 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1025 self.data = core::ptr::null_mut();
1029 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1030 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1033 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1034 fn from(v: Vec<crate::c_types::Signature>) -> Self {
1035 let datalen = v.len();
1036 let data = Box::into_raw(v.into_boxed_slice());
1037 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1042 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1043 impl Drop for CVec_SignatureZ {
1044 fn drop(&mut self) {
1045 if self.datalen == 0 { return; }
1046 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1049 impl Clone for CVec_SignatureZ {
1050 fn clone(&self) -> Self {
1051 let mut res = Vec::new();
1052 if self.datalen == 0 { return Self::from(res); }
1053 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1058 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1059 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1060 /// A pointer to the contents in the success state.
1061 /// Reading from this pointer when `result_ok` is not set is undefined.
1062 pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1063 /// A pointer to the contents in the error state.
1064 /// Reading from this pointer when `result_ok` is set is undefined.
1065 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1068 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1069 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1071 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1072 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1073 /// `err` or `result` depending on the state of `result_ok`.
1074 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1075 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1076 pub result_ok: bool,
1079 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1080 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1081 CResult_HolderCommitmentTransactionDecodeErrorZ {
1082 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1083 result: Box::into_raw(Box::new(o)),
1089 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1090 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1091 CResult_HolderCommitmentTransactionDecodeErrorZ {
1092 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1093 err: Box::into_raw(Box::new(e)),
1098 /// Checks if the given object is currently in the success state
1100 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1104 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1105 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1106 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1107 fn drop(&mut self) {
1109 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1110 let _ = unsafe { Box::from_raw(self.contents.result) };
1113 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1114 let _ = unsafe { Box::from_raw(self.contents.err) };
1119 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1120 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1121 let contents = if o.result_ok {
1122 let result = unsafe { o.contents.result };
1123 unsafe { o.contents.result = core::ptr::null_mut() };
1124 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1126 let err = unsafe { o.contents.err };
1127 unsafe { o.contents.err = core::ptr::null_mut(); }
1128 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1132 result_ok: o.result_ok,
1136 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137 fn clone(&self) -> Self {
1139 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1140 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1143 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1144 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1150 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1151 /// but with all dynamically-allocated buffers duplicated in new buffers.
1152 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1154 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1155 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1156 /// A pointer to the contents in the success state.
1157 /// Reading from this pointer when `result_ok` is not set is undefined.
1158 pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1159 /// A pointer to the contents in the error state.
1160 /// Reading from this pointer when `result_ok` is set is undefined.
1161 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1164 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1165 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1167 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1168 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1169 /// `err` or `result` depending on the state of `result_ok`.
1170 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1171 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1172 pub result_ok: bool,
1175 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1176 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1177 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1178 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1179 result: Box::into_raw(Box::new(o)),
1185 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1186 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1187 CResult_BuiltCommitmentTransactionDecodeErrorZ {
1188 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1189 err: Box::into_raw(Box::new(e)),
1194 /// Checks if the given object is currently in the success state
1196 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1200 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1201 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1202 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1203 fn drop(&mut self) {
1205 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1206 let _ = unsafe { Box::from_raw(self.contents.result) };
1209 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1210 let _ = unsafe { Box::from_raw(self.contents.err) };
1215 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1216 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1217 let contents = if o.result_ok {
1218 let result = unsafe { o.contents.result };
1219 unsafe { o.contents.result = core::ptr::null_mut() };
1220 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1222 let err = unsafe { o.contents.err };
1223 unsafe { o.contents.err = core::ptr::null_mut(); }
1224 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1228 result_ok: o.result_ok,
1232 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233 fn clone(&self) -> Self {
1235 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1236 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1239 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1240 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1246 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1247 /// but with all dynamically-allocated buffers duplicated in new buffers.
1248 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1250 /// The contents of CResult_TrustedClosingTransactionNoneZ
1251 pub union CResult_TrustedClosingTransactionNoneZPtr {
1252 /// A pointer to the contents in the success state.
1253 /// Reading from this pointer when `result_ok` is not set is undefined.
1254 pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1255 /// Note that this value is always NULL, as there are no contents in the Err variant
1256 pub err: *mut core::ffi::c_void,
1259 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1260 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1261 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1262 pub struct CResult_TrustedClosingTransactionNoneZ {
1263 /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1264 /// `err` or `result` depending on the state of `result_ok`.
1265 pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1266 /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1267 pub result_ok: bool,
1270 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1271 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1272 CResult_TrustedClosingTransactionNoneZ {
1273 contents: CResult_TrustedClosingTransactionNoneZPtr {
1274 result: Box::into_raw(Box::new(o)),
1280 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1281 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1282 CResult_TrustedClosingTransactionNoneZ {
1283 contents: CResult_TrustedClosingTransactionNoneZPtr {
1284 err: core::ptr::null_mut(),
1289 /// Checks if the given object is currently in the success state
1291 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1295 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1296 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1297 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1298 fn drop(&mut self) {
1300 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1301 let _ = unsafe { Box::from_raw(self.contents.result) };
1307 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1308 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1309 let contents = if o.result_ok {
1310 let result = unsafe { o.contents.result };
1311 unsafe { o.contents.result = core::ptr::null_mut() };
1312 CResult_TrustedClosingTransactionNoneZPtr { result }
1314 let _ = unsafe { Box::from_raw(o.contents.err) };
1315 o.contents.err = core::ptr::null_mut();
1316 CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1320 result_ok: o.result_ok,
1325 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1326 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1327 /// A pointer to the contents in the success state.
1328 /// Reading from this pointer when `result_ok` is not set is undefined.
1329 pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1330 /// A pointer to the contents in the error state.
1331 /// Reading from this pointer when `result_ok` is set is undefined.
1332 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1335 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1336 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1337 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1338 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1339 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1340 /// `err` or `result` depending on the state of `result_ok`.
1341 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1342 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1343 pub result_ok: bool,
1346 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1347 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1348 CResult_CommitmentTransactionDecodeErrorZ {
1349 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1350 result: Box::into_raw(Box::new(o)),
1356 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1357 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1358 CResult_CommitmentTransactionDecodeErrorZ {
1359 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1360 err: Box::into_raw(Box::new(e)),
1365 /// Checks if the given object is currently in the success state
1367 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1371 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1372 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1373 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1374 fn drop(&mut self) {
1376 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1377 let _ = unsafe { Box::from_raw(self.contents.result) };
1380 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1381 let _ = unsafe { Box::from_raw(self.contents.err) };
1386 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1387 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1388 let contents = if o.result_ok {
1389 let result = unsafe { o.contents.result };
1390 unsafe { o.contents.result = core::ptr::null_mut() };
1391 CResult_CommitmentTransactionDecodeErrorZPtr { result }
1393 let err = unsafe { o.contents.err };
1394 unsafe { o.contents.err = core::ptr::null_mut(); }
1395 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1399 result_ok: o.result_ok,
1403 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1404 fn clone(&self) -> Self {
1406 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1407 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1410 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1411 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1417 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1418 /// but with all dynamically-allocated buffers duplicated in new buffers.
1419 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1421 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1422 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1423 /// A pointer to the contents in the success state.
1424 /// Reading from this pointer when `result_ok` is not set is undefined.
1425 pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1426 /// Note that this value is always NULL, as there are no contents in the Err variant
1427 pub err: *mut core::ffi::c_void,
1430 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1431 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1432 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1433 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1434 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1435 /// `err` or `result` depending on the state of `result_ok`.
1436 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1437 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1438 pub result_ok: bool,
1441 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1442 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1443 CResult_TrustedCommitmentTransactionNoneZ {
1444 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1445 result: Box::into_raw(Box::new(o)),
1451 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1452 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1453 CResult_TrustedCommitmentTransactionNoneZ {
1454 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1455 err: core::ptr::null_mut(),
1460 /// Checks if the given object is currently in the success state
1462 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1466 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1467 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1468 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1469 fn drop(&mut self) {
1471 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1472 let _ = unsafe { Box::from_raw(self.contents.result) };
1478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1479 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1480 let contents = if o.result_ok {
1481 let result = unsafe { o.contents.result };
1482 unsafe { o.contents.result = core::ptr::null_mut() };
1483 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1485 let _ = unsafe { Box::from_raw(o.contents.err) };
1486 o.contents.err = core::ptr::null_mut();
1487 CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1491 result_ok: o.result_ok,
1496 /// The contents of CResult_CVec_SignatureZNoneZ
1497 pub union CResult_CVec_SignatureZNoneZPtr {
1498 /// A pointer to the contents in the success state.
1499 /// Reading from this pointer when `result_ok` is not set is undefined.
1500 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1501 /// Note that this value is always NULL, as there are no contents in the Err variant
1502 pub err: *mut core::ffi::c_void,
1505 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1506 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1507 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1508 pub struct CResult_CVec_SignatureZNoneZ {
1509 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1510 /// `err` or `result` depending on the state of `result_ok`.
1511 pub contents: CResult_CVec_SignatureZNoneZPtr,
1512 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1513 pub result_ok: bool,
1516 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1517 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1518 CResult_CVec_SignatureZNoneZ {
1519 contents: CResult_CVec_SignatureZNoneZPtr {
1520 result: Box::into_raw(Box::new(o)),
1526 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1527 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1528 CResult_CVec_SignatureZNoneZ {
1529 contents: CResult_CVec_SignatureZNoneZPtr {
1530 err: core::ptr::null_mut(),
1535 /// Checks if the given object is currently in the success state
1537 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1541 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1542 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1543 impl Drop for CResult_CVec_SignatureZNoneZ {
1544 fn drop(&mut self) {
1546 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1547 let _ = unsafe { Box::from_raw(self.contents.result) };
1553 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1554 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1555 let contents = if o.result_ok {
1556 let result = unsafe { o.contents.result };
1557 unsafe { o.contents.result = core::ptr::null_mut() };
1558 CResult_CVec_SignatureZNoneZPtr { result }
1560 let _ = unsafe { Box::from_raw(o.contents.err) };
1561 o.contents.err = core::ptr::null_mut();
1562 CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1566 result_ok: o.result_ok,
1570 impl Clone for CResult_CVec_SignatureZNoneZ {
1571 fn clone(&self) -> Self {
1573 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1574 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1577 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1578 err: core::ptr::null_mut()
1584 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1585 /// but with all dynamically-allocated buffers duplicated in new buffers.
1586 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1588 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1589 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1590 /// A pointer to the contents in the success state.
1591 /// Reading from this pointer when `result_ok` is not set is undefined.
1592 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1593 /// A pointer to the contents in the error state.
1594 /// Reading from this pointer when `result_ok` is set is undefined.
1595 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1598 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1599 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1600 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1601 pub struct CResult_ShutdownScriptDecodeErrorZ {
1602 /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1603 /// `err` or `result` depending on the state of `result_ok`.
1604 pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1605 /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1606 pub result_ok: bool,
1609 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1610 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1611 CResult_ShutdownScriptDecodeErrorZ {
1612 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1613 result: Box::into_raw(Box::new(o)),
1619 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1620 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1621 CResult_ShutdownScriptDecodeErrorZ {
1622 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1623 err: Box::into_raw(Box::new(e)),
1628 /// Checks if the given object is currently in the success state
1630 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1634 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1635 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1636 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1637 fn drop(&mut self) {
1639 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1640 let _ = unsafe { Box::from_raw(self.contents.result) };
1643 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1644 let _ = unsafe { Box::from_raw(self.contents.err) };
1649 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1650 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1651 let contents = if o.result_ok {
1652 let result = unsafe { o.contents.result };
1653 unsafe { o.contents.result = core::ptr::null_mut() };
1654 CResult_ShutdownScriptDecodeErrorZPtr { result }
1656 let err = unsafe { o.contents.err };
1657 unsafe { o.contents.err = core::ptr::null_mut(); }
1658 CResult_ShutdownScriptDecodeErrorZPtr { err }
1662 result_ok: o.result_ok,
1666 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1667 fn clone(&self) -> Self {
1669 Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1670 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1673 Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1674 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1680 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1681 /// but with all dynamically-allocated buffers duplicated in new buffers.
1682 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1684 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1685 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1686 /// A pointer to the contents in the success state.
1687 /// Reading from this pointer when `result_ok` is not set is undefined.
1688 pub result: *mut crate::lightning::ln::script::ShutdownScript,
1689 /// A pointer to the contents in the error state.
1690 /// Reading from this pointer when `result_ok` is set is undefined.
1691 pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1694 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1695 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1696 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1697 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1698 /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1699 /// `err` or `result` depending on the state of `result_ok`.
1700 pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1701 /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1702 pub result_ok: bool,
1705 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1706 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1707 CResult_ShutdownScriptInvalidShutdownScriptZ {
1708 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1709 result: Box::into_raw(Box::new(o)),
1715 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1716 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1717 CResult_ShutdownScriptInvalidShutdownScriptZ {
1718 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1719 err: Box::into_raw(Box::new(e)),
1724 /// Checks if the given object is currently in the success state
1726 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1730 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1731 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1732 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1733 fn drop(&mut self) {
1735 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1736 let _ = unsafe { Box::from_raw(self.contents.result) };
1739 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1740 let _ = unsafe { Box::from_raw(self.contents.err) };
1745 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1746 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1747 let contents = if o.result_ok {
1748 let result = unsafe { o.contents.result };
1749 unsafe { o.contents.result = core::ptr::null_mut() };
1750 CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1752 let err = unsafe { o.contents.err };
1753 unsafe { o.contents.err = core::ptr::null_mut(); }
1754 CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1758 result_ok: o.result_ok,
1762 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763 fn clone(&self) -> Self {
1765 Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1766 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1769 Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1770 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1776 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1777 /// but with all dynamically-allocated buffers duplicated in new buffers.
1778 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1780 /// The contents of CResult_NoneErrorZ
1781 pub union CResult_NoneErrorZPtr {
1782 /// Note that this value is always NULL, as there are no contents in the OK variant
1783 pub result: *mut core::ffi::c_void,
1784 /// A pointer to the contents in the error state.
1785 /// Reading from this pointer when `result_ok` is set is undefined.
1786 pub err: *mut crate::c_types::IOError,
1789 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1790 /// containing a () on success and a crate::c_types::IOError on failure.
1791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1792 pub struct CResult_NoneErrorZ {
1793 /// The contents of this CResult_NoneErrorZ, accessible via either
1794 /// `err` or `result` depending on the state of `result_ok`.
1795 pub contents: CResult_NoneErrorZPtr,
1796 /// Whether this CResult_NoneErrorZ represents a success state.
1797 pub result_ok: bool,
1800 /// Creates a new CResult_NoneErrorZ in the success state.
1801 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1802 CResult_NoneErrorZ {
1803 contents: CResult_NoneErrorZPtr {
1804 result: core::ptr::null_mut(),
1810 /// Creates a new CResult_NoneErrorZ in the error state.
1811 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1812 CResult_NoneErrorZ {
1813 contents: CResult_NoneErrorZPtr {
1814 err: Box::into_raw(Box::new(e)),
1819 /// Checks if the given object is currently in the success state
1821 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1825 /// Frees any resources used by the CResult_NoneErrorZ.
1826 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1827 impl Drop for CResult_NoneErrorZ {
1828 fn drop(&mut self) {
1831 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1832 let _ = unsafe { Box::from_raw(self.contents.err) };
1837 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1838 fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1839 let contents = if o.result_ok {
1840 let _ = unsafe { Box::from_raw(o.contents.result) };
1841 o.contents.result = core::ptr::null_mut();
1842 CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1844 let err = unsafe { o.contents.err };
1845 unsafe { o.contents.err = core::ptr::null_mut(); }
1846 CResult_NoneErrorZPtr { err }
1850 result_ok: o.result_ok,
1854 impl Clone for CResult_NoneErrorZ {
1855 fn clone(&self) -> Self {
1857 Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1858 result: core::ptr::null_mut()
1861 Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1862 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1868 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1869 /// but with all dynamically-allocated buffers duplicated in new buffers.
1870 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1872 /// The contents of CResult_RouteHopDecodeErrorZ
1873 pub union CResult_RouteHopDecodeErrorZPtr {
1874 /// A pointer to the contents in the success state.
1875 /// Reading from this pointer when `result_ok` is not set is undefined.
1876 pub result: *mut crate::lightning::routing::router::RouteHop,
1877 /// A pointer to the contents in the error state.
1878 /// Reading from this pointer when `result_ok` is set is undefined.
1879 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1882 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1883 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1884 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1885 pub struct CResult_RouteHopDecodeErrorZ {
1886 /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1887 /// `err` or `result` depending on the state of `result_ok`.
1888 pub contents: CResult_RouteHopDecodeErrorZPtr,
1889 /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1890 pub result_ok: bool,
1893 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1894 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1895 CResult_RouteHopDecodeErrorZ {
1896 contents: CResult_RouteHopDecodeErrorZPtr {
1897 result: Box::into_raw(Box::new(o)),
1903 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1904 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1905 CResult_RouteHopDecodeErrorZ {
1906 contents: CResult_RouteHopDecodeErrorZPtr {
1907 err: Box::into_raw(Box::new(e)),
1912 /// Checks if the given object is currently in the success state
1914 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1918 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1919 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1920 impl Drop for CResult_RouteHopDecodeErrorZ {
1921 fn drop(&mut self) {
1923 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1924 let _ = unsafe { Box::from_raw(self.contents.result) };
1927 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1928 let _ = unsafe { Box::from_raw(self.contents.err) };
1933 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1934 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1935 let contents = if o.result_ok {
1936 let result = unsafe { o.contents.result };
1937 unsafe { o.contents.result = core::ptr::null_mut() };
1938 CResult_RouteHopDecodeErrorZPtr { result }
1940 let err = unsafe { o.contents.err };
1941 unsafe { o.contents.err = core::ptr::null_mut(); }
1942 CResult_RouteHopDecodeErrorZPtr { err }
1946 result_ok: o.result_ok,
1950 impl Clone for CResult_RouteHopDecodeErrorZ {
1951 fn clone(&self) -> Self {
1953 Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1954 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1957 Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1958 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1964 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1965 /// but with all dynamically-allocated buffers duplicated in new buffers.
1966 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1968 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1969 /// This corresponds to std::vector in C++
1970 pub struct CVec_RouteHopZ {
1971 /// The elements in the array.
1972 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1973 pub data: *mut crate::lightning::routing::router::RouteHop,
1974 /// The number of elements pointed to by `data`.
1977 impl CVec_RouteHopZ {
1978 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1979 if self.datalen == 0 { return Vec::new(); }
1980 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1981 self.data = core::ptr::null_mut();
1985 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1986 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1989 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1990 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1991 let datalen = v.len();
1992 let data = Box::into_raw(v.into_boxed_slice());
1993 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1997 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1998 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1999 impl Drop for CVec_RouteHopZ {
2000 fn drop(&mut self) {
2001 if self.datalen == 0 { return; }
2002 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2005 impl Clone for CVec_RouteHopZ {
2006 fn clone(&self) -> Self {
2007 let mut res = Vec::new();
2008 if self.datalen == 0 { return Self::from(res); }
2009 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2014 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2015 /// This corresponds to std::vector in C++
2016 pub struct CVec_CVec_RouteHopZZ {
2017 /// The elements in the array.
2018 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2019 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2020 /// The number of elements pointed to by `data`.
2023 impl CVec_CVec_RouteHopZZ {
2024 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2025 if self.datalen == 0 { return Vec::new(); }
2026 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2027 self.data = core::ptr::null_mut();
2031 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2032 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2035 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2036 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2037 let datalen = v.len();
2038 let data = Box::into_raw(v.into_boxed_slice());
2039 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2043 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2044 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2045 impl Drop for CVec_CVec_RouteHopZZ {
2046 fn drop(&mut self) {
2047 if self.datalen == 0 { return; }
2048 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2051 impl Clone for CVec_CVec_RouteHopZZ {
2052 fn clone(&self) -> Self {
2053 let mut res = Vec::new();
2054 if self.datalen == 0 { return Self::from(res); }
2055 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2060 /// The contents of CResult_RouteDecodeErrorZ
2061 pub union CResult_RouteDecodeErrorZPtr {
2062 /// A pointer to the contents in the success state.
2063 /// Reading from this pointer when `result_ok` is not set is undefined.
2064 pub result: *mut crate::lightning::routing::router::Route,
2065 /// A pointer to the contents in the error state.
2066 /// Reading from this pointer when `result_ok` is set is undefined.
2067 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2070 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2071 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2073 pub struct CResult_RouteDecodeErrorZ {
2074 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2075 /// `err` or `result` depending on the state of `result_ok`.
2076 pub contents: CResult_RouteDecodeErrorZPtr,
2077 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2078 pub result_ok: bool,
2081 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2082 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2083 CResult_RouteDecodeErrorZ {
2084 contents: CResult_RouteDecodeErrorZPtr {
2085 result: Box::into_raw(Box::new(o)),
2091 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2092 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2093 CResult_RouteDecodeErrorZ {
2094 contents: CResult_RouteDecodeErrorZPtr {
2095 err: Box::into_raw(Box::new(e)),
2100 /// Checks if the given object is currently in the success state
2102 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2106 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2107 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2108 impl Drop for CResult_RouteDecodeErrorZ {
2109 fn drop(&mut self) {
2111 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2112 let _ = unsafe { Box::from_raw(self.contents.result) };
2115 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2116 let _ = unsafe { Box::from_raw(self.contents.err) };
2121 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2122 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2123 let contents = if o.result_ok {
2124 let result = unsafe { o.contents.result };
2125 unsafe { o.contents.result = core::ptr::null_mut() };
2126 CResult_RouteDecodeErrorZPtr { result }
2128 let err = unsafe { o.contents.err };
2129 unsafe { o.contents.err = core::ptr::null_mut(); }
2130 CResult_RouteDecodeErrorZPtr { err }
2134 result_ok: o.result_ok,
2138 impl Clone for CResult_RouteDecodeErrorZ {
2139 fn clone(&self) -> Self {
2141 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2142 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2145 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2146 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2152 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2153 /// but with all dynamically-allocated buffers duplicated in new buffers.
2154 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2156 /// The contents of CResult_RouteParametersDecodeErrorZ
2157 pub union CResult_RouteParametersDecodeErrorZPtr {
2158 /// A pointer to the contents in the success state.
2159 /// Reading from this pointer when `result_ok` is not set is undefined.
2160 pub result: *mut crate::lightning::routing::router::RouteParameters,
2161 /// A pointer to the contents in the error state.
2162 /// Reading from this pointer when `result_ok` is set is undefined.
2163 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2166 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2167 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2168 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2169 pub struct CResult_RouteParametersDecodeErrorZ {
2170 /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2171 /// `err` or `result` depending on the state of `result_ok`.
2172 pub contents: CResult_RouteParametersDecodeErrorZPtr,
2173 /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2174 pub result_ok: bool,
2177 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2178 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2179 CResult_RouteParametersDecodeErrorZ {
2180 contents: CResult_RouteParametersDecodeErrorZPtr {
2181 result: Box::into_raw(Box::new(o)),
2187 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2188 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2189 CResult_RouteParametersDecodeErrorZ {
2190 contents: CResult_RouteParametersDecodeErrorZPtr {
2191 err: Box::into_raw(Box::new(e)),
2196 /// Checks if the given object is currently in the success state
2198 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2202 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2203 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2204 impl Drop for CResult_RouteParametersDecodeErrorZ {
2205 fn drop(&mut self) {
2207 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2208 let _ = unsafe { Box::from_raw(self.contents.result) };
2211 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2212 let _ = unsafe { Box::from_raw(self.contents.err) };
2217 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2218 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2219 let contents = if o.result_ok {
2220 let result = unsafe { o.contents.result };
2221 unsafe { o.contents.result = core::ptr::null_mut() };
2222 CResult_RouteParametersDecodeErrorZPtr { result }
2224 let err = unsafe { o.contents.err };
2225 unsafe { o.contents.err = core::ptr::null_mut(); }
2226 CResult_RouteParametersDecodeErrorZPtr { err }
2230 result_ok: o.result_ok,
2234 impl Clone for CResult_RouteParametersDecodeErrorZ {
2235 fn clone(&self) -> Self {
2237 Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2238 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2241 Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2242 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2248 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2249 /// but with all dynamically-allocated buffers duplicated in new buffers.
2250 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2252 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2253 /// This corresponds to std::vector in C++
2254 pub struct CVec_RouteHintZ {
2255 /// The elements in the array.
2256 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2257 pub data: *mut crate::lightning::routing::router::RouteHint,
2258 /// The number of elements pointed to by `data`.
2261 impl CVec_RouteHintZ {
2262 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2263 if self.datalen == 0 { return Vec::new(); }
2264 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2265 self.data = core::ptr::null_mut();
2269 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2270 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2273 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2274 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2275 let datalen = v.len();
2276 let data = Box::into_raw(v.into_boxed_slice());
2277 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2281 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2282 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2283 impl Drop for CVec_RouteHintZ {
2284 fn drop(&mut self) {
2285 if self.datalen == 0 { return; }
2286 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2289 impl Clone for CVec_RouteHintZ {
2290 fn clone(&self) -> Self {
2291 let mut res = Vec::new();
2292 if self.datalen == 0 { return Self::from(res); }
2293 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2299 /// An enum which can either contain a u64 or not
2300 pub enum COption_u64Z {
2301 /// When we're in this state, this COption_u64Z contains a u64
2303 /// When we're in this state, this COption_u64Z contains nothing
2307 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2308 if let Self::None = self { false } else { true }
2310 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2313 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2314 if let Self::Some(v) = self { v } else { unreachable!() }
2318 /// Constructs a new COption_u64Z containing a u64
2319 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2320 COption_u64Z::Some(o)
2323 /// Constructs a new COption_u64Z containing nothing
2324 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2328 /// Frees any resources associated with the u64, if we are in the Some state
2329 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2331 /// Creates a new COption_u64Z which has the same data as `orig`
2332 /// but with all dynamically-allocated buffers duplicated in new buffers.
2333 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2335 /// The contents of CResult_PaymentParametersDecodeErrorZ
2336 pub union CResult_PaymentParametersDecodeErrorZPtr {
2337 /// A pointer to the contents in the success state.
2338 /// Reading from this pointer when `result_ok` is not set is undefined.
2339 pub result: *mut crate::lightning::routing::router::PaymentParameters,
2340 /// A pointer to the contents in the error state.
2341 /// Reading from this pointer when `result_ok` is set is undefined.
2342 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2345 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2346 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2348 pub struct CResult_PaymentParametersDecodeErrorZ {
2349 /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2350 /// `err` or `result` depending on the state of `result_ok`.
2351 pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2352 /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2353 pub result_ok: bool,
2356 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2357 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2358 CResult_PaymentParametersDecodeErrorZ {
2359 contents: CResult_PaymentParametersDecodeErrorZPtr {
2360 result: Box::into_raw(Box::new(o)),
2366 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2367 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2368 CResult_PaymentParametersDecodeErrorZ {
2369 contents: CResult_PaymentParametersDecodeErrorZPtr {
2370 err: Box::into_raw(Box::new(e)),
2375 /// Checks if the given object is currently in the success state
2377 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2381 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2382 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2383 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2384 fn drop(&mut self) {
2386 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2387 let _ = unsafe { Box::from_raw(self.contents.result) };
2390 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2391 let _ = unsafe { Box::from_raw(self.contents.err) };
2396 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2397 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2398 let contents = if o.result_ok {
2399 let result = unsafe { o.contents.result };
2400 unsafe { o.contents.result = core::ptr::null_mut() };
2401 CResult_PaymentParametersDecodeErrorZPtr { result }
2403 let err = unsafe { o.contents.err };
2404 unsafe { o.contents.err = core::ptr::null_mut(); }
2405 CResult_PaymentParametersDecodeErrorZPtr { err }
2409 result_ok: o.result_ok,
2413 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2414 fn clone(&self) -> Self {
2416 Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2417 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2420 Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2421 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2427 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2428 /// but with all dynamically-allocated buffers duplicated in new buffers.
2429 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2431 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2432 /// This corresponds to std::vector in C++
2433 pub struct CVec_RouteHintHopZ {
2434 /// The elements in the array.
2435 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2436 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2437 /// The number of elements pointed to by `data`.
2440 impl CVec_RouteHintHopZ {
2441 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2442 if self.datalen == 0 { return Vec::new(); }
2443 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2444 self.data = core::ptr::null_mut();
2448 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2449 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2452 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2453 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2454 let datalen = v.len();
2455 let data = Box::into_raw(v.into_boxed_slice());
2456 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2460 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2461 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2462 impl Drop for CVec_RouteHintHopZ {
2463 fn drop(&mut self) {
2464 if self.datalen == 0 { return; }
2465 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2468 impl Clone for CVec_RouteHintHopZ {
2469 fn clone(&self) -> Self {
2470 let mut res = Vec::new();
2471 if self.datalen == 0 { return Self::from(res); }
2472 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2477 /// The contents of CResult_RouteHintDecodeErrorZ
2478 pub union CResult_RouteHintDecodeErrorZPtr {
2479 /// A pointer to the contents in the success state.
2480 /// Reading from this pointer when `result_ok` is not set is undefined.
2481 pub result: *mut crate::lightning::routing::router::RouteHint,
2482 /// A pointer to the contents in the error state.
2483 /// Reading from this pointer when `result_ok` is set is undefined.
2484 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2487 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2488 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2490 pub struct CResult_RouteHintDecodeErrorZ {
2491 /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2492 /// `err` or `result` depending on the state of `result_ok`.
2493 pub contents: CResult_RouteHintDecodeErrorZPtr,
2494 /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2495 pub result_ok: bool,
2498 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2499 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2500 CResult_RouteHintDecodeErrorZ {
2501 contents: CResult_RouteHintDecodeErrorZPtr {
2502 result: Box::into_raw(Box::new(o)),
2508 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2509 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2510 CResult_RouteHintDecodeErrorZ {
2511 contents: CResult_RouteHintDecodeErrorZPtr {
2512 err: Box::into_raw(Box::new(e)),
2517 /// Checks if the given object is currently in the success state
2519 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2523 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2524 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2525 impl Drop for CResult_RouteHintDecodeErrorZ {
2526 fn drop(&mut self) {
2528 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2529 let _ = unsafe { Box::from_raw(self.contents.result) };
2532 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2533 let _ = unsafe { Box::from_raw(self.contents.err) };
2538 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2539 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2540 let contents = if o.result_ok {
2541 let result = unsafe { o.contents.result };
2542 unsafe { o.contents.result = core::ptr::null_mut() };
2543 CResult_RouteHintDecodeErrorZPtr { result }
2545 let err = unsafe { o.contents.err };
2546 unsafe { o.contents.err = core::ptr::null_mut(); }
2547 CResult_RouteHintDecodeErrorZPtr { err }
2551 result_ok: o.result_ok,
2555 impl Clone for CResult_RouteHintDecodeErrorZ {
2556 fn clone(&self) -> Self {
2558 Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2559 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2562 Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2563 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2569 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2570 /// but with all dynamically-allocated buffers duplicated in new buffers.
2571 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2573 /// The contents of CResult_RouteHintHopDecodeErrorZ
2574 pub union CResult_RouteHintHopDecodeErrorZPtr {
2575 /// A pointer to the contents in the success state.
2576 /// Reading from this pointer when `result_ok` is not set is undefined.
2577 pub result: *mut crate::lightning::routing::router::RouteHintHop,
2578 /// A pointer to the contents in the error state.
2579 /// Reading from this pointer when `result_ok` is set is undefined.
2580 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2583 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2584 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2586 pub struct CResult_RouteHintHopDecodeErrorZ {
2587 /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2588 /// `err` or `result` depending on the state of `result_ok`.
2589 pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2590 /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2591 pub result_ok: bool,
2594 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2595 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2596 CResult_RouteHintHopDecodeErrorZ {
2597 contents: CResult_RouteHintHopDecodeErrorZPtr {
2598 result: Box::into_raw(Box::new(o)),
2604 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2605 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2606 CResult_RouteHintHopDecodeErrorZ {
2607 contents: CResult_RouteHintHopDecodeErrorZPtr {
2608 err: Box::into_raw(Box::new(e)),
2613 /// Checks if the given object is currently in the success state
2615 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2619 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2620 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2621 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2622 fn drop(&mut self) {
2624 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2625 let _ = unsafe { Box::from_raw(self.contents.result) };
2628 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2629 let _ = unsafe { Box::from_raw(self.contents.err) };
2634 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2635 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2636 let contents = if o.result_ok {
2637 let result = unsafe { o.contents.result };
2638 unsafe { o.contents.result = core::ptr::null_mut() };
2639 CResult_RouteHintHopDecodeErrorZPtr { result }
2641 let err = unsafe { o.contents.err };
2642 unsafe { o.contents.err = core::ptr::null_mut(); }
2643 CResult_RouteHintHopDecodeErrorZPtr { err }
2647 result_ok: o.result_ok,
2651 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2652 fn clone(&self) -> Self {
2654 Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2655 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2658 Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2659 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2665 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2666 /// but with all dynamically-allocated buffers duplicated in new buffers.
2667 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2669 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2670 /// This corresponds to std::vector in C++
2671 pub struct CVec_ChannelDetailsZ {
2672 /// The elements in the array.
2673 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2674 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2675 /// The number of elements pointed to by `data`.
2678 impl CVec_ChannelDetailsZ {
2679 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2680 if self.datalen == 0 { return Vec::new(); }
2681 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2682 self.data = core::ptr::null_mut();
2686 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2687 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2690 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2691 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2692 let datalen = v.len();
2693 let data = Box::into_raw(v.into_boxed_slice());
2694 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2698 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2699 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2700 impl Drop for CVec_ChannelDetailsZ {
2701 fn drop(&mut self) {
2702 if self.datalen == 0 { return; }
2703 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2706 impl Clone for CVec_ChannelDetailsZ {
2707 fn clone(&self) -> Self {
2708 let mut res = Vec::new();
2709 if self.datalen == 0 { return Self::from(res); }
2710 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2715 /// The contents of CResult_RouteLightningErrorZ
2716 pub union CResult_RouteLightningErrorZPtr {
2717 /// A pointer to the contents in the success state.
2718 /// Reading from this pointer when `result_ok` is not set is undefined.
2719 pub result: *mut crate::lightning::routing::router::Route,
2720 /// A pointer to the contents in the error state.
2721 /// Reading from this pointer when `result_ok` is set is undefined.
2722 pub err: *mut crate::lightning::ln::msgs::LightningError,
2725 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2726 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2727 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2728 pub struct CResult_RouteLightningErrorZ {
2729 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2730 /// `err` or `result` depending on the state of `result_ok`.
2731 pub contents: CResult_RouteLightningErrorZPtr,
2732 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2733 pub result_ok: bool,
2736 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2737 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2738 CResult_RouteLightningErrorZ {
2739 contents: CResult_RouteLightningErrorZPtr {
2740 result: Box::into_raw(Box::new(o)),
2746 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2747 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2748 CResult_RouteLightningErrorZ {
2749 contents: CResult_RouteLightningErrorZPtr {
2750 err: Box::into_raw(Box::new(e)),
2755 /// Checks if the given object is currently in the success state
2757 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2761 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2762 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2763 impl Drop for CResult_RouteLightningErrorZ {
2764 fn drop(&mut self) {
2766 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2767 let _ = unsafe { Box::from_raw(self.contents.result) };
2770 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2771 let _ = unsafe { Box::from_raw(self.contents.err) };
2776 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2777 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2778 let contents = if o.result_ok {
2779 let result = unsafe { o.contents.result };
2780 unsafe { o.contents.result = core::ptr::null_mut() };
2781 CResult_RouteLightningErrorZPtr { result }
2783 let err = unsafe { o.contents.err };
2784 unsafe { o.contents.err = core::ptr::null_mut(); }
2785 CResult_RouteLightningErrorZPtr { err }
2789 result_ok: o.result_ok,
2793 impl Clone for CResult_RouteLightningErrorZ {
2794 fn clone(&self) -> Self {
2796 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2797 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2800 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2801 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2807 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2808 /// but with all dynamically-allocated buffers duplicated in new buffers.
2809 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2811 /// The contents of CResult_TxOutAccessErrorZ
2812 pub union CResult_TxOutAccessErrorZPtr {
2813 /// A pointer to the contents in the success state.
2814 /// Reading from this pointer when `result_ok` is not set is undefined.
2815 pub result: *mut crate::c_types::TxOut,
2816 /// A pointer to the contents in the error state.
2817 /// Reading from this pointer when `result_ok` is set is undefined.
2818 pub err: *mut crate::lightning::chain::AccessError,
2821 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2822 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2823 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2824 pub struct CResult_TxOutAccessErrorZ {
2825 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2826 /// `err` or `result` depending on the state of `result_ok`.
2827 pub contents: CResult_TxOutAccessErrorZPtr,
2828 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2829 pub result_ok: bool,
2832 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2833 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2834 CResult_TxOutAccessErrorZ {
2835 contents: CResult_TxOutAccessErrorZPtr {
2836 result: Box::into_raw(Box::new(o)),
2842 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2843 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2844 CResult_TxOutAccessErrorZ {
2845 contents: CResult_TxOutAccessErrorZPtr {
2846 err: Box::into_raw(Box::new(e)),
2851 /// Checks if the given object is currently in the success state
2853 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2857 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2858 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2859 impl Drop for CResult_TxOutAccessErrorZ {
2860 fn drop(&mut self) {
2862 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2863 let _ = unsafe { Box::from_raw(self.contents.result) };
2866 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2867 let _ = unsafe { Box::from_raw(self.contents.err) };
2872 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2873 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2874 let contents = if o.result_ok {
2875 let result = unsafe { o.contents.result };
2876 unsafe { o.contents.result = core::ptr::null_mut() };
2877 CResult_TxOutAccessErrorZPtr { result }
2879 let err = unsafe { o.contents.err };
2880 unsafe { o.contents.err = core::ptr::null_mut(); }
2881 CResult_TxOutAccessErrorZPtr { err }
2885 result_ok: o.result_ok,
2889 impl Clone for CResult_TxOutAccessErrorZ {
2890 fn clone(&self) -> Self {
2892 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2893 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2896 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2897 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2903 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2904 /// but with all dynamically-allocated buffers duplicated in new buffers.
2905 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2907 /// A tuple of 2 elements. See the individual fields for the types contained.
2908 pub struct C2Tuple_usizeTransactionZ {
2909 /// The element at position 0
2911 /// The element at position 1
2912 pub b: crate::c_types::Transaction,
2914 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2915 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2922 impl C2Tuple_usizeTransactionZ {
2923 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2927 impl Clone for C2Tuple_usizeTransactionZ {
2928 fn clone(&self) -> Self {
2930 a: Clone::clone(&self.a),
2931 b: Clone::clone(&self.b),
2936 /// Creates a new tuple which has the same data as `orig`
2937 /// but with all dynamically-allocated buffers duplicated in new buffers.
2938 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2939 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2941 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2942 C2Tuple_usizeTransactionZ { a, b, }
2946 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2947 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2949 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2950 /// This corresponds to std::vector in C++
2951 pub struct CVec_C2Tuple_usizeTransactionZZ {
2952 /// The elements in the array.
2953 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2954 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2955 /// The number of elements pointed to by `data`.
2958 impl CVec_C2Tuple_usizeTransactionZZ {
2959 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2960 if self.datalen == 0 { return Vec::new(); }
2961 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2962 self.data = core::ptr::null_mut();
2966 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2967 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2970 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2971 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2972 let datalen = v.len();
2973 let data = Box::into_raw(v.into_boxed_slice());
2974 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2978 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2979 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2980 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2981 fn drop(&mut self) {
2982 if self.datalen == 0 { return; }
2983 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2986 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2987 fn clone(&self) -> Self {
2988 let mut res = Vec::new();
2989 if self.datalen == 0 { return Self::from(res); }
2990 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2995 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2996 /// This corresponds to std::vector in C++
2997 pub struct CVec_TxidZ {
2998 /// The elements in the array.
2999 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3000 pub data: *mut crate::c_types::ThirtyTwoBytes,
3001 /// The number of elements pointed to by `data`.
3005 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3006 if self.datalen == 0 { return Vec::new(); }
3007 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3008 self.data = core::ptr::null_mut();
3012 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3013 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3016 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3017 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3018 let datalen = v.len();
3019 let data = Box::into_raw(v.into_boxed_slice());
3020 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3024 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3025 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3026 impl Drop for CVec_TxidZ {
3027 fn drop(&mut self) {
3028 if self.datalen == 0 { return; }
3029 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3032 impl Clone for CVec_TxidZ {
3033 fn clone(&self) -> Self {
3034 let mut res = Vec::new();
3035 if self.datalen == 0 { return Self::from(res); }
3036 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3041 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3042 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3043 /// Note that this value is always NULL, as there are no contents in the OK variant
3044 pub result: *mut core::ffi::c_void,
3045 /// A pointer to the contents in the error state.
3046 /// Reading from this pointer when `result_ok` is set is undefined.
3047 pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3050 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3051 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3053 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3054 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3055 /// `err` or `result` depending on the state of `result_ok`.
3056 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3057 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3058 pub result_ok: bool,
3061 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3062 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3063 CResult_NoneChannelMonitorUpdateErrZ {
3064 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3065 result: core::ptr::null_mut(),
3071 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3072 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3073 CResult_NoneChannelMonitorUpdateErrZ {
3074 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3075 err: Box::into_raw(Box::new(e)),
3080 /// Checks if the given object is currently in the success state
3082 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3086 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3087 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3088 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3089 fn drop(&mut self) {
3092 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3093 let _ = unsafe { Box::from_raw(self.contents.err) };
3098 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3099 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3100 let contents = if o.result_ok {
3101 let _ = unsafe { Box::from_raw(o.contents.result) };
3102 o.contents.result = core::ptr::null_mut();
3103 CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3105 let err = unsafe { o.contents.err };
3106 unsafe { o.contents.err = core::ptr::null_mut(); }
3107 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3111 result_ok: o.result_ok,
3115 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3116 fn clone(&self) -> Self {
3118 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3119 result: core::ptr::null_mut()
3122 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3123 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3129 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3130 /// but with all dynamically-allocated buffers duplicated in new buffers.
3131 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3133 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3134 /// This corresponds to std::vector in C++
3135 pub struct CVec_MonitorEventZ {
3136 /// The elements in the array.
3137 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3138 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3139 /// The number of elements pointed to by `data`.
3142 impl CVec_MonitorEventZ {
3143 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3144 if self.datalen == 0 { return Vec::new(); }
3145 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3146 self.data = core::ptr::null_mut();
3150 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3151 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3154 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3155 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3156 let datalen = v.len();
3157 let data = Box::into_raw(v.into_boxed_slice());
3158 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3162 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3163 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3164 impl Drop for CVec_MonitorEventZ {
3165 fn drop(&mut self) {
3166 if self.datalen == 0 { return; }
3167 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3170 impl Clone for CVec_MonitorEventZ {
3171 fn clone(&self) -> Self {
3172 let mut res = Vec::new();
3173 if self.datalen == 0 { return Self::from(res); }
3174 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3180 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3181 pub enum COption_C2Tuple_usizeTransactionZZ {
3182 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3183 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3184 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3187 impl COption_C2Tuple_usizeTransactionZZ {
3188 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3189 if let Self::None = self { false } else { true }
3191 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3194 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3195 if let Self::Some(v) = self { v } else { unreachable!() }
3199 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3201 COption_C2Tuple_usizeTransactionZZ::Some(o)
3204 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3205 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3206 COption_C2Tuple_usizeTransactionZZ::None
3209 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3210 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3212 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3213 /// but with all dynamically-allocated buffers duplicated in new buffers.
3214 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3217 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3218 pub enum COption_ClosureReasonZ {
3219 /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3220 Some(crate::lightning::util::events::ClosureReason),
3221 /// When we're in this state, this COption_ClosureReasonZ contains nothing
3224 impl COption_ClosureReasonZ {
3225 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3226 if let Self::None = self { false } else { true }
3228 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3231 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3232 if let Self::Some(v) = self { v } else { unreachable!() }
3236 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3237 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3238 COption_ClosureReasonZ::Some(o)
3241 /// Constructs a new COption_ClosureReasonZ containing nothing
3242 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3243 COption_ClosureReasonZ::None
3246 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3247 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3249 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3250 /// but with all dynamically-allocated buffers duplicated in new buffers.
3251 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3253 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3254 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3255 /// A pointer to the contents in the success state.
3256 /// Reading from this pointer when `result_ok` is not set is undefined.
3257 pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3258 /// A pointer to the contents in the error state.
3259 /// Reading from this pointer when `result_ok` is set is undefined.
3260 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3263 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3264 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3265 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3266 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3267 /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3268 /// `err` or `result` depending on the state of `result_ok`.
3269 pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3270 /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3271 pub result_ok: bool,
3274 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3275 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3276 CResult_COption_ClosureReasonZDecodeErrorZ {
3277 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3278 result: Box::into_raw(Box::new(o)),
3284 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3285 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3286 CResult_COption_ClosureReasonZDecodeErrorZ {
3287 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3288 err: Box::into_raw(Box::new(e)),
3293 /// Checks if the given object is currently in the success state
3295 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3299 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3300 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3301 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3302 fn drop(&mut self) {
3304 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3305 let _ = unsafe { Box::from_raw(self.contents.result) };
3308 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3309 let _ = unsafe { Box::from_raw(self.contents.err) };
3314 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3315 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3316 let contents = if o.result_ok {
3317 let result = unsafe { o.contents.result };
3318 unsafe { o.contents.result = core::ptr::null_mut() };
3319 CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3321 let err = unsafe { o.contents.err };
3322 unsafe { o.contents.err = core::ptr::null_mut(); }
3323 CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3327 result_ok: o.result_ok,
3331 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3332 fn clone(&self) -> Self {
3334 Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3335 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3338 Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3339 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3345 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3346 /// but with all dynamically-allocated buffers duplicated in new buffers.
3347 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3350 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3351 pub enum COption_NetworkUpdateZ {
3352 /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3353 Some(crate::lightning::routing::network_graph::NetworkUpdate),
3354 /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3357 impl COption_NetworkUpdateZ {
3358 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3359 if let Self::None = self { false } else { true }
3361 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3364 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3365 if let Self::Some(v) = self { v } else { unreachable!() }
3369 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3370 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3371 COption_NetworkUpdateZ::Some(o)
3374 /// Constructs a new COption_NetworkUpdateZ containing nothing
3375 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3376 COption_NetworkUpdateZ::None
3379 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3380 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3382 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3383 /// but with all dynamically-allocated buffers duplicated in new buffers.
3384 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3386 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3387 /// This corresponds to std::vector in C++
3388 pub struct CVec_SpendableOutputDescriptorZ {
3389 /// The elements in the array.
3390 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3391 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3392 /// The number of elements pointed to by `data`.
3395 impl CVec_SpendableOutputDescriptorZ {
3396 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3397 if self.datalen == 0 { return Vec::new(); }
3398 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3399 self.data = core::ptr::null_mut();
3403 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3404 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3407 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3408 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3409 let datalen = v.len();
3410 let data = Box::into_raw(v.into_boxed_slice());
3411 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3415 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3416 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3417 impl Drop for CVec_SpendableOutputDescriptorZ {
3418 fn drop(&mut self) {
3419 if self.datalen == 0 { return; }
3420 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3423 impl Clone for CVec_SpendableOutputDescriptorZ {
3424 fn clone(&self) -> Self {
3425 let mut res = Vec::new();
3426 if self.datalen == 0 { return Self::from(res); }
3427 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3433 /// An enum which can either contain a crate::lightning::util::events::Event or not
3434 pub enum COption_EventZ {
3435 /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3436 Some(crate::lightning::util::events::Event),
3437 /// When we're in this state, this COption_EventZ contains nothing
3440 impl COption_EventZ {
3441 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3442 if let Self::None = self { false } else { true }
3444 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3447 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3448 if let Self::Some(v) = self { v } else { unreachable!() }
3452 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3453 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3454 COption_EventZ::Some(o)
3457 /// Constructs a new COption_EventZ containing nothing
3458 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3459 COption_EventZ::None
3462 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3463 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3465 /// Creates a new COption_EventZ which has the same data as `orig`
3466 /// but with all dynamically-allocated buffers duplicated in new buffers.
3467 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3469 /// The contents of CResult_COption_EventZDecodeErrorZ
3470 pub union CResult_COption_EventZDecodeErrorZPtr {
3471 /// A pointer to the contents in the success state.
3472 /// Reading from this pointer when `result_ok` is not set is undefined.
3473 pub result: *mut crate::c_types::derived::COption_EventZ,
3474 /// A pointer to the contents in the error state.
3475 /// Reading from this pointer when `result_ok` is set is undefined.
3476 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3479 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3480 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3481 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3482 pub struct CResult_COption_EventZDecodeErrorZ {
3483 /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3484 /// `err` or `result` depending on the state of `result_ok`.
3485 pub contents: CResult_COption_EventZDecodeErrorZPtr,
3486 /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3487 pub result_ok: bool,
3490 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3491 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3492 CResult_COption_EventZDecodeErrorZ {
3493 contents: CResult_COption_EventZDecodeErrorZPtr {
3494 result: Box::into_raw(Box::new(o)),
3500 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3501 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3502 CResult_COption_EventZDecodeErrorZ {
3503 contents: CResult_COption_EventZDecodeErrorZPtr {
3504 err: Box::into_raw(Box::new(e)),
3509 /// Checks if the given object is currently in the success state
3511 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3515 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3516 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3517 impl Drop for CResult_COption_EventZDecodeErrorZ {
3518 fn drop(&mut self) {
3520 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3521 let _ = unsafe { Box::from_raw(self.contents.result) };
3524 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3525 let _ = unsafe { Box::from_raw(self.contents.err) };
3530 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3531 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3532 let contents = if o.result_ok {
3533 let result = unsafe { o.contents.result };
3534 unsafe { o.contents.result = core::ptr::null_mut() };
3535 CResult_COption_EventZDecodeErrorZPtr { result }
3537 let err = unsafe { o.contents.err };
3538 unsafe { o.contents.err = core::ptr::null_mut(); }
3539 CResult_COption_EventZDecodeErrorZPtr { err }
3543 result_ok: o.result_ok,
3547 impl Clone for CResult_COption_EventZDecodeErrorZ {
3548 fn clone(&self) -> Self {
3550 Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3551 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3554 Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3555 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3561 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3562 /// but with all dynamically-allocated buffers duplicated in new buffers.
3563 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3565 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3566 /// This corresponds to std::vector in C++
3567 pub struct CVec_MessageSendEventZ {
3568 /// The elements in the array.
3569 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3570 pub data: *mut crate::lightning::util::events::MessageSendEvent,
3571 /// The number of elements pointed to by `data`.
3574 impl CVec_MessageSendEventZ {
3575 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3576 if self.datalen == 0 { return Vec::new(); }
3577 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3578 self.data = core::ptr::null_mut();
3582 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3583 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3586 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3587 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3588 let datalen = v.len();
3589 let data = Box::into_raw(v.into_boxed_slice());
3590 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3594 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3595 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3596 impl Drop for CVec_MessageSendEventZ {
3597 fn drop(&mut self) {
3598 if self.datalen == 0 { return; }
3599 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3602 impl Clone for CVec_MessageSendEventZ {
3603 fn clone(&self) -> Self {
3604 let mut res = Vec::new();
3605 if self.datalen == 0 { return Self::from(res); }
3606 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3611 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3612 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3613 /// A pointer to the contents in the success state.
3614 /// Reading from this pointer when `result_ok` is not set is undefined.
3615 pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3616 /// A pointer to the contents in the error state.
3617 /// Reading from this pointer when `result_ok` is set is undefined.
3618 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3621 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3622 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3623 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3624 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3625 /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3626 /// `err` or `result` depending on the state of `result_ok`.
3627 pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3628 /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3629 pub result_ok: bool,
3632 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3633 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3634 CResult_FixedPenaltyScorerDecodeErrorZ {
3635 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3636 result: Box::into_raw(Box::new(o)),
3642 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3643 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3644 CResult_FixedPenaltyScorerDecodeErrorZ {
3645 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3646 err: Box::into_raw(Box::new(e)),
3651 /// Checks if the given object is currently in the success state
3653 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3657 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3658 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3659 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3660 fn drop(&mut self) {
3662 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3663 let _ = unsafe { Box::from_raw(self.contents.result) };
3666 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3667 let _ = unsafe { Box::from_raw(self.contents.err) };
3672 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3673 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3674 let contents = if o.result_ok {
3675 let result = unsafe { o.contents.result };
3676 unsafe { o.contents.result = core::ptr::null_mut() };
3677 CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3679 let err = unsafe { o.contents.err };
3680 unsafe { o.contents.err = core::ptr::null_mut(); }
3681 CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3685 result_ok: o.result_ok,
3690 /// The contents of CResult_ScoringParametersDecodeErrorZ
3691 pub union CResult_ScoringParametersDecodeErrorZPtr {
3692 /// A pointer to the contents in the success state.
3693 /// Reading from this pointer when `result_ok` is not set is undefined.
3694 pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3695 /// A pointer to the contents in the error state.
3696 /// Reading from this pointer when `result_ok` is set is undefined.
3697 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3700 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3701 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3703 pub struct CResult_ScoringParametersDecodeErrorZ {
3704 /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3705 /// `err` or `result` depending on the state of `result_ok`.
3706 pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3707 /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3708 pub result_ok: bool,
3711 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3712 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3713 CResult_ScoringParametersDecodeErrorZ {
3714 contents: CResult_ScoringParametersDecodeErrorZPtr {
3715 result: Box::into_raw(Box::new(o)),
3721 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3722 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3723 CResult_ScoringParametersDecodeErrorZ {
3724 contents: CResult_ScoringParametersDecodeErrorZPtr {
3725 err: Box::into_raw(Box::new(e)),
3730 /// Checks if the given object is currently in the success state
3732 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3736 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3737 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3738 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3739 fn drop(&mut self) {
3741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3742 let _ = unsafe { Box::from_raw(self.contents.result) };
3745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3746 let _ = unsafe { Box::from_raw(self.contents.err) };
3751 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3752 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3753 let contents = if o.result_ok {
3754 let result = unsafe { o.contents.result };
3755 unsafe { o.contents.result = core::ptr::null_mut() };
3756 CResult_ScoringParametersDecodeErrorZPtr { result }
3758 let err = unsafe { o.contents.err };
3759 unsafe { o.contents.err = core::ptr::null_mut(); }
3760 CResult_ScoringParametersDecodeErrorZPtr { err }
3764 result_ok: o.result_ok,
3769 /// The contents of CResult_ScorerDecodeErrorZ
3770 pub union CResult_ScorerDecodeErrorZPtr {
3771 /// A pointer to the contents in the success state.
3772 /// Reading from this pointer when `result_ok` is not set is undefined.
3773 pub result: *mut crate::lightning::routing::scoring::Scorer,
3774 /// A pointer to the contents in the error state.
3775 /// Reading from this pointer when `result_ok` is set is undefined.
3776 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3779 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3780 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3782 pub struct CResult_ScorerDecodeErrorZ {
3783 /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3784 /// `err` or `result` depending on the state of `result_ok`.
3785 pub contents: CResult_ScorerDecodeErrorZPtr,
3786 /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3787 pub result_ok: bool,
3790 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3791 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3792 CResult_ScorerDecodeErrorZ {
3793 contents: CResult_ScorerDecodeErrorZPtr {
3794 result: Box::into_raw(Box::new(o)),
3800 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3801 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3802 CResult_ScorerDecodeErrorZ {
3803 contents: CResult_ScorerDecodeErrorZPtr {
3804 err: Box::into_raw(Box::new(e)),
3809 /// Checks if the given object is currently in the success state
3811 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3815 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3816 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3817 impl Drop for CResult_ScorerDecodeErrorZ {
3818 fn drop(&mut self) {
3820 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3821 let _ = unsafe { Box::from_raw(self.contents.result) };
3824 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3825 let _ = unsafe { Box::from_raw(self.contents.err) };
3830 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3831 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3832 let contents = if o.result_ok {
3833 let result = unsafe { o.contents.result };
3834 unsafe { o.contents.result = core::ptr::null_mut() };
3835 CResult_ScorerDecodeErrorZPtr { result }
3837 let err = unsafe { o.contents.err };
3838 unsafe { o.contents.err = core::ptr::null_mut(); }
3839 CResult_ScorerDecodeErrorZPtr { err }
3843 result_ok: o.result_ok,
3848 /// The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
3849 pub union CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3850 /// A pointer to the contents in the success state.
3851 /// Reading from this pointer when `result_ok` is not set is undefined.
3852 pub result: *mut crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3853 /// A pointer to the contents in the error state.
3854 /// Reading from this pointer when `result_ok` is set is undefined.
3855 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3858 /// A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
3859 /// containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3861 pub struct CResult_ProbabilisticScoringParametersDecodeErrorZ {
3862 /// The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
3863 /// `err` or `result` depending on the state of `result_ok`.
3864 pub contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr,
3865 /// Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
3866 pub result_ok: bool,
3869 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
3870 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScoringParameters) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3871 CResult_ProbabilisticScoringParametersDecodeErrorZ {
3872 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3873 result: Box::into_raw(Box::new(o)),
3879 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
3880 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3881 CResult_ProbabilisticScoringParametersDecodeErrorZ {
3882 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3883 err: Box::into_raw(Box::new(e)),
3888 /// Checks if the given object is currently in the success state
3890 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> bool {
3894 /// Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
3895 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res: CResult_ProbabilisticScoringParametersDecodeErrorZ) { }
3896 impl Drop for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3897 fn drop(&mut self) {
3899 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3900 let _ = unsafe { Box::from_raw(self.contents.result) };
3903 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3904 let _ = unsafe { Box::from_raw(self.contents.err) };
3909 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3910 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3911 let contents = if o.result_ok {
3912 let result = unsafe { o.contents.result };
3913 unsafe { o.contents.result = core::ptr::null_mut() };
3914 CResult_ProbabilisticScoringParametersDecodeErrorZPtr { result }
3916 let err = unsafe { o.contents.err };
3917 unsafe { o.contents.err = core::ptr::null_mut(); }
3918 CResult_ProbabilisticScoringParametersDecodeErrorZPtr { err }
3922 result_ok: o.result_ok,
3926 impl Clone for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3927 fn clone(&self) -> Self {
3929 Self { result_ok: true, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3930 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ProbabilisticScoringParameters>::clone(unsafe { &*self.contents.result })))
3933 Self { result_ok: false, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3934 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3940 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
3941 /// but with all dynamically-allocated buffers duplicated in new buffers.
3942 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> CResult_ProbabilisticScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3944 /// The contents of CResult_InitFeaturesDecodeErrorZ
3945 pub union CResult_InitFeaturesDecodeErrorZPtr {
3946 /// A pointer to the contents in the success state.
3947 /// Reading from this pointer when `result_ok` is not set is undefined.
3948 pub result: *mut crate::lightning::ln::features::InitFeatures,
3949 /// A pointer to the contents in the error state.
3950 /// Reading from this pointer when `result_ok` is set is undefined.
3951 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3954 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3955 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3956 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3957 pub struct CResult_InitFeaturesDecodeErrorZ {
3958 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3959 /// `err` or `result` depending on the state of `result_ok`.
3960 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3961 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3962 pub result_ok: bool,
3965 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
3966 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
3967 CResult_InitFeaturesDecodeErrorZ {
3968 contents: CResult_InitFeaturesDecodeErrorZPtr {
3969 result: Box::into_raw(Box::new(o)),
3975 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3976 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3977 CResult_InitFeaturesDecodeErrorZ {
3978 contents: CResult_InitFeaturesDecodeErrorZPtr {
3979 err: Box::into_raw(Box::new(e)),
3984 /// Checks if the given object is currently in the success state
3986 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
3990 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3991 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3992 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3993 fn drop(&mut self) {
3995 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3996 let _ = unsafe { Box::from_raw(self.contents.result) };
3999 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4000 let _ = unsafe { Box::from_raw(self.contents.err) };
4005 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4006 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4007 let contents = if o.result_ok {
4008 let result = unsafe { o.contents.result };
4009 unsafe { o.contents.result = core::ptr::null_mut() };
4010 CResult_InitFeaturesDecodeErrorZPtr { result }
4012 let err = unsafe { o.contents.err };
4013 unsafe { o.contents.err = core::ptr::null_mut(); }
4014 CResult_InitFeaturesDecodeErrorZPtr { err }
4018 result_ok: o.result_ok,
4023 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4024 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4025 /// A pointer to the contents in the success state.
4026 /// Reading from this pointer when `result_ok` is not set is undefined.
4027 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4028 /// A pointer to the contents in the error state.
4029 /// Reading from this pointer when `result_ok` is set is undefined.
4030 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4033 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4034 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4035 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4036 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4037 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4038 /// `err` or `result` depending on the state of `result_ok`.
4039 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4040 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4041 pub result_ok: bool,
4044 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4045 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4046 CResult_ChannelFeaturesDecodeErrorZ {
4047 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4048 result: Box::into_raw(Box::new(o)),
4054 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4055 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4056 CResult_ChannelFeaturesDecodeErrorZ {
4057 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4058 err: Box::into_raw(Box::new(e)),
4063 /// Checks if the given object is currently in the success state
4065 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4069 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4070 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4071 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4072 fn drop(&mut self) {
4074 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4075 let _ = unsafe { Box::from_raw(self.contents.result) };
4078 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4079 let _ = unsafe { Box::from_raw(self.contents.err) };
4084 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4085 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4086 let contents = if o.result_ok {
4087 let result = unsafe { o.contents.result };
4088 unsafe { o.contents.result = core::ptr::null_mut() };
4089 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4091 let err = unsafe { o.contents.err };
4092 unsafe { o.contents.err = core::ptr::null_mut(); }
4093 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4097 result_ok: o.result_ok,
4102 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4103 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4104 /// A pointer to the contents in the success state.
4105 /// Reading from this pointer when `result_ok` is not set is undefined.
4106 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4107 /// A pointer to the contents in the error state.
4108 /// Reading from this pointer when `result_ok` is set is undefined.
4109 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4112 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4113 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4114 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4115 pub struct CResult_NodeFeaturesDecodeErrorZ {
4116 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4117 /// `err` or `result` depending on the state of `result_ok`.
4118 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4119 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4120 pub result_ok: bool,
4123 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4124 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4125 CResult_NodeFeaturesDecodeErrorZ {
4126 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4127 result: Box::into_raw(Box::new(o)),
4133 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4134 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4135 CResult_NodeFeaturesDecodeErrorZ {
4136 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4137 err: Box::into_raw(Box::new(e)),
4142 /// Checks if the given object is currently in the success state
4144 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4148 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4149 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4150 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4151 fn drop(&mut self) {
4153 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4154 let _ = unsafe { Box::from_raw(self.contents.result) };
4157 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4158 let _ = unsafe { Box::from_raw(self.contents.err) };
4163 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4164 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4165 let contents = if o.result_ok {
4166 let result = unsafe { o.contents.result };
4167 unsafe { o.contents.result = core::ptr::null_mut() };
4168 CResult_NodeFeaturesDecodeErrorZPtr { result }
4170 let err = unsafe { o.contents.err };
4171 unsafe { o.contents.err = core::ptr::null_mut(); }
4172 CResult_NodeFeaturesDecodeErrorZPtr { err }
4176 result_ok: o.result_ok,
4181 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4182 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4183 /// A pointer to the contents in the success state.
4184 /// Reading from this pointer when `result_ok` is not set is undefined.
4185 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4186 /// A pointer to the contents in the error state.
4187 /// Reading from this pointer when `result_ok` is set is undefined.
4188 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4191 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4192 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4193 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4194 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4195 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4196 /// `err` or `result` depending on the state of `result_ok`.
4197 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4198 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4199 pub result_ok: bool,
4202 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4203 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4204 CResult_InvoiceFeaturesDecodeErrorZ {
4205 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4206 result: Box::into_raw(Box::new(o)),
4212 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4213 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4214 CResult_InvoiceFeaturesDecodeErrorZ {
4215 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4216 err: Box::into_raw(Box::new(e)),
4221 /// Checks if the given object is currently in the success state
4223 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4227 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4228 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4229 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4230 fn drop(&mut self) {
4232 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4233 let _ = unsafe { Box::from_raw(self.contents.result) };
4236 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4237 let _ = unsafe { Box::from_raw(self.contents.err) };
4242 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4243 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4244 let contents = if o.result_ok {
4245 let result = unsafe { o.contents.result };
4246 unsafe { o.contents.result = core::ptr::null_mut() };
4247 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4249 let err = unsafe { o.contents.err };
4250 unsafe { o.contents.err = core::ptr::null_mut(); }
4251 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4255 result_ok: o.result_ok,
4260 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4261 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4262 /// A pointer to the contents in the success state.
4263 /// Reading from this pointer when `result_ok` is not set is undefined.
4264 pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4265 /// A pointer to the contents in the error state.
4266 /// Reading from this pointer when `result_ok` is set is undefined.
4267 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4270 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4271 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4272 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4273 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4274 /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4275 /// `err` or `result` depending on the state of `result_ok`.
4276 pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4277 /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4278 pub result_ok: bool,
4281 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4282 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4283 CResult_ChannelTypeFeaturesDecodeErrorZ {
4284 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4285 result: Box::into_raw(Box::new(o)),
4291 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4292 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4293 CResult_ChannelTypeFeaturesDecodeErrorZ {
4294 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4295 err: Box::into_raw(Box::new(e)),
4300 /// Checks if the given object is currently in the success state
4302 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4306 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4307 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4308 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4309 fn drop(&mut self) {
4311 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4312 let _ = unsafe { Box::from_raw(self.contents.result) };
4315 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4316 let _ = unsafe { Box::from_raw(self.contents.err) };
4321 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4322 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4323 let contents = if o.result_ok {
4324 let result = unsafe { o.contents.result };
4325 unsafe { o.contents.result = core::ptr::null_mut() };
4326 CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4328 let err = unsafe { o.contents.err };
4329 unsafe { o.contents.err = core::ptr::null_mut(); }
4330 CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4334 result_ok: o.result_ok,
4339 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4340 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4341 /// A pointer to the contents in the success state.
4342 /// Reading from this pointer when `result_ok` is not set is undefined.
4343 pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4344 /// A pointer to the contents in the error state.
4345 /// Reading from this pointer when `result_ok` is set is undefined.
4346 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4349 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4350 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4352 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4353 /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4354 /// `err` or `result` depending on the state of `result_ok`.
4355 pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4356 /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4357 pub result_ok: bool,
4360 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4361 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4362 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4363 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4364 result: Box::into_raw(Box::new(o)),
4370 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4371 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4372 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4373 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4374 err: Box::into_raw(Box::new(e)),
4379 /// Checks if the given object is currently in the success state
4381 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4385 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4386 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4387 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4388 fn drop(&mut self) {
4390 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4391 let _ = unsafe { Box::from_raw(self.contents.result) };
4394 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4395 let _ = unsafe { Box::from_raw(self.contents.err) };
4400 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4401 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4402 let contents = if o.result_ok {
4403 let result = unsafe { o.contents.result };
4404 unsafe { o.contents.result = core::ptr::null_mut() };
4405 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4407 let err = unsafe { o.contents.err };
4408 unsafe { o.contents.err = core::ptr::null_mut(); }
4409 CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4413 result_ok: o.result_ok,
4417 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4418 fn clone(&self) -> Self {
4420 Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4421 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4424 Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4425 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4431 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4432 /// but with all dynamically-allocated buffers duplicated in new buffers.
4433 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4435 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4436 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4437 /// A pointer to the contents in the success state.
4438 /// Reading from this pointer when `result_ok` is not set is undefined.
4439 pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4440 /// A pointer to the contents in the error state.
4441 /// Reading from this pointer when `result_ok` is set is undefined.
4442 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4445 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4446 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4448 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4449 /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4450 /// `err` or `result` depending on the state of `result_ok`.
4451 pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4452 /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4453 pub result_ok: bool,
4456 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4457 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4458 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4459 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4460 result: Box::into_raw(Box::new(o)),
4466 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4467 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4468 CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4469 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4470 err: Box::into_raw(Box::new(e)),
4475 /// Checks if the given object is currently in the success state
4477 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4481 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4482 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4483 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4484 fn drop(&mut self) {
4486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4487 let _ = unsafe { Box::from_raw(self.contents.result) };
4490 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4491 let _ = unsafe { Box::from_raw(self.contents.err) };
4496 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4497 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4498 let contents = if o.result_ok {
4499 let result = unsafe { o.contents.result };
4500 unsafe { o.contents.result = core::ptr::null_mut() };
4501 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4503 let err = unsafe { o.contents.err };
4504 unsafe { o.contents.err = core::ptr::null_mut(); }
4505 CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4509 result_ok: o.result_ok,
4513 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4514 fn clone(&self) -> Self {
4516 Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4517 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4520 Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4521 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4527 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4528 /// but with all dynamically-allocated buffers duplicated in new buffers.
4529 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4531 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4532 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4533 /// A pointer to the contents in the success state.
4534 /// Reading from this pointer when `result_ok` is not set is undefined.
4535 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4536 /// A pointer to the contents in the error state.
4537 /// Reading from this pointer when `result_ok` is set is undefined.
4538 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4541 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4542 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4544 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4545 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4546 /// `err` or `result` depending on the state of `result_ok`.
4547 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4548 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4549 pub result_ok: bool,
4552 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4553 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4554 CResult_SpendableOutputDescriptorDecodeErrorZ {
4555 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4556 result: Box::into_raw(Box::new(o)),
4562 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4563 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4564 CResult_SpendableOutputDescriptorDecodeErrorZ {
4565 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4566 err: Box::into_raw(Box::new(e)),
4571 /// Checks if the given object is currently in the success state
4573 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4577 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4578 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4579 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4580 fn drop(&mut self) {
4582 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4583 let _ = unsafe { Box::from_raw(self.contents.result) };
4586 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4587 let _ = unsafe { Box::from_raw(self.contents.err) };
4592 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4593 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4594 let contents = if o.result_ok {
4595 let result = unsafe { o.contents.result };
4596 unsafe { o.contents.result = core::ptr::null_mut() };
4597 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4599 let err = unsafe { o.contents.err };
4600 unsafe { o.contents.err = core::ptr::null_mut(); }
4601 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4605 result_ok: o.result_ok,
4609 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4610 fn clone(&self) -> Self {
4612 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4613 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4616 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4617 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4623 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4624 /// but with all dynamically-allocated buffers duplicated in new buffers.
4625 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4627 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4628 /// This corresponds to std::vector in C++
4629 pub struct CVec_PaymentPreimageZ {
4630 /// The elements in the array.
4631 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4632 pub data: *mut crate::c_types::ThirtyTwoBytes,
4633 /// The number of elements pointed to by `data`.
4636 impl CVec_PaymentPreimageZ {
4637 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4638 if self.datalen == 0 { return Vec::new(); }
4639 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4640 self.data = core::ptr::null_mut();
4644 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4645 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4648 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4649 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4650 let datalen = v.len();
4651 let data = Box::into_raw(v.into_boxed_slice());
4652 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4656 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4657 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4658 impl Drop for CVec_PaymentPreimageZ {
4659 fn drop(&mut self) {
4660 if self.datalen == 0 { return; }
4661 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4664 impl Clone for CVec_PaymentPreimageZ {
4665 fn clone(&self) -> Self {
4666 let mut res = Vec::new();
4667 if self.datalen == 0 { return Self::from(res); }
4668 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4673 /// A tuple of 2 elements. See the individual fields for the types contained.
4674 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4675 /// The element at position 0
4676 pub a: crate::c_types::Signature,
4677 /// The element at position 1
4678 pub b: crate::c_types::derived::CVec_SignatureZ,
4680 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4681 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4688 impl C2Tuple_SignatureCVec_SignatureZZ {
4689 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4693 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4694 fn clone(&self) -> Self {
4696 a: Clone::clone(&self.a),
4697 b: Clone::clone(&self.b),
4702 /// Creates a new tuple which has the same data as `orig`
4703 /// but with all dynamically-allocated buffers duplicated in new buffers.
4704 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4705 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4707 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4708 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4712 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4713 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4715 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4716 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4717 /// A pointer to the contents in the success state.
4718 /// Reading from this pointer when `result_ok` is not set is undefined.
4719 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4720 /// Note that this value is always NULL, as there are no contents in the Err variant
4721 pub err: *mut core::ffi::c_void,
4724 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4725 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4727 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4728 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4729 /// `err` or `result` depending on the state of `result_ok`.
4730 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4731 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4732 pub result_ok: bool,
4735 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4736 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4737 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4738 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4739 result: Box::into_raw(Box::new(o)),
4745 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4746 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4747 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4748 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4749 err: core::ptr::null_mut(),
4754 /// Checks if the given object is currently in the success state
4756 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4760 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4761 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4762 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4763 fn drop(&mut self) {
4765 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4766 let _ = unsafe { Box::from_raw(self.contents.result) };
4772 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4773 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4774 let contents = if o.result_ok {
4775 let result = unsafe { o.contents.result };
4776 unsafe { o.contents.result = core::ptr::null_mut() };
4777 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4779 let _ = unsafe { Box::from_raw(o.contents.err) };
4780 o.contents.err = core::ptr::null_mut();
4781 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4785 result_ok: o.result_ok,
4789 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4790 fn clone(&self) -> Self {
4792 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4793 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4796 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4797 err: core::ptr::null_mut()
4803 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4804 /// but with all dynamically-allocated buffers duplicated in new buffers.
4805 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4807 /// The contents of CResult_SignatureNoneZ
4808 pub union CResult_SignatureNoneZPtr {
4809 /// A pointer to the contents in the success state.
4810 /// Reading from this pointer when `result_ok` is not set is undefined.
4811 pub result: *mut crate::c_types::Signature,
4812 /// Note that this value is always NULL, as there are no contents in the Err variant
4813 pub err: *mut core::ffi::c_void,
4816 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4817 /// containing a crate::c_types::Signature on success and a () on failure.
4818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4819 pub struct CResult_SignatureNoneZ {
4820 /// The contents of this CResult_SignatureNoneZ, accessible via either
4821 /// `err` or `result` depending on the state of `result_ok`.
4822 pub contents: CResult_SignatureNoneZPtr,
4823 /// Whether this CResult_SignatureNoneZ represents a success state.
4824 pub result_ok: bool,
4827 /// Creates a new CResult_SignatureNoneZ in the success state.
4828 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4829 CResult_SignatureNoneZ {
4830 contents: CResult_SignatureNoneZPtr {
4831 result: Box::into_raw(Box::new(o)),
4837 /// Creates a new CResult_SignatureNoneZ in the error state.
4838 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4839 CResult_SignatureNoneZ {
4840 contents: CResult_SignatureNoneZPtr {
4841 err: core::ptr::null_mut(),
4846 /// Checks if the given object is currently in the success state
4848 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4852 /// Frees any resources used by the CResult_SignatureNoneZ.
4853 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4854 impl Drop for CResult_SignatureNoneZ {
4855 fn drop(&mut self) {
4857 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4858 let _ = unsafe { Box::from_raw(self.contents.result) };
4864 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4865 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4866 let contents = if o.result_ok {
4867 let result = unsafe { o.contents.result };
4868 unsafe { o.contents.result = core::ptr::null_mut() };
4869 CResult_SignatureNoneZPtr { result }
4871 let _ = unsafe { Box::from_raw(o.contents.err) };
4872 o.contents.err = core::ptr::null_mut();
4873 CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
4877 result_ok: o.result_ok,
4881 impl Clone for CResult_SignatureNoneZ {
4882 fn clone(&self) -> Self {
4884 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4885 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4888 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4889 err: core::ptr::null_mut()
4895 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4896 /// but with all dynamically-allocated buffers duplicated in new buffers.
4897 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4899 /// A tuple of 2 elements. See the individual fields for the types contained.
4900 pub struct C2Tuple_SignatureSignatureZ {
4901 /// The element at position 0
4902 pub a: crate::c_types::Signature,
4903 /// The element at position 1
4904 pub b: crate::c_types::Signature,
4906 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
4907 fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
4914 impl C2Tuple_SignatureSignatureZ {
4915 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
4919 impl Clone for C2Tuple_SignatureSignatureZ {
4920 fn clone(&self) -> Self {
4922 a: Clone::clone(&self.a),
4923 b: Clone::clone(&self.b),
4928 /// Creates a new tuple which has the same data as `orig`
4929 /// but with all dynamically-allocated buffers duplicated in new buffers.
4930 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
4931 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
4933 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
4934 C2Tuple_SignatureSignatureZ { a, b, }
4938 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
4939 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
4941 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
4942 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4943 /// A pointer to the contents in the success state.
4944 /// Reading from this pointer when `result_ok` is not set is undefined.
4945 pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
4946 /// Note that this value is always NULL, as there are no contents in the Err variant
4947 pub err: *mut core::ffi::c_void,
4950 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
4951 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
4952 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4953 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
4954 /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
4955 /// `err` or `result` depending on the state of `result_ok`.
4956 pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
4957 /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
4958 pub result_ok: bool,
4961 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
4962 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
4963 CResult_C2Tuple_SignatureSignatureZNoneZ {
4964 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4965 result: Box::into_raw(Box::new(o)),
4971 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
4972 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
4973 CResult_C2Tuple_SignatureSignatureZNoneZ {
4974 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4975 err: core::ptr::null_mut(),
4980 /// Checks if the given object is currently in the success state
4982 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
4986 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
4987 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
4988 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
4989 fn drop(&mut self) {
4991 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4992 let _ = unsafe { Box::from_raw(self.contents.result) };
4998 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
4999 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5000 let contents = if o.result_ok {
5001 let result = unsafe { o.contents.result };
5002 unsafe { o.contents.result = core::ptr::null_mut() };
5003 CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5005 let _ = unsafe { Box::from_raw(o.contents.err) };
5006 o.contents.err = core::ptr::null_mut();
5007 CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5011 result_ok: o.result_ok,
5015 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5016 fn clone(&self) -> Self {
5018 Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5019 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5022 Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5023 err: core::ptr::null_mut()
5029 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5030 /// but with all dynamically-allocated buffers duplicated in new buffers.
5031 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5033 /// The contents of CResult_SecretKeyNoneZ
5034 pub union CResult_SecretKeyNoneZPtr {
5035 /// A pointer to the contents in the success state.
5036 /// Reading from this pointer when `result_ok` is not set is undefined.
5037 pub result: *mut crate::c_types::SecretKey,
5038 /// Note that this value is always NULL, as there are no contents in the Err variant
5039 pub err: *mut core::ffi::c_void,
5042 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5043 /// containing a crate::c_types::SecretKey on success and a () on failure.
5044 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5045 pub struct CResult_SecretKeyNoneZ {
5046 /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5047 /// `err` or `result` depending on the state of `result_ok`.
5048 pub contents: CResult_SecretKeyNoneZPtr,
5049 /// Whether this CResult_SecretKeyNoneZ represents a success state.
5050 pub result_ok: bool,
5053 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5054 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5055 CResult_SecretKeyNoneZ {
5056 contents: CResult_SecretKeyNoneZPtr {
5057 result: Box::into_raw(Box::new(o)),
5063 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5064 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5065 CResult_SecretKeyNoneZ {
5066 contents: CResult_SecretKeyNoneZPtr {
5067 err: core::ptr::null_mut(),
5072 /// Checks if the given object is currently in the success state
5074 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5078 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5079 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5080 impl Drop for CResult_SecretKeyNoneZ {
5081 fn drop(&mut self) {
5083 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5084 let _ = unsafe { Box::from_raw(self.contents.result) };
5090 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5091 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5092 let contents = if o.result_ok {
5093 let result = unsafe { o.contents.result };
5094 unsafe { o.contents.result = core::ptr::null_mut() };
5095 CResult_SecretKeyNoneZPtr { result }
5097 let _ = unsafe { Box::from_raw(o.contents.err) };
5098 o.contents.err = core::ptr::null_mut();
5099 CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5103 result_ok: o.result_ok,
5108 /// The contents of CResult_SignDecodeErrorZ
5109 pub union CResult_SignDecodeErrorZPtr {
5110 /// A pointer to the contents in the success state.
5111 /// Reading from this pointer when `result_ok` is not set is undefined.
5112 pub result: *mut crate::lightning::chain::keysinterface::Sign,
5113 /// A pointer to the contents in the error state.
5114 /// Reading from this pointer when `result_ok` is set is undefined.
5115 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5118 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5119 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5120 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5121 pub struct CResult_SignDecodeErrorZ {
5122 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5123 /// `err` or `result` depending on the state of `result_ok`.
5124 pub contents: CResult_SignDecodeErrorZPtr,
5125 /// Whether this CResult_SignDecodeErrorZ represents a success state.
5126 pub result_ok: bool,
5129 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5130 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5131 CResult_SignDecodeErrorZ {
5132 contents: CResult_SignDecodeErrorZPtr {
5133 result: Box::into_raw(Box::new(o)),
5139 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5140 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5141 CResult_SignDecodeErrorZ {
5142 contents: CResult_SignDecodeErrorZPtr {
5143 err: Box::into_raw(Box::new(e)),
5148 /// Checks if the given object is currently in the success state
5150 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5154 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5155 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5156 impl Drop for CResult_SignDecodeErrorZ {
5157 fn drop(&mut self) {
5159 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5160 let _ = unsafe { Box::from_raw(self.contents.result) };
5163 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5164 let _ = unsafe { Box::from_raw(self.contents.err) };
5169 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5170 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5171 let contents = if o.result_ok {
5172 let result = unsafe { o.contents.result };
5173 unsafe { o.contents.result = core::ptr::null_mut() };
5174 CResult_SignDecodeErrorZPtr { result }
5176 let err = unsafe { o.contents.err };
5177 unsafe { o.contents.err = core::ptr::null_mut(); }
5178 CResult_SignDecodeErrorZPtr { err }
5182 result_ok: o.result_ok,
5186 impl Clone for CResult_SignDecodeErrorZ {
5187 fn clone(&self) -> Self {
5189 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5190 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5193 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5194 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5200 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5201 /// but with all dynamically-allocated buffers duplicated in new buffers.
5202 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5204 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5205 /// This corresponds to std::vector in C++
5206 pub struct CVec_u5Z {
5207 /// The elements in the array.
5208 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5209 pub data: *mut crate::c_types::u5,
5210 /// The number of elements pointed to by `data`.
5214 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5215 if self.datalen == 0 { return Vec::new(); }
5216 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5217 self.data = core::ptr::null_mut();
5221 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5222 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5225 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5226 fn from(v: Vec<crate::c_types::u5>) -> Self {
5227 let datalen = v.len();
5228 let data = Box::into_raw(v.into_boxed_slice());
5229 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5233 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5234 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5235 impl Drop for CVec_u5Z {
5236 fn drop(&mut self) {
5237 if self.datalen == 0 { return; }
5238 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5241 impl Clone for CVec_u5Z {
5242 fn clone(&self) -> Self {
5243 let mut res = Vec::new();
5244 if self.datalen == 0 { return Self::from(res); }
5245 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5250 /// The contents of CResult_RecoverableSignatureNoneZ
5251 pub union CResult_RecoverableSignatureNoneZPtr {
5252 /// A pointer to the contents in the success state.
5253 /// Reading from this pointer when `result_ok` is not set is undefined.
5254 pub result: *mut crate::c_types::RecoverableSignature,
5255 /// Note that this value is always NULL, as there are no contents in the Err variant
5256 pub err: *mut core::ffi::c_void,
5259 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5260 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5261 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5262 pub struct CResult_RecoverableSignatureNoneZ {
5263 /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5264 /// `err` or `result` depending on the state of `result_ok`.
5265 pub contents: CResult_RecoverableSignatureNoneZPtr,
5266 /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5267 pub result_ok: bool,
5270 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5271 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5272 CResult_RecoverableSignatureNoneZ {
5273 contents: CResult_RecoverableSignatureNoneZPtr {
5274 result: Box::into_raw(Box::new(o)),
5280 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5281 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5282 CResult_RecoverableSignatureNoneZ {
5283 contents: CResult_RecoverableSignatureNoneZPtr {
5284 err: core::ptr::null_mut(),
5289 /// Checks if the given object is currently in the success state
5291 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5295 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5296 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5297 impl Drop for CResult_RecoverableSignatureNoneZ {
5298 fn drop(&mut self) {
5300 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5301 let _ = unsafe { Box::from_raw(self.contents.result) };
5307 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5308 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5309 let contents = if o.result_ok {
5310 let result = unsafe { o.contents.result };
5311 unsafe { o.contents.result = core::ptr::null_mut() };
5312 CResult_RecoverableSignatureNoneZPtr { result }
5314 let _ = unsafe { Box::from_raw(o.contents.err) };
5315 o.contents.err = core::ptr::null_mut();
5316 CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5320 result_ok: o.result_ok,
5324 impl Clone for CResult_RecoverableSignatureNoneZ {
5325 fn clone(&self) -> Self {
5327 Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5328 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5331 Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5332 err: core::ptr::null_mut()
5338 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5339 /// but with all dynamically-allocated buffers duplicated in new buffers.
5340 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5342 /// A dynamically-allocated array of u8s of arbitrary size.
5343 /// This corresponds to std::vector in C++
5344 pub struct CVec_u8Z {
5345 /// The elements in the array.
5346 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5348 /// The number of elements pointed to by `data`.
5352 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5353 if self.datalen == 0 { return Vec::new(); }
5354 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5355 self.data = core::ptr::null_mut();
5359 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5360 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5363 impl From<Vec<u8>> for CVec_u8Z {
5364 fn from(v: Vec<u8>) -> Self {
5365 let datalen = v.len();
5366 let data = Box::into_raw(v.into_boxed_slice());
5367 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5371 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5372 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5373 impl Drop for CVec_u8Z {
5374 fn drop(&mut self) {
5375 if self.datalen == 0 { return; }
5376 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5379 impl Clone for CVec_u8Z {
5380 fn clone(&self) -> Self {
5381 let mut res = Vec::new();
5382 if self.datalen == 0 { return Self::from(res); }
5383 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5388 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5389 /// This corresponds to std::vector in C++
5390 pub struct CVec_CVec_u8ZZ {
5391 /// The elements in the array.
5392 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5393 pub data: *mut crate::c_types::derived::CVec_u8Z,
5394 /// The number of elements pointed to by `data`.
5397 impl CVec_CVec_u8ZZ {
5398 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5399 if self.datalen == 0 { return Vec::new(); }
5400 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5401 self.data = core::ptr::null_mut();
5405 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5406 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5409 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5410 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5411 let datalen = v.len();
5412 let data = Box::into_raw(v.into_boxed_slice());
5413 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5417 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5418 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5419 impl Drop for CVec_CVec_u8ZZ {
5420 fn drop(&mut self) {
5421 if self.datalen == 0 { return; }
5422 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5425 impl Clone for CVec_CVec_u8ZZ {
5426 fn clone(&self) -> Self {
5427 let mut res = Vec::new();
5428 if self.datalen == 0 { return Self::from(res); }
5429 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5434 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5435 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5436 /// A pointer to the contents in the success state.
5437 /// Reading from this pointer when `result_ok` is not set is undefined.
5438 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5439 /// Note that this value is always NULL, as there are no contents in the Err variant
5440 pub err: *mut core::ffi::c_void,
5443 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5444 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5445 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5446 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5447 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5448 /// `err` or `result` depending on the state of `result_ok`.
5449 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5450 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5451 pub result_ok: bool,
5454 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5455 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5456 CResult_CVec_CVec_u8ZZNoneZ {
5457 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5458 result: Box::into_raw(Box::new(o)),
5464 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5465 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5466 CResult_CVec_CVec_u8ZZNoneZ {
5467 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5468 err: core::ptr::null_mut(),
5473 /// Checks if the given object is currently in the success state
5475 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5479 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5480 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5481 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5482 fn drop(&mut self) {
5484 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5485 let _ = unsafe { Box::from_raw(self.contents.result) };
5491 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5492 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5493 let contents = if o.result_ok {
5494 let result = unsafe { o.contents.result };
5495 unsafe { o.contents.result = core::ptr::null_mut() };
5496 CResult_CVec_CVec_u8ZZNoneZPtr { result }
5498 let _ = unsafe { Box::from_raw(o.contents.err) };
5499 o.contents.err = core::ptr::null_mut();
5500 CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5504 result_ok: o.result_ok,
5508 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5509 fn clone(&self) -> Self {
5511 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5512 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5515 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5516 err: core::ptr::null_mut()
5522 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5523 /// but with all dynamically-allocated buffers duplicated in new buffers.
5524 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5526 /// The contents of CResult_InMemorySignerDecodeErrorZ
5527 pub union CResult_InMemorySignerDecodeErrorZPtr {
5528 /// A pointer to the contents in the success state.
5529 /// Reading from this pointer when `result_ok` is not set is undefined.
5530 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5531 /// A pointer to the contents in the error state.
5532 /// Reading from this pointer when `result_ok` is set is undefined.
5533 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5536 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5537 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5538 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5539 pub struct CResult_InMemorySignerDecodeErrorZ {
5540 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5541 /// `err` or `result` depending on the state of `result_ok`.
5542 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5543 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5544 pub result_ok: bool,
5547 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5548 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5549 CResult_InMemorySignerDecodeErrorZ {
5550 contents: CResult_InMemorySignerDecodeErrorZPtr {
5551 result: Box::into_raw(Box::new(o)),
5557 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5558 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5559 CResult_InMemorySignerDecodeErrorZ {
5560 contents: CResult_InMemorySignerDecodeErrorZPtr {
5561 err: Box::into_raw(Box::new(e)),
5566 /// Checks if the given object is currently in the success state
5568 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5572 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5573 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5574 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5575 fn drop(&mut self) {
5577 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5578 let _ = unsafe { Box::from_raw(self.contents.result) };
5581 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5582 let _ = unsafe { Box::from_raw(self.contents.err) };
5587 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5588 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5589 let contents = if o.result_ok {
5590 let result = unsafe { o.contents.result };
5591 unsafe { o.contents.result = core::ptr::null_mut() };
5592 CResult_InMemorySignerDecodeErrorZPtr { result }
5594 let err = unsafe { o.contents.err };
5595 unsafe { o.contents.err = core::ptr::null_mut(); }
5596 CResult_InMemorySignerDecodeErrorZPtr { err }
5600 result_ok: o.result_ok,
5604 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5605 fn clone(&self) -> Self {
5607 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5608 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5611 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5612 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5618 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5619 /// but with all dynamically-allocated buffers duplicated in new buffers.
5620 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5622 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5623 /// This corresponds to std::vector in C++
5624 pub struct CVec_TxOutZ {
5625 /// The elements in the array.
5626 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5627 pub data: *mut crate::c_types::TxOut,
5628 /// The number of elements pointed to by `data`.
5632 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5633 if self.datalen == 0 { return Vec::new(); }
5634 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5635 self.data = core::ptr::null_mut();
5639 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5640 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5643 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5644 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5645 let datalen = v.len();
5646 let data = Box::into_raw(v.into_boxed_slice());
5647 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5651 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5652 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5653 impl Drop for CVec_TxOutZ {
5654 fn drop(&mut self) {
5655 if self.datalen == 0 { return; }
5656 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5659 impl Clone for CVec_TxOutZ {
5660 fn clone(&self) -> Self {
5661 let mut res = Vec::new();
5662 if self.datalen == 0 { return Self::from(res); }
5663 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5668 /// The contents of CResult_TransactionNoneZ
5669 pub union CResult_TransactionNoneZPtr {
5670 /// A pointer to the contents in the success state.
5671 /// Reading from this pointer when `result_ok` is not set is undefined.
5672 pub result: *mut crate::c_types::Transaction,
5673 /// Note that this value is always NULL, as there are no contents in the Err variant
5674 pub err: *mut core::ffi::c_void,
5677 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5678 /// containing a crate::c_types::Transaction on success and a () on failure.
5679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5680 pub struct CResult_TransactionNoneZ {
5681 /// The contents of this CResult_TransactionNoneZ, accessible via either
5682 /// `err` or `result` depending on the state of `result_ok`.
5683 pub contents: CResult_TransactionNoneZPtr,
5684 /// Whether this CResult_TransactionNoneZ represents a success state.
5685 pub result_ok: bool,
5688 /// Creates a new CResult_TransactionNoneZ in the success state.
5689 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5690 CResult_TransactionNoneZ {
5691 contents: CResult_TransactionNoneZPtr {
5692 result: Box::into_raw(Box::new(o)),
5698 /// Creates a new CResult_TransactionNoneZ in the error state.
5699 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5700 CResult_TransactionNoneZ {
5701 contents: CResult_TransactionNoneZPtr {
5702 err: core::ptr::null_mut(),
5707 /// Checks if the given object is currently in the success state
5709 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5713 /// Frees any resources used by the CResult_TransactionNoneZ.
5714 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5715 impl Drop for CResult_TransactionNoneZ {
5716 fn drop(&mut self) {
5718 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5719 let _ = unsafe { Box::from_raw(self.contents.result) };
5725 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5726 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5727 let contents = if o.result_ok {
5728 let result = unsafe { o.contents.result };
5729 unsafe { o.contents.result = core::ptr::null_mut() };
5730 CResult_TransactionNoneZPtr { result }
5732 let _ = unsafe { Box::from_raw(o.contents.err) };
5733 o.contents.err = core::ptr::null_mut();
5734 CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5738 result_ok: o.result_ok,
5742 impl Clone for CResult_TransactionNoneZ {
5743 fn clone(&self) -> Self {
5745 Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5746 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5749 Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5750 err: core::ptr::null_mut()
5756 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5757 /// but with all dynamically-allocated buffers duplicated in new buffers.
5758 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5760 /// A tuple of 2 elements. See the individual fields for the types contained.
5761 pub struct C2Tuple_BlockHashChannelMonitorZ {
5762 /// The element at position 0
5763 pub a: crate::c_types::ThirtyTwoBytes,
5764 /// The element at position 1
5765 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5767 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5768 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5775 impl C2Tuple_BlockHashChannelMonitorZ {
5776 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5780 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5782 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5783 C2Tuple_BlockHashChannelMonitorZ { a, b, }
5787 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5788 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5790 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5791 /// This corresponds to std::vector in C++
5792 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5793 /// The elements in the array.
5794 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5795 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5796 /// The number of elements pointed to by `data`.
5799 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5800 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5801 if self.datalen == 0 { return Vec::new(); }
5802 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5803 self.data = core::ptr::null_mut();
5807 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5808 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5811 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5812 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5813 let datalen = v.len();
5814 let data = Box::into_raw(v.into_boxed_slice());
5815 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5819 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5820 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5821 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5822 fn drop(&mut self) {
5823 if self.datalen == 0 { return; }
5824 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5828 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5829 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5830 /// A pointer to the contents in the success state.
5831 /// Reading from this pointer when `result_ok` is not set is undefined.
5832 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5833 /// A pointer to the contents in the error state.
5834 /// Reading from this pointer when `result_ok` is set is undefined.
5835 pub err: *mut crate::c_types::IOError,
5838 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5839 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5841 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5842 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5843 /// `err` or `result` depending on the state of `result_ok`.
5844 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5845 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5846 pub result_ok: bool,
5849 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5850 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5851 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5852 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5853 result: Box::into_raw(Box::new(o)),
5859 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5860 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5861 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5862 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5863 err: Box::into_raw(Box::new(e)),
5868 /// Checks if the given object is currently in the success state
5870 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5874 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5875 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5876 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5877 fn drop(&mut self) {
5879 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5880 let _ = unsafe { Box::from_raw(self.contents.result) };
5883 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5884 let _ = unsafe { Box::from_raw(self.contents.err) };
5889 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5890 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5891 let contents = if o.result_ok {
5892 let result = unsafe { o.contents.result };
5893 unsafe { o.contents.result = core::ptr::null_mut() };
5894 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5896 let err = unsafe { o.contents.err };
5897 unsafe { o.contents.err = core::ptr::null_mut(); }
5898 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5902 result_ok: o.result_ok,
5908 /// An enum which can either contain a u16 or not
5909 pub enum COption_u16Z {
5910 /// When we're in this state, this COption_u16Z contains a u16
5912 /// When we're in this state, this COption_u16Z contains nothing
5916 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5917 if let Self::None = self { false } else { true }
5919 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5922 #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5923 if let Self::Some(v) = self { v } else { unreachable!() }
5927 /// Constructs a new COption_u16Z containing a u16
5928 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5929 COption_u16Z::Some(o)
5932 /// Constructs a new COption_u16Z containing nothing
5933 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5937 /// Frees any resources associated with the u16, if we are in the Some state
5938 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5940 /// Creates a new COption_u16Z which has the same data as `orig`
5941 /// but with all dynamically-allocated buffers duplicated in new buffers.
5942 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5944 /// The contents of CResult_NoneAPIErrorZ
5945 pub union CResult_NoneAPIErrorZPtr {
5946 /// Note that this value is always NULL, as there are no contents in the OK variant
5947 pub result: *mut core::ffi::c_void,
5948 /// A pointer to the contents in the error state.
5949 /// Reading from this pointer when `result_ok` is set is undefined.
5950 pub err: *mut crate::lightning::util::errors::APIError,
5953 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5954 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
5955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5956 pub struct CResult_NoneAPIErrorZ {
5957 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
5958 /// `err` or `result` depending on the state of `result_ok`.
5959 pub contents: CResult_NoneAPIErrorZPtr,
5960 /// Whether this CResult_NoneAPIErrorZ represents a success state.
5961 pub result_ok: bool,
5964 /// Creates a new CResult_NoneAPIErrorZ in the success state.
5965 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
5966 CResult_NoneAPIErrorZ {
5967 contents: CResult_NoneAPIErrorZPtr {
5968 result: core::ptr::null_mut(),
5974 /// Creates a new CResult_NoneAPIErrorZ in the error state.
5975 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
5976 CResult_NoneAPIErrorZ {
5977 contents: CResult_NoneAPIErrorZPtr {
5978 err: Box::into_raw(Box::new(e)),
5983 /// Checks if the given object is currently in the success state
5985 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
5989 /// Frees any resources used by the CResult_NoneAPIErrorZ.
5990 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
5991 impl Drop for CResult_NoneAPIErrorZ {
5992 fn drop(&mut self) {
5995 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5996 let _ = unsafe { Box::from_raw(self.contents.err) };
6001 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6002 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6003 let contents = if o.result_ok {
6004 let _ = unsafe { Box::from_raw(o.contents.result) };
6005 o.contents.result = core::ptr::null_mut();
6006 CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6008 let err = unsafe { o.contents.err };
6009 unsafe { o.contents.err = core::ptr::null_mut(); }
6010 CResult_NoneAPIErrorZPtr { err }
6014 result_ok: o.result_ok,
6018 impl Clone for CResult_NoneAPIErrorZ {
6019 fn clone(&self) -> Self {
6021 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6022 result: core::ptr::null_mut()
6025 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6026 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6032 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6033 /// but with all dynamically-allocated buffers duplicated in new buffers.
6034 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6036 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6037 /// This corresponds to std::vector in C++
6038 pub struct CVec_CResult_NoneAPIErrorZZ {
6039 /// The elements in the array.
6040 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6041 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6042 /// The number of elements pointed to by `data`.
6045 impl CVec_CResult_NoneAPIErrorZZ {
6046 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6047 if self.datalen == 0 { return Vec::new(); }
6048 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6049 self.data = core::ptr::null_mut();
6053 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6054 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6057 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6058 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6059 let datalen = v.len();
6060 let data = Box::into_raw(v.into_boxed_slice());
6061 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6065 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6066 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6067 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6068 fn drop(&mut self) {
6069 if self.datalen == 0 { return; }
6070 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6073 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6074 fn clone(&self) -> Self {
6075 let mut res = Vec::new();
6076 if self.datalen == 0 { return Self::from(res); }
6077 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6082 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6083 /// This corresponds to std::vector in C++
6084 pub struct CVec_APIErrorZ {
6085 /// The elements in the array.
6086 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6087 pub data: *mut crate::lightning::util::errors::APIError,
6088 /// The number of elements pointed to by `data`.
6091 impl CVec_APIErrorZ {
6092 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6093 if self.datalen == 0 { return Vec::new(); }
6094 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6095 self.data = core::ptr::null_mut();
6099 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6100 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6103 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6104 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6105 let datalen = v.len();
6106 let data = Box::into_raw(v.into_boxed_slice());
6107 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6111 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6112 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6113 impl Drop for CVec_APIErrorZ {
6114 fn drop(&mut self) {
6115 if self.datalen == 0 { return; }
6116 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6119 impl Clone for CVec_APIErrorZ {
6120 fn clone(&self) -> Self {
6121 let mut res = Vec::new();
6122 if self.datalen == 0 { return Self::from(res); }
6123 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6128 /// The contents of CResult__u832APIErrorZ
6129 pub union CResult__u832APIErrorZPtr {
6130 /// A pointer to the contents in the success state.
6131 /// Reading from this pointer when `result_ok` is not set is undefined.
6132 pub result: *mut crate::c_types::ThirtyTwoBytes,
6133 /// A pointer to the contents in the error state.
6134 /// Reading from this pointer when `result_ok` is set is undefined.
6135 pub err: *mut crate::lightning::util::errors::APIError,
6138 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6139 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6140 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6141 pub struct CResult__u832APIErrorZ {
6142 /// The contents of this CResult__u832APIErrorZ, accessible via either
6143 /// `err` or `result` depending on the state of `result_ok`.
6144 pub contents: CResult__u832APIErrorZPtr,
6145 /// Whether this CResult__u832APIErrorZ represents a success state.
6146 pub result_ok: bool,
6149 /// Creates a new CResult__u832APIErrorZ in the success state.
6150 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6151 CResult__u832APIErrorZ {
6152 contents: CResult__u832APIErrorZPtr {
6153 result: Box::into_raw(Box::new(o)),
6159 /// Creates a new CResult__u832APIErrorZ in the error state.
6160 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6161 CResult__u832APIErrorZ {
6162 contents: CResult__u832APIErrorZPtr {
6163 err: Box::into_raw(Box::new(e)),
6168 /// Checks if the given object is currently in the success state
6170 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6174 /// Frees any resources used by the CResult__u832APIErrorZ.
6175 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6176 impl Drop for CResult__u832APIErrorZ {
6177 fn drop(&mut self) {
6179 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6180 let _ = unsafe { Box::from_raw(self.contents.result) };
6183 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6184 let _ = unsafe { Box::from_raw(self.contents.err) };
6189 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6190 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6191 let contents = if o.result_ok {
6192 let result = unsafe { o.contents.result };
6193 unsafe { o.contents.result = core::ptr::null_mut() };
6194 CResult__u832APIErrorZPtr { result }
6196 let err = unsafe { o.contents.err };
6197 unsafe { o.contents.err = core::ptr::null_mut(); }
6198 CResult__u832APIErrorZPtr { err }
6202 result_ok: o.result_ok,
6206 impl Clone for CResult__u832APIErrorZ {
6207 fn clone(&self) -> Self {
6209 Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6210 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6213 Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6214 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6220 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6221 /// but with all dynamically-allocated buffers duplicated in new buffers.
6222 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6224 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6225 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6226 /// A pointer to the contents in the success state.
6227 /// Reading from this pointer when `result_ok` is not set is undefined.
6228 pub result: *mut crate::c_types::ThirtyTwoBytes,
6229 /// A pointer to the contents in the error state.
6230 /// Reading from this pointer when `result_ok` is set is undefined.
6231 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6234 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6235 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6236 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6237 pub struct CResult_PaymentIdPaymentSendFailureZ {
6238 /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6239 /// `err` or `result` depending on the state of `result_ok`.
6240 pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6241 /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6242 pub result_ok: bool,
6245 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6246 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6247 CResult_PaymentIdPaymentSendFailureZ {
6248 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6249 result: Box::into_raw(Box::new(o)),
6255 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6256 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6257 CResult_PaymentIdPaymentSendFailureZ {
6258 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6259 err: Box::into_raw(Box::new(e)),
6264 /// Checks if the given object is currently in the success state
6266 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6270 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6271 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6272 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6273 fn drop(&mut self) {
6275 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6276 let _ = unsafe { Box::from_raw(self.contents.result) };
6279 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6280 let _ = unsafe { Box::from_raw(self.contents.err) };
6285 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6286 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6287 let contents = if o.result_ok {
6288 let result = unsafe { o.contents.result };
6289 unsafe { o.contents.result = core::ptr::null_mut() };
6290 CResult_PaymentIdPaymentSendFailureZPtr { result }
6292 let err = unsafe { o.contents.err };
6293 unsafe { o.contents.err = core::ptr::null_mut(); }
6294 CResult_PaymentIdPaymentSendFailureZPtr { err }
6298 result_ok: o.result_ok,
6302 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6303 fn clone(&self) -> Self {
6305 Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6306 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6309 Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6310 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6316 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6317 /// but with all dynamically-allocated buffers duplicated in new buffers.
6318 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6320 /// The contents of CResult_NonePaymentSendFailureZ
6321 pub union CResult_NonePaymentSendFailureZPtr {
6322 /// Note that this value is always NULL, as there are no contents in the OK variant
6323 pub result: *mut core::ffi::c_void,
6324 /// A pointer to the contents in the error state.
6325 /// Reading from this pointer when `result_ok` is set is undefined.
6326 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6329 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6330 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6332 pub struct CResult_NonePaymentSendFailureZ {
6333 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6334 /// `err` or `result` depending on the state of `result_ok`.
6335 pub contents: CResult_NonePaymentSendFailureZPtr,
6336 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6337 pub result_ok: bool,
6340 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6341 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6342 CResult_NonePaymentSendFailureZ {
6343 contents: CResult_NonePaymentSendFailureZPtr {
6344 result: core::ptr::null_mut(),
6350 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6351 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6352 CResult_NonePaymentSendFailureZ {
6353 contents: CResult_NonePaymentSendFailureZPtr {
6354 err: Box::into_raw(Box::new(e)),
6359 /// Checks if the given object is currently in the success state
6361 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6365 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6366 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6367 impl Drop for CResult_NonePaymentSendFailureZ {
6368 fn drop(&mut self) {
6371 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6372 let _ = unsafe { Box::from_raw(self.contents.err) };
6377 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6378 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6379 let contents = if o.result_ok {
6380 let _ = unsafe { Box::from_raw(o.contents.result) };
6381 o.contents.result = core::ptr::null_mut();
6382 CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6384 let err = unsafe { o.contents.err };
6385 unsafe { o.contents.err = core::ptr::null_mut(); }
6386 CResult_NonePaymentSendFailureZPtr { err }
6390 result_ok: o.result_ok,
6394 impl Clone for CResult_NonePaymentSendFailureZ {
6395 fn clone(&self) -> Self {
6397 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6398 result: core::ptr::null_mut()
6401 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6402 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6408 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6409 /// but with all dynamically-allocated buffers duplicated in new buffers.
6410 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6412 /// A tuple of 2 elements. See the individual fields for the types contained.
6413 pub struct C2Tuple_PaymentHashPaymentIdZ {
6414 /// The element at position 0
6415 pub a: crate::c_types::ThirtyTwoBytes,
6416 /// The element at position 1
6417 pub b: crate::c_types::ThirtyTwoBytes,
6419 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6420 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6427 impl C2Tuple_PaymentHashPaymentIdZ {
6428 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6432 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6433 fn clone(&self) -> Self {
6435 a: Clone::clone(&self.a),
6436 b: Clone::clone(&self.b),
6441 /// Creates a new tuple which has the same data as `orig`
6442 /// but with all dynamically-allocated buffers duplicated in new buffers.
6443 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6444 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6446 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6447 C2Tuple_PaymentHashPaymentIdZ { a, b, }
6451 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6452 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6454 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6455 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6456 /// A pointer to the contents in the success state.
6457 /// Reading from this pointer when `result_ok` is not set is undefined.
6458 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6459 /// A pointer to the contents in the error state.
6460 /// Reading from this pointer when `result_ok` is set is undefined.
6461 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6464 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6465 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6466 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6467 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6468 /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6469 /// `err` or `result` depending on the state of `result_ok`.
6470 pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6471 /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6472 pub result_ok: bool,
6475 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6476 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6477 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6478 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6479 result: Box::into_raw(Box::new(o)),
6485 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6486 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6487 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6488 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6489 err: Box::into_raw(Box::new(e)),
6494 /// Checks if the given object is currently in the success state
6496 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6500 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6501 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6502 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6503 fn drop(&mut self) {
6505 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6506 let _ = unsafe { Box::from_raw(self.contents.result) };
6509 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6510 let _ = unsafe { Box::from_raw(self.contents.err) };
6515 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6516 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6517 let contents = if o.result_ok {
6518 let result = unsafe { o.contents.result };
6519 unsafe { o.contents.result = core::ptr::null_mut() };
6520 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6522 let err = unsafe { o.contents.err };
6523 unsafe { o.contents.err = core::ptr::null_mut(); }
6524 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6528 result_ok: o.result_ok,
6532 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6533 fn clone(&self) -> Self {
6535 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6536 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6539 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6540 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6546 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6547 /// but with all dynamically-allocated buffers duplicated in new buffers.
6548 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6550 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6551 /// This corresponds to std::vector in C++
6552 pub struct CVec_NetAddressZ {
6553 /// The elements in the array.
6554 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6555 pub data: *mut crate::lightning::ln::msgs::NetAddress,
6556 /// The number of elements pointed to by `data`.
6559 impl CVec_NetAddressZ {
6560 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6561 if self.datalen == 0 { return Vec::new(); }
6562 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6563 self.data = core::ptr::null_mut();
6567 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6568 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6571 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6572 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6573 let datalen = v.len();
6574 let data = Box::into_raw(v.into_boxed_slice());
6575 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6579 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6580 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6581 impl Drop for CVec_NetAddressZ {
6582 fn drop(&mut self) {
6583 if self.datalen == 0 { return; }
6584 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6587 impl Clone for CVec_NetAddressZ {
6588 fn clone(&self) -> Self {
6589 let mut res = Vec::new();
6590 if self.datalen == 0 { return Self::from(res); }
6591 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6596 /// A tuple of 2 elements. See the individual fields for the types contained.
6597 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6598 /// The element at position 0
6599 pub a: crate::c_types::ThirtyTwoBytes,
6600 /// The element at position 1
6601 pub b: crate::c_types::ThirtyTwoBytes,
6603 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6604 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6611 impl C2Tuple_PaymentHashPaymentSecretZ {
6612 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6616 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6617 fn clone(&self) -> Self {
6619 a: Clone::clone(&self.a),
6620 b: Clone::clone(&self.b),
6625 /// Creates a new tuple which has the same data as `orig`
6626 /// but with all dynamically-allocated buffers duplicated in new buffers.
6627 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6628 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6630 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6631 C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6635 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6636 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6638 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6639 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6640 /// A pointer to the contents in the success state.
6641 /// Reading from this pointer when `result_ok` is not set is undefined.
6642 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6643 /// Note that this value is always NULL, as there are no contents in the Err variant
6644 pub err: *mut core::ffi::c_void,
6647 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6648 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6649 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6650 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6651 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6652 /// `err` or `result` depending on the state of `result_ok`.
6653 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6654 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6655 pub result_ok: bool,
6658 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6659 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6660 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6661 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6662 result: Box::into_raw(Box::new(o)),
6668 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6669 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6670 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6671 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6672 err: core::ptr::null_mut(),
6677 /// Checks if the given object is currently in the success state
6679 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6683 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6684 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6685 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6686 fn drop(&mut self) {
6688 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6689 let _ = unsafe { Box::from_raw(self.contents.result) };
6695 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6696 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6697 let contents = if o.result_ok {
6698 let result = unsafe { o.contents.result };
6699 unsafe { o.contents.result = core::ptr::null_mut() };
6700 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6702 let _ = unsafe { Box::from_raw(o.contents.err) };
6703 o.contents.err = core::ptr::null_mut();
6704 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6708 result_ok: o.result_ok,
6712 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6713 fn clone(&self) -> Self {
6715 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6716 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6719 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6720 err: core::ptr::null_mut()
6726 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6727 /// but with all dynamically-allocated buffers duplicated in new buffers.
6728 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6730 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6731 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6732 /// A pointer to the contents in the success state.
6733 /// Reading from this pointer when `result_ok` is not set is undefined.
6734 pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6735 /// A pointer to the contents in the error state.
6736 /// Reading from this pointer when `result_ok` is set is undefined.
6737 pub err: *mut crate::lightning::util::errors::APIError,
6740 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6741 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6743 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6744 /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6745 /// `err` or `result` depending on the state of `result_ok`.
6746 pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6747 /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6748 pub result_ok: bool,
6751 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6752 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6753 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6754 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6755 result: Box::into_raw(Box::new(o)),
6761 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6762 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6763 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6764 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6765 err: Box::into_raw(Box::new(e)),
6770 /// Checks if the given object is currently in the success state
6772 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6776 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6777 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6778 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6779 fn drop(&mut self) {
6781 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6782 let _ = unsafe { Box::from_raw(self.contents.result) };
6785 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6786 let _ = unsafe { Box::from_raw(self.contents.err) };
6791 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6792 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6793 let contents = if o.result_ok {
6794 let result = unsafe { o.contents.result };
6795 unsafe { o.contents.result = core::ptr::null_mut() };
6796 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6798 let err = unsafe { o.contents.err };
6799 unsafe { o.contents.err = core::ptr::null_mut(); }
6800 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6804 result_ok: o.result_ok,
6808 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6809 fn clone(&self) -> Self {
6811 Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6812 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6815 Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6816 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6822 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6823 /// but with all dynamically-allocated buffers duplicated in new buffers.
6824 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6826 /// The contents of CResult_PaymentSecretNoneZ
6827 pub union CResult_PaymentSecretNoneZPtr {
6828 /// A pointer to the contents in the success state.
6829 /// Reading from this pointer when `result_ok` is not set is undefined.
6830 pub result: *mut crate::c_types::ThirtyTwoBytes,
6831 /// Note that this value is always NULL, as there are no contents in the Err variant
6832 pub err: *mut core::ffi::c_void,
6835 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6836 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6837 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6838 pub struct CResult_PaymentSecretNoneZ {
6839 /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6840 /// `err` or `result` depending on the state of `result_ok`.
6841 pub contents: CResult_PaymentSecretNoneZPtr,
6842 /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6843 pub result_ok: bool,
6846 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6847 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6848 CResult_PaymentSecretNoneZ {
6849 contents: CResult_PaymentSecretNoneZPtr {
6850 result: Box::into_raw(Box::new(o)),
6856 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6857 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6858 CResult_PaymentSecretNoneZ {
6859 contents: CResult_PaymentSecretNoneZPtr {
6860 err: core::ptr::null_mut(),
6865 /// Checks if the given object is currently in the success state
6867 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6871 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6872 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6873 impl Drop for CResult_PaymentSecretNoneZ {
6874 fn drop(&mut self) {
6876 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6877 let _ = unsafe { Box::from_raw(self.contents.result) };
6883 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6884 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6885 let contents = if o.result_ok {
6886 let result = unsafe { o.contents.result };
6887 unsafe { o.contents.result = core::ptr::null_mut() };
6888 CResult_PaymentSecretNoneZPtr { result }
6890 let _ = unsafe { Box::from_raw(o.contents.err) };
6891 o.contents.err = core::ptr::null_mut();
6892 CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
6896 result_ok: o.result_ok,
6900 impl Clone for CResult_PaymentSecretNoneZ {
6901 fn clone(&self) -> Self {
6903 Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
6904 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6907 Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
6908 err: core::ptr::null_mut()
6914 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
6915 /// but with all dynamically-allocated buffers duplicated in new buffers.
6916 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
6918 /// The contents of CResult_PaymentSecretAPIErrorZ
6919 pub union CResult_PaymentSecretAPIErrorZPtr {
6920 /// A pointer to the contents in the success state.
6921 /// Reading from this pointer when `result_ok` is not set is undefined.
6922 pub result: *mut crate::c_types::ThirtyTwoBytes,
6923 /// A pointer to the contents in the error state.
6924 /// Reading from this pointer when `result_ok` is set is undefined.
6925 pub err: *mut crate::lightning::util::errors::APIError,
6928 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6929 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6931 pub struct CResult_PaymentSecretAPIErrorZ {
6932 /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6933 /// `err` or `result` depending on the state of `result_ok`.
6934 pub contents: CResult_PaymentSecretAPIErrorZPtr,
6935 /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6936 pub result_ok: bool,
6939 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
6940 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
6941 CResult_PaymentSecretAPIErrorZ {
6942 contents: CResult_PaymentSecretAPIErrorZPtr {
6943 result: Box::into_raw(Box::new(o)),
6949 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
6950 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
6951 CResult_PaymentSecretAPIErrorZ {
6952 contents: CResult_PaymentSecretAPIErrorZPtr {
6953 err: Box::into_raw(Box::new(e)),
6958 /// Checks if the given object is currently in the success state
6960 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
6964 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
6965 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
6966 impl Drop for CResult_PaymentSecretAPIErrorZ {
6967 fn drop(&mut self) {
6969 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6970 let _ = unsafe { Box::from_raw(self.contents.result) };
6973 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6974 let _ = unsafe { Box::from_raw(self.contents.err) };
6979 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
6980 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6981 let contents = if o.result_ok {
6982 let result = unsafe { o.contents.result };
6983 unsafe { o.contents.result = core::ptr::null_mut() };
6984 CResult_PaymentSecretAPIErrorZPtr { result }
6986 let err = unsafe { o.contents.err };
6987 unsafe { o.contents.err = core::ptr::null_mut(); }
6988 CResult_PaymentSecretAPIErrorZPtr { err }
6992 result_ok: o.result_ok,
6996 impl Clone for CResult_PaymentSecretAPIErrorZ {
6997 fn clone(&self) -> Self {
6999 Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7000 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7003 Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7004 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7010 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7011 /// but with all dynamically-allocated buffers duplicated in new buffers.
7012 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7014 /// The contents of CResult_PaymentPreimageAPIErrorZ
7015 pub union CResult_PaymentPreimageAPIErrorZPtr {
7016 /// A pointer to the contents in the success state.
7017 /// Reading from this pointer when `result_ok` is not set is undefined.
7018 pub result: *mut crate::c_types::ThirtyTwoBytes,
7019 /// A pointer to the contents in the error state.
7020 /// Reading from this pointer when `result_ok` is set is undefined.
7021 pub err: *mut crate::lightning::util::errors::APIError,
7024 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7025 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7026 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7027 pub struct CResult_PaymentPreimageAPIErrorZ {
7028 /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7029 /// `err` or `result` depending on the state of `result_ok`.
7030 pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7031 /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7032 pub result_ok: bool,
7035 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7036 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7037 CResult_PaymentPreimageAPIErrorZ {
7038 contents: CResult_PaymentPreimageAPIErrorZPtr {
7039 result: Box::into_raw(Box::new(o)),
7045 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7046 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7047 CResult_PaymentPreimageAPIErrorZ {
7048 contents: CResult_PaymentPreimageAPIErrorZPtr {
7049 err: Box::into_raw(Box::new(e)),
7054 /// Checks if the given object is currently in the success state
7056 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7060 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7061 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7062 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7063 fn drop(&mut self) {
7065 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7066 let _ = unsafe { Box::from_raw(self.contents.result) };
7069 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7070 let _ = unsafe { Box::from_raw(self.contents.err) };
7075 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7076 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7077 let contents = if o.result_ok {
7078 let result = unsafe { o.contents.result };
7079 unsafe { o.contents.result = core::ptr::null_mut() };
7080 CResult_PaymentPreimageAPIErrorZPtr { result }
7082 let err = unsafe { o.contents.err };
7083 unsafe { o.contents.err = core::ptr::null_mut(); }
7084 CResult_PaymentPreimageAPIErrorZPtr { err }
7088 result_ok: o.result_ok,
7092 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7093 fn clone(&self) -> Self {
7095 Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7096 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7099 Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7100 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7106 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7107 /// but with all dynamically-allocated buffers duplicated in new buffers.
7108 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7110 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7111 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7112 /// A pointer to the contents in the success state.
7113 /// Reading from this pointer when `result_ok` is not set is undefined.
7114 pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7115 /// A pointer to the contents in the error state.
7116 /// Reading from this pointer when `result_ok` is set is undefined.
7117 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7120 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7121 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7123 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7124 /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7125 /// `err` or `result` depending on the state of `result_ok`.
7126 pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7127 /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7128 pub result_ok: bool,
7131 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7132 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7133 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7134 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7135 result: Box::into_raw(Box::new(o)),
7141 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7142 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7143 CResult_CounterpartyForwardingInfoDecodeErrorZ {
7144 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7145 err: Box::into_raw(Box::new(e)),
7150 /// Checks if the given object is currently in the success state
7152 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7156 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7157 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7158 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7159 fn drop(&mut self) {
7161 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7162 let _ = unsafe { Box::from_raw(self.contents.result) };
7165 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7166 let _ = unsafe { Box::from_raw(self.contents.err) };
7171 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7172 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7173 let contents = if o.result_ok {
7174 let result = unsafe { o.contents.result };
7175 unsafe { o.contents.result = core::ptr::null_mut() };
7176 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7178 let err = unsafe { o.contents.err };
7179 unsafe { o.contents.err = core::ptr::null_mut(); }
7180 CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7184 result_ok: o.result_ok,
7188 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7189 fn clone(&self) -> Self {
7191 Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7192 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7195 Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7196 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7202 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7203 /// but with all dynamically-allocated buffers duplicated in new buffers.
7204 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7206 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7207 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7208 /// A pointer to the contents in the success state.
7209 /// Reading from this pointer when `result_ok` is not set is undefined.
7210 pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7211 /// A pointer to the contents in the error state.
7212 /// Reading from this pointer when `result_ok` is set is undefined.
7213 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7216 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7217 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7219 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7220 /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7221 /// `err` or `result` depending on the state of `result_ok`.
7222 pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7223 /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7224 pub result_ok: bool,
7227 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7228 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7229 CResult_ChannelCounterpartyDecodeErrorZ {
7230 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7231 result: Box::into_raw(Box::new(o)),
7237 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7238 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7239 CResult_ChannelCounterpartyDecodeErrorZ {
7240 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7241 err: Box::into_raw(Box::new(e)),
7246 /// Checks if the given object is currently in the success state
7248 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7252 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7253 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7254 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7255 fn drop(&mut self) {
7257 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7258 let _ = unsafe { Box::from_raw(self.contents.result) };
7261 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7262 let _ = unsafe { Box::from_raw(self.contents.err) };
7267 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7268 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7269 let contents = if o.result_ok {
7270 let result = unsafe { o.contents.result };
7271 unsafe { o.contents.result = core::ptr::null_mut() };
7272 CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7274 let err = unsafe { o.contents.err };
7275 unsafe { o.contents.err = core::ptr::null_mut(); }
7276 CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7280 result_ok: o.result_ok,
7284 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7285 fn clone(&self) -> Self {
7287 Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7288 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7291 Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7292 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7298 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7299 /// but with all dynamically-allocated buffers duplicated in new buffers.
7300 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7302 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7303 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7304 /// A pointer to the contents in the success state.
7305 /// Reading from this pointer when `result_ok` is not set is undefined.
7306 pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7307 /// A pointer to the contents in the error state.
7308 /// Reading from this pointer when `result_ok` is set is undefined.
7309 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7312 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7313 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7315 pub struct CResult_ChannelDetailsDecodeErrorZ {
7316 /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7317 /// `err` or `result` depending on the state of `result_ok`.
7318 pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7319 /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7320 pub result_ok: bool,
7323 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7324 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7325 CResult_ChannelDetailsDecodeErrorZ {
7326 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7327 result: Box::into_raw(Box::new(o)),
7333 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7334 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7335 CResult_ChannelDetailsDecodeErrorZ {
7336 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7337 err: Box::into_raw(Box::new(e)),
7342 /// Checks if the given object is currently in the success state
7344 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7348 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7349 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7350 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7351 fn drop(&mut self) {
7353 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7354 let _ = unsafe { Box::from_raw(self.contents.result) };
7357 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7358 let _ = unsafe { Box::from_raw(self.contents.err) };
7363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7364 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7365 let contents = if o.result_ok {
7366 let result = unsafe { o.contents.result };
7367 unsafe { o.contents.result = core::ptr::null_mut() };
7368 CResult_ChannelDetailsDecodeErrorZPtr { result }
7370 let err = unsafe { o.contents.err };
7371 unsafe { o.contents.err = core::ptr::null_mut(); }
7372 CResult_ChannelDetailsDecodeErrorZPtr { err }
7376 result_ok: o.result_ok,
7380 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7381 fn clone(&self) -> Self {
7383 Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7384 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7387 Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7388 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7394 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7395 /// but with all dynamically-allocated buffers duplicated in new buffers.
7396 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7398 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7399 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7400 /// A pointer to the contents in the success state.
7401 /// Reading from this pointer when `result_ok` is not set is undefined.
7402 pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7403 /// A pointer to the contents in the error state.
7404 /// Reading from this pointer when `result_ok` is set is undefined.
7405 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7408 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7409 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7411 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7412 /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7413 /// `err` or `result` depending on the state of `result_ok`.
7414 pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7415 /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7416 pub result_ok: bool,
7419 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7420 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7421 CResult_PhantomRouteHintsDecodeErrorZ {
7422 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7423 result: Box::into_raw(Box::new(o)),
7429 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7430 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7431 CResult_PhantomRouteHintsDecodeErrorZ {
7432 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7433 err: Box::into_raw(Box::new(e)),
7438 /// Checks if the given object is currently in the success state
7440 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7444 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7445 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7446 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7447 fn drop(&mut self) {
7449 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7450 let _ = unsafe { Box::from_raw(self.contents.result) };
7453 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7454 let _ = unsafe { Box::from_raw(self.contents.err) };
7459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7460 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7461 let contents = if o.result_ok {
7462 let result = unsafe { o.contents.result };
7463 unsafe { o.contents.result = core::ptr::null_mut() };
7464 CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7466 let err = unsafe { o.contents.err };
7467 unsafe { o.contents.err = core::ptr::null_mut(); }
7468 CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7472 result_ok: o.result_ok,
7477 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7478 /// This corresponds to std::vector in C++
7479 pub struct CVec_ChannelMonitorZ {
7480 /// The elements in the array.
7481 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7482 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7483 /// The number of elements pointed to by `data`.
7486 impl CVec_ChannelMonitorZ {
7487 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7488 if self.datalen == 0 { return Vec::new(); }
7489 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7490 self.data = core::ptr::null_mut();
7494 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7495 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7498 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7499 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7500 let datalen = v.len();
7501 let data = Box::into_raw(v.into_boxed_slice());
7502 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7506 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7507 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7508 impl Drop for CVec_ChannelMonitorZ {
7509 fn drop(&mut self) {
7510 if self.datalen == 0 { return; }
7511 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7515 /// A tuple of 2 elements. See the individual fields for the types contained.
7516 pub struct C2Tuple_BlockHashChannelManagerZ {
7517 /// The element at position 0
7518 pub a: crate::c_types::ThirtyTwoBytes,
7519 /// The element at position 1
7520 pub b: crate::lightning::ln::channelmanager::ChannelManager,
7522 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7523 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7530 impl C2Tuple_BlockHashChannelManagerZ {
7531 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7535 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7537 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7538 C2Tuple_BlockHashChannelManagerZ { a, b, }
7542 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7543 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7545 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7546 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7547 /// A pointer to the contents in the success state.
7548 /// Reading from this pointer when `result_ok` is not set is undefined.
7549 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7550 /// A pointer to the contents in the error state.
7551 /// Reading from this pointer when `result_ok` is set is undefined.
7552 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7555 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7556 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7558 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7559 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7560 /// `err` or `result` depending on the state of `result_ok`.
7561 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7562 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7563 pub result_ok: bool,
7566 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7567 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7568 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7569 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7570 result: Box::into_raw(Box::new(o)),
7576 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7577 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7578 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7579 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7580 err: Box::into_raw(Box::new(e)),
7585 /// Checks if the given object is currently in the success state
7587 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7591 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7592 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7593 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7594 fn drop(&mut self) {
7596 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7597 let _ = unsafe { Box::from_raw(self.contents.result) };
7600 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7601 let _ = unsafe { Box::from_raw(self.contents.err) };
7606 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7607 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7608 let contents = if o.result_ok {
7609 let result = unsafe { o.contents.result };
7610 unsafe { o.contents.result = core::ptr::null_mut() };
7611 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7613 let err = unsafe { o.contents.err };
7614 unsafe { o.contents.err = core::ptr::null_mut(); }
7615 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7619 result_ok: o.result_ok,
7624 /// The contents of CResult_ChannelConfigDecodeErrorZ
7625 pub union CResult_ChannelConfigDecodeErrorZPtr {
7626 /// A pointer to the contents in the success state.
7627 /// Reading from this pointer when `result_ok` is not set is undefined.
7628 pub result: *mut crate::lightning::util::config::ChannelConfig,
7629 /// A pointer to the contents in the error state.
7630 /// Reading from this pointer when `result_ok` is set is undefined.
7631 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7634 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7635 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7636 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7637 pub struct CResult_ChannelConfigDecodeErrorZ {
7638 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7639 /// `err` or `result` depending on the state of `result_ok`.
7640 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7641 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7642 pub result_ok: bool,
7645 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7646 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7647 CResult_ChannelConfigDecodeErrorZ {
7648 contents: CResult_ChannelConfigDecodeErrorZPtr {
7649 result: Box::into_raw(Box::new(o)),
7655 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7656 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7657 CResult_ChannelConfigDecodeErrorZ {
7658 contents: CResult_ChannelConfigDecodeErrorZPtr {
7659 err: Box::into_raw(Box::new(e)),
7664 /// Checks if the given object is currently in the success state
7666 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7670 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7671 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7672 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7673 fn drop(&mut self) {
7675 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7676 let _ = unsafe { Box::from_raw(self.contents.result) };
7679 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7680 let _ = unsafe { Box::from_raw(self.contents.err) };
7685 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7686 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7687 let contents = if o.result_ok {
7688 let result = unsafe { o.contents.result };
7689 unsafe { o.contents.result = core::ptr::null_mut() };
7690 CResult_ChannelConfigDecodeErrorZPtr { result }
7692 let err = unsafe { o.contents.err };
7693 unsafe { o.contents.err = core::ptr::null_mut(); }
7694 CResult_ChannelConfigDecodeErrorZPtr { err }
7698 result_ok: o.result_ok,
7702 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7703 fn clone(&self) -> Self {
7705 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7706 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7709 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7710 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7716 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7717 /// but with all dynamically-allocated buffers duplicated in new buffers.
7718 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7720 /// The contents of CResult_OutPointDecodeErrorZ
7721 pub union CResult_OutPointDecodeErrorZPtr {
7722 /// A pointer to the contents in the success state.
7723 /// Reading from this pointer when `result_ok` is not set is undefined.
7724 pub result: *mut crate::lightning::chain::transaction::OutPoint,
7725 /// A pointer to the contents in the error state.
7726 /// Reading from this pointer when `result_ok` is set is undefined.
7727 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7730 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7731 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7732 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7733 pub struct CResult_OutPointDecodeErrorZ {
7734 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7735 /// `err` or `result` depending on the state of `result_ok`.
7736 pub contents: CResult_OutPointDecodeErrorZPtr,
7737 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7738 pub result_ok: bool,
7741 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7742 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7743 CResult_OutPointDecodeErrorZ {
7744 contents: CResult_OutPointDecodeErrorZPtr {
7745 result: Box::into_raw(Box::new(o)),
7751 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7752 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7753 CResult_OutPointDecodeErrorZ {
7754 contents: CResult_OutPointDecodeErrorZPtr {
7755 err: Box::into_raw(Box::new(e)),
7760 /// Checks if the given object is currently in the success state
7762 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7766 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7767 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7768 impl Drop for CResult_OutPointDecodeErrorZ {
7769 fn drop(&mut self) {
7771 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7772 let _ = unsafe { Box::from_raw(self.contents.result) };
7775 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7776 let _ = unsafe { Box::from_raw(self.contents.err) };
7781 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7782 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7783 let contents = if o.result_ok {
7784 let result = unsafe { o.contents.result };
7785 unsafe { o.contents.result = core::ptr::null_mut() };
7786 CResult_OutPointDecodeErrorZPtr { result }
7788 let err = unsafe { o.contents.err };
7789 unsafe { o.contents.err = core::ptr::null_mut(); }
7790 CResult_OutPointDecodeErrorZPtr { err }
7794 result_ok: o.result_ok,
7798 impl Clone for CResult_OutPointDecodeErrorZ {
7799 fn clone(&self) -> Self {
7801 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7802 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7805 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7806 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7812 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7813 /// but with all dynamically-allocated buffers duplicated in new buffers.
7814 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7816 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7817 pub enum COption_TypeZ {
7818 /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7819 Some(crate::lightning::ln::wire::Type),
7820 /// When we're in this state, this COption_TypeZ contains nothing
7823 impl COption_TypeZ {
7824 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7825 if let Self::None = self { false } else { true }
7827 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7830 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7831 if let Self::Some(v) = self { v } else { unreachable!() }
7835 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7836 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7837 COption_TypeZ::Some(o)
7840 /// Constructs a new COption_TypeZ containing nothing
7841 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7845 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
7846 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
7848 /// The contents of CResult_COption_TypeZDecodeErrorZ
7849 pub union CResult_COption_TypeZDecodeErrorZPtr {
7850 /// A pointer to the contents in the success state.
7851 /// Reading from this pointer when `result_ok` is not set is undefined.
7852 pub result: *mut crate::c_types::derived::COption_TypeZ,
7853 /// A pointer to the contents in the error state.
7854 /// Reading from this pointer when `result_ok` is set is undefined.
7855 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7858 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7859 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7861 pub struct CResult_COption_TypeZDecodeErrorZ {
7862 /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7863 /// `err` or `result` depending on the state of `result_ok`.
7864 pub contents: CResult_COption_TypeZDecodeErrorZPtr,
7865 /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7866 pub result_ok: bool,
7869 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
7870 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
7871 CResult_COption_TypeZDecodeErrorZ {
7872 contents: CResult_COption_TypeZDecodeErrorZPtr {
7873 result: Box::into_raw(Box::new(o)),
7879 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
7880 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
7881 CResult_COption_TypeZDecodeErrorZ {
7882 contents: CResult_COption_TypeZDecodeErrorZPtr {
7883 err: Box::into_raw(Box::new(e)),
7888 /// Checks if the given object is currently in the success state
7890 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
7894 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
7895 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
7896 impl Drop for CResult_COption_TypeZDecodeErrorZ {
7897 fn drop(&mut self) {
7899 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7900 let _ = unsafe { Box::from_raw(self.contents.result) };
7903 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7904 let _ = unsafe { Box::from_raw(self.contents.err) };
7909 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
7910 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7911 let contents = if o.result_ok {
7912 let result = unsafe { o.contents.result };
7913 unsafe { o.contents.result = core::ptr::null_mut() };
7914 CResult_COption_TypeZDecodeErrorZPtr { result }
7916 let err = unsafe { o.contents.err };
7917 unsafe { o.contents.err = core::ptr::null_mut(); }
7918 CResult_COption_TypeZDecodeErrorZPtr { err }
7922 result_ok: o.result_ok,
7927 /// The contents of CResult_PaymentIdPaymentErrorZ
7928 pub union CResult_PaymentIdPaymentErrorZPtr {
7929 /// A pointer to the contents in the success state.
7930 /// Reading from this pointer when `result_ok` is not set is undefined.
7931 pub result: *mut crate::c_types::ThirtyTwoBytes,
7932 /// A pointer to the contents in the error state.
7933 /// Reading from this pointer when `result_ok` is set is undefined.
7934 pub err: *mut crate::lightning_invoice::payment::PaymentError,
7937 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
7938 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7940 pub struct CResult_PaymentIdPaymentErrorZ {
7941 /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7942 /// `err` or `result` depending on the state of `result_ok`.
7943 pub contents: CResult_PaymentIdPaymentErrorZPtr,
7944 /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7945 pub result_ok: bool,
7948 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
7949 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
7950 CResult_PaymentIdPaymentErrorZ {
7951 contents: CResult_PaymentIdPaymentErrorZPtr {
7952 result: Box::into_raw(Box::new(o)),
7958 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
7959 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
7960 CResult_PaymentIdPaymentErrorZ {
7961 contents: CResult_PaymentIdPaymentErrorZPtr {
7962 err: Box::into_raw(Box::new(e)),
7967 /// Checks if the given object is currently in the success state
7969 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
7973 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
7974 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
7975 impl Drop for CResult_PaymentIdPaymentErrorZ {
7976 fn drop(&mut self) {
7978 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7979 let _ = unsafe { Box::from_raw(self.contents.result) };
7982 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7983 let _ = unsafe { Box::from_raw(self.contents.err) };
7988 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
7989 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
7990 let contents = if o.result_ok {
7991 let result = unsafe { o.contents.result };
7992 unsafe { o.contents.result = core::ptr::null_mut() };
7993 CResult_PaymentIdPaymentErrorZPtr { result }
7995 let err = unsafe { o.contents.err };
7996 unsafe { o.contents.err = core::ptr::null_mut(); }
7997 CResult_PaymentIdPaymentErrorZPtr { err }
8001 result_ok: o.result_ok,
8005 impl Clone for CResult_PaymentIdPaymentErrorZ {
8006 fn clone(&self) -> Self {
8008 Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8009 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8012 Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8013 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8019 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8020 /// but with all dynamically-allocated buffers duplicated in new buffers.
8021 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8023 /// The contents of CResult_SiPrefixNoneZ
8024 pub union CResult_SiPrefixNoneZPtr {
8025 /// A pointer to the contents in the success state.
8026 /// Reading from this pointer when `result_ok` is not set is undefined.
8027 pub result: *mut crate::lightning_invoice::SiPrefix,
8028 /// Note that this value is always NULL, as there are no contents in the Err variant
8029 pub err: *mut core::ffi::c_void,
8032 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
8033 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
8034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8035 pub struct CResult_SiPrefixNoneZ {
8036 /// The contents of this CResult_SiPrefixNoneZ, accessible via either
8037 /// `err` or `result` depending on the state of `result_ok`.
8038 pub contents: CResult_SiPrefixNoneZPtr,
8039 /// Whether this CResult_SiPrefixNoneZ represents a success state.
8040 pub result_ok: bool,
8043 /// Creates a new CResult_SiPrefixNoneZ in the success state.
8044 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
8045 CResult_SiPrefixNoneZ {
8046 contents: CResult_SiPrefixNoneZPtr {
8047 result: Box::into_raw(Box::new(o)),
8053 /// Creates a new CResult_SiPrefixNoneZ in the error state.
8054 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
8055 CResult_SiPrefixNoneZ {
8056 contents: CResult_SiPrefixNoneZPtr {
8057 err: core::ptr::null_mut(),
8062 /// Checks if the given object is currently in the success state
8064 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
8068 /// Frees any resources used by the CResult_SiPrefixNoneZ.
8069 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
8070 impl Drop for CResult_SiPrefixNoneZ {
8071 fn drop(&mut self) {
8073 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8074 let _ = unsafe { Box::from_raw(self.contents.result) };
8080 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
8081 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
8082 let contents = if o.result_ok {
8083 let result = unsafe { o.contents.result };
8084 unsafe { o.contents.result = core::ptr::null_mut() };
8085 CResult_SiPrefixNoneZPtr { result }
8087 let _ = unsafe { Box::from_raw(o.contents.err) };
8088 o.contents.err = core::ptr::null_mut();
8089 CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
8093 result_ok: o.result_ok,
8097 impl Clone for CResult_SiPrefixNoneZ {
8098 fn clone(&self) -> Self {
8100 Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
8101 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8104 Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
8105 err: core::ptr::null_mut()
8111 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
8112 /// but with all dynamically-allocated buffers duplicated in new buffers.
8113 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
8115 /// The contents of CResult_InvoiceNoneZ
8116 pub union CResult_InvoiceNoneZPtr {
8117 /// A pointer to the contents in the success state.
8118 /// Reading from this pointer when `result_ok` is not set is undefined.
8119 pub result: *mut crate::lightning_invoice::Invoice,
8120 /// Note that this value is always NULL, as there are no contents in the Err variant
8121 pub err: *mut core::ffi::c_void,
8124 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
8125 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
8126 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8127 pub struct CResult_InvoiceNoneZ {
8128 /// The contents of this CResult_InvoiceNoneZ, accessible via either
8129 /// `err` or `result` depending on the state of `result_ok`.
8130 pub contents: CResult_InvoiceNoneZPtr,
8131 /// Whether this CResult_InvoiceNoneZ represents a success state.
8132 pub result_ok: bool,
8135 /// Creates a new CResult_InvoiceNoneZ in the success state.
8136 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
8137 CResult_InvoiceNoneZ {
8138 contents: CResult_InvoiceNoneZPtr {
8139 result: Box::into_raw(Box::new(o)),
8145 /// Creates a new CResult_InvoiceNoneZ in the error state.
8146 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
8147 CResult_InvoiceNoneZ {
8148 contents: CResult_InvoiceNoneZPtr {
8149 err: core::ptr::null_mut(),
8154 /// Checks if the given object is currently in the success state
8156 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
8160 /// Frees any resources used by the CResult_InvoiceNoneZ.
8161 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
8162 impl Drop for CResult_InvoiceNoneZ {
8163 fn drop(&mut self) {
8165 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8166 let _ = unsafe { Box::from_raw(self.contents.result) };
8172 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
8173 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
8174 let contents = if o.result_ok {
8175 let result = unsafe { o.contents.result };
8176 unsafe { o.contents.result = core::ptr::null_mut() };
8177 CResult_InvoiceNoneZPtr { result }
8179 let _ = unsafe { Box::from_raw(o.contents.err) };
8180 o.contents.err = core::ptr::null_mut();
8181 CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
8185 result_ok: o.result_ok,
8189 impl Clone for CResult_InvoiceNoneZ {
8190 fn clone(&self) -> Self {
8192 Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
8193 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8196 Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
8197 err: core::ptr::null_mut()
8203 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
8204 /// but with all dynamically-allocated buffers duplicated in new buffers.
8205 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
8207 /// The contents of CResult_SignedRawInvoiceNoneZ
8208 pub union CResult_SignedRawInvoiceNoneZPtr {
8209 /// A pointer to the contents in the success state.
8210 /// Reading from this pointer when `result_ok` is not set is undefined.
8211 pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8212 /// Note that this value is always NULL, as there are no contents in the Err variant
8213 pub err: *mut core::ffi::c_void,
8216 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
8217 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
8218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8219 pub struct CResult_SignedRawInvoiceNoneZ {
8220 /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
8221 /// `err` or `result` depending on the state of `result_ok`.
8222 pub contents: CResult_SignedRawInvoiceNoneZPtr,
8223 /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
8224 pub result_ok: bool,
8227 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
8228 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
8229 CResult_SignedRawInvoiceNoneZ {
8230 contents: CResult_SignedRawInvoiceNoneZPtr {
8231 result: Box::into_raw(Box::new(o)),
8237 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
8238 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
8239 CResult_SignedRawInvoiceNoneZ {
8240 contents: CResult_SignedRawInvoiceNoneZPtr {
8241 err: core::ptr::null_mut(),
8246 /// Checks if the given object is currently in the success state
8248 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
8252 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
8253 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
8254 impl Drop for CResult_SignedRawInvoiceNoneZ {
8255 fn drop(&mut self) {
8257 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8258 let _ = unsafe { Box::from_raw(self.contents.result) };
8264 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
8265 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
8266 let contents = if o.result_ok {
8267 let result = unsafe { o.contents.result };
8268 unsafe { o.contents.result = core::ptr::null_mut() };
8269 CResult_SignedRawInvoiceNoneZPtr { result }
8271 let _ = unsafe { Box::from_raw(o.contents.err) };
8272 o.contents.err = core::ptr::null_mut();
8273 CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
8277 result_ok: o.result_ok,
8281 impl Clone for CResult_SignedRawInvoiceNoneZ {
8282 fn clone(&self) -> Self {
8284 Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
8285 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8288 Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
8289 err: core::ptr::null_mut()
8295 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
8296 /// but with all dynamically-allocated buffers duplicated in new buffers.
8297 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
8299 /// A tuple of 3 elements. See the individual fields for the types contained.
8300 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8301 /// The element at position 0
8302 pub a: crate::lightning_invoice::RawInvoice,
8303 /// The element at position 1
8304 pub b: crate::c_types::ThirtyTwoBytes,
8305 /// The element at position 2
8306 pub c: crate::lightning_invoice::InvoiceSignature,
8308 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8309 fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8317 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8318 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8319 (self.a, self.b, self.c)
8322 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8323 fn clone(&self) -> Self {
8325 a: Clone::clone(&self.a),
8326 b: Clone::clone(&self.b),
8327 c: Clone::clone(&self.c),
8332 /// Creates a new tuple which has the same data as `orig`
8333 /// but with all dynamically-allocated buffers duplicated in new buffers.
8334 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8335 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8337 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 {
8338 C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8342 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8343 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8345 /// The contents of CResult_PayeePubKeyErrorZ
8346 pub union CResult_PayeePubKeyErrorZPtr {
8347 /// A pointer to the contents in the success state.
8348 /// Reading from this pointer when `result_ok` is not set is undefined.
8349 pub result: *mut crate::lightning_invoice::PayeePubKey,
8350 /// A pointer to the contents in the error state.
8351 /// Reading from this pointer when `result_ok` is set is undefined.
8352 pub err: *mut crate::c_types::Secp256k1Error,
8355 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8356 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8357 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8358 pub struct CResult_PayeePubKeyErrorZ {
8359 /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8360 /// `err` or `result` depending on the state of `result_ok`.
8361 pub contents: CResult_PayeePubKeyErrorZPtr,
8362 /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8363 pub result_ok: bool,
8366 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8367 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8368 CResult_PayeePubKeyErrorZ {
8369 contents: CResult_PayeePubKeyErrorZPtr {
8370 result: Box::into_raw(Box::new(o)),
8376 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8377 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8378 CResult_PayeePubKeyErrorZ {
8379 contents: CResult_PayeePubKeyErrorZPtr {
8380 err: Box::into_raw(Box::new(e)),
8385 /// Checks if the given object is currently in the success state
8387 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8391 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8392 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8393 impl Drop for CResult_PayeePubKeyErrorZ {
8394 fn drop(&mut self) {
8396 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8397 let _ = unsafe { Box::from_raw(self.contents.result) };
8400 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8401 let _ = unsafe { Box::from_raw(self.contents.err) };
8406 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8407 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8408 let contents = if o.result_ok {
8409 let result = unsafe { o.contents.result };
8410 unsafe { o.contents.result = core::ptr::null_mut() };
8411 CResult_PayeePubKeyErrorZPtr { result }
8413 let err = unsafe { o.contents.err };
8414 unsafe { o.contents.err = core::ptr::null_mut(); }
8415 CResult_PayeePubKeyErrorZPtr { err }
8419 result_ok: o.result_ok,
8423 impl Clone for CResult_PayeePubKeyErrorZ {
8424 fn clone(&self) -> Self {
8426 Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8427 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8430 Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8431 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8437 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8438 /// but with all dynamically-allocated buffers duplicated in new buffers.
8439 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8441 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8442 /// This corresponds to std::vector in C++
8443 pub struct CVec_PrivateRouteZ {
8444 /// The elements in the array.
8445 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8446 pub data: *mut crate::lightning_invoice::PrivateRoute,
8447 /// The number of elements pointed to by `data`.
8450 impl CVec_PrivateRouteZ {
8451 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8452 if self.datalen == 0 { return Vec::new(); }
8453 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8454 self.data = core::ptr::null_mut();
8458 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8459 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8462 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8463 fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8464 let datalen = v.len();
8465 let data = Box::into_raw(v.into_boxed_slice());
8466 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8470 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8471 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8472 impl Drop for CVec_PrivateRouteZ {
8473 fn drop(&mut self) {
8474 if self.datalen == 0 { return; }
8475 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8478 impl Clone for CVec_PrivateRouteZ {
8479 fn clone(&self) -> Self {
8480 let mut res = Vec::new();
8481 if self.datalen == 0 { return Self::from(res); }
8482 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8487 /// The contents of CResult_PositiveTimestampCreationErrorZ
8488 pub union CResult_PositiveTimestampCreationErrorZPtr {
8489 /// A pointer to the contents in the success state.
8490 /// Reading from this pointer when `result_ok` is not set is undefined.
8491 pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8492 /// A pointer to the contents in the error state.
8493 /// Reading from this pointer when `result_ok` is set is undefined.
8494 pub err: *mut crate::lightning_invoice::CreationError,
8497 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8498 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8500 pub struct CResult_PositiveTimestampCreationErrorZ {
8501 /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8502 /// `err` or `result` depending on the state of `result_ok`.
8503 pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8504 /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8505 pub result_ok: bool,
8508 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8509 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8510 CResult_PositiveTimestampCreationErrorZ {
8511 contents: CResult_PositiveTimestampCreationErrorZPtr {
8512 result: Box::into_raw(Box::new(o)),
8518 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8519 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8520 CResult_PositiveTimestampCreationErrorZ {
8521 contents: CResult_PositiveTimestampCreationErrorZPtr {
8522 err: Box::into_raw(Box::new(e)),
8527 /// Checks if the given object is currently in the success state
8529 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8533 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8534 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8535 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8536 fn drop(&mut self) {
8538 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8539 let _ = unsafe { Box::from_raw(self.contents.result) };
8542 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8543 let _ = unsafe { Box::from_raw(self.contents.err) };
8548 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8549 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8550 let contents = if o.result_ok {
8551 let result = unsafe { o.contents.result };
8552 unsafe { o.contents.result = core::ptr::null_mut() };
8553 CResult_PositiveTimestampCreationErrorZPtr { result }
8555 let err = unsafe { o.contents.err };
8556 unsafe { o.contents.err = core::ptr::null_mut(); }
8557 CResult_PositiveTimestampCreationErrorZPtr { err }
8561 result_ok: o.result_ok,
8565 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8566 fn clone(&self) -> Self {
8568 Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8569 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8572 Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8573 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8579 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8580 /// but with all dynamically-allocated buffers duplicated in new buffers.
8581 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8583 /// The contents of CResult_NoneSemanticErrorZ
8584 pub union CResult_NoneSemanticErrorZPtr {
8585 /// Note that this value is always NULL, as there are no contents in the OK variant
8586 pub result: *mut core::ffi::c_void,
8587 /// A pointer to the contents in the error state.
8588 /// Reading from this pointer when `result_ok` is set is undefined.
8589 pub err: *mut crate::lightning_invoice::SemanticError,
8592 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8593 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8595 pub struct CResult_NoneSemanticErrorZ {
8596 /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8597 /// `err` or `result` depending on the state of `result_ok`.
8598 pub contents: CResult_NoneSemanticErrorZPtr,
8599 /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8600 pub result_ok: bool,
8603 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8604 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8605 CResult_NoneSemanticErrorZ {
8606 contents: CResult_NoneSemanticErrorZPtr {
8607 result: core::ptr::null_mut(),
8613 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8614 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8615 CResult_NoneSemanticErrorZ {
8616 contents: CResult_NoneSemanticErrorZPtr {
8617 err: Box::into_raw(Box::new(e)),
8622 /// Checks if the given object is currently in the success state
8624 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8628 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8629 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8630 impl Drop for CResult_NoneSemanticErrorZ {
8631 fn drop(&mut self) {
8634 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8635 let _ = unsafe { Box::from_raw(self.contents.err) };
8640 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8641 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8642 let contents = if o.result_ok {
8643 let _ = unsafe { Box::from_raw(o.contents.result) };
8644 o.contents.result = core::ptr::null_mut();
8645 CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8647 let err = unsafe { o.contents.err };
8648 unsafe { o.contents.err = core::ptr::null_mut(); }
8649 CResult_NoneSemanticErrorZPtr { err }
8653 result_ok: o.result_ok,
8657 impl Clone for CResult_NoneSemanticErrorZ {
8658 fn clone(&self) -> Self {
8660 Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8661 result: core::ptr::null_mut()
8664 Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8665 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8671 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8672 /// but with all dynamically-allocated buffers duplicated in new buffers.
8673 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8675 /// The contents of CResult_InvoiceSemanticErrorZ
8676 pub union CResult_InvoiceSemanticErrorZPtr {
8677 /// A pointer to the contents in the success state.
8678 /// Reading from this pointer when `result_ok` is not set is undefined.
8679 pub result: *mut crate::lightning_invoice::Invoice,
8680 /// A pointer to the contents in the error state.
8681 /// Reading from this pointer when `result_ok` is set is undefined.
8682 pub err: *mut crate::lightning_invoice::SemanticError,
8685 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8686 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8687 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8688 pub struct CResult_InvoiceSemanticErrorZ {
8689 /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8690 /// `err` or `result` depending on the state of `result_ok`.
8691 pub contents: CResult_InvoiceSemanticErrorZPtr,
8692 /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8693 pub result_ok: bool,
8696 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8697 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8698 CResult_InvoiceSemanticErrorZ {
8699 contents: CResult_InvoiceSemanticErrorZPtr {
8700 result: Box::into_raw(Box::new(o)),
8706 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8707 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8708 CResult_InvoiceSemanticErrorZ {
8709 contents: CResult_InvoiceSemanticErrorZPtr {
8710 err: Box::into_raw(Box::new(e)),
8715 /// Checks if the given object is currently in the success state
8717 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8721 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8722 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8723 impl Drop for CResult_InvoiceSemanticErrorZ {
8724 fn drop(&mut self) {
8726 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8727 let _ = unsafe { Box::from_raw(self.contents.result) };
8730 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8731 let _ = unsafe { Box::from_raw(self.contents.err) };
8736 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8737 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8738 let contents = if o.result_ok {
8739 let result = unsafe { o.contents.result };
8740 unsafe { o.contents.result = core::ptr::null_mut() };
8741 CResult_InvoiceSemanticErrorZPtr { result }
8743 let err = unsafe { o.contents.err };
8744 unsafe { o.contents.err = core::ptr::null_mut(); }
8745 CResult_InvoiceSemanticErrorZPtr { err }
8749 result_ok: o.result_ok,
8753 impl Clone for CResult_InvoiceSemanticErrorZ {
8754 fn clone(&self) -> Self {
8756 Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8757 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8760 Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8761 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8767 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8768 /// but with all dynamically-allocated buffers duplicated in new buffers.
8769 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8771 /// The contents of CResult_DescriptionCreationErrorZ
8772 pub union CResult_DescriptionCreationErrorZPtr {
8773 /// A pointer to the contents in the success state.
8774 /// Reading from this pointer when `result_ok` is not set is undefined.
8775 pub result: *mut crate::lightning_invoice::Description,
8776 /// A pointer to the contents in the error state.
8777 /// Reading from this pointer when `result_ok` is set is undefined.
8778 pub err: *mut crate::lightning_invoice::CreationError,
8781 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8782 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8783 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8784 pub struct CResult_DescriptionCreationErrorZ {
8785 /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8786 /// `err` or `result` depending on the state of `result_ok`.
8787 pub contents: CResult_DescriptionCreationErrorZPtr,
8788 /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8789 pub result_ok: bool,
8792 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8793 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8794 CResult_DescriptionCreationErrorZ {
8795 contents: CResult_DescriptionCreationErrorZPtr {
8796 result: Box::into_raw(Box::new(o)),
8802 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8803 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8804 CResult_DescriptionCreationErrorZ {
8805 contents: CResult_DescriptionCreationErrorZPtr {
8806 err: Box::into_raw(Box::new(e)),
8811 /// Checks if the given object is currently in the success state
8813 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8817 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8818 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8819 impl Drop for CResult_DescriptionCreationErrorZ {
8820 fn drop(&mut self) {
8822 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8823 let _ = unsafe { Box::from_raw(self.contents.result) };
8826 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8827 let _ = unsafe { Box::from_raw(self.contents.err) };
8832 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8833 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8834 let contents = if o.result_ok {
8835 let result = unsafe { o.contents.result };
8836 unsafe { o.contents.result = core::ptr::null_mut() };
8837 CResult_DescriptionCreationErrorZPtr { result }
8839 let err = unsafe { o.contents.err };
8840 unsafe { o.contents.err = core::ptr::null_mut(); }
8841 CResult_DescriptionCreationErrorZPtr { err }
8845 result_ok: o.result_ok,
8849 impl Clone for CResult_DescriptionCreationErrorZ {
8850 fn clone(&self) -> Self {
8852 Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
8853 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
8856 Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
8857 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8863 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
8864 /// but with all dynamically-allocated buffers duplicated in new buffers.
8865 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
8867 /// The contents of CResult_PrivateRouteCreationErrorZ
8868 pub union CResult_PrivateRouteCreationErrorZPtr {
8869 /// A pointer to the contents in the success state.
8870 /// Reading from this pointer when `result_ok` is not set is undefined.
8871 pub result: *mut crate::lightning_invoice::PrivateRoute,
8872 /// A pointer to the contents in the error state.
8873 /// Reading from this pointer when `result_ok` is set is undefined.
8874 pub err: *mut crate::lightning_invoice::CreationError,
8877 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8878 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8879 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8880 pub struct CResult_PrivateRouteCreationErrorZ {
8881 /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8882 /// `err` or `result` depending on the state of `result_ok`.
8883 pub contents: CResult_PrivateRouteCreationErrorZPtr,
8884 /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8885 pub result_ok: bool,
8888 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
8889 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
8890 CResult_PrivateRouteCreationErrorZ {
8891 contents: CResult_PrivateRouteCreationErrorZPtr {
8892 result: Box::into_raw(Box::new(o)),
8898 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
8899 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
8900 CResult_PrivateRouteCreationErrorZ {
8901 contents: CResult_PrivateRouteCreationErrorZPtr {
8902 err: Box::into_raw(Box::new(e)),
8907 /// Checks if the given object is currently in the success state
8909 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
8913 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
8914 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
8915 impl Drop for CResult_PrivateRouteCreationErrorZ {
8916 fn drop(&mut self) {
8918 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8919 let _ = unsafe { Box::from_raw(self.contents.result) };
8922 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8923 let _ = unsafe { Box::from_raw(self.contents.err) };
8928 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
8929 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
8930 let contents = if o.result_ok {
8931 let result = unsafe { o.contents.result };
8932 unsafe { o.contents.result = core::ptr::null_mut() };
8933 CResult_PrivateRouteCreationErrorZPtr { result }
8935 let err = unsafe { o.contents.err };
8936 unsafe { o.contents.err = core::ptr::null_mut(); }
8937 CResult_PrivateRouteCreationErrorZPtr { err }
8941 result_ok: o.result_ok,
8945 impl Clone for CResult_PrivateRouteCreationErrorZ {
8946 fn clone(&self) -> Self {
8948 Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
8949 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
8952 Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
8953 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8959 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
8960 /// but with all dynamically-allocated buffers duplicated in new buffers.
8961 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
8963 /// The contents of CResult_StringErrorZ
8964 pub union CResult_StringErrorZPtr {
8965 /// A pointer to the contents in the success state.
8966 /// Reading from this pointer when `result_ok` is not set is undefined.
8967 pub result: *mut crate::c_types::Str,
8968 /// A pointer to the contents in the error state.
8969 /// Reading from this pointer when `result_ok` is set is undefined.
8970 pub err: *mut crate::c_types::Secp256k1Error,
8973 /// A CResult_StringErrorZ represents the result of a fallible operation,
8974 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
8975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8976 pub struct CResult_StringErrorZ {
8977 /// The contents of this CResult_StringErrorZ, accessible via either
8978 /// `err` or `result` depending on the state of `result_ok`.
8979 pub contents: CResult_StringErrorZPtr,
8980 /// Whether this CResult_StringErrorZ represents a success state.
8981 pub result_ok: bool,
8984 /// Creates a new CResult_StringErrorZ in the success state.
8985 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
8986 CResult_StringErrorZ {
8987 contents: CResult_StringErrorZPtr {
8988 result: Box::into_raw(Box::new(o)),
8994 /// Creates a new CResult_StringErrorZ in the error state.
8995 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
8996 CResult_StringErrorZ {
8997 contents: CResult_StringErrorZPtr {
8998 err: Box::into_raw(Box::new(e)),
9003 /// Checks if the given object is currently in the success state
9005 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9009 /// Frees any resources used by the CResult_StringErrorZ.
9010 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9011 impl Drop for CResult_StringErrorZ {
9012 fn drop(&mut self) {
9014 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9015 let _ = unsafe { Box::from_raw(self.contents.result) };
9018 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9019 let _ = unsafe { Box::from_raw(self.contents.err) };
9024 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9025 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9026 let contents = if o.result_ok {
9027 let result = unsafe { o.contents.result };
9028 unsafe { o.contents.result = core::ptr::null_mut() };
9029 CResult_StringErrorZPtr { result }
9031 let err = unsafe { o.contents.err };
9032 unsafe { o.contents.err = core::ptr::null_mut(); }
9033 CResult_StringErrorZPtr { err }
9037 result_ok: o.result_ok,
9042 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9043 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9044 /// A pointer to the contents in the success state.
9045 /// Reading from this pointer when `result_ok` is not set is undefined.
9046 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9047 /// A pointer to the contents in the error state.
9048 /// Reading from this pointer when `result_ok` is set is undefined.
9049 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9052 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9053 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9055 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9056 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9057 /// `err` or `result` depending on the state of `result_ok`.
9058 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9059 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9060 pub result_ok: bool,
9063 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9064 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9065 CResult_ChannelMonitorUpdateDecodeErrorZ {
9066 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9067 result: Box::into_raw(Box::new(o)),
9073 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9074 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9075 CResult_ChannelMonitorUpdateDecodeErrorZ {
9076 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9077 err: Box::into_raw(Box::new(e)),
9082 /// Checks if the given object is currently in the success state
9084 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9088 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9089 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9090 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9091 fn drop(&mut self) {
9093 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9094 let _ = unsafe { Box::from_raw(self.contents.result) };
9097 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9098 let _ = unsafe { Box::from_raw(self.contents.err) };
9103 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9104 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9105 let contents = if o.result_ok {
9106 let result = unsafe { o.contents.result };
9107 unsafe { o.contents.result = core::ptr::null_mut() };
9108 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9110 let err = unsafe { o.contents.err };
9111 unsafe { o.contents.err = core::ptr::null_mut(); }
9112 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9116 result_ok: o.result_ok,
9120 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9121 fn clone(&self) -> Self {
9123 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9124 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9127 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9128 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9134 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9135 /// but with all dynamically-allocated buffers duplicated in new buffers.
9136 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9139 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9140 pub enum COption_MonitorEventZ {
9141 /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9142 Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9143 /// When we're in this state, this COption_MonitorEventZ contains nothing
9146 impl COption_MonitorEventZ {
9147 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9148 if let Self::None = self { false } else { true }
9150 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9153 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9154 if let Self::Some(v) = self { v } else { unreachable!() }
9158 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9159 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9160 COption_MonitorEventZ::Some(o)
9163 /// Constructs a new COption_MonitorEventZ containing nothing
9164 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9165 COption_MonitorEventZ::None
9168 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9169 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9171 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9172 /// but with all dynamically-allocated buffers duplicated in new buffers.
9173 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9175 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9176 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9177 /// A pointer to the contents in the success state.
9178 /// Reading from this pointer when `result_ok` is not set is undefined.
9179 pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9180 /// A pointer to the contents in the error state.
9181 /// Reading from this pointer when `result_ok` is set is undefined.
9182 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9185 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9186 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9188 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9189 /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9190 /// `err` or `result` depending on the state of `result_ok`.
9191 pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9192 /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9193 pub result_ok: bool,
9196 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9197 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9198 CResult_COption_MonitorEventZDecodeErrorZ {
9199 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9200 result: Box::into_raw(Box::new(o)),
9206 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9207 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9208 CResult_COption_MonitorEventZDecodeErrorZ {
9209 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9210 err: Box::into_raw(Box::new(e)),
9215 /// Checks if the given object is currently in the success state
9217 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9221 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9222 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9223 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9224 fn drop(&mut self) {
9226 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9227 let _ = unsafe { Box::from_raw(self.contents.result) };
9230 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9231 let _ = unsafe { Box::from_raw(self.contents.err) };
9236 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9237 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9238 let contents = if o.result_ok {
9239 let result = unsafe { o.contents.result };
9240 unsafe { o.contents.result = core::ptr::null_mut() };
9241 CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9243 let err = unsafe { o.contents.err };
9244 unsafe { o.contents.err = core::ptr::null_mut(); }
9245 CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9249 result_ok: o.result_ok,
9253 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9254 fn clone(&self) -> Self {
9256 Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9257 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9260 Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9261 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9267 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9268 /// but with all dynamically-allocated buffers duplicated in new buffers.
9269 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9271 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9272 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9273 /// A pointer to the contents in the success state.
9274 /// Reading from this pointer when `result_ok` is not set is undefined.
9275 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9276 /// A pointer to the contents in the error state.
9277 /// Reading from this pointer when `result_ok` is set is undefined.
9278 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9281 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9282 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9284 pub struct CResult_HTLCUpdateDecodeErrorZ {
9285 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9286 /// `err` or `result` depending on the state of `result_ok`.
9287 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9288 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9289 pub result_ok: bool,
9292 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9293 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9294 CResult_HTLCUpdateDecodeErrorZ {
9295 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9296 result: Box::into_raw(Box::new(o)),
9302 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9303 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9304 CResult_HTLCUpdateDecodeErrorZ {
9305 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9306 err: Box::into_raw(Box::new(e)),
9311 /// Checks if the given object is currently in the success state
9313 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9317 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9318 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9319 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9320 fn drop(&mut self) {
9322 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9323 let _ = unsafe { Box::from_raw(self.contents.result) };
9326 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9327 let _ = unsafe { Box::from_raw(self.contents.err) };
9332 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9333 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9334 let contents = if o.result_ok {
9335 let result = unsafe { o.contents.result };
9336 unsafe { o.contents.result = core::ptr::null_mut() };
9337 CResult_HTLCUpdateDecodeErrorZPtr { result }
9339 let err = unsafe { o.contents.err };
9340 unsafe { o.contents.err = core::ptr::null_mut(); }
9341 CResult_HTLCUpdateDecodeErrorZPtr { err }
9345 result_ok: o.result_ok,
9349 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9350 fn clone(&self) -> Self {
9352 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9353 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9356 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9357 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9363 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9364 /// but with all dynamically-allocated buffers duplicated in new buffers.
9365 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9367 /// A tuple of 2 elements. See the individual fields for the types contained.
9368 pub struct C2Tuple_OutPointScriptZ {
9369 /// The element at position 0
9370 pub a: crate::lightning::chain::transaction::OutPoint,
9371 /// The element at position 1
9372 pub b: crate::c_types::derived::CVec_u8Z,
9374 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9375 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9382 impl C2Tuple_OutPointScriptZ {
9383 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9387 impl Clone for C2Tuple_OutPointScriptZ {
9388 fn clone(&self) -> Self {
9390 a: Clone::clone(&self.a),
9391 b: Clone::clone(&self.b),
9396 /// Creates a new tuple which has the same data as `orig`
9397 /// but with all dynamically-allocated buffers duplicated in new buffers.
9398 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9399 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9401 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9402 C2Tuple_OutPointScriptZ { a, b, }
9406 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9407 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9409 /// A tuple of 2 elements. See the individual fields for the types contained.
9410 pub struct C2Tuple_u32ScriptZ {
9411 /// The element at position 0
9413 /// The element at position 1
9414 pub b: crate::c_types::derived::CVec_u8Z,
9416 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9417 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9424 impl C2Tuple_u32ScriptZ {
9425 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9429 impl Clone for C2Tuple_u32ScriptZ {
9430 fn clone(&self) -> Self {
9432 a: Clone::clone(&self.a),
9433 b: Clone::clone(&self.b),
9438 /// Creates a new tuple which has the same data as `orig`
9439 /// but with all dynamically-allocated buffers duplicated in new buffers.
9440 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9441 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9443 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9444 C2Tuple_u32ScriptZ { a, b, }
9448 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9449 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9451 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9452 /// This corresponds to std::vector in C++
9453 pub struct CVec_C2Tuple_u32ScriptZZ {
9454 /// The elements in the array.
9455 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9456 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9457 /// The number of elements pointed to by `data`.
9460 impl CVec_C2Tuple_u32ScriptZZ {
9461 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9462 if self.datalen == 0 { return Vec::new(); }
9463 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9464 self.data = core::ptr::null_mut();
9468 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9469 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9472 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9473 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9474 let datalen = v.len();
9475 let data = Box::into_raw(v.into_boxed_slice());
9476 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9480 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9481 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9482 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9483 fn drop(&mut self) {
9484 if self.datalen == 0 { return; }
9485 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9488 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9489 fn clone(&self) -> Self {
9490 let mut res = Vec::new();
9491 if self.datalen == 0 { return Self::from(res); }
9492 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9497 /// A tuple of 2 elements. See the individual fields for the types contained.
9498 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9499 /// The element at position 0
9500 pub a: crate::c_types::ThirtyTwoBytes,
9501 /// The element at position 1
9502 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9504 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9505 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9512 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9513 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9517 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9518 fn clone(&self) -> Self {
9520 a: Clone::clone(&self.a),
9521 b: Clone::clone(&self.b),
9526 /// Creates a new tuple which has the same data as `orig`
9527 /// but with all dynamically-allocated buffers duplicated in new buffers.
9528 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9529 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9531 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 {
9532 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9536 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9537 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9539 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9540 /// This corresponds to std::vector in C++
9541 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9542 /// The elements in the array.
9543 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9544 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9545 /// The number of elements pointed to by `data`.
9548 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9549 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9550 if self.datalen == 0 { return Vec::new(); }
9551 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9552 self.data = core::ptr::null_mut();
9556 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9557 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9560 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9561 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9562 let datalen = v.len();
9563 let data = Box::into_raw(v.into_boxed_slice());
9564 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9568 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9569 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9570 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9571 fn drop(&mut self) {
9572 if self.datalen == 0 { return; }
9573 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9576 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9577 fn clone(&self) -> Self {
9578 let mut res = Vec::new();
9579 if self.datalen == 0 { return Self::from(res); }
9580 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9585 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9586 /// This corresponds to std::vector in C++
9587 pub struct CVec_EventZ {
9588 /// The elements in the array.
9589 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9590 pub data: *mut crate::lightning::util::events::Event,
9591 /// The number of elements pointed to by `data`.
9595 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9596 if self.datalen == 0 { return Vec::new(); }
9597 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9598 self.data = core::ptr::null_mut();
9602 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9603 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9606 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9607 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9608 let datalen = v.len();
9609 let data = Box::into_raw(v.into_boxed_slice());
9610 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9614 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9615 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9616 impl Drop for CVec_EventZ {
9617 fn drop(&mut self) {
9618 if self.datalen == 0 { return; }
9619 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9622 impl Clone for CVec_EventZ {
9623 fn clone(&self) -> Self {
9624 let mut res = Vec::new();
9625 if self.datalen == 0 { return Self::from(res); }
9626 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9631 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9632 /// This corresponds to std::vector in C++
9633 pub struct CVec_TransactionZ {
9634 /// The elements in the array.
9635 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9636 pub data: *mut crate::c_types::Transaction,
9637 /// The number of elements pointed to by `data`.
9640 impl CVec_TransactionZ {
9641 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9642 if self.datalen == 0 { return Vec::new(); }
9643 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9644 self.data = core::ptr::null_mut();
9648 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9649 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9652 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9653 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9654 let datalen = v.len();
9655 let data = Box::into_raw(v.into_boxed_slice());
9656 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9660 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9661 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9662 impl Drop for CVec_TransactionZ {
9663 fn drop(&mut self) {
9664 if self.datalen == 0 { return; }
9665 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9668 impl Clone for CVec_TransactionZ {
9669 fn clone(&self) -> Self {
9670 let mut res = Vec::new();
9671 if self.datalen == 0 { return Self::from(res); }
9672 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9677 /// A tuple of 2 elements. See the individual fields for the types contained.
9678 pub struct C2Tuple_u32TxOutZ {
9679 /// The element at position 0
9681 /// The element at position 1
9682 pub b: crate::c_types::TxOut,
9684 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9685 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9692 impl C2Tuple_u32TxOutZ {
9693 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9697 impl Clone for C2Tuple_u32TxOutZ {
9698 fn clone(&self) -> Self {
9700 a: Clone::clone(&self.a),
9701 b: Clone::clone(&self.b),
9706 /// Creates a new tuple which has the same data as `orig`
9707 /// but with all dynamically-allocated buffers duplicated in new buffers.
9708 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9709 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9711 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9712 C2Tuple_u32TxOutZ { a, b, }
9716 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9717 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9719 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9720 /// This corresponds to std::vector in C++
9721 pub struct CVec_C2Tuple_u32TxOutZZ {
9722 /// The elements in the array.
9723 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9724 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9725 /// The number of elements pointed to by `data`.
9728 impl CVec_C2Tuple_u32TxOutZZ {
9729 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9730 if self.datalen == 0 { return Vec::new(); }
9731 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9732 self.data = core::ptr::null_mut();
9736 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9737 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9740 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9741 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9742 let datalen = v.len();
9743 let data = Box::into_raw(v.into_boxed_slice());
9744 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9748 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9749 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9750 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9751 fn drop(&mut self) {
9752 if self.datalen == 0 { return; }
9753 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9756 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9757 fn clone(&self) -> Self {
9758 let mut res = Vec::new();
9759 if self.datalen == 0 { return Self::from(res); }
9760 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9765 /// A tuple of 2 elements. See the individual fields for the types contained.
9766 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9767 /// The element at position 0
9768 pub a: crate::c_types::ThirtyTwoBytes,
9769 /// The element at position 1
9770 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9772 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9773 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9780 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9781 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9785 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9786 fn clone(&self) -> Self {
9788 a: Clone::clone(&self.a),
9789 b: Clone::clone(&self.b),
9794 /// Creates a new tuple which has the same data as `orig`
9795 /// but with all dynamically-allocated buffers duplicated in new buffers.
9796 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9797 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9799 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 {
9800 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9804 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9805 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9807 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9808 /// This corresponds to std::vector in C++
9809 pub struct CVec_TransactionOutputsZ {
9810 /// The elements in the array.
9811 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9812 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9813 /// The number of elements pointed to by `data`.
9816 impl CVec_TransactionOutputsZ {
9817 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9818 if self.datalen == 0 { return Vec::new(); }
9819 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9820 self.data = core::ptr::null_mut();
9824 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9825 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9828 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9829 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9830 let datalen = v.len();
9831 let data = Box::into_raw(v.into_boxed_slice());
9832 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9836 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9837 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9838 impl Drop for CVec_TransactionOutputsZ {
9839 fn drop(&mut self) {
9840 if self.datalen == 0 { return; }
9841 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9844 impl Clone for CVec_TransactionOutputsZ {
9845 fn clone(&self) -> Self {
9846 let mut res = Vec::new();
9847 if self.datalen == 0 { return Self::from(res); }
9848 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9853 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9854 /// This corresponds to std::vector in C++
9855 pub struct CVec_BalanceZ {
9856 /// The elements in the array.
9857 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9858 pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9859 /// The number of elements pointed to by `data`.
9862 impl CVec_BalanceZ {
9863 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9864 if self.datalen == 0 { return Vec::new(); }
9865 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9866 self.data = core::ptr::null_mut();
9870 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9871 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9874 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9875 fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9876 let datalen = v.len();
9877 let data = Box::into_raw(v.into_boxed_slice());
9878 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9882 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9883 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9884 impl Drop for CVec_BalanceZ {
9885 fn drop(&mut self) {
9886 if self.datalen == 0 { return; }
9887 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9890 impl Clone for CVec_BalanceZ {
9891 fn clone(&self) -> Self {
9892 let mut res = Vec::new();
9893 if self.datalen == 0 { return Self::from(res); }
9894 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9899 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9900 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9901 /// A pointer to the contents in the success state.
9902 /// Reading from this pointer when `result_ok` is not set is undefined.
9903 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9904 /// A pointer to the contents in the error state.
9905 /// Reading from this pointer when `result_ok` is set is undefined.
9906 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9909 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9910 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9912 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9913 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9914 /// `err` or `result` depending on the state of `result_ok`.
9915 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
9916 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9917 pub result_ok: bool,
9920 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9921 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9922 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9923 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9924 result: Box::into_raw(Box::new(o)),
9930 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9931 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9932 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9933 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9934 err: Box::into_raw(Box::new(e)),
9939 /// Checks if the given object is currently in the success state
9941 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
9945 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9946 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
9947 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9948 fn drop(&mut self) {
9950 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9951 let _ = unsafe { Box::from_raw(self.contents.result) };
9954 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9955 let _ = unsafe { Box::from_raw(self.contents.err) };
9960 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9961 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9962 let contents = if o.result_ok {
9963 let result = unsafe { o.contents.result };
9964 unsafe { o.contents.result = core::ptr::null_mut() };
9965 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
9967 let err = unsafe { o.contents.err };
9968 unsafe { o.contents.err = core::ptr::null_mut(); }
9969 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
9973 result_ok: o.result_ok,
9978 /// The contents of CResult_NoneLightningErrorZ
9979 pub union CResult_NoneLightningErrorZPtr {
9980 /// Note that this value is always NULL, as there are no contents in the OK variant
9981 pub result: *mut core::ffi::c_void,
9982 /// A pointer to the contents in the error state.
9983 /// Reading from this pointer when `result_ok` is set is undefined.
9984 pub err: *mut crate::lightning::ln::msgs::LightningError,
9987 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
9988 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
9989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9990 pub struct CResult_NoneLightningErrorZ {
9991 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
9992 /// `err` or `result` depending on the state of `result_ok`.
9993 pub contents: CResult_NoneLightningErrorZPtr,
9994 /// Whether this CResult_NoneLightningErrorZ represents a success state.
9995 pub result_ok: bool,
9998 /// Creates a new CResult_NoneLightningErrorZ in the success state.
9999 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10000 CResult_NoneLightningErrorZ {
10001 contents: CResult_NoneLightningErrorZPtr {
10002 result: core::ptr::null_mut(),
10008 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10009 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10010 CResult_NoneLightningErrorZ {
10011 contents: CResult_NoneLightningErrorZPtr {
10012 err: Box::into_raw(Box::new(e)),
10017 /// Checks if the given object is currently in the success state
10019 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10023 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10024 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10025 impl Drop for CResult_NoneLightningErrorZ {
10026 fn drop(&mut self) {
10027 if self.result_ok {
10029 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10030 let _ = unsafe { Box::from_raw(self.contents.err) };
10035 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10036 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10037 let contents = if o.result_ok {
10038 let _ = unsafe { Box::from_raw(o.contents.result) };
10039 o.contents.result = core::ptr::null_mut();
10040 CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10042 let err = unsafe { o.contents.err };
10043 unsafe { o.contents.err = core::ptr::null_mut(); }
10044 CResult_NoneLightningErrorZPtr { err }
10048 result_ok: o.result_ok,
10052 impl Clone for CResult_NoneLightningErrorZ {
10053 fn clone(&self) -> Self {
10054 if self.result_ok {
10055 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10056 result: core::ptr::null_mut()
10059 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10060 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10066 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10067 /// but with all dynamically-allocated buffers duplicated in new buffers.
10068 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10070 /// A tuple of 2 elements. See the individual fields for the types contained.
10071 pub struct C2Tuple_PublicKeyTypeZ {
10072 /// The element at position 0
10073 pub a: crate::c_types::PublicKey,
10074 /// The element at position 1
10075 pub b: crate::lightning::ln::wire::Type,
10077 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10078 fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10085 impl C2Tuple_PublicKeyTypeZ {
10086 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10090 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10092 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10093 C2Tuple_PublicKeyTypeZ { a, b, }
10097 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10098 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10100 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10101 /// This corresponds to std::vector in C++
10102 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10103 /// The elements in the array.
10104 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10105 pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10106 /// The number of elements pointed to by `data`.
10109 impl CVec_C2Tuple_PublicKeyTypeZZ {
10110 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10111 if self.datalen == 0 { return Vec::new(); }
10112 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10113 self.data = core::ptr::null_mut();
10117 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10118 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10121 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10122 fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10123 let datalen = v.len();
10124 let data = Box::into_raw(v.into_boxed_slice());
10125 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10129 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10130 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10131 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10132 fn drop(&mut self) {
10133 if self.datalen == 0 { return; }
10134 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10138 /// The contents of CResult_boolLightningErrorZ
10139 pub union CResult_boolLightningErrorZPtr {
10140 /// A pointer to the contents in the success state.
10141 /// Reading from this pointer when `result_ok` is not set is undefined.
10142 pub result: *mut bool,
10143 /// A pointer to the contents in the error state.
10144 /// Reading from this pointer when `result_ok` is set is undefined.
10145 pub err: *mut crate::lightning::ln::msgs::LightningError,
10148 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10149 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10151 pub struct CResult_boolLightningErrorZ {
10152 /// The contents of this CResult_boolLightningErrorZ, accessible via either
10153 /// `err` or `result` depending on the state of `result_ok`.
10154 pub contents: CResult_boolLightningErrorZPtr,
10155 /// Whether this CResult_boolLightningErrorZ represents a success state.
10156 pub result_ok: bool,
10159 /// Creates a new CResult_boolLightningErrorZ in the success state.
10160 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10161 CResult_boolLightningErrorZ {
10162 contents: CResult_boolLightningErrorZPtr {
10163 result: Box::into_raw(Box::new(o)),
10169 /// Creates a new CResult_boolLightningErrorZ in the error state.
10170 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10171 CResult_boolLightningErrorZ {
10172 contents: CResult_boolLightningErrorZPtr {
10173 err: Box::into_raw(Box::new(e)),
10178 /// Checks if the given object is currently in the success state
10180 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10184 /// Frees any resources used by the CResult_boolLightningErrorZ.
10185 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10186 impl Drop for CResult_boolLightningErrorZ {
10187 fn drop(&mut self) {
10188 if self.result_ok {
10189 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10190 let _ = unsafe { Box::from_raw(self.contents.result) };
10193 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10194 let _ = unsafe { Box::from_raw(self.contents.err) };
10199 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10200 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10201 let contents = if o.result_ok {
10202 let result = unsafe { o.contents.result };
10203 unsafe { o.contents.result = core::ptr::null_mut() };
10204 CResult_boolLightningErrorZPtr { result }
10206 let err = unsafe { o.contents.err };
10207 unsafe { o.contents.err = core::ptr::null_mut(); }
10208 CResult_boolLightningErrorZPtr { err }
10212 result_ok: o.result_ok,
10216 impl Clone for CResult_boolLightningErrorZ {
10217 fn clone(&self) -> Self {
10218 if self.result_ok {
10219 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10220 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10223 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10224 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10230 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10231 /// but with all dynamically-allocated buffers duplicated in new buffers.
10232 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10234 /// A tuple of 3 elements. See the individual fields for the types contained.
10235 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10236 /// The element at position 0
10237 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10238 /// The element at position 1
10239 pub b: crate::lightning::ln::msgs::ChannelUpdate,
10240 /// The element at position 2
10241 pub c: crate::lightning::ln::msgs::ChannelUpdate,
10243 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10244 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10252 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10253 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10254 (self.a, self.b, self.c)
10257 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10258 fn clone(&self) -> Self {
10260 a: Clone::clone(&self.a),
10261 b: Clone::clone(&self.b),
10262 c: Clone::clone(&self.c),
10267 /// Creates a new tuple which has the same data as `orig`
10268 /// but with all dynamically-allocated buffers duplicated in new buffers.
10269 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10270 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10272 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 {
10273 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10277 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10278 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10280 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10281 /// This corresponds to std::vector in C++
10282 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10283 /// The elements in the array.
10284 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10285 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10286 /// The number of elements pointed to by `data`.
10289 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10290 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10291 if self.datalen == 0 { return Vec::new(); }
10292 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10293 self.data = core::ptr::null_mut();
10297 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10298 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10301 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10302 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10303 let datalen = v.len();
10304 let data = Box::into_raw(v.into_boxed_slice());
10305 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10309 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10310 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10311 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10312 fn drop(&mut self) {
10313 if self.datalen == 0 { return; }
10314 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10317 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10318 fn clone(&self) -> Self {
10319 let mut res = Vec::new();
10320 if self.datalen == 0 { return Self::from(res); }
10321 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10326 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10327 /// This corresponds to std::vector in C++
10328 pub struct CVec_NodeAnnouncementZ {
10329 /// The elements in the array.
10330 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10331 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10332 /// The number of elements pointed to by `data`.
10335 impl CVec_NodeAnnouncementZ {
10336 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10337 if self.datalen == 0 { return Vec::new(); }
10338 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10339 self.data = core::ptr::null_mut();
10343 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10344 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10347 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10348 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10349 let datalen = v.len();
10350 let data = Box::into_raw(v.into_boxed_slice());
10351 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10355 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10356 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10357 impl Drop for CVec_NodeAnnouncementZ {
10358 fn drop(&mut self) {
10359 if self.datalen == 0 { return; }
10360 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10363 impl Clone for CVec_NodeAnnouncementZ {
10364 fn clone(&self) -> Self {
10365 let mut res = Vec::new();
10366 if self.datalen == 0 { return Self::from(res); }
10367 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10372 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10373 /// This corresponds to std::vector in C++
10374 pub struct CVec_PublicKeyZ {
10375 /// The elements in the array.
10376 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10377 pub data: *mut crate::c_types::PublicKey,
10378 /// The number of elements pointed to by `data`.
10381 impl CVec_PublicKeyZ {
10382 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10383 if self.datalen == 0 { return Vec::new(); }
10384 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10385 self.data = core::ptr::null_mut();
10389 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10390 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10393 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10394 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10395 let datalen = v.len();
10396 let data = Box::into_raw(v.into_boxed_slice());
10397 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10401 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10402 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10403 impl Drop for CVec_PublicKeyZ {
10404 fn drop(&mut self) {
10405 if self.datalen == 0 { return; }
10406 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10409 impl Clone for CVec_PublicKeyZ {
10410 fn clone(&self) -> Self {
10411 let mut res = Vec::new();
10412 if self.datalen == 0 { return Self::from(res); }
10413 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10418 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10419 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10420 /// A pointer to the contents in the success state.
10421 /// Reading from this pointer when `result_ok` is not set is undefined.
10422 pub result: *mut crate::c_types::derived::CVec_u8Z,
10423 /// A pointer to the contents in the error state.
10424 /// Reading from this pointer when `result_ok` is set is undefined.
10425 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10428 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10429 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10431 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10432 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10433 /// `err` or `result` depending on the state of `result_ok`.
10434 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10435 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10436 pub result_ok: bool,
10439 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10440 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10441 CResult_CVec_u8ZPeerHandleErrorZ {
10442 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10443 result: Box::into_raw(Box::new(o)),
10449 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10450 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10451 CResult_CVec_u8ZPeerHandleErrorZ {
10452 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10453 err: Box::into_raw(Box::new(e)),
10458 /// Checks if the given object is currently in the success state
10460 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10464 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10465 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10466 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10467 fn drop(&mut self) {
10468 if self.result_ok {
10469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10470 let _ = unsafe { Box::from_raw(self.contents.result) };
10473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10474 let _ = unsafe { Box::from_raw(self.contents.err) };
10479 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10480 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10481 let contents = if o.result_ok {
10482 let result = unsafe { o.contents.result };
10483 unsafe { o.contents.result = core::ptr::null_mut() };
10484 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10486 let err = unsafe { o.contents.err };
10487 unsafe { o.contents.err = core::ptr::null_mut(); }
10488 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10492 result_ok: o.result_ok,
10496 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10497 fn clone(&self) -> Self {
10498 if self.result_ok {
10499 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10500 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10503 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10504 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10510 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10511 /// but with all dynamically-allocated buffers duplicated in new buffers.
10512 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10514 /// The contents of CResult_NonePeerHandleErrorZ
10515 pub union CResult_NonePeerHandleErrorZPtr {
10516 /// Note that this value is always NULL, as there are no contents in the OK variant
10517 pub result: *mut core::ffi::c_void,
10518 /// A pointer to the contents in the error state.
10519 /// Reading from this pointer when `result_ok` is set is undefined.
10520 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10523 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10524 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10526 pub struct CResult_NonePeerHandleErrorZ {
10527 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10528 /// `err` or `result` depending on the state of `result_ok`.
10529 pub contents: CResult_NonePeerHandleErrorZPtr,
10530 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10531 pub result_ok: bool,
10534 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10535 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10536 CResult_NonePeerHandleErrorZ {
10537 contents: CResult_NonePeerHandleErrorZPtr {
10538 result: core::ptr::null_mut(),
10544 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10545 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10546 CResult_NonePeerHandleErrorZ {
10547 contents: CResult_NonePeerHandleErrorZPtr {
10548 err: Box::into_raw(Box::new(e)),
10553 /// Checks if the given object is currently in the success state
10555 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10559 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10560 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10561 impl Drop for CResult_NonePeerHandleErrorZ {
10562 fn drop(&mut self) {
10563 if self.result_ok {
10565 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10566 let _ = unsafe { Box::from_raw(self.contents.err) };
10571 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10572 fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10573 let contents = if o.result_ok {
10574 let _ = unsafe { Box::from_raw(o.contents.result) };
10575 o.contents.result = core::ptr::null_mut();
10576 CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10578 let err = unsafe { o.contents.err };
10579 unsafe { o.contents.err = core::ptr::null_mut(); }
10580 CResult_NonePeerHandleErrorZPtr { err }
10584 result_ok: o.result_ok,
10588 impl Clone for CResult_NonePeerHandleErrorZ {
10589 fn clone(&self) -> Self {
10590 if self.result_ok {
10591 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10592 result: core::ptr::null_mut()
10595 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10596 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10602 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10603 /// but with all dynamically-allocated buffers duplicated in new buffers.
10604 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10606 /// The contents of CResult_boolPeerHandleErrorZ
10607 pub union CResult_boolPeerHandleErrorZPtr {
10608 /// A pointer to the contents in the success state.
10609 /// Reading from this pointer when `result_ok` is not set is undefined.
10610 pub result: *mut bool,
10611 /// A pointer to the contents in the error state.
10612 /// Reading from this pointer when `result_ok` is set is undefined.
10613 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10616 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10617 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10619 pub struct CResult_boolPeerHandleErrorZ {
10620 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10621 /// `err` or `result` depending on the state of `result_ok`.
10622 pub contents: CResult_boolPeerHandleErrorZPtr,
10623 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10624 pub result_ok: bool,
10627 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10628 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10629 CResult_boolPeerHandleErrorZ {
10630 contents: CResult_boolPeerHandleErrorZPtr {
10631 result: Box::into_raw(Box::new(o)),
10637 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10638 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10639 CResult_boolPeerHandleErrorZ {
10640 contents: CResult_boolPeerHandleErrorZPtr {
10641 err: Box::into_raw(Box::new(e)),
10646 /// Checks if the given object is currently in the success state
10648 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10652 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10653 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10654 impl Drop for CResult_boolPeerHandleErrorZ {
10655 fn drop(&mut self) {
10656 if self.result_ok {
10657 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10658 let _ = unsafe { Box::from_raw(self.contents.result) };
10661 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10662 let _ = unsafe { Box::from_raw(self.contents.err) };
10667 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10668 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10669 let contents = if o.result_ok {
10670 let result = unsafe { o.contents.result };
10671 unsafe { o.contents.result = core::ptr::null_mut() };
10672 CResult_boolPeerHandleErrorZPtr { result }
10674 let err = unsafe { o.contents.err };
10675 unsafe { o.contents.err = core::ptr::null_mut(); }
10676 CResult_boolPeerHandleErrorZPtr { err }
10680 result_ok: o.result_ok,
10684 impl Clone for CResult_boolPeerHandleErrorZ {
10685 fn clone(&self) -> Self {
10686 if self.result_ok {
10687 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10688 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10691 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10692 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10698 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10699 /// but with all dynamically-allocated buffers duplicated in new buffers.
10700 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10702 /// The contents of CResult_NodeIdDecodeErrorZ
10703 pub union CResult_NodeIdDecodeErrorZPtr {
10704 /// A pointer to the contents in the success state.
10705 /// Reading from this pointer when `result_ok` is not set is undefined.
10706 pub result: *mut crate::lightning::routing::network_graph::NodeId,
10707 /// A pointer to the contents in the error state.
10708 /// Reading from this pointer when `result_ok` is set is undefined.
10709 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10712 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10713 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10714 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10715 pub struct CResult_NodeIdDecodeErrorZ {
10716 /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10717 /// `err` or `result` depending on the state of `result_ok`.
10718 pub contents: CResult_NodeIdDecodeErrorZPtr,
10719 /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10720 pub result_ok: bool,
10723 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10724 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10725 CResult_NodeIdDecodeErrorZ {
10726 contents: CResult_NodeIdDecodeErrorZPtr {
10727 result: Box::into_raw(Box::new(o)),
10733 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10734 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10735 CResult_NodeIdDecodeErrorZ {
10736 contents: CResult_NodeIdDecodeErrorZPtr {
10737 err: Box::into_raw(Box::new(e)),
10742 /// Checks if the given object is currently in the success state
10744 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10748 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10749 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10750 impl Drop for CResult_NodeIdDecodeErrorZ {
10751 fn drop(&mut self) {
10752 if self.result_ok {
10753 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10754 let _ = unsafe { Box::from_raw(self.contents.result) };
10757 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10758 let _ = unsafe { Box::from_raw(self.contents.err) };
10763 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10764 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10765 let contents = if o.result_ok {
10766 let result = unsafe { o.contents.result };
10767 unsafe { o.contents.result = core::ptr::null_mut() };
10768 CResult_NodeIdDecodeErrorZPtr { result }
10770 let err = unsafe { o.contents.err };
10771 unsafe { o.contents.err = core::ptr::null_mut(); }
10772 CResult_NodeIdDecodeErrorZPtr { err }
10776 result_ok: o.result_ok,
10780 impl Clone for CResult_NodeIdDecodeErrorZ {
10781 fn clone(&self) -> Self {
10782 if self.result_ok {
10783 Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10784 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10787 Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10788 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10794 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10795 /// but with all dynamically-allocated buffers duplicated in new buffers.
10796 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10798 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10799 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10800 /// A pointer to the contents in the success state.
10801 /// Reading from this pointer when `result_ok` is not set is undefined.
10802 pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10803 /// A pointer to the contents in the error state.
10804 /// Reading from this pointer when `result_ok` is set is undefined.
10805 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10808 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10809 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10810 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10811 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10812 /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10813 /// `err` or `result` depending on the state of `result_ok`.
10814 pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10815 /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10816 pub result_ok: bool,
10819 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10820 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10821 CResult_COption_NetworkUpdateZDecodeErrorZ {
10822 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10823 result: Box::into_raw(Box::new(o)),
10829 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10830 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10831 CResult_COption_NetworkUpdateZDecodeErrorZ {
10832 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10833 err: Box::into_raw(Box::new(e)),
10838 /// Checks if the given object is currently in the success state
10840 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10844 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10845 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10846 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10847 fn drop(&mut self) {
10848 if self.result_ok {
10849 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10850 let _ = unsafe { Box::from_raw(self.contents.result) };
10853 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10854 let _ = unsafe { Box::from_raw(self.contents.err) };
10859 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10860 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10861 let contents = if o.result_ok {
10862 let result = unsafe { o.contents.result };
10863 unsafe { o.contents.result = core::ptr::null_mut() };
10864 CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10866 let err = unsafe { o.contents.err };
10867 unsafe { o.contents.err = core::ptr::null_mut(); }
10868 CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10872 result_ok: o.result_ok,
10876 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10877 fn clone(&self) -> Self {
10878 if self.result_ok {
10879 Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10880 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10883 Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10884 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10890 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
10891 /// but with all dynamically-allocated buffers duplicated in new buffers.
10892 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
10894 /// An enum which can either contain a crate::lightning::chain::Access or not
10895 pub enum COption_AccessZ {
10896 /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
10897 Some(crate::lightning::chain::Access),
10898 /// When we're in this state, this COption_AccessZ contains nothing
10901 impl COption_AccessZ {
10902 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10903 if let Self::None = self { false } else { true }
10905 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10908 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
10909 if let Self::Some(v) = self { v } else { unreachable!() }
10913 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
10914 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
10915 COption_AccessZ::Some(o)
10918 /// Constructs a new COption_AccessZ containing nothing
10919 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
10920 COption_AccessZ::None
10923 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
10924 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
10926 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
10927 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
10928 /// A pointer to the contents in the success state.
10929 /// Reading from this pointer when `result_ok` is not set is undefined.
10930 pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
10931 /// A pointer to the contents in the error state.
10932 /// Reading from this pointer when `result_ok` is set is undefined.
10933 pub err: *mut crate::lightning::ln::msgs::DecodeError,
10936 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
10937 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10939 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
10940 /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
10941 /// `err` or `result` depending on the state of `result_ok`.
10942 pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
10943 /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
10944 pub result_ok: bool,
10947 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
10948 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
10949 CResult_ChannelUpdateInfoDecodeErrorZ {
10950 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
10951 result: Box::into_raw(Box::new(o)),
10957 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
10958 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
10959 CResult_ChannelUpdateInfoDecodeErrorZ {
10960 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
10961 err: Box::into_raw(Box::new(e)),
10966 /// Checks if the given object is currently in the success state
10968 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
10972 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
10973 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
10974 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
10975 fn drop(&mut self) {
10976 if self.result_ok {
10977 if unsafe { !(self.contents.result as *mut ()).is_null() } {
10978 let _ = unsafe { Box::from_raw(self.contents.result) };
10981 if unsafe { !(self.contents.err as *mut ()).is_null() } {
10982 let _ = unsafe { Box::from_raw(self.contents.err) };
10987 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
10988 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10989 let contents = if o.result_ok {
10990 let result = unsafe { o.contents.result };
10991 unsafe { o.contents.result = core::ptr::null_mut() };
10992 CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
10994 let err = unsafe { o.contents.err };
10995 unsafe { o.contents.err = core::ptr::null_mut(); }
10996 CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11000 result_ok: o.result_ok,
11004 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11005 fn clone(&self) -> Self {
11006 if self.result_ok {
11007 Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11008 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11011 Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11012 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11018 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11019 /// but with all dynamically-allocated buffers duplicated in new buffers.
11020 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11022 /// The contents of CResult_ChannelInfoDecodeErrorZ
11023 pub union CResult_ChannelInfoDecodeErrorZPtr {
11024 /// A pointer to the contents in the success state.
11025 /// Reading from this pointer when `result_ok` is not set is undefined.
11026 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11027 /// A pointer to the contents in the error state.
11028 /// Reading from this pointer when `result_ok` is set is undefined.
11029 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11032 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11033 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11035 pub struct CResult_ChannelInfoDecodeErrorZ {
11036 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11037 /// `err` or `result` depending on the state of `result_ok`.
11038 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11039 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11040 pub result_ok: bool,
11043 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11044 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11045 CResult_ChannelInfoDecodeErrorZ {
11046 contents: CResult_ChannelInfoDecodeErrorZPtr {
11047 result: Box::into_raw(Box::new(o)),
11053 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11054 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11055 CResult_ChannelInfoDecodeErrorZ {
11056 contents: CResult_ChannelInfoDecodeErrorZPtr {
11057 err: Box::into_raw(Box::new(e)),
11062 /// Checks if the given object is currently in the success state
11064 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11068 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11069 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11070 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11071 fn drop(&mut self) {
11072 if self.result_ok {
11073 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11074 let _ = unsafe { Box::from_raw(self.contents.result) };
11077 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11078 let _ = unsafe { Box::from_raw(self.contents.err) };
11083 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11084 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11085 let contents = if o.result_ok {
11086 let result = unsafe { o.contents.result };
11087 unsafe { o.contents.result = core::ptr::null_mut() };
11088 CResult_ChannelInfoDecodeErrorZPtr { result }
11090 let err = unsafe { o.contents.err };
11091 unsafe { o.contents.err = core::ptr::null_mut(); }
11092 CResult_ChannelInfoDecodeErrorZPtr { err }
11096 result_ok: o.result_ok,
11100 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11101 fn clone(&self) -> Self {
11102 if self.result_ok {
11103 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11104 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11107 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11108 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11114 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11115 /// but with all dynamically-allocated buffers duplicated in new buffers.
11116 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11118 /// The contents of CResult_RoutingFeesDecodeErrorZ
11119 pub union CResult_RoutingFeesDecodeErrorZPtr {
11120 /// A pointer to the contents in the success state.
11121 /// Reading from this pointer when `result_ok` is not set is undefined.
11122 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11123 /// A pointer to the contents in the error state.
11124 /// Reading from this pointer when `result_ok` is set is undefined.
11125 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11128 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11129 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11130 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11131 pub struct CResult_RoutingFeesDecodeErrorZ {
11132 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11133 /// `err` or `result` depending on the state of `result_ok`.
11134 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11135 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11136 pub result_ok: bool,
11139 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11140 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11141 CResult_RoutingFeesDecodeErrorZ {
11142 contents: CResult_RoutingFeesDecodeErrorZPtr {
11143 result: Box::into_raw(Box::new(o)),
11149 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11150 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11151 CResult_RoutingFeesDecodeErrorZ {
11152 contents: CResult_RoutingFeesDecodeErrorZPtr {
11153 err: Box::into_raw(Box::new(e)),
11158 /// Checks if the given object is currently in the success state
11160 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11164 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11165 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11166 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11167 fn drop(&mut self) {
11168 if self.result_ok {
11169 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11170 let _ = unsafe { Box::from_raw(self.contents.result) };
11173 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11174 let _ = unsafe { Box::from_raw(self.contents.err) };
11179 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11180 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11181 let contents = if o.result_ok {
11182 let result = unsafe { o.contents.result };
11183 unsafe { o.contents.result = core::ptr::null_mut() };
11184 CResult_RoutingFeesDecodeErrorZPtr { result }
11186 let err = unsafe { o.contents.err };
11187 unsafe { o.contents.err = core::ptr::null_mut(); }
11188 CResult_RoutingFeesDecodeErrorZPtr { err }
11192 result_ok: o.result_ok,
11196 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11197 fn clone(&self) -> Self {
11198 if self.result_ok {
11199 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11200 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11203 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11204 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11210 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11211 /// but with all dynamically-allocated buffers duplicated in new buffers.
11212 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11214 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11215 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11216 /// A pointer to the contents in the success state.
11217 /// Reading from this pointer when `result_ok` is not set is undefined.
11218 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11219 /// A pointer to the contents in the error state.
11220 /// Reading from this pointer when `result_ok` is set is undefined.
11221 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11224 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11225 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11227 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11228 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11229 /// `err` or `result` depending on the state of `result_ok`.
11230 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11231 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11232 pub result_ok: bool,
11235 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11236 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11237 CResult_NodeAnnouncementInfoDecodeErrorZ {
11238 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11239 result: Box::into_raw(Box::new(o)),
11245 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11246 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11247 CResult_NodeAnnouncementInfoDecodeErrorZ {
11248 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11249 err: Box::into_raw(Box::new(e)),
11254 /// Checks if the given object is currently in the success state
11256 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11260 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11261 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11262 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11263 fn drop(&mut self) {
11264 if self.result_ok {
11265 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11266 let _ = unsafe { Box::from_raw(self.contents.result) };
11269 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11270 let _ = unsafe { Box::from_raw(self.contents.err) };
11275 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11276 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11277 let contents = if o.result_ok {
11278 let result = unsafe { o.contents.result };
11279 unsafe { o.contents.result = core::ptr::null_mut() };
11280 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11282 let err = unsafe { o.contents.err };
11283 unsafe { o.contents.err = core::ptr::null_mut(); }
11284 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11288 result_ok: o.result_ok,
11292 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11293 fn clone(&self) -> Self {
11294 if self.result_ok {
11295 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11296 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11299 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11300 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11306 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11307 /// but with all dynamically-allocated buffers duplicated in new buffers.
11308 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11310 /// A dynamically-allocated array of u64s of arbitrary size.
11311 /// This corresponds to std::vector in C++
11312 pub struct CVec_u64Z {
11313 /// The elements in the array.
11314 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11315 pub data: *mut u64,
11316 /// The number of elements pointed to by `data`.
11320 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11321 if self.datalen == 0 { return Vec::new(); }
11322 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11323 self.data = core::ptr::null_mut();
11327 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11328 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11331 impl From<Vec<u64>> for CVec_u64Z {
11332 fn from(v: Vec<u64>) -> Self {
11333 let datalen = v.len();
11334 let data = Box::into_raw(v.into_boxed_slice());
11335 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11339 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11340 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11341 impl Drop for CVec_u64Z {
11342 fn drop(&mut self) {
11343 if self.datalen == 0 { return; }
11344 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11347 impl Clone for CVec_u64Z {
11348 fn clone(&self) -> Self {
11349 let mut res = Vec::new();
11350 if self.datalen == 0 { return Self::from(res); }
11351 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11356 /// The contents of CResult_NodeInfoDecodeErrorZ
11357 pub union CResult_NodeInfoDecodeErrorZPtr {
11358 /// A pointer to the contents in the success state.
11359 /// Reading from this pointer when `result_ok` is not set is undefined.
11360 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11361 /// A pointer to the contents in the error state.
11362 /// Reading from this pointer when `result_ok` is set is undefined.
11363 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11366 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11367 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11368 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11369 pub struct CResult_NodeInfoDecodeErrorZ {
11370 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11371 /// `err` or `result` depending on the state of `result_ok`.
11372 pub contents: CResult_NodeInfoDecodeErrorZPtr,
11373 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11374 pub result_ok: bool,
11377 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11378 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11379 CResult_NodeInfoDecodeErrorZ {
11380 contents: CResult_NodeInfoDecodeErrorZPtr {
11381 result: Box::into_raw(Box::new(o)),
11387 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11388 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11389 CResult_NodeInfoDecodeErrorZ {
11390 contents: CResult_NodeInfoDecodeErrorZPtr {
11391 err: Box::into_raw(Box::new(e)),
11396 /// Checks if the given object is currently in the success state
11398 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11402 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11403 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11404 impl Drop for CResult_NodeInfoDecodeErrorZ {
11405 fn drop(&mut self) {
11406 if self.result_ok {
11407 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11408 let _ = unsafe { Box::from_raw(self.contents.result) };
11411 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11412 let _ = unsafe { Box::from_raw(self.contents.err) };
11417 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11418 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11419 let contents = if o.result_ok {
11420 let result = unsafe { o.contents.result };
11421 unsafe { o.contents.result = core::ptr::null_mut() };
11422 CResult_NodeInfoDecodeErrorZPtr { result }
11424 let err = unsafe { o.contents.err };
11425 unsafe { o.contents.err = core::ptr::null_mut(); }
11426 CResult_NodeInfoDecodeErrorZPtr { err }
11430 result_ok: o.result_ok,
11434 impl Clone for CResult_NodeInfoDecodeErrorZ {
11435 fn clone(&self) -> Self {
11436 if self.result_ok {
11437 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11438 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11441 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11442 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11448 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11449 /// but with all dynamically-allocated buffers duplicated in new buffers.
11450 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11452 /// The contents of CResult_NetworkGraphDecodeErrorZ
11453 pub union CResult_NetworkGraphDecodeErrorZPtr {
11454 /// A pointer to the contents in the success state.
11455 /// Reading from this pointer when `result_ok` is not set is undefined.
11456 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11457 /// A pointer to the contents in the error state.
11458 /// Reading from this pointer when `result_ok` is set is undefined.
11459 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11462 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11463 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11465 pub struct CResult_NetworkGraphDecodeErrorZ {
11466 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11467 /// `err` or `result` depending on the state of `result_ok`.
11468 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11469 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11470 pub result_ok: bool,
11473 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11474 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11475 CResult_NetworkGraphDecodeErrorZ {
11476 contents: CResult_NetworkGraphDecodeErrorZPtr {
11477 result: Box::into_raw(Box::new(o)),
11483 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11484 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11485 CResult_NetworkGraphDecodeErrorZ {
11486 contents: CResult_NetworkGraphDecodeErrorZPtr {
11487 err: Box::into_raw(Box::new(e)),
11492 /// Checks if the given object is currently in the success state
11494 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11498 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11499 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11500 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11501 fn drop(&mut self) {
11502 if self.result_ok {
11503 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11504 let _ = unsafe { Box::from_raw(self.contents.result) };
11507 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11508 let _ = unsafe { Box::from_raw(self.contents.err) };
11513 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11514 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11515 let contents = if o.result_ok {
11516 let result = unsafe { o.contents.result };
11517 unsafe { o.contents.result = core::ptr::null_mut() };
11518 CResult_NetworkGraphDecodeErrorZPtr { result }
11520 let err = unsafe { o.contents.err };
11521 unsafe { o.contents.err = core::ptr::null_mut(); }
11522 CResult_NetworkGraphDecodeErrorZPtr { err }
11526 result_ok: o.result_ok,
11530 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11531 fn clone(&self) -> Self {
11532 if self.result_ok {
11533 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11534 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11537 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11538 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11544 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11545 /// but with all dynamically-allocated buffers duplicated in new buffers.
11546 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11549 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11550 pub enum COption_CVec_NetAddressZZ {
11551 /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11552 Some(crate::c_types::derived::CVec_NetAddressZ),
11553 /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11556 impl COption_CVec_NetAddressZZ {
11557 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11558 if let Self::None = self { false } else { true }
11560 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11563 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11564 if let Self::Some(v) = self { v } else { unreachable!() }
11568 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11569 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11570 COption_CVec_NetAddressZZ::Some(o)
11573 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11574 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11575 COption_CVec_NetAddressZZ::None
11578 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11579 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11581 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11582 /// but with all dynamically-allocated buffers duplicated in new buffers.
11583 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11585 /// The contents of CResult_NetAddressDecodeErrorZ
11586 pub union CResult_NetAddressDecodeErrorZPtr {
11587 /// A pointer to the contents in the success state.
11588 /// Reading from this pointer when `result_ok` is not set is undefined.
11589 pub result: *mut crate::lightning::ln::msgs::NetAddress,
11590 /// A pointer to the contents in the error state.
11591 /// Reading from this pointer when `result_ok` is set is undefined.
11592 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11595 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11596 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11597 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11598 pub struct CResult_NetAddressDecodeErrorZ {
11599 /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11600 /// `err` or `result` depending on the state of `result_ok`.
11601 pub contents: CResult_NetAddressDecodeErrorZPtr,
11602 /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11603 pub result_ok: bool,
11606 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11607 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11608 CResult_NetAddressDecodeErrorZ {
11609 contents: CResult_NetAddressDecodeErrorZPtr {
11610 result: Box::into_raw(Box::new(o)),
11616 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11617 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11618 CResult_NetAddressDecodeErrorZ {
11619 contents: CResult_NetAddressDecodeErrorZPtr {
11620 err: Box::into_raw(Box::new(e)),
11625 /// Checks if the given object is currently in the success state
11627 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11631 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11632 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11633 impl Drop for CResult_NetAddressDecodeErrorZ {
11634 fn drop(&mut self) {
11635 if self.result_ok {
11636 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11637 let _ = unsafe { Box::from_raw(self.contents.result) };
11640 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11641 let _ = unsafe { Box::from_raw(self.contents.err) };
11646 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11647 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11648 let contents = if o.result_ok {
11649 let result = unsafe { o.contents.result };
11650 unsafe { o.contents.result = core::ptr::null_mut() };
11651 CResult_NetAddressDecodeErrorZPtr { result }
11653 let err = unsafe { o.contents.err };
11654 unsafe { o.contents.err = core::ptr::null_mut(); }
11655 CResult_NetAddressDecodeErrorZPtr { err }
11659 result_ok: o.result_ok,
11663 impl Clone for CResult_NetAddressDecodeErrorZ {
11664 fn clone(&self) -> Self {
11665 if self.result_ok {
11666 Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11667 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11670 Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11671 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11677 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11678 /// but with all dynamically-allocated buffers duplicated in new buffers.
11679 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11681 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11682 /// This corresponds to std::vector in C++
11683 pub struct CVec_UpdateAddHTLCZ {
11684 /// The elements in the array.
11685 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11686 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11687 /// The number of elements pointed to by `data`.
11690 impl CVec_UpdateAddHTLCZ {
11691 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11692 if self.datalen == 0 { return Vec::new(); }
11693 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11694 self.data = core::ptr::null_mut();
11698 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11699 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11702 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11703 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11704 let datalen = v.len();
11705 let data = Box::into_raw(v.into_boxed_slice());
11706 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11710 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11711 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11712 impl Drop for CVec_UpdateAddHTLCZ {
11713 fn drop(&mut self) {
11714 if self.datalen == 0 { return; }
11715 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11718 impl Clone for CVec_UpdateAddHTLCZ {
11719 fn clone(&self) -> Self {
11720 let mut res = Vec::new();
11721 if self.datalen == 0 { return Self::from(res); }
11722 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11727 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11728 /// This corresponds to std::vector in C++
11729 pub struct CVec_UpdateFulfillHTLCZ {
11730 /// The elements in the array.
11731 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11732 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11733 /// The number of elements pointed to by `data`.
11736 impl CVec_UpdateFulfillHTLCZ {
11737 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11738 if self.datalen == 0 { return Vec::new(); }
11739 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11740 self.data = core::ptr::null_mut();
11744 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11745 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11748 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11749 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11750 let datalen = v.len();
11751 let data = Box::into_raw(v.into_boxed_slice());
11752 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11756 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11757 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11758 impl Drop for CVec_UpdateFulfillHTLCZ {
11759 fn drop(&mut self) {
11760 if self.datalen == 0 { return; }
11761 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11764 impl Clone for CVec_UpdateFulfillHTLCZ {
11765 fn clone(&self) -> Self {
11766 let mut res = Vec::new();
11767 if self.datalen == 0 { return Self::from(res); }
11768 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11773 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11774 /// This corresponds to std::vector in C++
11775 pub struct CVec_UpdateFailHTLCZ {
11776 /// The elements in the array.
11777 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11778 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11779 /// The number of elements pointed to by `data`.
11782 impl CVec_UpdateFailHTLCZ {
11783 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11784 if self.datalen == 0 { return Vec::new(); }
11785 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11786 self.data = core::ptr::null_mut();
11790 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11791 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11794 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11795 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11796 let datalen = v.len();
11797 let data = Box::into_raw(v.into_boxed_slice());
11798 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11802 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11803 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11804 impl Drop for CVec_UpdateFailHTLCZ {
11805 fn drop(&mut self) {
11806 if self.datalen == 0 { return; }
11807 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11810 impl Clone for CVec_UpdateFailHTLCZ {
11811 fn clone(&self) -> Self {
11812 let mut res = Vec::new();
11813 if self.datalen == 0 { return Self::from(res); }
11814 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11819 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11820 /// This corresponds to std::vector in C++
11821 pub struct CVec_UpdateFailMalformedHTLCZ {
11822 /// The elements in the array.
11823 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11824 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11825 /// The number of elements pointed to by `data`.
11828 impl CVec_UpdateFailMalformedHTLCZ {
11829 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11830 if self.datalen == 0 { return Vec::new(); }
11831 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11832 self.data = core::ptr::null_mut();
11836 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11837 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11840 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11841 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11842 let datalen = v.len();
11843 let data = Box::into_raw(v.into_boxed_slice());
11844 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11848 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11849 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11850 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11851 fn drop(&mut self) {
11852 if self.datalen == 0 { return; }
11853 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11856 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11857 fn clone(&self) -> Self {
11858 let mut res = Vec::new();
11859 if self.datalen == 0 { return Self::from(res); }
11860 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11865 /// The contents of CResult_AcceptChannelDecodeErrorZ
11866 pub union CResult_AcceptChannelDecodeErrorZPtr {
11867 /// A pointer to the contents in the success state.
11868 /// Reading from this pointer when `result_ok` is not set is undefined.
11869 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11870 /// A pointer to the contents in the error state.
11871 /// Reading from this pointer when `result_ok` is set is undefined.
11872 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11875 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11876 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11878 pub struct CResult_AcceptChannelDecodeErrorZ {
11879 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11880 /// `err` or `result` depending on the state of `result_ok`.
11881 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11882 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11883 pub result_ok: bool,
11886 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
11887 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
11888 CResult_AcceptChannelDecodeErrorZ {
11889 contents: CResult_AcceptChannelDecodeErrorZPtr {
11890 result: Box::into_raw(Box::new(o)),
11896 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
11897 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
11898 CResult_AcceptChannelDecodeErrorZ {
11899 contents: CResult_AcceptChannelDecodeErrorZPtr {
11900 err: Box::into_raw(Box::new(e)),
11905 /// Checks if the given object is currently in the success state
11907 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
11911 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
11912 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
11913 impl Drop for CResult_AcceptChannelDecodeErrorZ {
11914 fn drop(&mut self) {
11915 if self.result_ok {
11916 if unsafe { !(self.contents.result as *mut ()).is_null() } {
11917 let _ = unsafe { Box::from_raw(self.contents.result) };
11920 if unsafe { !(self.contents.err as *mut ()).is_null() } {
11921 let _ = unsafe { Box::from_raw(self.contents.err) };
11926 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
11927 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
11928 let contents = if o.result_ok {
11929 let result = unsafe { o.contents.result };
11930 unsafe { o.contents.result = core::ptr::null_mut() };
11931 CResult_AcceptChannelDecodeErrorZPtr { result }
11933 let err = unsafe { o.contents.err };
11934 unsafe { o.contents.err = core::ptr::null_mut(); }
11935 CResult_AcceptChannelDecodeErrorZPtr { err }
11939 result_ok: o.result_ok,
11943 impl Clone for CResult_AcceptChannelDecodeErrorZ {
11944 fn clone(&self) -> Self {
11945 if self.result_ok {
11946 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
11947 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
11950 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
11951 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11957 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
11958 /// but with all dynamically-allocated buffers duplicated in new buffers.
11959 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
11961 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
11962 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
11963 /// A pointer to the contents in the success state.
11964 /// Reading from this pointer when `result_ok` is not set is undefined.
11965 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
11966 /// A pointer to the contents in the error state.
11967 /// Reading from this pointer when `result_ok` is set is undefined.
11968 pub err: *mut crate::lightning::ln::msgs::DecodeError,
11971 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
11972 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
11973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11974 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
11975 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
11976 /// `err` or `result` depending on the state of `result_ok`.
11977 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
11978 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
11979 pub result_ok: bool,
11982 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
11983 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11984 CResult_AnnouncementSignaturesDecodeErrorZ {
11985 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11986 result: Box::into_raw(Box::new(o)),
11992 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
11993 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11994 CResult_AnnouncementSignaturesDecodeErrorZ {
11995 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11996 err: Box::into_raw(Box::new(e)),
12001 /// Checks if the given object is currently in the success state
12003 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12007 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12008 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12009 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12010 fn drop(&mut self) {
12011 if self.result_ok {
12012 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12013 let _ = unsafe { Box::from_raw(self.contents.result) };
12016 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12017 let _ = unsafe { Box::from_raw(self.contents.err) };
12022 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12023 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12024 let contents = if o.result_ok {
12025 let result = unsafe { o.contents.result };
12026 unsafe { o.contents.result = core::ptr::null_mut() };
12027 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12029 let err = unsafe { o.contents.err };
12030 unsafe { o.contents.err = core::ptr::null_mut(); }
12031 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12035 result_ok: o.result_ok,
12039 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12040 fn clone(&self) -> Self {
12041 if self.result_ok {
12042 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12043 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12046 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12047 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12053 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12054 /// but with all dynamically-allocated buffers duplicated in new buffers.
12055 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12057 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12058 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12059 /// A pointer to the contents in the success state.
12060 /// Reading from this pointer when `result_ok` is not set is undefined.
12061 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12062 /// A pointer to the contents in the error state.
12063 /// Reading from this pointer when `result_ok` is set is undefined.
12064 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12067 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12068 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12070 pub struct CResult_ChannelReestablishDecodeErrorZ {
12071 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12072 /// `err` or `result` depending on the state of `result_ok`.
12073 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12074 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12075 pub result_ok: bool,
12078 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12079 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12080 CResult_ChannelReestablishDecodeErrorZ {
12081 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12082 result: Box::into_raw(Box::new(o)),
12088 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12089 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12090 CResult_ChannelReestablishDecodeErrorZ {
12091 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12092 err: Box::into_raw(Box::new(e)),
12097 /// Checks if the given object is currently in the success state
12099 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12103 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12104 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12105 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12106 fn drop(&mut self) {
12107 if self.result_ok {
12108 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12109 let _ = unsafe { Box::from_raw(self.contents.result) };
12112 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12113 let _ = unsafe { Box::from_raw(self.contents.err) };
12118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12119 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12120 let contents = if o.result_ok {
12121 let result = unsafe { o.contents.result };
12122 unsafe { o.contents.result = core::ptr::null_mut() };
12123 CResult_ChannelReestablishDecodeErrorZPtr { result }
12125 let err = unsafe { o.contents.err };
12126 unsafe { o.contents.err = core::ptr::null_mut(); }
12127 CResult_ChannelReestablishDecodeErrorZPtr { err }
12131 result_ok: o.result_ok,
12135 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12136 fn clone(&self) -> Self {
12137 if self.result_ok {
12138 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12139 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12142 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12143 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12149 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12150 /// but with all dynamically-allocated buffers duplicated in new buffers.
12151 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12153 /// The contents of CResult_ClosingSignedDecodeErrorZ
12154 pub union CResult_ClosingSignedDecodeErrorZPtr {
12155 /// A pointer to the contents in the success state.
12156 /// Reading from this pointer when `result_ok` is not set is undefined.
12157 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12158 /// A pointer to the contents in the error state.
12159 /// Reading from this pointer when `result_ok` is set is undefined.
12160 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12163 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12164 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12165 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12166 pub struct CResult_ClosingSignedDecodeErrorZ {
12167 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12168 /// `err` or `result` depending on the state of `result_ok`.
12169 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12170 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12171 pub result_ok: bool,
12174 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12175 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12176 CResult_ClosingSignedDecodeErrorZ {
12177 contents: CResult_ClosingSignedDecodeErrorZPtr {
12178 result: Box::into_raw(Box::new(o)),
12184 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12185 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12186 CResult_ClosingSignedDecodeErrorZ {
12187 contents: CResult_ClosingSignedDecodeErrorZPtr {
12188 err: Box::into_raw(Box::new(e)),
12193 /// Checks if the given object is currently in the success state
12195 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12199 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12200 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12201 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12202 fn drop(&mut self) {
12203 if self.result_ok {
12204 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12205 let _ = unsafe { Box::from_raw(self.contents.result) };
12208 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12209 let _ = unsafe { Box::from_raw(self.contents.err) };
12214 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12215 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12216 let contents = if o.result_ok {
12217 let result = unsafe { o.contents.result };
12218 unsafe { o.contents.result = core::ptr::null_mut() };
12219 CResult_ClosingSignedDecodeErrorZPtr { result }
12221 let err = unsafe { o.contents.err };
12222 unsafe { o.contents.err = core::ptr::null_mut(); }
12223 CResult_ClosingSignedDecodeErrorZPtr { err }
12227 result_ok: o.result_ok,
12231 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12232 fn clone(&self) -> Self {
12233 if self.result_ok {
12234 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12235 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12238 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12239 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12245 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12246 /// but with all dynamically-allocated buffers duplicated in new buffers.
12247 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12249 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12250 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12251 /// A pointer to the contents in the success state.
12252 /// Reading from this pointer when `result_ok` is not set is undefined.
12253 pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12254 /// A pointer to the contents in the error state.
12255 /// Reading from this pointer when `result_ok` is set is undefined.
12256 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12259 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12260 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12261 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12262 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12263 /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12264 /// `err` or `result` depending on the state of `result_ok`.
12265 pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12266 /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12267 pub result_ok: bool,
12270 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12271 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12272 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12273 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12274 result: Box::into_raw(Box::new(o)),
12280 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12281 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12282 CResult_ClosingSignedFeeRangeDecodeErrorZ {
12283 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12284 err: Box::into_raw(Box::new(e)),
12289 /// Checks if the given object is currently in the success state
12291 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12295 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12296 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12297 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12298 fn drop(&mut self) {
12299 if self.result_ok {
12300 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12301 let _ = unsafe { Box::from_raw(self.contents.result) };
12304 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12305 let _ = unsafe { Box::from_raw(self.contents.err) };
12310 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12311 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12312 let contents = if o.result_ok {
12313 let result = unsafe { o.contents.result };
12314 unsafe { o.contents.result = core::ptr::null_mut() };
12315 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12317 let err = unsafe { o.contents.err };
12318 unsafe { o.contents.err = core::ptr::null_mut(); }
12319 CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12323 result_ok: o.result_ok,
12327 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12328 fn clone(&self) -> Self {
12329 if self.result_ok {
12330 Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12331 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12334 Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12335 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12341 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12342 /// but with all dynamically-allocated buffers duplicated in new buffers.
12343 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12345 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12346 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12347 /// A pointer to the contents in the success state.
12348 /// Reading from this pointer when `result_ok` is not set is undefined.
12349 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12350 /// A pointer to the contents in the error state.
12351 /// Reading from this pointer when `result_ok` is set is undefined.
12352 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12355 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12356 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12357 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12358 pub struct CResult_CommitmentSignedDecodeErrorZ {
12359 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12360 /// `err` or `result` depending on the state of `result_ok`.
12361 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12362 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12363 pub result_ok: bool,
12366 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12367 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12368 CResult_CommitmentSignedDecodeErrorZ {
12369 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12370 result: Box::into_raw(Box::new(o)),
12376 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12377 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12378 CResult_CommitmentSignedDecodeErrorZ {
12379 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12380 err: Box::into_raw(Box::new(e)),
12385 /// Checks if the given object is currently in the success state
12387 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12391 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12392 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12393 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12394 fn drop(&mut self) {
12395 if self.result_ok {
12396 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12397 let _ = unsafe { Box::from_raw(self.contents.result) };
12400 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12401 let _ = unsafe { Box::from_raw(self.contents.err) };
12406 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12407 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12408 let contents = if o.result_ok {
12409 let result = unsafe { o.contents.result };
12410 unsafe { o.contents.result = core::ptr::null_mut() };
12411 CResult_CommitmentSignedDecodeErrorZPtr { result }
12413 let err = unsafe { o.contents.err };
12414 unsafe { o.contents.err = core::ptr::null_mut(); }
12415 CResult_CommitmentSignedDecodeErrorZPtr { err }
12419 result_ok: o.result_ok,
12423 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12424 fn clone(&self) -> Self {
12425 if self.result_ok {
12426 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12427 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12430 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12431 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12437 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12438 /// but with all dynamically-allocated buffers duplicated in new buffers.
12439 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12441 /// The contents of CResult_FundingCreatedDecodeErrorZ
12442 pub union CResult_FundingCreatedDecodeErrorZPtr {
12443 /// A pointer to the contents in the success state.
12444 /// Reading from this pointer when `result_ok` is not set is undefined.
12445 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12446 /// A pointer to the contents in the error state.
12447 /// Reading from this pointer when `result_ok` is set is undefined.
12448 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12451 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12452 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12453 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12454 pub struct CResult_FundingCreatedDecodeErrorZ {
12455 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12456 /// `err` or `result` depending on the state of `result_ok`.
12457 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12458 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12459 pub result_ok: bool,
12462 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12463 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12464 CResult_FundingCreatedDecodeErrorZ {
12465 contents: CResult_FundingCreatedDecodeErrorZPtr {
12466 result: Box::into_raw(Box::new(o)),
12472 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12473 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12474 CResult_FundingCreatedDecodeErrorZ {
12475 contents: CResult_FundingCreatedDecodeErrorZPtr {
12476 err: Box::into_raw(Box::new(e)),
12481 /// Checks if the given object is currently in the success state
12483 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12487 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12488 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12489 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12490 fn drop(&mut self) {
12491 if self.result_ok {
12492 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12493 let _ = unsafe { Box::from_raw(self.contents.result) };
12496 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12497 let _ = unsafe { Box::from_raw(self.contents.err) };
12502 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12503 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12504 let contents = if o.result_ok {
12505 let result = unsafe { o.contents.result };
12506 unsafe { o.contents.result = core::ptr::null_mut() };
12507 CResult_FundingCreatedDecodeErrorZPtr { result }
12509 let err = unsafe { o.contents.err };
12510 unsafe { o.contents.err = core::ptr::null_mut(); }
12511 CResult_FundingCreatedDecodeErrorZPtr { err }
12515 result_ok: o.result_ok,
12519 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12520 fn clone(&self) -> Self {
12521 if self.result_ok {
12522 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12523 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12526 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12527 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12533 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12534 /// but with all dynamically-allocated buffers duplicated in new buffers.
12535 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12537 /// The contents of CResult_FundingSignedDecodeErrorZ
12538 pub union CResult_FundingSignedDecodeErrorZPtr {
12539 /// A pointer to the contents in the success state.
12540 /// Reading from this pointer when `result_ok` is not set is undefined.
12541 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12542 /// A pointer to the contents in the error state.
12543 /// Reading from this pointer when `result_ok` is set is undefined.
12544 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12547 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12548 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12549 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12550 pub struct CResult_FundingSignedDecodeErrorZ {
12551 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12552 /// `err` or `result` depending on the state of `result_ok`.
12553 pub contents: CResult_FundingSignedDecodeErrorZPtr,
12554 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12555 pub result_ok: bool,
12558 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12559 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12560 CResult_FundingSignedDecodeErrorZ {
12561 contents: CResult_FundingSignedDecodeErrorZPtr {
12562 result: Box::into_raw(Box::new(o)),
12568 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12569 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12570 CResult_FundingSignedDecodeErrorZ {
12571 contents: CResult_FundingSignedDecodeErrorZPtr {
12572 err: Box::into_raw(Box::new(e)),
12577 /// Checks if the given object is currently in the success state
12579 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12583 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12584 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12585 impl Drop for CResult_FundingSignedDecodeErrorZ {
12586 fn drop(&mut self) {
12587 if self.result_ok {
12588 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12589 let _ = unsafe { Box::from_raw(self.contents.result) };
12592 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12593 let _ = unsafe { Box::from_raw(self.contents.err) };
12598 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12599 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12600 let contents = if o.result_ok {
12601 let result = unsafe { o.contents.result };
12602 unsafe { o.contents.result = core::ptr::null_mut() };
12603 CResult_FundingSignedDecodeErrorZPtr { result }
12605 let err = unsafe { o.contents.err };
12606 unsafe { o.contents.err = core::ptr::null_mut(); }
12607 CResult_FundingSignedDecodeErrorZPtr { err }
12611 result_ok: o.result_ok,
12615 impl Clone for CResult_FundingSignedDecodeErrorZ {
12616 fn clone(&self) -> Self {
12617 if self.result_ok {
12618 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12619 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12622 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12623 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12629 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12630 /// but with all dynamically-allocated buffers duplicated in new buffers.
12631 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12633 /// The contents of CResult_FundingLockedDecodeErrorZ
12634 pub union CResult_FundingLockedDecodeErrorZPtr {
12635 /// A pointer to the contents in the success state.
12636 /// Reading from this pointer when `result_ok` is not set is undefined.
12637 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12638 /// A pointer to the contents in the error state.
12639 /// Reading from this pointer when `result_ok` is set is undefined.
12640 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12643 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12644 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12645 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12646 pub struct CResult_FundingLockedDecodeErrorZ {
12647 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12648 /// `err` or `result` depending on the state of `result_ok`.
12649 pub contents: CResult_FundingLockedDecodeErrorZPtr,
12650 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12651 pub result_ok: bool,
12654 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12655 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12656 CResult_FundingLockedDecodeErrorZ {
12657 contents: CResult_FundingLockedDecodeErrorZPtr {
12658 result: Box::into_raw(Box::new(o)),
12664 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12665 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12666 CResult_FundingLockedDecodeErrorZ {
12667 contents: CResult_FundingLockedDecodeErrorZPtr {
12668 err: Box::into_raw(Box::new(e)),
12673 /// Checks if the given object is currently in the success state
12675 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12679 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12680 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12681 impl Drop for CResult_FundingLockedDecodeErrorZ {
12682 fn drop(&mut self) {
12683 if self.result_ok {
12684 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12685 let _ = unsafe { Box::from_raw(self.contents.result) };
12688 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12689 let _ = unsafe { Box::from_raw(self.contents.err) };
12694 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12695 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12696 let contents = if o.result_ok {
12697 let result = unsafe { o.contents.result };
12698 unsafe { o.contents.result = core::ptr::null_mut() };
12699 CResult_FundingLockedDecodeErrorZPtr { result }
12701 let err = unsafe { o.contents.err };
12702 unsafe { o.contents.err = core::ptr::null_mut(); }
12703 CResult_FundingLockedDecodeErrorZPtr { err }
12707 result_ok: o.result_ok,
12711 impl Clone for CResult_FundingLockedDecodeErrorZ {
12712 fn clone(&self) -> Self {
12713 if self.result_ok {
12714 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12715 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12718 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12719 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12725 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12726 /// but with all dynamically-allocated buffers duplicated in new buffers.
12727 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12729 /// The contents of CResult_InitDecodeErrorZ
12730 pub union CResult_InitDecodeErrorZPtr {
12731 /// A pointer to the contents in the success state.
12732 /// Reading from this pointer when `result_ok` is not set is undefined.
12733 pub result: *mut crate::lightning::ln::msgs::Init,
12734 /// A pointer to the contents in the error state.
12735 /// Reading from this pointer when `result_ok` is set is undefined.
12736 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12739 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12740 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12741 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12742 pub struct CResult_InitDecodeErrorZ {
12743 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12744 /// `err` or `result` depending on the state of `result_ok`.
12745 pub contents: CResult_InitDecodeErrorZPtr,
12746 /// Whether this CResult_InitDecodeErrorZ represents a success state.
12747 pub result_ok: bool,
12750 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12751 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12752 CResult_InitDecodeErrorZ {
12753 contents: CResult_InitDecodeErrorZPtr {
12754 result: Box::into_raw(Box::new(o)),
12760 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12761 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12762 CResult_InitDecodeErrorZ {
12763 contents: CResult_InitDecodeErrorZPtr {
12764 err: Box::into_raw(Box::new(e)),
12769 /// Checks if the given object is currently in the success state
12771 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12775 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12776 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12777 impl Drop for CResult_InitDecodeErrorZ {
12778 fn drop(&mut self) {
12779 if self.result_ok {
12780 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12781 let _ = unsafe { Box::from_raw(self.contents.result) };
12784 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12785 let _ = unsafe { Box::from_raw(self.contents.err) };
12790 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12791 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12792 let contents = if o.result_ok {
12793 let result = unsafe { o.contents.result };
12794 unsafe { o.contents.result = core::ptr::null_mut() };
12795 CResult_InitDecodeErrorZPtr { result }
12797 let err = unsafe { o.contents.err };
12798 unsafe { o.contents.err = core::ptr::null_mut(); }
12799 CResult_InitDecodeErrorZPtr { err }
12803 result_ok: o.result_ok,
12807 impl Clone for CResult_InitDecodeErrorZ {
12808 fn clone(&self) -> Self {
12809 if self.result_ok {
12810 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12811 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12814 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12815 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12821 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12822 /// but with all dynamically-allocated buffers duplicated in new buffers.
12823 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12825 /// The contents of CResult_OpenChannelDecodeErrorZ
12826 pub union CResult_OpenChannelDecodeErrorZPtr {
12827 /// A pointer to the contents in the success state.
12828 /// Reading from this pointer when `result_ok` is not set is undefined.
12829 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12830 /// A pointer to the contents in the error state.
12831 /// Reading from this pointer when `result_ok` is set is undefined.
12832 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12835 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12836 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12837 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12838 pub struct CResult_OpenChannelDecodeErrorZ {
12839 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12840 /// `err` or `result` depending on the state of `result_ok`.
12841 pub contents: CResult_OpenChannelDecodeErrorZPtr,
12842 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12843 pub result_ok: bool,
12846 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12847 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12848 CResult_OpenChannelDecodeErrorZ {
12849 contents: CResult_OpenChannelDecodeErrorZPtr {
12850 result: Box::into_raw(Box::new(o)),
12856 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12857 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12858 CResult_OpenChannelDecodeErrorZ {
12859 contents: CResult_OpenChannelDecodeErrorZPtr {
12860 err: Box::into_raw(Box::new(e)),
12865 /// Checks if the given object is currently in the success state
12867 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12871 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12872 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12873 impl Drop for CResult_OpenChannelDecodeErrorZ {
12874 fn drop(&mut self) {
12875 if self.result_ok {
12876 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12877 let _ = unsafe { Box::from_raw(self.contents.result) };
12880 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12881 let _ = unsafe { Box::from_raw(self.contents.err) };
12886 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
12887 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12888 let contents = if o.result_ok {
12889 let result = unsafe { o.contents.result };
12890 unsafe { o.contents.result = core::ptr::null_mut() };
12891 CResult_OpenChannelDecodeErrorZPtr { result }
12893 let err = unsafe { o.contents.err };
12894 unsafe { o.contents.err = core::ptr::null_mut(); }
12895 CResult_OpenChannelDecodeErrorZPtr { err }
12899 result_ok: o.result_ok,
12903 impl Clone for CResult_OpenChannelDecodeErrorZ {
12904 fn clone(&self) -> Self {
12905 if self.result_ok {
12906 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
12907 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
12910 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
12911 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12917 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
12918 /// but with all dynamically-allocated buffers duplicated in new buffers.
12919 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
12921 /// The contents of CResult_RevokeAndACKDecodeErrorZ
12922 pub union CResult_RevokeAndACKDecodeErrorZPtr {
12923 /// A pointer to the contents in the success state.
12924 /// Reading from this pointer when `result_ok` is not set is undefined.
12925 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
12926 /// A pointer to the contents in the error state.
12927 /// Reading from this pointer when `result_ok` is set is undefined.
12928 pub err: *mut crate::lightning::ln::msgs::DecodeError,
12931 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
12932 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
12933 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12934 pub struct CResult_RevokeAndACKDecodeErrorZ {
12935 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
12936 /// `err` or `result` depending on the state of `result_ok`.
12937 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
12938 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
12939 pub result_ok: bool,
12942 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
12943 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
12944 CResult_RevokeAndACKDecodeErrorZ {
12945 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12946 result: Box::into_raw(Box::new(o)),
12952 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
12953 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
12954 CResult_RevokeAndACKDecodeErrorZ {
12955 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12956 err: Box::into_raw(Box::new(e)),
12961 /// Checks if the given object is currently in the success state
12963 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
12967 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
12968 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
12969 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
12970 fn drop(&mut self) {
12971 if self.result_ok {
12972 if unsafe { !(self.contents.result as *mut ()).is_null() } {
12973 let _ = unsafe { Box::from_raw(self.contents.result) };
12976 if unsafe { !(self.contents.err as *mut ()).is_null() } {
12977 let _ = unsafe { Box::from_raw(self.contents.err) };
12982 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
12983 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
12984 let contents = if o.result_ok {
12985 let result = unsafe { o.contents.result };
12986 unsafe { o.contents.result = core::ptr::null_mut() };
12987 CResult_RevokeAndACKDecodeErrorZPtr { result }
12989 let err = unsafe { o.contents.err };
12990 unsafe { o.contents.err = core::ptr::null_mut(); }
12991 CResult_RevokeAndACKDecodeErrorZPtr { err }
12995 result_ok: o.result_ok,
12999 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13000 fn clone(&self) -> Self {
13001 if self.result_ok {
13002 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13003 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13006 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13007 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13013 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13014 /// but with all dynamically-allocated buffers duplicated in new buffers.
13015 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13017 /// The contents of CResult_ShutdownDecodeErrorZ
13018 pub union CResult_ShutdownDecodeErrorZPtr {
13019 /// A pointer to the contents in the success state.
13020 /// Reading from this pointer when `result_ok` is not set is undefined.
13021 pub result: *mut crate::lightning::ln::msgs::Shutdown,
13022 /// A pointer to the contents in the error state.
13023 /// Reading from this pointer when `result_ok` is set is undefined.
13024 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13027 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13028 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13029 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13030 pub struct CResult_ShutdownDecodeErrorZ {
13031 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13032 /// `err` or `result` depending on the state of `result_ok`.
13033 pub contents: CResult_ShutdownDecodeErrorZPtr,
13034 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13035 pub result_ok: bool,
13038 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13039 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13040 CResult_ShutdownDecodeErrorZ {
13041 contents: CResult_ShutdownDecodeErrorZPtr {
13042 result: Box::into_raw(Box::new(o)),
13048 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13049 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13050 CResult_ShutdownDecodeErrorZ {
13051 contents: CResult_ShutdownDecodeErrorZPtr {
13052 err: Box::into_raw(Box::new(e)),
13057 /// Checks if the given object is currently in the success state
13059 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13063 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13064 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13065 impl Drop for CResult_ShutdownDecodeErrorZ {
13066 fn drop(&mut self) {
13067 if self.result_ok {
13068 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13069 let _ = unsafe { Box::from_raw(self.contents.result) };
13072 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13073 let _ = unsafe { Box::from_raw(self.contents.err) };
13078 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13079 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13080 let contents = if o.result_ok {
13081 let result = unsafe { o.contents.result };
13082 unsafe { o.contents.result = core::ptr::null_mut() };
13083 CResult_ShutdownDecodeErrorZPtr { result }
13085 let err = unsafe { o.contents.err };
13086 unsafe { o.contents.err = core::ptr::null_mut(); }
13087 CResult_ShutdownDecodeErrorZPtr { err }
13091 result_ok: o.result_ok,
13095 impl Clone for CResult_ShutdownDecodeErrorZ {
13096 fn clone(&self) -> Self {
13097 if self.result_ok {
13098 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13099 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13102 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13103 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13109 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13110 /// but with all dynamically-allocated buffers duplicated in new buffers.
13111 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13113 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13114 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13115 /// A pointer to the contents in the success state.
13116 /// Reading from this pointer when `result_ok` is not set is undefined.
13117 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13118 /// A pointer to the contents in the error state.
13119 /// Reading from this pointer when `result_ok` is set is undefined.
13120 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13123 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13124 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13126 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13127 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13128 /// `err` or `result` depending on the state of `result_ok`.
13129 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13130 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13131 pub result_ok: bool,
13134 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13135 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13136 CResult_UpdateFailHTLCDecodeErrorZ {
13137 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13138 result: Box::into_raw(Box::new(o)),
13144 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13145 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13146 CResult_UpdateFailHTLCDecodeErrorZ {
13147 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13148 err: Box::into_raw(Box::new(e)),
13153 /// Checks if the given object is currently in the success state
13155 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13159 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13160 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13161 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13162 fn drop(&mut self) {
13163 if self.result_ok {
13164 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13165 let _ = unsafe { Box::from_raw(self.contents.result) };
13168 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13169 let _ = unsafe { Box::from_raw(self.contents.err) };
13174 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13175 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13176 let contents = if o.result_ok {
13177 let result = unsafe { o.contents.result };
13178 unsafe { o.contents.result = core::ptr::null_mut() };
13179 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13181 let err = unsafe { o.contents.err };
13182 unsafe { o.contents.err = core::ptr::null_mut(); }
13183 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13187 result_ok: o.result_ok,
13191 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13192 fn clone(&self) -> Self {
13193 if self.result_ok {
13194 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13195 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13198 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13199 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13205 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13206 /// but with all dynamically-allocated buffers duplicated in new buffers.
13207 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13209 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13210 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13211 /// A pointer to the contents in the success state.
13212 /// Reading from this pointer when `result_ok` is not set is undefined.
13213 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13214 /// A pointer to the contents in the error state.
13215 /// Reading from this pointer when `result_ok` is set is undefined.
13216 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13219 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13220 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13221 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13222 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13223 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13224 /// `err` or `result` depending on the state of `result_ok`.
13225 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13226 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13227 pub result_ok: bool,
13230 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13231 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13232 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13233 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13234 result: Box::into_raw(Box::new(o)),
13240 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13241 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13242 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13243 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13244 err: Box::into_raw(Box::new(e)),
13249 /// Checks if the given object is currently in the success state
13251 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13255 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13256 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13257 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13258 fn drop(&mut self) {
13259 if self.result_ok {
13260 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13261 let _ = unsafe { Box::from_raw(self.contents.result) };
13264 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13265 let _ = unsafe { Box::from_raw(self.contents.err) };
13270 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13271 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13272 let contents = if o.result_ok {
13273 let result = unsafe { o.contents.result };
13274 unsafe { o.contents.result = core::ptr::null_mut() };
13275 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13277 let err = unsafe { o.contents.err };
13278 unsafe { o.contents.err = core::ptr::null_mut(); }
13279 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13283 result_ok: o.result_ok,
13287 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13288 fn clone(&self) -> Self {
13289 if self.result_ok {
13290 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13291 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13294 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13295 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13301 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13302 /// but with all dynamically-allocated buffers duplicated in new buffers.
13303 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13305 /// The contents of CResult_UpdateFeeDecodeErrorZ
13306 pub union CResult_UpdateFeeDecodeErrorZPtr {
13307 /// A pointer to the contents in the success state.
13308 /// Reading from this pointer when `result_ok` is not set is undefined.
13309 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13310 /// A pointer to the contents in the error state.
13311 /// Reading from this pointer when `result_ok` is set is undefined.
13312 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13315 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13316 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13317 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13318 pub struct CResult_UpdateFeeDecodeErrorZ {
13319 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13320 /// `err` or `result` depending on the state of `result_ok`.
13321 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13322 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13323 pub result_ok: bool,
13326 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13327 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13328 CResult_UpdateFeeDecodeErrorZ {
13329 contents: CResult_UpdateFeeDecodeErrorZPtr {
13330 result: Box::into_raw(Box::new(o)),
13336 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13337 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13338 CResult_UpdateFeeDecodeErrorZ {
13339 contents: CResult_UpdateFeeDecodeErrorZPtr {
13340 err: Box::into_raw(Box::new(e)),
13345 /// Checks if the given object is currently in the success state
13347 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13351 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13352 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13353 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13354 fn drop(&mut self) {
13355 if self.result_ok {
13356 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13357 let _ = unsafe { Box::from_raw(self.contents.result) };
13360 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13361 let _ = unsafe { Box::from_raw(self.contents.err) };
13366 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13367 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13368 let contents = if o.result_ok {
13369 let result = unsafe { o.contents.result };
13370 unsafe { o.contents.result = core::ptr::null_mut() };
13371 CResult_UpdateFeeDecodeErrorZPtr { result }
13373 let err = unsafe { o.contents.err };
13374 unsafe { o.contents.err = core::ptr::null_mut(); }
13375 CResult_UpdateFeeDecodeErrorZPtr { err }
13379 result_ok: o.result_ok,
13383 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13384 fn clone(&self) -> Self {
13385 if self.result_ok {
13386 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13387 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13390 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13391 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13397 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13398 /// but with all dynamically-allocated buffers duplicated in new buffers.
13399 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13401 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13402 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13403 /// A pointer to the contents in the success state.
13404 /// Reading from this pointer when `result_ok` is not set is undefined.
13405 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13406 /// A pointer to the contents in the error state.
13407 /// Reading from this pointer when `result_ok` is set is undefined.
13408 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13411 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13412 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13414 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13415 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13416 /// `err` or `result` depending on the state of `result_ok`.
13417 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13418 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13419 pub result_ok: bool,
13422 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13423 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13424 CResult_UpdateFulfillHTLCDecodeErrorZ {
13425 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13426 result: Box::into_raw(Box::new(o)),
13432 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13433 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13434 CResult_UpdateFulfillHTLCDecodeErrorZ {
13435 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13436 err: Box::into_raw(Box::new(e)),
13441 /// Checks if the given object is currently in the success state
13443 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13447 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13448 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13449 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13450 fn drop(&mut self) {
13451 if self.result_ok {
13452 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13453 let _ = unsafe { Box::from_raw(self.contents.result) };
13456 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13457 let _ = unsafe { Box::from_raw(self.contents.err) };
13462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13463 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13464 let contents = if o.result_ok {
13465 let result = unsafe { o.contents.result };
13466 unsafe { o.contents.result = core::ptr::null_mut() };
13467 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13469 let err = unsafe { o.contents.err };
13470 unsafe { o.contents.err = core::ptr::null_mut(); }
13471 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13475 result_ok: o.result_ok,
13479 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13480 fn clone(&self) -> Self {
13481 if self.result_ok {
13482 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13483 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13486 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13487 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13493 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13494 /// but with all dynamically-allocated buffers duplicated in new buffers.
13495 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13497 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13498 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13499 /// A pointer to the contents in the success state.
13500 /// Reading from this pointer when `result_ok` is not set is undefined.
13501 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13502 /// A pointer to the contents in the error state.
13503 /// Reading from this pointer when `result_ok` is set is undefined.
13504 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13507 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13508 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13510 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13511 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13512 /// `err` or `result` depending on the state of `result_ok`.
13513 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13514 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13515 pub result_ok: bool,
13518 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13519 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13520 CResult_UpdateAddHTLCDecodeErrorZ {
13521 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13522 result: Box::into_raw(Box::new(o)),
13528 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13529 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13530 CResult_UpdateAddHTLCDecodeErrorZ {
13531 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13532 err: Box::into_raw(Box::new(e)),
13537 /// Checks if the given object is currently in the success state
13539 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13543 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13544 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13545 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13546 fn drop(&mut self) {
13547 if self.result_ok {
13548 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13549 let _ = unsafe { Box::from_raw(self.contents.result) };
13552 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13553 let _ = unsafe { Box::from_raw(self.contents.err) };
13558 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13559 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13560 let contents = if o.result_ok {
13561 let result = unsafe { o.contents.result };
13562 unsafe { o.contents.result = core::ptr::null_mut() };
13563 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13565 let err = unsafe { o.contents.err };
13566 unsafe { o.contents.err = core::ptr::null_mut(); }
13567 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13571 result_ok: o.result_ok,
13575 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13576 fn clone(&self) -> Self {
13577 if self.result_ok {
13578 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13579 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13582 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13583 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13589 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13590 /// but with all dynamically-allocated buffers duplicated in new buffers.
13591 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13593 /// The contents of CResult_PingDecodeErrorZ
13594 pub union CResult_PingDecodeErrorZPtr {
13595 /// A pointer to the contents in the success state.
13596 /// Reading from this pointer when `result_ok` is not set is undefined.
13597 pub result: *mut crate::lightning::ln::msgs::Ping,
13598 /// A pointer to the contents in the error state.
13599 /// Reading from this pointer when `result_ok` is set is undefined.
13600 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13603 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13604 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13606 pub struct CResult_PingDecodeErrorZ {
13607 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13608 /// `err` or `result` depending on the state of `result_ok`.
13609 pub contents: CResult_PingDecodeErrorZPtr,
13610 /// Whether this CResult_PingDecodeErrorZ represents a success state.
13611 pub result_ok: bool,
13614 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13615 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13616 CResult_PingDecodeErrorZ {
13617 contents: CResult_PingDecodeErrorZPtr {
13618 result: Box::into_raw(Box::new(o)),
13624 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13625 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13626 CResult_PingDecodeErrorZ {
13627 contents: CResult_PingDecodeErrorZPtr {
13628 err: Box::into_raw(Box::new(e)),
13633 /// Checks if the given object is currently in the success state
13635 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13639 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13640 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13641 impl Drop for CResult_PingDecodeErrorZ {
13642 fn drop(&mut self) {
13643 if self.result_ok {
13644 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13645 let _ = unsafe { Box::from_raw(self.contents.result) };
13648 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13649 let _ = unsafe { Box::from_raw(self.contents.err) };
13654 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13655 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13656 let contents = if o.result_ok {
13657 let result = unsafe { o.contents.result };
13658 unsafe { o.contents.result = core::ptr::null_mut() };
13659 CResult_PingDecodeErrorZPtr { result }
13661 let err = unsafe { o.contents.err };
13662 unsafe { o.contents.err = core::ptr::null_mut(); }
13663 CResult_PingDecodeErrorZPtr { err }
13667 result_ok: o.result_ok,
13671 impl Clone for CResult_PingDecodeErrorZ {
13672 fn clone(&self) -> Self {
13673 if self.result_ok {
13674 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13675 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13678 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13679 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13685 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13686 /// but with all dynamically-allocated buffers duplicated in new buffers.
13687 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13689 /// The contents of CResult_PongDecodeErrorZ
13690 pub union CResult_PongDecodeErrorZPtr {
13691 /// A pointer to the contents in the success state.
13692 /// Reading from this pointer when `result_ok` is not set is undefined.
13693 pub result: *mut crate::lightning::ln::msgs::Pong,
13694 /// A pointer to the contents in the error state.
13695 /// Reading from this pointer when `result_ok` is set is undefined.
13696 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13699 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13700 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13702 pub struct CResult_PongDecodeErrorZ {
13703 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13704 /// `err` or `result` depending on the state of `result_ok`.
13705 pub contents: CResult_PongDecodeErrorZPtr,
13706 /// Whether this CResult_PongDecodeErrorZ represents a success state.
13707 pub result_ok: bool,
13710 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13711 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13712 CResult_PongDecodeErrorZ {
13713 contents: CResult_PongDecodeErrorZPtr {
13714 result: Box::into_raw(Box::new(o)),
13720 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13721 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13722 CResult_PongDecodeErrorZ {
13723 contents: CResult_PongDecodeErrorZPtr {
13724 err: Box::into_raw(Box::new(e)),
13729 /// Checks if the given object is currently in the success state
13731 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13735 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13736 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13737 impl Drop for CResult_PongDecodeErrorZ {
13738 fn drop(&mut self) {
13739 if self.result_ok {
13740 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13741 let _ = unsafe { Box::from_raw(self.contents.result) };
13744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13745 let _ = unsafe { Box::from_raw(self.contents.err) };
13750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13751 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13752 let contents = if o.result_ok {
13753 let result = unsafe { o.contents.result };
13754 unsafe { o.contents.result = core::ptr::null_mut() };
13755 CResult_PongDecodeErrorZPtr { result }
13757 let err = unsafe { o.contents.err };
13758 unsafe { o.contents.err = core::ptr::null_mut(); }
13759 CResult_PongDecodeErrorZPtr { err }
13763 result_ok: o.result_ok,
13767 impl Clone for CResult_PongDecodeErrorZ {
13768 fn clone(&self) -> Self {
13769 if self.result_ok {
13770 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13771 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13774 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13775 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13781 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13782 /// but with all dynamically-allocated buffers duplicated in new buffers.
13783 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13785 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13786 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13787 /// A pointer to the contents in the success state.
13788 /// Reading from this pointer when `result_ok` is not set is undefined.
13789 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13790 /// A pointer to the contents in the error state.
13791 /// Reading from this pointer when `result_ok` is set is undefined.
13792 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13795 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13796 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13798 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13799 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13800 /// `err` or `result` depending on the state of `result_ok`.
13801 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13802 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13803 pub result_ok: bool,
13806 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13807 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13808 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13809 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13810 result: Box::into_raw(Box::new(o)),
13816 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13817 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13818 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13819 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13820 err: Box::into_raw(Box::new(e)),
13825 /// Checks if the given object is currently in the success state
13827 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13831 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13832 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13833 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13834 fn drop(&mut self) {
13835 if self.result_ok {
13836 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13837 let _ = unsafe { Box::from_raw(self.contents.result) };
13840 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13841 let _ = unsafe { Box::from_raw(self.contents.err) };
13846 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13847 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13848 let contents = if o.result_ok {
13849 let result = unsafe { o.contents.result };
13850 unsafe { o.contents.result = core::ptr::null_mut() };
13851 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13853 let err = unsafe { o.contents.err };
13854 unsafe { o.contents.err = core::ptr::null_mut(); }
13855 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13859 result_ok: o.result_ok,
13863 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13864 fn clone(&self) -> Self {
13865 if self.result_ok {
13866 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13867 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13870 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13871 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13877 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13878 /// but with all dynamically-allocated buffers duplicated in new buffers.
13879 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13881 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13882 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
13883 /// A pointer to the contents in the success state.
13884 /// Reading from this pointer when `result_ok` is not set is undefined.
13885 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
13886 /// A pointer to the contents in the error state.
13887 /// Reading from this pointer when `result_ok` is set is undefined.
13888 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13891 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13892 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13894 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
13895 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
13896 /// `err` or `result` depending on the state of `result_ok`.
13897 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
13898 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
13899 pub result_ok: bool,
13902 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
13903 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
13904 CResult_ChannelAnnouncementDecodeErrorZ {
13905 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13906 result: Box::into_raw(Box::new(o)),
13912 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
13913 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
13914 CResult_ChannelAnnouncementDecodeErrorZ {
13915 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13916 err: Box::into_raw(Box::new(e)),
13921 /// Checks if the given object is currently in the success state
13923 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
13927 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
13928 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
13929 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
13930 fn drop(&mut self) {
13931 if self.result_ok {
13932 if unsafe { !(self.contents.result as *mut ()).is_null() } {
13933 let _ = unsafe { Box::from_raw(self.contents.result) };
13936 if unsafe { !(self.contents.err as *mut ()).is_null() } {
13937 let _ = unsafe { Box::from_raw(self.contents.err) };
13942 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
13943 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13944 let contents = if o.result_ok {
13945 let result = unsafe { o.contents.result };
13946 unsafe { o.contents.result = core::ptr::null_mut() };
13947 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
13949 let err = unsafe { o.contents.err };
13950 unsafe { o.contents.err = core::ptr::null_mut(); }
13951 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
13955 result_ok: o.result_ok,
13959 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
13960 fn clone(&self) -> Self {
13961 if self.result_ok {
13962 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13963 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13966 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13967 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13973 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13974 /// but with all dynamically-allocated buffers duplicated in new buffers.
13975 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13977 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
13978 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13979 /// A pointer to the contents in the success state.
13980 /// Reading from this pointer when `result_ok` is not set is undefined.
13981 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
13982 /// A pointer to the contents in the error state.
13983 /// Reading from this pointer when `result_ok` is set is undefined.
13984 pub err: *mut crate::lightning::ln::msgs::DecodeError,
13987 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
13988 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
13989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13990 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
13991 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
13992 /// `err` or `result` depending on the state of `result_ok`.
13993 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
13994 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
13995 pub result_ok: bool,
13998 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
13999 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14000 CResult_UnsignedChannelUpdateDecodeErrorZ {
14001 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14002 result: Box::into_raw(Box::new(o)),
14008 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14009 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14010 CResult_UnsignedChannelUpdateDecodeErrorZ {
14011 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14012 err: Box::into_raw(Box::new(e)),
14017 /// Checks if the given object is currently in the success state
14019 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14023 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14024 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14025 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14026 fn drop(&mut self) {
14027 if self.result_ok {
14028 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14029 let _ = unsafe { Box::from_raw(self.contents.result) };
14032 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14033 let _ = unsafe { Box::from_raw(self.contents.err) };
14038 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14039 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14040 let contents = if o.result_ok {
14041 let result = unsafe { o.contents.result };
14042 unsafe { o.contents.result = core::ptr::null_mut() };
14043 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14045 let err = unsafe { o.contents.err };
14046 unsafe { o.contents.err = core::ptr::null_mut(); }
14047 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14051 result_ok: o.result_ok,
14055 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14056 fn clone(&self) -> Self {
14057 if self.result_ok {
14058 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14059 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14062 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14063 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14069 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14070 /// but with all dynamically-allocated buffers duplicated in new buffers.
14071 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14073 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14074 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14075 /// A pointer to the contents in the success state.
14076 /// Reading from this pointer when `result_ok` is not set is undefined.
14077 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14078 /// A pointer to the contents in the error state.
14079 /// Reading from this pointer when `result_ok` is set is undefined.
14080 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14083 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14084 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14085 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14086 pub struct CResult_ChannelUpdateDecodeErrorZ {
14087 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14088 /// `err` or `result` depending on the state of `result_ok`.
14089 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14090 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14091 pub result_ok: bool,
14094 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14095 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14096 CResult_ChannelUpdateDecodeErrorZ {
14097 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14098 result: Box::into_raw(Box::new(o)),
14104 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14105 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14106 CResult_ChannelUpdateDecodeErrorZ {
14107 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14108 err: Box::into_raw(Box::new(e)),
14113 /// Checks if the given object is currently in the success state
14115 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14119 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14120 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14121 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14122 fn drop(&mut self) {
14123 if self.result_ok {
14124 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14125 let _ = unsafe { Box::from_raw(self.contents.result) };
14128 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14129 let _ = unsafe { Box::from_raw(self.contents.err) };
14134 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14135 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14136 let contents = if o.result_ok {
14137 let result = unsafe { o.contents.result };
14138 unsafe { o.contents.result = core::ptr::null_mut() };
14139 CResult_ChannelUpdateDecodeErrorZPtr { result }
14141 let err = unsafe { o.contents.err };
14142 unsafe { o.contents.err = core::ptr::null_mut(); }
14143 CResult_ChannelUpdateDecodeErrorZPtr { err }
14147 result_ok: o.result_ok,
14151 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14152 fn clone(&self) -> Self {
14153 if self.result_ok {
14154 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14155 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14158 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14159 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14165 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14166 /// but with all dynamically-allocated buffers duplicated in new buffers.
14167 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14169 /// The contents of CResult_ErrorMessageDecodeErrorZ
14170 pub union CResult_ErrorMessageDecodeErrorZPtr {
14171 /// A pointer to the contents in the success state.
14172 /// Reading from this pointer when `result_ok` is not set is undefined.
14173 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14174 /// A pointer to the contents in the error state.
14175 /// Reading from this pointer when `result_ok` is set is undefined.
14176 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14179 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14180 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14181 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14182 pub struct CResult_ErrorMessageDecodeErrorZ {
14183 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14184 /// `err` or `result` depending on the state of `result_ok`.
14185 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14186 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14187 pub result_ok: bool,
14190 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14191 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14192 CResult_ErrorMessageDecodeErrorZ {
14193 contents: CResult_ErrorMessageDecodeErrorZPtr {
14194 result: Box::into_raw(Box::new(o)),
14200 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14201 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14202 CResult_ErrorMessageDecodeErrorZ {
14203 contents: CResult_ErrorMessageDecodeErrorZPtr {
14204 err: Box::into_raw(Box::new(e)),
14209 /// Checks if the given object is currently in the success state
14211 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14215 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14216 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14217 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14218 fn drop(&mut self) {
14219 if self.result_ok {
14220 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14221 let _ = unsafe { Box::from_raw(self.contents.result) };
14224 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14225 let _ = unsafe { Box::from_raw(self.contents.err) };
14230 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14231 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14232 let contents = if o.result_ok {
14233 let result = unsafe { o.contents.result };
14234 unsafe { o.contents.result = core::ptr::null_mut() };
14235 CResult_ErrorMessageDecodeErrorZPtr { result }
14237 let err = unsafe { o.contents.err };
14238 unsafe { o.contents.err = core::ptr::null_mut(); }
14239 CResult_ErrorMessageDecodeErrorZPtr { err }
14243 result_ok: o.result_ok,
14247 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14248 fn clone(&self) -> Self {
14249 if self.result_ok {
14250 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14251 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14254 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14255 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14261 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14262 /// but with all dynamically-allocated buffers duplicated in new buffers.
14263 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14265 /// The contents of CResult_WarningMessageDecodeErrorZ
14266 pub union CResult_WarningMessageDecodeErrorZPtr {
14267 /// A pointer to the contents in the success state.
14268 /// Reading from this pointer when `result_ok` is not set is undefined.
14269 pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14270 /// A pointer to the contents in the error state.
14271 /// Reading from this pointer when `result_ok` is set is undefined.
14272 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14275 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14276 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14277 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14278 pub struct CResult_WarningMessageDecodeErrorZ {
14279 /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14280 /// `err` or `result` depending on the state of `result_ok`.
14281 pub contents: CResult_WarningMessageDecodeErrorZPtr,
14282 /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14283 pub result_ok: bool,
14286 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14287 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14288 CResult_WarningMessageDecodeErrorZ {
14289 contents: CResult_WarningMessageDecodeErrorZPtr {
14290 result: Box::into_raw(Box::new(o)),
14296 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14297 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14298 CResult_WarningMessageDecodeErrorZ {
14299 contents: CResult_WarningMessageDecodeErrorZPtr {
14300 err: Box::into_raw(Box::new(e)),
14305 /// Checks if the given object is currently in the success state
14307 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14311 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14312 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14313 impl Drop for CResult_WarningMessageDecodeErrorZ {
14314 fn drop(&mut self) {
14315 if self.result_ok {
14316 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14317 let _ = unsafe { Box::from_raw(self.contents.result) };
14320 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14321 let _ = unsafe { Box::from_raw(self.contents.err) };
14326 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14327 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14328 let contents = if o.result_ok {
14329 let result = unsafe { o.contents.result };
14330 unsafe { o.contents.result = core::ptr::null_mut() };
14331 CResult_WarningMessageDecodeErrorZPtr { result }
14333 let err = unsafe { o.contents.err };
14334 unsafe { o.contents.err = core::ptr::null_mut(); }
14335 CResult_WarningMessageDecodeErrorZPtr { err }
14339 result_ok: o.result_ok,
14343 impl Clone for CResult_WarningMessageDecodeErrorZ {
14344 fn clone(&self) -> Self {
14345 if self.result_ok {
14346 Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14347 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14350 Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14351 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14357 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14358 /// but with all dynamically-allocated buffers duplicated in new buffers.
14359 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14361 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14362 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14363 /// A pointer to the contents in the success state.
14364 /// Reading from this pointer when `result_ok` is not set is undefined.
14365 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14366 /// A pointer to the contents in the error state.
14367 /// Reading from this pointer when `result_ok` is set is undefined.
14368 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14371 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14372 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14374 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14375 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14376 /// `err` or `result` depending on the state of `result_ok`.
14377 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14378 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14379 pub result_ok: bool,
14382 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14383 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14384 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14385 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14386 result: Box::into_raw(Box::new(o)),
14392 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14393 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14394 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14395 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14396 err: Box::into_raw(Box::new(e)),
14401 /// Checks if the given object is currently in the success state
14403 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14407 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14408 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14409 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14410 fn drop(&mut self) {
14411 if self.result_ok {
14412 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14413 let _ = unsafe { Box::from_raw(self.contents.result) };
14416 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14417 let _ = unsafe { Box::from_raw(self.contents.err) };
14422 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14423 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14424 let contents = if o.result_ok {
14425 let result = unsafe { o.contents.result };
14426 unsafe { o.contents.result = core::ptr::null_mut() };
14427 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14429 let err = unsafe { o.contents.err };
14430 unsafe { o.contents.err = core::ptr::null_mut(); }
14431 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14435 result_ok: o.result_ok,
14439 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14440 fn clone(&self) -> Self {
14441 if self.result_ok {
14442 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14443 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14446 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14447 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14453 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14454 /// but with all dynamically-allocated buffers duplicated in new buffers.
14455 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14457 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14458 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14459 /// A pointer to the contents in the success state.
14460 /// Reading from this pointer when `result_ok` is not set is undefined.
14461 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14462 /// A pointer to the contents in the error state.
14463 /// Reading from this pointer when `result_ok` is set is undefined.
14464 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14467 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14468 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14470 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14471 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14472 /// `err` or `result` depending on the state of `result_ok`.
14473 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14474 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14475 pub result_ok: bool,
14478 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14479 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14480 CResult_NodeAnnouncementDecodeErrorZ {
14481 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14482 result: Box::into_raw(Box::new(o)),
14488 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14489 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14490 CResult_NodeAnnouncementDecodeErrorZ {
14491 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14492 err: Box::into_raw(Box::new(e)),
14497 /// Checks if the given object is currently in the success state
14499 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14503 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14504 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14505 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14506 fn drop(&mut self) {
14507 if self.result_ok {
14508 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14509 let _ = unsafe { Box::from_raw(self.contents.result) };
14512 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14513 let _ = unsafe { Box::from_raw(self.contents.err) };
14518 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14519 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14520 let contents = if o.result_ok {
14521 let result = unsafe { o.contents.result };
14522 unsafe { o.contents.result = core::ptr::null_mut() };
14523 CResult_NodeAnnouncementDecodeErrorZPtr { result }
14525 let err = unsafe { o.contents.err };
14526 unsafe { o.contents.err = core::ptr::null_mut(); }
14527 CResult_NodeAnnouncementDecodeErrorZPtr { err }
14531 result_ok: o.result_ok,
14535 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14536 fn clone(&self) -> Self {
14537 if self.result_ok {
14538 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14539 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14542 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14543 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14549 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14550 /// but with all dynamically-allocated buffers duplicated in new buffers.
14551 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14553 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14554 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14555 /// A pointer to the contents in the success state.
14556 /// Reading from this pointer when `result_ok` is not set is undefined.
14557 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14558 /// A pointer to the contents in the error state.
14559 /// Reading from this pointer when `result_ok` is set is undefined.
14560 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14563 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14564 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14565 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14566 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14567 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14568 /// `err` or `result` depending on the state of `result_ok`.
14569 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14570 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14571 pub result_ok: bool,
14574 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14575 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14576 CResult_QueryShortChannelIdsDecodeErrorZ {
14577 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14578 result: Box::into_raw(Box::new(o)),
14584 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14585 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14586 CResult_QueryShortChannelIdsDecodeErrorZ {
14587 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14588 err: Box::into_raw(Box::new(e)),
14593 /// Checks if the given object is currently in the success state
14595 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14599 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14600 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14601 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14602 fn drop(&mut self) {
14603 if self.result_ok {
14604 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14605 let _ = unsafe { Box::from_raw(self.contents.result) };
14608 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14609 let _ = unsafe { Box::from_raw(self.contents.err) };
14614 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14615 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14616 let contents = if o.result_ok {
14617 let result = unsafe { o.contents.result };
14618 unsafe { o.contents.result = core::ptr::null_mut() };
14619 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14621 let err = unsafe { o.contents.err };
14622 unsafe { o.contents.err = core::ptr::null_mut(); }
14623 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14627 result_ok: o.result_ok,
14631 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14632 fn clone(&self) -> Self {
14633 if self.result_ok {
14634 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14635 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14638 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14639 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14645 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14646 /// but with all dynamically-allocated buffers duplicated in new buffers.
14647 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14649 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14650 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14651 /// A pointer to the contents in the success state.
14652 /// Reading from this pointer when `result_ok` is not set is undefined.
14653 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14654 /// A pointer to the contents in the error state.
14655 /// Reading from this pointer when `result_ok` is set is undefined.
14656 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14659 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14660 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14661 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14662 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14663 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14664 /// `err` or `result` depending on the state of `result_ok`.
14665 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14666 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14667 pub result_ok: bool,
14670 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14671 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14672 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14673 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14674 result: Box::into_raw(Box::new(o)),
14680 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14681 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14682 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14683 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14684 err: Box::into_raw(Box::new(e)),
14689 /// Checks if the given object is currently in the success state
14691 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14695 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14696 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14697 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14698 fn drop(&mut self) {
14699 if self.result_ok {
14700 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14701 let _ = unsafe { Box::from_raw(self.contents.result) };
14704 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14705 let _ = unsafe { Box::from_raw(self.contents.err) };
14710 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14711 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14712 let contents = if o.result_ok {
14713 let result = unsafe { o.contents.result };
14714 unsafe { o.contents.result = core::ptr::null_mut() };
14715 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14717 let err = unsafe { o.contents.err };
14718 unsafe { o.contents.err = core::ptr::null_mut(); }
14719 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14723 result_ok: o.result_ok,
14727 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14728 fn clone(&self) -> Self {
14729 if self.result_ok {
14730 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14731 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14734 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14735 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14741 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14742 /// but with all dynamically-allocated buffers duplicated in new buffers.
14743 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14745 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14746 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14747 /// A pointer to the contents in the success state.
14748 /// Reading from this pointer when `result_ok` is not set is undefined.
14749 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14750 /// A pointer to the contents in the error state.
14751 /// Reading from this pointer when `result_ok` is set is undefined.
14752 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14755 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14756 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14758 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14759 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14760 /// `err` or `result` depending on the state of `result_ok`.
14761 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14762 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14763 pub result_ok: bool,
14766 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14767 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14768 CResult_QueryChannelRangeDecodeErrorZ {
14769 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14770 result: Box::into_raw(Box::new(o)),
14776 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14777 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14778 CResult_QueryChannelRangeDecodeErrorZ {
14779 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14780 err: Box::into_raw(Box::new(e)),
14785 /// Checks if the given object is currently in the success state
14787 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14791 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14792 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14793 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14794 fn drop(&mut self) {
14795 if self.result_ok {
14796 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14797 let _ = unsafe { Box::from_raw(self.contents.result) };
14800 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14801 let _ = unsafe { Box::from_raw(self.contents.err) };
14806 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14807 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14808 let contents = if o.result_ok {
14809 let result = unsafe { o.contents.result };
14810 unsafe { o.contents.result = core::ptr::null_mut() };
14811 CResult_QueryChannelRangeDecodeErrorZPtr { result }
14813 let err = unsafe { o.contents.err };
14814 unsafe { o.contents.err = core::ptr::null_mut(); }
14815 CResult_QueryChannelRangeDecodeErrorZPtr { err }
14819 result_ok: o.result_ok,
14823 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14824 fn clone(&self) -> Self {
14825 if self.result_ok {
14826 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14827 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14830 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14831 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14837 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14838 /// but with all dynamically-allocated buffers duplicated in new buffers.
14839 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14841 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14842 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14843 /// A pointer to the contents in the success state.
14844 /// Reading from this pointer when `result_ok` is not set is undefined.
14845 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
14846 /// A pointer to the contents in the error state.
14847 /// Reading from this pointer when `result_ok` is set is undefined.
14848 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14851 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
14852 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14853 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14854 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
14855 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
14856 /// `err` or `result` depending on the state of `result_ok`.
14857 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
14858 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
14859 pub result_ok: bool,
14862 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
14863 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
14864 CResult_ReplyChannelRangeDecodeErrorZ {
14865 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14866 result: Box::into_raw(Box::new(o)),
14872 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
14873 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
14874 CResult_ReplyChannelRangeDecodeErrorZ {
14875 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14876 err: Box::into_raw(Box::new(e)),
14881 /// Checks if the given object is currently in the success state
14883 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
14887 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
14888 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
14889 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
14890 fn drop(&mut self) {
14891 if self.result_ok {
14892 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14893 let _ = unsafe { Box::from_raw(self.contents.result) };
14896 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14897 let _ = unsafe { Box::from_raw(self.contents.err) };
14902 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
14903 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14904 let contents = if o.result_ok {
14905 let result = unsafe { o.contents.result };
14906 unsafe { o.contents.result = core::ptr::null_mut() };
14907 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
14909 let err = unsafe { o.contents.err };
14910 unsafe { o.contents.err = core::ptr::null_mut(); }
14911 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
14915 result_ok: o.result_ok,
14919 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
14920 fn clone(&self) -> Self {
14921 if self.result_ok {
14922 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14923 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
14926 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14927 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14933 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
14934 /// but with all dynamically-allocated buffers duplicated in new buffers.
14935 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14937 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
14938 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
14939 /// A pointer to the contents in the success state.
14940 /// Reading from this pointer when `result_ok` is not set is undefined.
14941 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
14942 /// A pointer to the contents in the error state.
14943 /// Reading from this pointer when `result_ok` is set is undefined.
14944 pub err: *mut crate::lightning::ln::msgs::DecodeError,
14947 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
14948 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
14949 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14950 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
14951 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
14952 /// `err` or `result` depending on the state of `result_ok`.
14953 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
14954 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
14955 pub result_ok: bool,
14958 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
14959 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
14960 CResult_GossipTimestampFilterDecodeErrorZ {
14961 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14962 result: Box::into_raw(Box::new(o)),
14968 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
14969 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
14970 CResult_GossipTimestampFilterDecodeErrorZ {
14971 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14972 err: Box::into_raw(Box::new(e)),
14977 /// Checks if the given object is currently in the success state
14979 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
14983 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
14984 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
14985 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
14986 fn drop(&mut self) {
14987 if self.result_ok {
14988 if unsafe { !(self.contents.result as *mut ()).is_null() } {
14989 let _ = unsafe { Box::from_raw(self.contents.result) };
14992 if unsafe { !(self.contents.err as *mut ()).is_null() } {
14993 let _ = unsafe { Box::from_raw(self.contents.err) };
14998 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
14999 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15000 let contents = if o.result_ok {
15001 let result = unsafe { o.contents.result };
15002 unsafe { o.contents.result = core::ptr::null_mut() };
15003 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15005 let err = unsafe { o.contents.err };
15006 unsafe { o.contents.err = core::ptr::null_mut(); }
15007 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15011 result_ok: o.result_ok,
15015 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15016 fn clone(&self) -> Self {
15017 if self.result_ok {
15018 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15019 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15022 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15023 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15029 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15030 /// but with all dynamically-allocated buffers duplicated in new buffers.
15031 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15033 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15034 /// This corresponds to std::vector in C++
15035 pub struct CVec_PhantomRouteHintsZ {
15036 /// The elements in the array.
15037 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15038 pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15039 /// The number of elements pointed to by `data`.
15042 impl CVec_PhantomRouteHintsZ {
15043 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15044 if self.datalen == 0 { return Vec::new(); }
15045 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15046 self.data = core::ptr::null_mut();
15050 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15051 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15054 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15055 fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15056 let datalen = v.len();
15057 let data = Box::into_raw(v.into_boxed_slice());
15058 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15062 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15063 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15064 impl Drop for CVec_PhantomRouteHintsZ {
15065 fn drop(&mut self) {
15066 if self.datalen == 0 { return; }
15067 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15071 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15072 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15073 /// A pointer to the contents in the success state.
15074 /// Reading from this pointer when `result_ok` is not set is undefined.
15075 pub result: *mut crate::lightning_invoice::Invoice,
15076 /// A pointer to the contents in the error state.
15077 /// Reading from this pointer when `result_ok` is set is undefined.
15078 pub err: *mut crate::lightning_invoice::SignOrCreationError,
15081 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15082 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15083 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15084 pub struct CResult_InvoiceSignOrCreationErrorZ {
15085 /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15086 /// `err` or `result` depending on the state of `result_ok`.
15087 pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15088 /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15089 pub result_ok: bool,
15092 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15093 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15094 CResult_InvoiceSignOrCreationErrorZ {
15095 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15096 result: Box::into_raw(Box::new(o)),
15102 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15103 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15104 CResult_InvoiceSignOrCreationErrorZ {
15105 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15106 err: Box::into_raw(Box::new(e)),
15111 /// Checks if the given object is currently in the success state
15113 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15117 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15118 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15119 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15120 fn drop(&mut self) {
15121 if self.result_ok {
15122 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15123 let _ = unsafe { Box::from_raw(self.contents.result) };
15126 if unsafe { !(self.contents.err as *mut ()).is_null() } {
15127 let _ = unsafe { Box::from_raw(self.contents.err) };
15132 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15133 fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15134 let contents = if o.result_ok {
15135 let result = unsafe { o.contents.result };
15136 unsafe { o.contents.result = core::ptr::null_mut() };
15137 CResult_InvoiceSignOrCreationErrorZPtr { result }
15139 let err = unsafe { o.contents.err };
15140 unsafe { o.contents.err = core::ptr::null_mut(); }
15141 CResult_InvoiceSignOrCreationErrorZPtr { err }
15145 result_ok: o.result_ok,
15149 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15150 fn clone(&self) -> Self {
15151 if self.result_ok {
15152 Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15153 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15156 Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15157 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15163 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15164 /// but with all dynamically-allocated buffers duplicated in new buffers.
15165 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15167 /// An enum which can either contain a crate::lightning::chain::Filter or not
15168 pub enum COption_FilterZ {
15169 /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15170 Some(crate::lightning::chain::Filter),
15171 /// When we're in this state, this COption_FilterZ contains nothing
15174 impl COption_FilterZ {
15175 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15176 if let Self::None = self { false } else { true }
15178 #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15181 #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15182 if let Self::Some(v) = self { v } else { unreachable!() }
15186 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15187 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15188 COption_FilterZ::Some(o)
15191 /// Constructs a new COption_FilterZ containing nothing
15192 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15193 COption_FilterZ::None
15196 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15197 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15199 /// The contents of CResult_LockedChannelMonitorNoneZ
15200 pub union CResult_LockedChannelMonitorNoneZPtr {
15201 /// A pointer to the contents in the success state.
15202 /// Reading from this pointer when `result_ok` is not set is undefined.
15203 pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15204 /// Note that this value is always NULL, as there are no contents in the Err variant
15205 pub err: *mut core::ffi::c_void,
15208 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15209 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15210 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15211 pub struct CResult_LockedChannelMonitorNoneZ {
15212 /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15213 /// `err` or `result` depending on the state of `result_ok`.
15214 pub contents: CResult_LockedChannelMonitorNoneZPtr,
15215 /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15216 pub result_ok: bool,
15219 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15220 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15221 CResult_LockedChannelMonitorNoneZ {
15222 contents: CResult_LockedChannelMonitorNoneZPtr {
15223 result: Box::into_raw(Box::new(o)),
15229 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15230 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15231 CResult_LockedChannelMonitorNoneZ {
15232 contents: CResult_LockedChannelMonitorNoneZPtr {
15233 err: core::ptr::null_mut(),
15238 /// Checks if the given object is currently in the success state
15240 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15244 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15245 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15246 impl Drop for CResult_LockedChannelMonitorNoneZ {
15247 fn drop(&mut self) {
15248 if self.result_ok {
15249 if unsafe { !(self.contents.result as *mut ()).is_null() } {
15250 let _ = unsafe { Box::from_raw(self.contents.result) };
15256 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15257 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15258 let contents = if o.result_ok {
15259 let result = unsafe { o.contents.result };
15260 unsafe { o.contents.result = core::ptr::null_mut() };
15261 CResult_LockedChannelMonitorNoneZPtr { result }
15263 let _ = unsafe { Box::from_raw(o.contents.err) };
15264 o.contents.err = core::ptr::null_mut();
15265 CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15269 result_ok: o.result_ok,
15274 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15275 /// This corresponds to std::vector in C++
15276 pub struct CVec_OutPointZ {
15277 /// The elements in the array.
15278 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15279 pub data: *mut crate::lightning::chain::transaction::OutPoint,
15280 /// The number of elements pointed to by `data`.
15283 impl CVec_OutPointZ {
15284 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15285 if self.datalen == 0 { return Vec::new(); }
15286 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15287 self.data = core::ptr::null_mut();
15291 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15292 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15295 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15296 fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15297 let datalen = v.len();
15298 let data = Box::into_raw(v.into_boxed_slice());
15299 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15303 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15304 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15305 impl Drop for CVec_OutPointZ {
15306 fn drop(&mut self) {
15307 if self.datalen == 0 { return; }
15308 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15311 impl Clone for CVec_OutPointZ {
15312 fn clone(&self) -> Self {
15313 let mut res = Vec::new();
15314 if self.datalen == 0 { return Self::from(res); }
15315 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });